Skip to content

added secretBase64Encoded parameter to the decode func. #37

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

Conversation

mollywoodnini
Copy link

JWT-Secrets which are base64 encoded (for example from Auth0) couldn't be decoded and verified before.

There's an additional checkbox in https://jwt.io to mark the secret as base64 encoded.

Therefore I added a flag to mark the secret as base64 encoded, so the sign-function could handle the secret.

@ed-mejia
Copy link

ed-mejia commented Aug 1, 2016

+1

@kylef kylef closed this in 414f5b7 Sep 13, 2016
@kylef
Copy link
Owner

kylef commented Sep 13, 2016

Thinking about this API some more, it shouldn't actually take a String but instead Data.

You can then pass in Data which can be created from a String of a base64 string.

.hs256("secret".data(using: .utf8)!)
.hs256(Data(base64Encoded: "c2VjcmV0")!)

This behaviour is now supported in JSONWebToken 2.0.1.

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.

3 participants