Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/SPRIND-137 #174

Merged
merged 56 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
4b7e8ae
feat: dcql alpha
auer-martin Nov 20, 2024
dc1c318
feat: dcql alpha
auer-martin Nov 21, 2024
6ff3355
fix: dcql alpha
auer-martin Nov 21, 2024
6ad4d89
feat: add things
auer-martin Nov 21, 2024
6d94367
feat: update dcql lib
auer-martin Nov 21, 2024
413ecb9
fix: feedback
auer-martin Nov 22, 2024
3c6e08a
Merge branch 'develop' of github.com:Sphereon-Opensource/OID4VC into …
auer-martin Nov 22, 2024
9ff62bd
fix: update
auer-martin Nov 23, 2024
c654a7b
fix: check if oid4vp defined
TimoGlastra Nov 24, 2024
76be4cc
fix: update dcql and incorporate feedback
auer-martin Nov 25, 2024
d7cc1e7
feat: update dcql
auer-martin Nov 26, 2024
ad19797
feat: update dcql
auer-martin Nov 26, 2024
036276e
Merge remote-tracking branch 'upstream/develop' into develop
zoemaas Dec 5, 2024
33e0be7
chore: Added dcql to resolutions since there are major changes in the…
zoemaas Dec 5, 2024
10fd2b1
chore: Fixed broken dependencies
zoemaas Dec 9, 2024
fc238f4
refactor: Removed local dependencies
zoemaas Dec 11, 2024
47b9205
refactor: Removed packageManager from the package.json
zoemaas Dec 11, 2024
1695368
Merge remote-tracking branch 'origin/develop' into feature/SPRIND-137
sanderPostma Dec 17, 2024
fa3e1b8
chore: lockfile
sanderPostma Dec 17, 2024
9b7a2c3
chore: use DcqlQuery object just like presentation_definition has an …
sanderPostma Dec 17, 2024
9b4bb1f
chore: only show DcqlQuery when present
sanderPostma Dec 17, 2024
1020b5b
test: Added AuthenticationRequest and AuthenticationResponse queries
zoemaas Dec 17, 2024
34ec540
Merge branch 'feature/SPRIND-137' of github.com:Sphereon-Opensource/O…
zoemaas Dec 17, 2024
f94344e
chore: "fixed succeed when valid JWT with DCQL query is passed in" to…
sanderPostma Dec 18, 2024
7e0c198
Fix: Added the hasher and compact sdjwt credential to the Authorizati…
zoemaas Dec 18, 2024
169118c
Fix: Fixed broken IT tests
zoemaas Dec 30, 2024
3cc42b1
Fix: Removed skip from tests that are running successfully
zoemaas Dec 30, 2024
88ce80c
chore: added DCQL tests
zoemaas Dec 31, 2024
e5a1854
Fix: Nonce was searched in the wrong place
zoemaas Jan 2, 2025
1c2838f
Fix: Fixed the SD-JWT sign callback and added extra DCQL test
zoemaas Jan 3, 2025
5674a27
Fix: Updated the response mode in test
zoemaas Jan 3, 2025
fd6a07b
Refactor: Disabled tests again
zoemaas Jan 8, 2025
9e2035b
Merge remote-tracking branch 'origin/dcql' into feature/SPRIND-137
zoemaas Jan 8, 2025
d002379
Refactor: Rolled back the changes in response type and updated DCQL l…
zoemaas Jan 8, 2025
43420cf
refactor: Checking whether PDs and DCQL are present
zoemaas Jan 8, 2025
44821ee
refactor: Removed pnpm version limitation
zoemaas Jan 8, 2025
d6d751a
chore: lib updates
sanderPostma Jan 13, 2025
7bf30b7
Merge branch 'feature/SPRIND-137' into feature/VDX-341_dcql
sanderPostma Jan 13, 2025
4ff1d70
chore: dcql update
sanderPostma Jan 13, 2025
7e8a5fd
chore: dcql fixes
sanderPostma Jan 13, 2025
b28b39e
chore: dcql fixes
sanderPostma Jan 13, 2025
6e4e2cc
chore: dcql fixes
sanderPostma Jan 13, 2025
7c0b5e1
chore: lockfile
sanderPostma Jan 13, 2025
0ea0125
chore: force pnpm version
sanderPostma Jan 13, 2025
1ac4907
chore: withDcqlQuery update
sanderPostma Jan 14, 2025
05d39b7
refactor: Allowed only presentation definition objects.
zoemaas Jan 14, 2025
ec6a13e
refactor: Moved Dcql.ts functions into a Dcql class and made them sta…
zoemaas Jan 14, 2025
d8fdf44
refactor: Removed potentially nulls from removeNullUndefined(...) fun…
zoemaas Jan 14, 2025
8b9a1ff
Merge branch 'feature/SPRIND-137' of github.com:Sphereon-Opensource/O…
zoemaas Jan 16, 2025
5510c53
chore: PR feedback fixes
sanderPostma Jan 20, 2025
ef38f3c
Merge remote-tracking branch 'origin/develop' into feature/SPRIND-137
sanderPostma Jan 20, 2025
fa56bcc
chore: lockfile
sanderPostma Jan 20, 2025
2180e7f
chore: reverted definitionVersionDiscovery
sanderPostma Jan 21, 2025
9069e27
chore: added comments in CI
sanderPostma Jan 21, 2025
19382fa
chore: removed commented out code
sanderPostma Jan 21, 2025
44db119
chore: fixed definitionVersionDiscovery handling
sanderPostma Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-test-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
node-version: '20.x'
- uses: pnpm/action-setup@v4
with:
version: 9
version: 9.15.3
- run: pnpm install
- run: pnpm build
- name: run CI tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-publish-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
node-version: '20.x'
- uses: pnpm/action-setup@v4
with:
version: 9
version: 9.15.3
- run: pnpm install
- run: pnpm build
- name: run integration tests
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"node": ">=18"
},
"resolutions": {
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wondering if we will keep working with packages with branch-names, after merge to developer we might fix it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will take care of it, see other tickets

"dcql": "0.2.19",
"node-fetch": "2.6.12"
},
"prettier": {
Expand Down Expand Up @@ -66,4 +67,3 @@
"OID4VP"
]
}

2 changes: 1 addition & 1 deletion packages/callback-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@sphereon/oid4vci-client": "workspace:*",
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/oid4vci-issuer": "workspace:*",
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be addressed. (For all instances of this branch)
Maybe it's best to create a separate PR for ssi-types, merged it, then use it in this repo, merge this one then SSI-SDK.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will create a follow-up PR when SSI-SDK is merged. But first we need to merge this PR because SSI-SDK also depends on this project to a greater extend.

"jose": "^4.10.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@sphereon/oid4vc-common": "workspace:*",
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"cross-fetch": "^3.1.8",
"debug": "^4.3.5"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"jwt-decode": "^4.0.0",
"sha.js": "^2.4.11",
"uint8arrays": "3.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/issuer-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/oid4vci-issuer": "workspace:*",
"@sphereon/ssi-express-support": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"body-parser": "^1.20.2",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/issuer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@sphereon/oid4vc-common": "workspace:*",
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"uuid": "^9.0.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/oid4vci-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@sphereon/oid4vc-common": "workspace:*",
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"cross-fetch": "^3.1.8",
"debug": "^4.3.5",
"jwt-decode": "^4.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
VERIFIERZ_PURPOSE_TO_VERIFY,
VERIFIERZ_PURPOSE_TO_VERIFY_NL,
} from './data/mockedData'
import { DcqlQuery } from 'dcql'

const EXAMPLE_REDIRECT_URL = 'https://acme.com/hello'
const EXAMPLE_REFERENCE_URL = 'https://rp.acme.com/siop/jwts'
Expand Down Expand Up @@ -671,4 +672,85 @@ describe('create Request JWT should', () => {
}
await expect(URI.fromOpts(opts)).rejects.toThrow(SIOPErrors.REQUEST_CLAIMS_PRESENTATION_DEFINITION_NOT_VALID)
})

it('should succeed when requesting with a valid dcql query', async () => {
const dcqlQuery: DcqlQuery = {
credentials: [
{
id: 'Credentials',
format: 'jwt_vc_json',
claims: [
{
id: 'ID Card Credential',
path: ['$.issuer.id'],
values: ['did:example:issuer'],
},
],
},
],
}
const opts: CreateAuthorizationRequestOpts = {
version: SupportedVersion.SIOPv2_ID1,
payload: {
client_id: WELL_KNOWN_OPENID_FEDERATION,
scope: 'test',
response_type: 'vp_token',
request_object_signing_alg_values_supported: [SigningAlgo.ES256, SigningAlgo.EDDSA],
redirect_uri: EXAMPLE_REDIRECT_URL,
},
requestObject: {
jwtIssuer: { method: 'did', didUrl: KID, alg: SigningAlgo.ES256K },
passBy: PassBy.REFERENCE,
reference_uri: EXAMPLE_REFERENCE_URL,

createJwtCallback: getCreateJwtCallback({
hexPrivateKey: HEX_KEY,
did: DID,
kid: KID,
alg: SigningAlgo.ES256K,
}),
payload: {
client_id: WELL_KNOWN_OPENID_FEDERATION,
scope: 'test',
response_type: 'vp_token',
redirect_uri: EXAMPLE_REDIRECT_URL,
request_object_signing_alg_values_supported: [SigningAlgo.EDDSA, SigningAlgo.ES256],
claims: {
vp_token: {
dcql_query: JSON.stringify(dcqlQuery)
},
},
},
},
clientMetadata: {
client_id: WELL_KNOWN_OPENID_FEDERATION,
idTokenSigningAlgValuesSupported: [SigningAlgo.EDDSA, SigningAlgo.ES256],
requestObjectSigningAlgValuesSupported: [SigningAlgo.EDDSA, SigningAlgo.ES256],
responseTypesSupported: [ResponseType.ID_TOKEN],
scopesSupported: [Scope.OPENID_DIDAUTHN, Scope.OPENID],
subject_syntax_types_supported: ['did:ethr:', SubjectIdentifierType.DID],
subjectTypesSupported: [SubjectType.PAIRWISE],
vpFormatsSupported: {
ldp_vc: {
proof_type: [IProofType.EcdsaSecp256k1Signature2019, IProofType.EcdsaSecp256k1Signature2019],
},
},

passBy: PassBy.VALUE,

logo_uri: VERIFIER_LOGO_FOR_CLIENT,
clientName: VERIFIER_NAME_FOR_CLIENT,
'clientName#nl-NL': VERIFIER_NAME_FOR_CLIENT_NL + '2022100305',
clientPurpose: VERIFIERZ_PURPOSE_TO_VERIFY,
'clientPurpose#nl-NL': VERIFIERZ_PURPOSE_TO_VERIFY_NL,
},
}

const uriRequest = await URI.fromOpts(opts)

const uriDecoded = decodeURIComponent(uriRequest.encodedUri)
expect(uriDecoded.startsWith('openid4vp://?')).toBeTruthy()
expect(uriDecoded).toContain(`request_uri=https://rp.acme.com/siop/jwts`)
expect((await (await uriRequest.toAuthorizationRequest())?.requestObject?.getPayload())?.claims.vp_token).toBeDefined()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
IVerifiablePresentation,
OriginalVerifiableCredential,
} from '@sphereon/ssi-types'
import { DcqlCredential, DcqlPresentation, DcqlQuery, DcqlQueryResult } from 'dcql'

import {
AuthorizationResponse,
Expand All @@ -27,12 +28,12 @@ import {
VerifyAuthorizationRequestOpts,
VPTokenLocation,
} from '..'
import { createPresentationSubmission } from '../authorization-response/OpenID4VP'
import { createPresentationSubmission } from '../authorization-response'
import SIOPErrors from '../types/Errors'

import { getCreateJwtCallback, getVerifyJwtCallback } from './DidJwtTestUtils'
import { getResolver } from './ResolverTestUtils'
import { mockedGetEnterpriseAuthToken, WELL_KNOWN_OPENID_FEDERATION } from './TestUtils'
import { mockedGetEnterpriseAuthToken, pexHasher, WELL_KNOWN_OPENID_FEDERATION } from './TestUtils'
import {
UNIT_TEST_TIMEOUT,
VERIFIER_LOGO_FOR_CLIENT,
Expand Down Expand Up @@ -90,6 +91,7 @@ describe('create JWT from Request JWT should', () => {

const resolver = getResolver('ethr')
const verifyOpts: VerifyAuthorizationRequestOpts = {
hasher: pexHasher,
verifyJwtCallback: getVerifyJwtCallback(resolver),
verification: {},
supportedVersions: [SupportedVersion.SIOPv2_ID1],
Expand Down Expand Up @@ -650,4 +652,143 @@ describe('create JWT from Request JWT should', () => {
const authResponse = AuthorizationResponse.fromRequestObject(jwt, responseOpts, verifyOpts)
await expect(authResponse).toBeDefined()
})

it('succeed when valid JWT with DCQL query is passed in', async () => {
expect.assertions(1)

const mockReqEntity = await mockedGetEnterpriseAuthToken('REQ COMPANY')
const mockResEntity = await mockedGetEnterpriseAuthToken('RES COMPANY')

const dcqlQuery: DcqlQuery = {
credentials: [
{
id: 'Credentials',
format: 'vc+sd-jwt',
claims: [
{
path: ['given_name'],
values: ['John'],
},
],
},
],
}

const dcqlParsedQuery = DcqlQuery.parse(dcqlQuery)
DcqlQuery.validate(dcqlParsedQuery)

const requestOpts: CreateAuthorizationRequestOpts = {
version: SupportedVersion.SIOPv2_D12_OID4VP_D20,
requestObject: {
passBy: PassBy.REFERENCE,
reference_uri: 'https://my-request.com/here',
jwtIssuer: { method: 'did', didUrl: mockReqEntity.did, alg: SigningAlgo.ES256K },
createJwtCallback: getCreateJwtCallback({
hexPrivateKey: mockReqEntity.hexPrivateKey,
did: mockReqEntity.did,
kid: `${mockReqEntity.did}#controller`,
alg: SigningAlgo.ES256K,
}),
payload: {
client_id: WELL_KNOWN_OPENID_FEDERATION,
scope: 'test',
response_type: 'id_token vp_token',
redirect_uri: EXAMPLE_REDIRECT_URL,
dcql_query: JSON.stringify(dcqlParsedQuery),
},
},
clientMetadata: {
client_id: WELL_KNOWN_OPENID_FEDERATION,
idTokenSigningAlgValuesSupported: [SigningAlgo.EDDSA, SigningAlgo.ES256],
subject_syntax_types_supported: ['did:ethr:', SubjectIdentifierType.DID],
requestObjectSigningAlgValuesSupported: [SigningAlgo.EDDSA, SigningAlgo.ES256],
responseTypesSupported: [ResponseType.ID_TOKEN],
scopesSupported: [Scope.OPENID_DIDAUTHN, Scope.OPENID],
subjectTypesSupported: [SubjectType.PAIRWISE],
vpFormatsSupported: {
ldp_vc: {
proof_type: [IProofType.EcdsaSecp256k1Signature2019, IProofType.EcdsaSecp256k1Signature2019],
},
},
passBy: PassBy.VALUE,
logo_uri: VERIFIER_LOGO_FOR_CLIENT,
clientName: VERIFIER_NAME_FOR_CLIENT,
'clientName#nl-NL': VERIFIER_NAME_FOR_CLIENT_NL + '2022100315',
clientPurpose: VERIFIERZ_PURPOSE_TO_VERIFY,
'clientPurpose#nl-NL': VERIFI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Tk5OS0xYmQyM2U0OGQ0MGEiLCJiaXJ0aGRhdGUiLCIxOTQwLTAxLTAxIl0~',
decodedPayload: {
header: {
typ: 'vc+sd-jwt',
kid: 'did:jwk:eyJhbGciOiJFUzI1NiIsInVzZSI6InNpZyIsImt0eSI6IkVDIiwiY3J2IjoiUC0yNTYiLCJ4IjoiS0dpc3hvU3h2aW0xa1NIMWJtN2xfRHByR2s3YkdkZEZaWWZtcUpuV2VoSSIsInkiOiJaQ3BWTUVRNHl4cTJVbTdCTjhIT25Gejk3M1A0UTBUdndneXVRX2FiTFVVIn0#0',
alg: 'ES256',
},
payload: {
sub: 'did:jwk:eyJhbGciOiJFUzI1NiIsInVzZSI6InNpZyIsImt0eSI6IkVDIiwiY3J2IjoiUC0yNTYiLCJ4IjoiWFJWQXl5RHBWMmpMNnh6U0JKY3RHem1KZjlQeWFxXzMtTUxreGFhRTA4TSIsInkiOiJCSm9KV3NVa0ZBU2VTY2lxT1l5SVM0Y0ZheU8zaGhBSjVZb2tuOHpTSTFnIn0#0',
iss: 'did:jwk:eyJhbGciOiJFUzI1NiIsInVzZSI6InNpZyIsImt0eSI6IkVDIiwiY3J2IjoiUC0yNTYiLCJ4IjoiS0dpc3hvU3h2aW0xa1NIMWJtN2xfRHByR2s3YkdkZEZaWWZtcUpuV2VoSSIsInkiOiJaQ3BWTUVRNHl4cTJVbTdCTjhIT25Gejk3M1A0UTBUdndneXVRX2FiTFVVIn0#0',
iat: 1734458042,
vct: 'urn:eu.europa.ec.eudi:pid:1',
given_name: 'John',
email: 'johndeo@example.com',
birthdate: '1940-01-01',
phone: '+1-202-555-0101',
address: {
street_address: '123 Main St',
locality: 'Anytown',
region: 'Anystate',
country: 'US',
},
family_name: 'Doe',
},
kb: undefined,
},
}

const vc: DcqlCredential = {
credential_format: 'vc+sd-jwt',
vct: sdjwt.decodedPayload.payload.vct,
claims: sdjwt.decodedPayload.payload,
}

const dcqlQueryResult: DcqlQueryResult = DcqlQuery.query(dcqlQuery, [vc])

const presentation: DcqlPresentation.Output = {}
for (const [key, value] of Object.entries(dcqlQueryResult.credential_matches)) {
if (value.success) {
presentation[key] = sdjwt.compactJwtVc
}
}

const dcqlPresentation = DcqlPresentation.parse(presentation)

const responseOpts: AuthorizationResponseOpts = {
responseURI: EXAMPLE_REDIRECT_URL,
responseURIType: 'redirect_uri',
createJwtCallback: getCreateJwtCallback({
did: mockResEntity.did,
hexPrivateKey: mockResEntity.hexPrivateKey,
kid: `${mockResEntity.did}#controller`,
alg: SigningAlgo.ES256K,
}),
jwtIssuer: { method: 'did', didUrl: `${mockResEntity.did}#controller`, alg: SigningAlgo.ES256K },
dcqlQuery: {
dcqlPresentation
},
responseMode: ResponseMode.DIRECT_POST,
}

const requestObject = await RequestObject.fromOpts(requestOpts)
/* console.log(
sanderPostma marked this conversation as resolved.
Show resolved Hide resolved
JSON.stringify(await AuthenticationResponse.createJWTFromRequestJWT(requestWithJWT.jwt, responseOpts, verifyOpts))
);*/
const jwt = await requestObject.toJwt()
if (!jwt) throw new Error('JWT is undefined')
const authorizationRequest = await AuthorizationResponse.fromRequestObject(jwt, responseOpts, verifyOpts)
expect(authorizationRequest).toBeDefined()
})
})
2 changes: 1 addition & 1 deletion packages/siop-oid4vp/lib/__tests__/IT.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ describe.skip('RP and OP interaction should', () => {
const verifiedAuthReqWithJWT = await op.verifyAuthorizationRequest(parsedAuthReqURI.requestObjectJwt)
expect(verifiedAuthReqWithJWT.issuer).toMatch(rpMockEntity.did)
await expect(op.createAuthorizationResponse(verifiedAuthReqWithJWT, {})).rejects.toThrow(
Error('authentication request expects a verifiable presentation in the response'),
Error('vp_token is present, but no presentation definitions or dcql query provided'),
)

expect(verifiedAuthReqWithJWT.payload?.['registration'].client_name).toEqual(VERIFIER_NAME_FOR_CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,7 @@ describe('presentation exchange manager tests', () => {
const payload = await getPayloadVID1Val()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
;(payload.claims?.vp_token as any).presentation_definition_uri = EXAMPLE_PD_URL
await expect(PresentationExchange.findValidPresentationDefinitions(payload)).rejects.toThrow(
SIOPErrors.REQUEST_CLAIMS_PRESENTATION_DEFINITION_BY_REF_AND_VALUE_NON_EXCLUSIVE,
)
await expect(PresentationExchange.findValidPresentationDefinitions(payload)).rejects.toThrow(SIOPErrors.REQUEST_CLAIMS_PRESENTATION_NON_EXCLUSIVE)
})

it('validatePresentationAgainstDefinition: should pass if provided VP match the PD', async function () {
Expand Down
Loading
Loading