From a6c850efedf70974f0fb0e327bb023ceff67219f Mon Sep 17 00:00:00 2001 From: Orie Steele Date: Sat, 10 Aug 2024 17:53:07 -0500 Subject: [PATCH] media types --- README.md | 6 +++--- test/controller-documents/kid.resolver.test.ts | 2 +- test/controller-documents/token.resolver.test.ts | 4 ++-- test/disclosure-edge-cases/full-disclosure.test.ts | 2 +- test/disclosure-edge-cases/no-disclosure.test.ts | 2 +- test/headers.test.ts | 4 ++-- test/v2.e2e.test.ts | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 402f8db..407b8fe 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ const vc = await sd .issuer({ iss: issuerId, kid: issuerKeyId, - typ: `application/vc+sd-jwt`, + typ: `application/vc-ld+sd-jwt`, signer: await sd.jws.signer(issuerRole.privateKeyJwk), }) .issue({ @@ -216,7 +216,7 @@ const verification = await sd verify: async (token: string) => { const jwt = token.split("~")[0]; const decodedHeader = decodeProtectedHeader(jwt); - if (decodedHeader.typ === "application/vc+sd-jwt") { + if (decodedHeader.typ === "application/vc-ld+sd-jwt") { const decodedPayload = decodeJwt(jwt); const iss = (decodedHeader.iss || decodedPayload.iss) as string; const kid = decodedHeader.kid as string; @@ -257,7 +257,7 @@ This is the result of the verification operations above: "protectedHeader": { "alg": "ES384", "kid": "https://university.example/issuers/565049#key-42", - "typ": "application/vc+sd-jwt" + "typ": "application/vc-ld+sd-jwt" }, "claimset": { "iss": "https://university.example/issuers/565049", diff --git a/test/controller-documents/kid.resolver.test.ts b/test/controller-documents/kid.resolver.test.ts index 8fd766b..6d1f606 100644 --- a/test/controller-documents/kid.resolver.test.ts +++ b/test/controller-documents/kid.resolver.test.ts @@ -91,7 +91,7 @@ it('End to End Test', async () => { const vc = await sd.issuer({ iss: issuerId, kid: issuerKeyId, - typ: `application/vc+sd-jwt`, + typ: `application/vc-ld+sd-jwt`, privateKeyJwk: issuerRole.privateKeyJwk }) .issue({ diff --git a/test/controller-documents/token.resolver.test.ts b/test/controller-documents/token.resolver.test.ts index dcbc825..13885b8 100644 --- a/test/controller-documents/token.resolver.test.ts +++ b/test/controller-documents/token.resolver.test.ts @@ -91,7 +91,7 @@ it('End to End Test', async () => { const vc = await sd.issuer({ iss: issuerId, kid: issuerKeyId, - typ: `application/vc+sd-jwt`, + typ: `application/vc-ld+sd-jwt`, privateKeyJwk: issuerRole.privateKeyJwk }) .issue({ @@ -133,7 +133,7 @@ it('End to End Test', async () => { verify: async (token: string) => { const jwt = token.split('~')[0] const decodedHeader = decodeProtectedHeader(jwt) - if (decodedHeader.typ === 'application/vc+sd-jwt'){ + if (decodedHeader.typ === 'application/vc-ld+sd-jwt'){ const decodedPayload = decodeJwt(jwt) const iss = (decodedHeader.iss || decodedPayload.iss) as string const kid = decodedHeader.kid as string diff --git a/test/disclosure-edge-cases/full-disclosure.test.ts b/test/disclosure-edge-cases/full-disclosure.test.ts index ddb5564..94ea2b6 100644 --- a/test/disclosure-edge-cases/full-disclosure.test.ts +++ b/test/disclosure-edge-cases/full-disclosure.test.ts @@ -76,7 +76,7 @@ it('no disclosure and key binding', async () => { let nonce = undefined as string | undefined; const iss = `https://university.example/issuers/565049` const kid = `${iss}#key-123` - const typ = `application/vc+sd-jwt` + const typ = `application/vc-ld+sd-jwt` const cty = `application/vc` const { publicKeyJwk, privateKeyJwk } = await sd.key.generate(alg) const signer = await sd.jws.signer(privateKeyJwk) diff --git a/test/disclosure-edge-cases/no-disclosure.test.ts b/test/disclosure-edge-cases/no-disclosure.test.ts index 24fdb36..dc82b70 100644 --- a/test/disclosure-edge-cases/no-disclosure.test.ts +++ b/test/disclosure-edge-cases/no-disclosure.test.ts @@ -76,7 +76,7 @@ it('no disclosure and key binding', async () => { let nonce = undefined as string | undefined; const iss = `https://university.example/issuers/565049` const kid = `${iss}#key-123` - const typ = `application/vc+sd-jwt` + const typ = `application/vc-ld+sd-jwt` const cty = `application/vc` const { publicKeyJwk, privateKeyJwk } = await sd.key.generate(alg) const signer = await sd.jws.signer(privateKeyJwk) diff --git a/test/headers.test.ts b/test/headers.test.ts index 5c866b5..5e6d956 100644 --- a/test/headers.test.ts +++ b/test/headers.test.ts @@ -18,7 +18,7 @@ it('W3C Example', async () => { const issuer = SD.issuer({ alg, kid: `${iss}#key-42`, - typ: `application/vc+sd-jwt`, + typ: `application/vc-ld+sd-jwt`, cty: `application/vc`, iss, digester, @@ -94,7 +94,7 @@ credentialSubject: expect(JSON.stringify(verified.protectedHeader)).toBe(JSON.stringify({ "alg": "ES384", "kid": "did:web:issuer.example#key-42", - "typ": "application/vc+sd-jwt", + "typ": "application/vc-ld+sd-jwt", "cty": "application/vc" })) diff --git a/test/v2.e2e.test.ts b/test/v2.e2e.test.ts index f9bad74..89110ab 100644 --- a/test/v2.e2e.test.ts +++ b/test/v2.e2e.test.ts @@ -90,7 +90,7 @@ const helpCheck = async (isVC: boolean, token: string, publicKeyJwk: any, audien expect(JSON.stringify(verification.protectedHeader, null, 2)).toEqual(JSON.stringify({ "alg": "ES384", "kid": "https://university.example/issuers/565049#key-123", - "typ": "application/vc+sd-jwt", + "typ": "application/vc-ld+sd-jwt", "cty": "application/vc", }, null, 2)) } else { @@ -132,7 +132,7 @@ it('verbose setup', async () => { let nonce = undefined as string | undefined; const iss = `https://university.example/issuers/565049` const kid = `${iss}#key-123` - const typ = `application/vc+sd-jwt` + const typ = `application/vc-ld+sd-jwt` const cty = `application/vc` const { publicKeyJwk, privateKeyJwk } = await sd.key.generate(alg) const signer = await sd.jws.signer(privateKeyJwk)