Skip to content

Commit

Permalink
broken interfaces for unsecured presentations
Browse files Browse the repository at this point in the history
  • Loading branch information
OR13 committed Feb 5, 2024
1 parent 7b75dd6 commit 89694c4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
6 changes: 1 addition & 5 deletions test/w3c-cr-1/1-credentials.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,4 @@ describe('SD-JWT based W3C Verifiable Credentials', () => {
})
expect(verified.issuer.id).toBe('https://university.example/issuers/565049')
})

})

// refactor cose to support signer apis first.
it.todo('cose credentials')
})
40 changes: 25 additions & 15 deletions test/w3c-cr-1/2-presentations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,23 @@ describe('JWT based W3C Verifiable Presentations', () => {
})

describe('SD-JWT based W3C Verifiable Presentations', () => {

// todo seperate test for totally unsecured presentation.

it('application/vp+ld+json+sd-jwt (without key binding)', async () => {
// this content type always implies an sd-jwt secured json-ld object (vp) contain enveloped Fnards.
const type = 'application/vp+ld+json+sd-jwt'
const type = 'application/vp+ld+json'
const vp = await transmute
.holder({
alg: 'ES384',
cty: type,
// this is the private key that signed the outer JSON-LD VP object.
signer: jws
// should be valid.
// signer: jws
})
.issue({
audience: undefined,
nonce: undefined,
presentation: {
"@context": [
"https://www.w3.org/ns/credentials/v2",
Expand All @@ -147,12 +153,13 @@ describe('SD-JWT based W3C Verifiable Presentations', () => {
claimset: fixtures.claimset_disclosable_0,
}),
disclosure: fixtures.claimset_disclosable_0_disclosure,
audience: undefined,
nonce: undefined,
// each credential can have a different bound public key
// so we need a different private key or signer for each
// disclosure
signer: jws
// should be valid.
// audience: undefined,
// nonce: undefined,
// // each credential can have a different bound public key
// // so we need a different private key or signer for each
// // disclosure
// signer: jws
}],
})
const verified = await transmute.
Expand Down Expand Up @@ -188,6 +195,8 @@ describe('SD-JWT based W3C Verifiable Presentations', () => {
signer: jws
})
.issue({
audience: 'aud-123',
nonce: 'nonce-456',
presentation: {
"@context": [
"https://www.w3.org/ns/credentials/v2",
Expand All @@ -202,6 +211,7 @@ describe('SD-JWT based W3C Verifiable Presentations', () => {
// }]
},
disclosures: [{
// internal params
credential: await transmute
.issuer({
alg: 'ES384',
Expand All @@ -211,13 +221,15 @@ describe('SD-JWT based W3C Verifiable Presentations', () => {
.issue({
claimset: fixtures.claimset_disclosable_1,
}),
disclosure: fixtures.claimset_disclosable_0_disclosure,
audience: 'aud-123',
nonce: 'nonce-456',
// each credential can have a different bound public key
// so we need a different private key or signer for each
// disclosure
signer: jws
signer: jws,

// external params
disclosure: fixtures.claimset_disclosable_0_disclosure,
audience: 'aud-123',
nonce: 'nonce-456',
}],
})
const verified = await transmute.
Expand Down Expand Up @@ -267,6 +279,4 @@ describe('SD-JWT based W3C Verifiable Presentations', () => {
expect(verified3.nonce).toBe('nonce-456')

})
})

it.todo('cose presentations')
})

0 comments on commit 89694c4

Please sign in to comment.