0.0.1 • Published 8 months ago

@gofarqs/jwtwo v0.0.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

as-jwt

AssemblyScript package that provides simple jws handling for jwt tokens.

Installation:

npm install @gcoredev/as-jwt

Usage:

import { jwtVerify, JwtValidation } from "@gcoredev/as-jwt/assembly";

const token = "<base64-header>.<base64-payload>.<signed-secret>";
const secret = "my-long-private-key-that-is-hard-to-guess";

const result: JwtValidation = jwtVerify(token, secret, {
  issuer: "urn:example:issuer",
  audience: "urn:example:audience",
});

if (result === JwtValidation.Ok) {
  // Jwt is valid.
} else {
  // Jwt validation failed
}

API

jwtVerify()

jwtVerify(jwt, key, options?): JwtValidation

Internal Libraries:

Under the hood this package is powered by:

0.0.1

8 months ago