Coder Social home page Coder Social logo

kreactive / jsonwebtoken Goto Github PK

View Code? Open in Web Editor NEW
36.0 36.0 24.0 123 KB

Swift lib for decoding, validating, signing and verifying JWT

License: MIT License

Swift 92.26% Objective-C 0.41% Python 5.50% Shell 0.99% Ruby 0.85%
decoding ios jsonwebtoken rsa swift verify

jsonwebtoken's People

Contributors

antoinepalazzolo avatar g-bourachot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jsonwebtoken's Issues

JSONWebToken header

Hi!
This project is awesome, so thank you for this contribution. But I do have a question - when turning my token String into JSONWebToken type I don't get header part in the object. Is this left out on purpose and if so, why? Otherwise it would be really great if we could access it the same way as the payload.

Add a Boolean Claim Transformer

There are transformers for almost all the JSON types in the library, except Boolean. It would be great to add the Boolean Transformer for the sake of completeness.

Using for Sign in with Apple verify token

Seems this package can be used token verification in Sign in with Apple.

how do I use it exactly? How do i get the secret and compare with "sub"?

When will this package be upgraded to support Swift 5 and Xcode 11?

Thanks
Ashish

Trying to sign a JWT Token with RSA256

Hi there

I need to mint a JWT using RS256 to use to validate a connection to a Google Firebase database via my app.

I have a Private Key from Firebase that looks something like:

"-----BEGIN PRIVATE KEY-----\nMIIEvQIBADds4tTHG53.........................................oBDP6N8=\n-----END PRIVATE KEY-----\n"

This is supplied in a string format and there are around 1600 characters in the key.

I can create the payload with the required claims, however I am struggling with taking the payload and creating a signed token using RSA256.

From your instructions I determined that I might need to do the following:

Use RSAPKCS1Signer to generate signed token:

let payload : JSONWebToken.Payload
let privateKey : RSAKey

let signer = RSAPKCS1Signer(hashFunction: .SHA256, key: privateKey) 
let jwt = try JSONWebToken(payload : payload, signer : signer)
let rawJWT : String = jwt.rawString

The two issues I have is that the privateKey won't accept the Private Key string I have, I believe it is looking for a DER certificate format.

I also cannot see how to set it to use RSA256, which is a requirement for the Firebase Database.

Can you please help shed some light on how best to approach this?

Thanks for any help you can provide.

CocoaPods Support / PodSpec Support

Hi @antoinepalazzolo

I am wondering if it is possible to publish the library?

Using the git ref pod 'JSONWebToken', :git => 'https://github.com/kreactive/JSONWebToken.git', :branch => 'master' only works in a Podfile and not a PodSpec.

PodSpec's only support the following format and don't support using git branches, so its not possible to use the library via a PodSpec.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.