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

Provide ABNF #393

Open
bifurcation opened this issue Dec 5, 2023 · 6 comments
Open

Provide ABNF #393

bifurcation opened this issue Dec 5, 2023 · 6 comments

Comments

@bifurcation
Copy link

It seems like it could be helpful to implementors, allowing them to quickly validate whether what they have is syntactically an SD-JWT or an SD-JWT with key binding. Something like:

base64url ::= ALPHA / DIGIT / "-" / "_"
JWT ::= base64url "." base64url "." base64url
SD-JWT ::= JWT "~" [base64url "~"]*
Fnord ::= SD-JWT JWT
@bc-pi
Copy link
Collaborator

bc-pi commented Feb 12, 2024

It seems like it could be helpful to implementors, allowing them to quickly validate whether what they have is syntactically an SD-JWT or an SD-JWT with key binding. Something like:

base64url ::= ALPHA / DIGIT / "-" / "_"
JWT ::= base64url "." base64url "." base64url
SD-JWT ::= JWT "~" [base64url "~"]*
Fnord ::= SD-JWT JWT

The actual helpfulness of ABNF IMHO really depends on the readers familiarity with ABNF. I don't know that such familiarity is particularity prevalent. But, as long as it's correct, it doesn't hurt to include either. And while I'm not overly familiar with ABNF myself, I know enough to know that that isn't valid ABNF and doesn't quite correctly convey the SD-JWT constructs. I've endeavored* to fix it up but am not 100% sure this is correct either:

ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
DIGIT = %x30-39 ; 0-9
base64url = 1*(ALPHA / DIGIT / "-" / "_")
JWT = base64url "." base64url "." base64url
SD-JWT = JWT "~" *[base64url "~"]
SD-JWT-KB = SD-JWT JWT

* with a bit of help from https://author-tools.ietf.org/abnf

@danielfett
Copy link
Member

Looks good to me, thank you!

Maybe a small improvement would be to introduce a name for disclosure?

ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
DIGIT = %x30-39 ; 0-9
base64url = 1*(ALPHA / DIGIT / "-" / "_")
JWT = base64url "." base64url "." base64url
DISCLOSURE = base64url
SD-JWT = JWT "~" *[DISCLOSURE "~"]
SD-JWT-KB = SD-JWT JWT

@bc-pi
Copy link
Collaborator

bc-pi commented Feb 13, 2024

That's a good improvement, thanks!

@bifurcation
Copy link
Author

Looks good to me, and appears valid according to the IETF ABNF parser.

@Sakurann
Copy link
Collaborator

(SD-JWT-KB part of the ABNF depends on another PR)

@Sakurann
Copy link
Collaborator

need to wait after #394 is resolved to do a PR.

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

No branches or pull requests

4 participants