Skip to content

09. Encode & Decode

Lukas.J.Han edited this page Dec 15, 2023 · 1 revision

Decode

You can decode SD JWT encoded credential to SDJwt Object.

import sdjwt from '@hopae/sd-jwt';

// decoded variable is SDJwt Object
const decoded = sdjwt.decode(encodedSdjwt);

// You can access inside of SDJwt object
console.log(decoded.jwt, decoded.disclosures); 

Encode

You can encode SD JWT object instance to encoded credential

import sdjwt from '@hopae/sd-jwt';

// encode SDJwt object to string
const encodedSdjwt = sdjwt.encode(decoded);
Clone this wiki locally