Options
All
  • Public
  • Public/Protected
  • All
Menu

Package jwt

@typed/jwt

An JWT implementation that uses public-key cryptography for signing/verifying, using @typed/effects.

Index

Type aliases

Jwt

Jwt: NewType<string, "Jwt">

VerificationOptions

VerificationOptions: { audience?: undefined | string; issuer?: undefined | string; subject?: undefined | string }

Type declaration

  • Optional Readonly audience?: undefined | string
  • Optional Readonly issuer?: undefined | string
  • Optional Readonly subject?: undefined | string

Variables

Const base64UrlDecode

base64UrlDecode: (encoded: string) => string = pipe(replaceTokens,padString,base64Decode,)

Type declaration

    • (encoded: string): string
    • Parameters

      • encoded: string

      Returns string

Const base64UrlEncode

base64UrlEncode: (str: string) => string = pipe(base64Encode, encodeTokens)

Type declaration

    • (str: string): string
    • Parameters

      • str: string

      Returns string

Const isJwt

isJwt: (value: A) => value is B = isNewType((s: string): s is Jwt => regex.test(s))

Type declaration

    • (value: A): value is B
    • Parameters

      • value: A

      Returns value is B

Functions

base64Decode

  • base64Decode(message: string): string

base64Encode

  • base64Encode(message: string): string

createClaims

  • createClaims<A>(claims: A, expirationMs: number): Readonly<A & { exp: number; nbf: number }>

decode

  • decode(input: string): string

encode

  • encode(input: string): string

encodeTokens

  • encodeTokens(message: string): string

getClaims

  • getClaims<A>(jwt: Jwt): A

getExpiration

  • getExpiration(jwt: Jwt): Date

getHeader

  • getHeader(jwt: Jwt): JsonObject

getNotBefore

  • getNotBefore(jwt: Jwt): Date

getSignature

  • getSignature(jwt: Jwt): string

getToken

  • getToken(jwt: Jwt): string

isActive

  • isActive(jwt: Jwt): boolean

isExpired

  • isExpired(jwt: Jwt): boolean

sign

  • sign(claims: JsonObject, privateKey: CryptoKey): Effects<CryptoEnv & CryptoFailure, Jwt>

splitToken

  • splitToken(jwt: Jwt): keyof [string, string, string]

verify

Generated using TypeDoc