Juliusz Chroboczek
53481fde5e
Protect against empty expires field in Expire.
2024-05-02 18:48:51 +02:00
Juliusz Chroboczek
2f5c21d161
Implement accessors for stateful tokens.
2024-05-01 22:39:48 +02:00
Juliusz Chroboczek
e8ea707904
Split token.Get into method and function.
2024-05-01 19:29:30 +02:00
Juliusz Chroboczek
8a94f4a716
Export getStateful, simplify interface.
...
We used to return nil, nil if the token didn't exist.
We now return os.ErrNotExist.
2024-05-01 19:25:26 +02:00
Juliusz Chroboczek
3409f5a27f
Replace uses of os.IsExist and os.IsNotExist with errors.Is.
...
The former don't properly unwrap errors.
2024-04-14 13:34:32 +02:00
Juliusz Chroboczek
68887f13d5
Rename tokens.Edit to Extend.
2024-04-14 13:21:55 +02:00
Juliusz Chroboczek
5aff224e62
Complete token.stateful.Clone.
2023-07-09 11:52:13 +02:00
Juliusz Chroboczek
e73aaa31d7
Remove tokens.Del.
...
It was unused.
2023-07-09 11:51:18 +02:00
Juliusz Chroboczek
0de0199742
Resynchronise with disk when editing tokens.
...
We used to assume that the in-memory representation is in sync
when editing a stateful token. That is usually the case, since
editing requires knowing the token to edit, but resynchronising
here is the right thing to do.
2023-05-19 15:08:05 +02:00
Juliusz Chroboczek
3c0dbf5e9b
Reliably return an error from token.Parse.
...
We would sometimes return nil cast to an interface with no error,
which would cause the server to crash with a null dereference.
2023-05-14 21:14:59 +02:00
Juliusz Chroboczek
8775ce6406
Keep track of issuer and creation date in tokens.
2023-04-08 21:13:35 +02:00
Juliusz Chroboczek
adf273f9ea
Expire expired tokens.
...
We now remove a token a week after it has expired.
2023-04-04 01:22:05 +02:00
Juliusz Chroboczek
a6314a7384
Implement stateful tokens.
...
Stateful tokens look just like cryptographic tokens to the client.
Unlike cryptographic tokens, they are stored in a file and are
revokable and editable.
2023-04-04 00:59:54 +02:00