Novelty Palliates Malaise

    @cfworker/jwt
    TypeScript icon, indicating that this package has built-in type declarations

    4.0.4 • Public • Published

    cfworker/jwt

    Tiny lib for decoding JWTs and verifying signatures, using native crypto APIs.

    Currently supports RS256, RS384, and RS512.

    const jwt = request.headers.get('Authorization');
    const issuer = '...'; // Auth0 origin.
    const audience = '...'; // Auth0 client id.
    
    const result = await parseJwt(jwt, issuer, audience);
    if (!result.valid) {
      console.log(result.reason); // Invalid issuer/audience, expired, etc
    } else {
      console.log(result.payload); // { iss, sub, aud, iat, exp, ...claims }
    }

    Install

    npm i @cfworker/jwt

    DownloadsWeekly Downloads

    348

    Version

    4.0.4

    License

    MIT

    Unpacked Size

    24.4 kB

    Total Files

    27

    Last publish

    Collaborators

    • jdanyow