From 1aa3aea86213e75328975e34d9bf71410fc7a12a Mon Sep 17 00:00:00 2001 From: Stefan Charsley Date: Sat, 16 Nov 2024 03:57:58 +1300 Subject: [PATCH] feat: align media type with sd-jwt-vc draft 06 (#256) --- examples/sd-jwt-example/custom_header.ts | 2 +- examples/sd-jwt-vc-example/custom_header.ts | 2 +- packages/sd-jwt-vc/src/sd-jwt-vc-instance.ts | 2 +- packages/sd-jwt-vc/test/app-e2e.spec.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/sd-jwt-example/custom_header.ts b/examples/sd-jwt-example/custom_header.ts index d4bbd86..ca82786 100644 --- a/examples/sd-jwt-example/custom_header.ts +++ b/examples/sd-jwt-example/custom_header.ts @@ -31,7 +31,7 @@ import { createSignerVerifier, digest, ES256, generateSalt } from './utils'; // Issue a signed JWT credential with the specified claims and disclosures // Return a Encoded SD JWT. Issuer send the credential to the holder const credential = await sdjwt.issue(claims, disclosureFrame, { - header: { typ: 'vc+sd-jwt', custom: 'data' }, // You can add custom header data to the SD JWT + header: { typ: 'dc+sd-jwt', custom: 'data' }, // You can add custom header data to the SD JWT }); console.log('encodedSdjwt:', credential); diff --git a/examples/sd-jwt-vc-example/custom_header.ts b/examples/sd-jwt-vc-example/custom_header.ts index 0b8cab7..8ab0379 100644 --- a/examples/sd-jwt-vc-example/custom_header.ts +++ b/examples/sd-jwt-vc-example/custom_header.ts @@ -39,7 +39,7 @@ import { createSignerVerifier, digest, ES256, generateSalt } from './utils'; }, disclosureFrame, { - header: { typ: 'vc+sd-jwt', custom: 'data' }, // You can add custom header data to the SD JWT + header: { typ: 'dc+sd-jwt', custom: 'data' }, // You can add custom header data to the SD JWT }, ); console.log('encodedSdjwt:', credential); diff --git a/packages/sd-jwt-vc/src/sd-jwt-vc-instance.ts b/packages/sd-jwt-vc/src/sd-jwt-vc-instance.ts index ee1f008..5ad0870 100644 --- a/packages/sd-jwt-vc/src/sd-jwt-vc-instance.ts +++ b/packages/sd-jwt-vc/src/sd-jwt-vc-instance.ts @@ -22,7 +22,7 @@ export class SDJwtVcInstance extends SDJwtInstance { /** * The type of the SD-JWT-VC set in the header.typ field. */ - protected type = 'vc+sd-jwt'; + protected type = 'dc+sd-jwt'; protected userConfig: SDJWTVCConfig = {}; diff --git a/packages/sd-jwt-vc/test/app-e2e.spec.ts b/packages/sd-jwt-vc/test/app-e2e.spec.ts index 7f8958f..85941ed 100644 --- a/packages/sd-jwt-vc/test/app-e2e.spec.ts +++ b/packages/sd-jwt-vc/test/app-e2e.spec.ts @@ -235,7 +235,7 @@ async function JSONtest(filename: string) { expect(validated).toBeDefined(); expect(validated).toStrictEqual({ - header: { alg: 'EdDSA', typ: 'vc+sd-jwt' }, + header: { alg: 'EdDSA', typ: 'dc+sd-jwt' }, payload, }); @@ -259,7 +259,7 @@ async function JSONtest(filename: string) { expect(verified).toBeDefined(); expect(verified).toStrictEqual({ - header: { alg: 'EdDSA', typ: 'vc+sd-jwt' }, + header: { alg: 'EdDSA', typ: 'dc+sd-jwt' }, kb: undefined, payload, });