base64url-xplatform
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

Base64Url Cross-Platform

A cross-platform implementation of base64 URL, with typescript definitions included.

Usage

Install via NPM and require in your project. There is also an ESM export, for use with browser or Deno.

const { Base64Url } = require('base64url-xplatform')
const header = { alg: 'RS256' }
const claimsSet = {
  iss: 'iss',
  sub: 'sub',
  aud: 'aud',
  exp: Math.floor(Date.now() / 1000) + 60 * 5
}
const encodedJWTHeader = Base64Url.encode(JSON.stringify(header))
const encodedJWTClaimsSet = Base64Url.encode(JSON.stringify(claimsSet))
const existingString = encodedJWTHeader + '.' + encodedJWTClaimsSet

Readme

Keywords

Package Sidebar

Install

npm i base64url-xplatform

Weekly Downloads

2,403

Version

1.1.2

License

MIT

Unpacked Size

5.7 kB

Total Files

6

Last publish

Collaborators

  • ahuggins_nhs