Skip to content
LogoLogo

Attestation.decode

Decode an attestation

Decodes an attestation without verifying it. Use it to read the audience, issuer, type, or expiry; use Attestation.verify before trusting any claim.

Usage

import * as  from 'mppx/extensions/identity/attestation'
 
declare const : string
 
const  = .() 
.(?..)
https://api.example.com

Return type

type Decoded = {
  claims: Partial<Attestation.Claims> & Record<string, unknown> // unverified
  header: { alg?: unknown; kid?: unknown; typ?: unknown }
  signature: Uint8Array
  signingInput: Uint8Array // base64url(header) + '.' + base64url(claims)
} | undefined

Returns undefined when the token is longer than 8192 characters, doesn't have three base64url parts, or its header or claims aren't JSON objects.

Parameters

token

  • Type: string

Compact JWS attestation.