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

Higher level objects #12

Open
z64 opened this issue Oct 6, 2017 · 0 comments
Open

Higher level objects #12

z64 opened this issue Oct 6, 2017 · 0 comments

Comments

@z64
Copy link

z64 commented Oct 6, 2017

Hi there! Thanks for the great little library.

I wrote a small shard that adds a mixin to the JWT namespace that makes it easy to extend existing classes and structs with the optional JWT claims and serialize them with #encode

encoded = session.encode("secret", "none") do
  issued_at Time.now
  issuer "z64"
  audience ["GitHub", "snapcase"]
end

See the full example and implementation here: https://github.com/y32/jwt_obj

This abstracts away the optional claim "codes" of "ext", "iss", etc. into a more expressive DSL, additionally letting users use Time for applicable fields instead of writing their own epoch conversion.

It is currently built to fit our use case, but I'd be happy to PR it and make adjustments if it would complement this shard. If this shard is meant to strictly be a implementation of JWT, that's cool too 👍

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

1 participant