Skip to content

Commit

Permalink
media types
Browse files Browse the repository at this point in the history
  • Loading branch information
OR13 committed Aug 10, 2024
1 parent da4bba5 commit a6c850e
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/controller-documents/kid.resolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
4 changes: 2 additions & 2 deletions test/controller-documents/token.resolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/disclosure-edge-cases/full-disclosure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/disclosure-edge-cases/no-disclosure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/headers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
}))

Expand Down
4 changes: 2 additions & 2 deletions test/v2.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a6c850e

Please sign in to comment.