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

1.0.0 • Public • Published

cf-access-jwt

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

Currently supports alg:'RS256' only.

const jwt = request.headers.get('Cf-Access-Jwt-Assertion');

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 }
}

Code shamelessly stolen from: https://github.com/cfworker/cfworker/

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    1

Package Sidebar

Install

npm i @bren2010/cf-access-jwt

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

14.3 kB

Total Files

22

Last publish

Collaborators

  • bren2010