-
Notifications
You must be signed in to change notification settings - Fork 13
11. Key Binding
Lukas.J.Han edited this page Dec 18, 2023
·
1 revision
You can issue SD JWT with Key Binding JWT and verify it.
const { privateKey, publicKey } = createKeyPair();
const claims = {
irstname: 'John',
lastname: 'Doe',
ssn: '123-45-6789',
id: '1234',
};
const disclosureFrame: DisclosureFrame<typeof claims> = {
_sd: ['firstname', 'id'],
};
const encodedSdjwt = await sdjwt.issue(claims, privateKey, disclosureFrame, {
kb: {
alg: 'EdDSA',
payload: {
iat: Math.floor(Date.now() / 1000),
aud: 'https://example.com',
nonce: '1234',
_sd_hash: '1234',
},
privateKey,
},
});
const verified = await sdjwt.verify(encodedSdjwt, publicKey, ['id', 'ssn'], {
kb: {
publicKey,
},
});
console.log(verified);