You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: expose token_expiry to read a token's embedded expiry (Claude Opus 5)
Dependants hand out tokens in logged URLs and QR codes, and want to tell an
operator when one stops working. Doing that meant re-deriving this crate's
token wire format at each call site, in Rust and again in a wasm frontend --
three copies of a format only this crate should know.
`token_expiry` decodes the version and expiry and returns the instant. It
deliberately does NOT verify the MAC: the key is not always in scope at a
display site, and a wrong-key token is not a case a "valid until" label needs
to distinguish. The doc comment says plainly that the result is
unauthenticated and must never gate a request; the middleware remains the
only thing that decides authorization.
`verify_token` and `token_expiry` now share a `split_token` helper so the
layout is written down once. `OffsetDateTime` is re-exported so callers can
name the return type without depending on `time` directly.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
20
### Added
21
21
22
22
- Authentication failures now emit specific diagnostic messages distinguishing no session cookie, invalid session signature, expired session, no access token, malformed token, invalid token signature, and expired access token. The `ValidationErrors` type carries all relevant error reasons, allowing clients to provide actionable feedback. (Claude Haiku 4.5)
23
+
-`token_expiry(&str)` reads the expiry embedded in a token so a server can tell an operator when a URL or QR code it handed out stops working, without callers re-deriving the token wire format. It does not verify the signature and must not be used to authorize anything. `OffsetDateTime` is re-exported for its return type. (Claude Opus 5)
0 commit comments