Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specs/xrpc: more JWT fields; document typ #347

Merged
merged 4 commits into from
Oct 3, 2024

Conversation

bnewbold
Copy link
Contributor

Pulls in the lxm and jti updates from: bluesky-social/atproto#2687

And the iat and jti fields, and typ values.

Please review the types (string/number/integer) and whether required or not. I'm not really sure how to specify the data type of, eg, iat: it is JSON so can't really say "integer", right? Just numeric? If these are floats, is it expected that they be validated with sub-second precision?

Trying to keep this PR tight/simple, so not reviewing/touching any "should" / "must" type language elsewhere in these sections.

Closes: #327

cc: @rudyfraser doing PDS work and generating inter-service auth JWTs

- `aud` body field: service DID associated with the service that the request is being sent to
- `exp` body field: token expiration time, as a UNIX timestamp with seconds precision. Should be a short time window, as revocation is not implemented. 60 seconds is a good value.
- JWT signature: base64url-encoded signature using the account DID's signing key
- `typ` header field (string, required): `JWT`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have formally intended to specify that this must be "JWT". We intentionally do not require that it take this value when we verify the token since we hadn't explicitly specified it. Wanted to leave the door open to a different value we might prefer more, e.g. perhaps something akin to at+jwt/refresh+jwt/dpop+jwt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matthieusieben had recommended this in #327.

I can mention the field and that it doesn't have a stable/specified value yet for this use-case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I indeed wanted to put something there. Whether it's JWT or something more specific is a more complex topic.

Either we consider that there will only ever be only one type of JWT in Atproto (besides access & refresh tokens) and JWT is fine. Or we want to be future proof and we might want to do something like service+jwt (or pds-2-pds+jwt, or whatever).

The important thing here is to make sure that a JWT generated for one particular purpose cannot be used for another purpose, while still allowing them to be signed with the same key
a dev could choose to implement a PDS from scratch using the same key everywhere
The only control we'd have is the typ header.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated with:

currently JWT, but intend to update to a more specific value

Co-authored-by: devin ivy <devinivy@gmail.com>
@arcalinea arcalinea temporarily deployed to bnewbold/auth-token-updates - atproto-website PR #347 October 3, 2024 02:42 — with Render Destroyed
@bnewbold bnewbold merged commit 1deac93 into main Oct 3, 2024
@bnewbold bnewbold deleted the bnewbold/auth-token-updates branch October 3, 2024 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

specs: update service auth and session auth JWT docs with updates
4 participants