@sphereon/ssi-sdk.siopv2-oid4vp-op-auth 0.34.1-feat.SSISDK.35.64 → 0.34.1-feature.DIIPv4.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1086 -563
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +111 -709
- package/dist/index.d.ts +111 -709
- package/dist/index.js +1041 -518
- package/dist/index.js.map +1 -1
- package/package.json +25 -24
- package/src/agent/DidAuthSiopOpAuthenticator.ts +136 -18
- package/src/index.ts +1 -2
- package/src/machine/Siopv2Machine.ts +4 -4
- package/src/services/Siopv2MachineService.ts +203 -97
- package/src/session/OID4VP.ts +299 -310
- package/src/session/OpSession.ts +114 -22
- package/src/types/IDidAuthSiopOpAuthenticator.ts +58 -5
- package/src/types/identifier/index.ts +4 -0
- package/src/types/siop-service/index.ts +3 -1
- package/src/utils/CredentialUtils.ts +39 -1
- package/src/utils/dcql.ts +19 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.siopv2-oid4vp-op-auth",
|
|
3
|
-
"version": "0.34.1-
|
|
3
|
+
"version": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,30 +26,31 @@
|
|
|
26
26
|
"build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@sphereon/did-auth-siop": "0.19.1-
|
|
30
|
-
"@sphereon/did-auth-siop-adapter": "0.19.1-
|
|
31
|
-
"@sphereon/oid4vc-common": "0.19.1-
|
|
29
|
+
"@sphereon/did-auth-siop": "0.19.1-next.2",
|
|
30
|
+
"@sphereon/did-auth-siop-adapter": "0.19.1-next.2",
|
|
31
|
+
"@sphereon/oid4vc-common": "0.19.1-next.2",
|
|
32
|
+
"@sphereon/pex": "5.0.0-unstable.28",
|
|
32
33
|
"@sphereon/pex-models": "^2.3.2",
|
|
33
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-
|
|
34
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-
|
|
35
|
-
"@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-
|
|
36
|
-
"@sphereon/ssi-sdk.contact-manager": "0.34.1-
|
|
37
|
-
"@sphereon/ssi-sdk.core": "0.34.1-
|
|
38
|
-
"@sphereon/ssi-sdk.credential-store": "0.34.1-
|
|
39
|
-
"@sphereon/ssi-sdk.credential-validation": "0.34.1-
|
|
40
|
-
"@sphereon/ssi-sdk.data-store": "0.34.1-
|
|
41
|
-
"@sphereon/ssi-sdk.issuance-branding": "0.34.1-
|
|
42
|
-
"@sphereon/ssi-sdk.pd-manager": "0.34.1-
|
|
43
|
-
"@sphereon/ssi-sdk.presentation-exchange": "0.34.1-
|
|
44
|
-
"@sphereon/ssi-sdk.sd-jwt": "0.34.1-
|
|
45
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-
|
|
46
|
-
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.34.1-
|
|
47
|
-
"@sphereon/ssi-types": "0.34.1-
|
|
34
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
35
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
36
|
+
"@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
37
|
+
"@sphereon/ssi-sdk.contact-manager": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
38
|
+
"@sphereon/ssi-sdk.core": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
39
|
+
"@sphereon/ssi-sdk.credential-store": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
40
|
+
"@sphereon/ssi-sdk.credential-validation": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
41
|
+
"@sphereon/ssi-sdk.data-store": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
42
|
+
"@sphereon/ssi-sdk.issuance-branding": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
43
|
+
"@sphereon/ssi-sdk.pd-manager": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
44
|
+
"@sphereon/ssi-sdk.presentation-exchange": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
45
|
+
"@sphereon/ssi-sdk.sd-jwt": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
46
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
47
|
+
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
48
|
+
"@sphereon/ssi-types": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
48
49
|
"@sphereon/wellknown-dids-client": "^0.1.3",
|
|
49
50
|
"@veramo/core": "4.2.0",
|
|
50
51
|
"@veramo/credential-w3c": "4.2.0",
|
|
51
|
-
"cross-fetch": "^
|
|
52
|
-
"dcql": "
|
|
52
|
+
"cross-fetch": "^3.1.8",
|
|
53
|
+
"dcql": "0.2.19",
|
|
53
54
|
"did-jwt-vc": "3.1.3",
|
|
54
55
|
"i18n-js": "^3.9.2",
|
|
55
56
|
"lodash.memoize": "^4.1.2",
|
|
@@ -58,8 +59,8 @@
|
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@sphereon/did-uni-client": "^0.6.3",
|
|
61
|
-
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.34.1-
|
|
62
|
-
"@sphereon/ssi-sdk.agent-config": "0.34.1-
|
|
62
|
+
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
63
|
+
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.DIIPv4.41+76a5bfab",
|
|
63
64
|
"@types/i18n-js": "^3.8.9",
|
|
64
65
|
"@types/lodash.memoize": "^4.1.9",
|
|
65
66
|
"@types/sha.js": "^2.4.4",
|
|
@@ -101,5 +102,5 @@
|
|
|
101
102
|
"OpenID Connect",
|
|
102
103
|
"Authenticator"
|
|
103
104
|
],
|
|
104
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "76a5bfabd8c8feb79b3ac823f19f5bc91e5bce3e"
|
|
105
106
|
}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
decodeUriAsJson,
|
|
3
|
-
PresentationSignCallback,
|
|
4
|
-
VerifiedAuthorizationRequest } from '@sphereon/did-auth-siop'
|
|
1
|
+
import { decodeUriAsJson, PresentationSignCallback, SupportedVersion, VerifiedAuthorizationRequest } from '@sphereon/did-auth-siop'
|
|
5
2
|
import {
|
|
6
3
|
ConnectionType,
|
|
7
4
|
CorrelationIdentifierType,
|
|
5
|
+
CredentialDocumentFormat,
|
|
8
6
|
CredentialRole,
|
|
7
|
+
DocumentType,
|
|
9
8
|
Identity,
|
|
10
9
|
IdentityOrigin,
|
|
11
10
|
NonPersistedIdentity,
|
|
12
11
|
Party,
|
|
13
12
|
} from '@sphereon/ssi-sdk.data-store'
|
|
14
|
-
import { HasherSync, Loggers } from '@sphereon/ssi-types'
|
|
13
|
+
import { HasherSync, Loggers, SdJwtDecodedVerifiableCredential } from '@sphereon/ssi-types'
|
|
15
14
|
import { IAgentPlugin } from '@veramo/core'
|
|
16
15
|
import { v4 as uuidv4 } from 'uuid'
|
|
16
|
+
|
|
17
17
|
import { OpSession } from '../session'
|
|
18
|
+
import { PEX, Status } from '@sphereon/pex'
|
|
19
|
+
import { computeEntryHash } from '@veramo/utils'
|
|
20
|
+
import { UniqueDigitalCredential } from '@sphereon/ssi-sdk.credential-store'
|
|
18
21
|
import { EventEmitter } from 'events'
|
|
19
22
|
import {
|
|
20
23
|
DidAuthSiopOpAuthenticatorOptions,
|
|
@@ -26,11 +29,14 @@ import {
|
|
|
26
29
|
IRemoveCustomApprovalForSiopArgs,
|
|
27
30
|
IRemoveSiopSessionArgs,
|
|
28
31
|
IRequiredContext,
|
|
32
|
+
Json,
|
|
29
33
|
LOGGER_NAMESPACE,
|
|
30
34
|
RequiredContext,
|
|
31
35
|
SelectableCredentialsMap,
|
|
32
36
|
Siopv2AuthorizationResponseData,
|
|
37
|
+
VerifiableCredentialsWithDefinition,
|
|
33
38
|
} from '../types'
|
|
39
|
+
|
|
34
40
|
import {
|
|
35
41
|
AddIdentityArgs,
|
|
36
42
|
CreateConfigArgs,
|
|
@@ -45,6 +51,7 @@ import {
|
|
|
45
51
|
Siopv2Machine as Siopv2MachineId,
|
|
46
52
|
Siopv2MachineInstanceOpts,
|
|
47
53
|
} from '../types'
|
|
54
|
+
import { DcqlCredential, DcqlPresentation, DcqlQuery, DcqlSdJwtVcCredential } from 'dcql'
|
|
48
55
|
import { Siopv2Machine } from '../machine/Siopv2Machine'
|
|
49
56
|
import { getSelectableCredentials, siopSendAuthorizationResponse, translateCorrelationIdToName } from '../services/Siopv2MachineService'
|
|
50
57
|
import { schema } from '..'
|
|
@@ -92,18 +99,12 @@ export class DidAuthSiopOpAuthenticator implements IAgentPlugin {
|
|
|
92
99
|
private readonly hasher?: HasherSync
|
|
93
100
|
|
|
94
101
|
constructor(options?: DidAuthSiopOpAuthenticatorOptions) {
|
|
95
|
-
const {
|
|
96
|
-
onContactIdentityCreated,
|
|
97
|
-
onIdentifierCreated,
|
|
98
|
-
hasher,
|
|
99
|
-
customApprovals = {},
|
|
100
|
-
presentationSignCallback
|
|
101
|
-
} = { ...options }
|
|
102
|
+
const { onContactIdentityCreated, onIdentifierCreated, hasher, customApprovals = {}, presentationSignCallback } = { ...options }
|
|
102
103
|
|
|
103
104
|
this.hasher = hasher
|
|
104
105
|
this.onContactIdentityCreated = onContactIdentityCreated
|
|
105
106
|
this.onIdentifierCreated = onIdentifierCreated
|
|
106
|
-
this.presentationSignCallback = presentationSignCallback
|
|
107
|
+
this.presentationSignCallback = presentationSignCallback
|
|
107
108
|
this.sessions = new Map<string, OpSession>()
|
|
108
109
|
this.customApprovals = customApprovals
|
|
109
110
|
}
|
|
@@ -233,7 +234,7 @@ export class DidAuthSiopOpAuthenticator implements IAgentPlugin {
|
|
|
233
234
|
: (verifiedAuthorizationRequest.issuer ?? verifiedAuthorizationRequest.registrationMetadataPayload?.client_id))
|
|
234
235
|
const uri: URL | undefined = url.includes('://') ? new URL(url) : undefined
|
|
235
236
|
const correlationId: string = uri?.hostname ?? (await this.determineCorrelationId(uri, verifiedAuthorizationRequest, clientName, context))
|
|
236
|
-
const clientId: string | undefined = verifiedAuthorizationRequest.authorizationRequest.getMergedProperty<string>('client_id')
|
|
237
|
+
const clientId: string | undefined = await verifiedAuthorizationRequest.authorizationRequest.getMergedProperty<string>('client_id')
|
|
237
238
|
|
|
238
239
|
return {
|
|
239
240
|
issuer: verifiedAuthorizationRequest.issuer,
|
|
@@ -242,6 +243,13 @@ export class DidAuthSiopOpAuthenticator implements IAgentPlugin {
|
|
|
242
243
|
uri,
|
|
243
244
|
name: clientName,
|
|
244
245
|
clientId,
|
|
246
|
+
presentationDefinitions:
|
|
247
|
+
(await verifiedAuthorizationRequest.authorizationRequest.containsResponseType('vp_token')) ||
|
|
248
|
+
(verifiedAuthorizationRequest.versions.every((version) => version <= SupportedVersion.JWT_VC_PRESENTATION_PROFILE_v1) &&
|
|
249
|
+
verifiedAuthorizationRequest.presentationDefinitions &&
|
|
250
|
+
verifiedAuthorizationRequest.presentationDefinitions.length > 0)
|
|
251
|
+
? verifiedAuthorizationRequest.presentationDefinitions
|
|
252
|
+
: undefined,
|
|
245
253
|
dcqlQuery: verifiedAuthorizationRequest.dcqlQuery,
|
|
246
254
|
}
|
|
247
255
|
}
|
|
@@ -341,14 +349,87 @@ export class DidAuthSiopOpAuthenticator implements IAgentPlugin {
|
|
|
341
349
|
return Promise.reject(Error('Missing authorization request data in context'))
|
|
342
350
|
}
|
|
343
351
|
|
|
352
|
+
const pex = new PEX({ hasher: this.hasher })
|
|
353
|
+
const verifiableCredentialsWithDefinition: Array<VerifiableCredentialsWithDefinition> = []
|
|
354
|
+
const dcqlCredentialsWithCredentials: Map<DcqlCredential, UniqueDigitalCredential> = new Map()
|
|
355
|
+
|
|
356
|
+
if (Array.isArray(authorizationRequestData.presentationDefinitions) && authorizationRequestData?.presentationDefinitions.length > 0) {
|
|
357
|
+
try {
|
|
358
|
+
authorizationRequestData.presentationDefinitions?.forEach((presentationDefinition) => {
|
|
359
|
+
const { areRequiredCredentialsPresent, verifiableCredential: verifiableCredentials } = pex.selectFrom(
|
|
360
|
+
presentationDefinition.definition,
|
|
361
|
+
selectedCredentials.map((udc) => udc.originalVerifiableCredential!),
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
if (areRequiredCredentialsPresent !== Status.ERROR && verifiableCredentials) {
|
|
365
|
+
let uniqueDigitalCredentials: UniqueDigitalCredential[] = []
|
|
366
|
+
uniqueDigitalCredentials = verifiableCredentials.map((vc) => {
|
|
367
|
+
// @ts-ignore FIXME Funke
|
|
368
|
+
const hash = typeof vc === 'string' ? computeEntryHash(vc.split('~'[0])) : computeEntryHash(vc)
|
|
369
|
+
const udc = selectedCredentials.find((udc) => udc.hash == hash || udc.originalVerifiableCredential == vc)
|
|
370
|
+
|
|
371
|
+
if (!udc) {
|
|
372
|
+
throw Error(
|
|
373
|
+
`UniqueDigitalCredential could not be found in store. Either the credential is not present in the store or the hash is not correct.`,
|
|
374
|
+
)
|
|
375
|
+
}
|
|
376
|
+
return udc
|
|
377
|
+
})
|
|
378
|
+
verifiableCredentialsWithDefinition.push({
|
|
379
|
+
definition: presentationDefinition,
|
|
380
|
+
credentials: uniqueDigitalCredentials,
|
|
381
|
+
})
|
|
382
|
+
}
|
|
383
|
+
})
|
|
384
|
+
} catch (e) {
|
|
385
|
+
return Promise.reject(e)
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (verifiableCredentialsWithDefinition.length === 0) {
|
|
389
|
+
return Promise.reject(Error('None of the selected credentials match any of the presentation definitions.'))
|
|
390
|
+
}
|
|
391
|
+
} else if (authorizationRequestData.dcqlQuery) {
|
|
392
|
+
//TODO Only SD-JWT and MSO MDOC are supported at the moment
|
|
393
|
+
if (this.hasMDocCredentials(selectedCredentials) || this.hasSdJwtCredentials(selectedCredentials)) {
|
|
394
|
+
try {
|
|
395
|
+
selectedCredentials.forEach((vc) => {
|
|
396
|
+
if (this.isSdJwtCredential(vc)) {
|
|
397
|
+
const payload = (vc.originalVerifiableCredential as SdJwtDecodedVerifiableCredential).decodedPayload
|
|
398
|
+
const result: DcqlSdJwtVcCredential = {
|
|
399
|
+
claims: payload as { [x: string]: Json },
|
|
400
|
+
vct: payload.vct,
|
|
401
|
+
credential_format: 'vc+sd-jwt',
|
|
402
|
+
}
|
|
403
|
+
dcqlCredentialsWithCredentials.set(result, vc)
|
|
404
|
+
//FIXME MDoc namespaces are incompatible: array of strings vs complex object - https://sphereon.atlassian.net/browse/SPRIND-143
|
|
405
|
+
} else {
|
|
406
|
+
throw Error(`Invalid credential format: ${vc.digitalCredential.documentFormat}`)
|
|
407
|
+
}
|
|
408
|
+
})
|
|
409
|
+
} catch (e) {
|
|
410
|
+
return Promise.reject(e)
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
const dcqlPresentationRecord: DcqlPresentation.Output = {}
|
|
414
|
+
const queryResult = DcqlQuery.query(authorizationRequestData.dcqlQuery, Array.from(dcqlCredentialsWithCredentials.keys()))
|
|
415
|
+
for (const [key, value] of Object.entries(queryResult.credential_matches)) {
|
|
416
|
+
if (value.success) {
|
|
417
|
+
dcqlPresentationRecord[key] = this.retrieveEncodedCredential(dcqlCredentialsWithCredentials.get(value.output)!) as
|
|
418
|
+
| string
|
|
419
|
+
| { [x: string]: Json }
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
344
425
|
const response = await siopSendAuthorizationResponse(
|
|
345
426
|
ConnectionType.SIOPv2_OpenID4VP,
|
|
346
427
|
{
|
|
347
428
|
sessionId: didAuthConfig.sessionId,
|
|
348
429
|
...(args.idOpts && { idOpts: args.idOpts }),
|
|
430
|
+
...(authorizationRequestData.presentationDefinitions !== undefined && { verifiableCredentialsWithDefinition }),
|
|
349
431
|
isFirstParty,
|
|
350
432
|
hasher: this.hasher,
|
|
351
|
-
credentials: selectedCredentials,
|
|
352
433
|
},
|
|
353
434
|
context,
|
|
354
435
|
)
|
|
@@ -368,13 +449,50 @@ export class DidAuthSiopOpAuthenticator implements IAgentPlugin {
|
|
|
368
449
|
}
|
|
369
450
|
}
|
|
370
451
|
|
|
452
|
+
private hasMDocCredentials = (credentials: UniqueDigitalCredential[]): boolean => {
|
|
453
|
+
return credentials.some(this.isMDocCredential)
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
private isMDocCredential = (credential: UniqueDigitalCredential) => {
|
|
457
|
+
return (
|
|
458
|
+
credential.digitalCredential.documentFormat === CredentialDocumentFormat.MSO_MDOC &&
|
|
459
|
+
credential.digitalCredential.documentType === DocumentType.VC
|
|
460
|
+
)
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
private hasSdJwtCredentials = (credentials: UniqueDigitalCredential[]): boolean => {
|
|
464
|
+
return credentials.some(this.isSdJwtCredential)
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
private isSdJwtCredential = (credential: UniqueDigitalCredential) => {
|
|
468
|
+
return (
|
|
469
|
+
credential.digitalCredential.documentFormat === CredentialDocumentFormat.SD_JWT && credential.digitalCredential.documentType === DocumentType.VC
|
|
470
|
+
)
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
private retrieveEncodedCredential = (credential: UniqueDigitalCredential) => {
|
|
474
|
+
return credential.originalVerifiableCredential !== undefined &&
|
|
475
|
+
credential.originalVerifiableCredential !== null &&
|
|
476
|
+
(credential?.originalVerifiableCredential as SdJwtDecodedVerifiableCredential)?.compactSdJwtVc !== undefined &&
|
|
477
|
+
(credential?.originalVerifiableCredential as SdJwtDecodedVerifiableCredential)?.compactSdJwtVc !== null
|
|
478
|
+
? (credential.originalVerifiableCredential as SdJwtDecodedVerifiableCredential).compactSdJwtVc
|
|
479
|
+
: credential.originalVerifiableCredential
|
|
480
|
+
}
|
|
481
|
+
|
|
371
482
|
private async siopGetSelectableCredentials(args: GetSelectableCredentialsArgs, context: RequiredContext): Promise<SelectableCredentialsMap> {
|
|
372
483
|
const { authorizationRequestData } = args
|
|
373
484
|
|
|
374
|
-
if (
|
|
375
|
-
|
|
485
|
+
if (
|
|
486
|
+
!authorizationRequestData ||
|
|
487
|
+
!authorizationRequestData.presentationDefinitions ||
|
|
488
|
+
authorizationRequestData.presentationDefinitions.length === 0
|
|
489
|
+
) {
|
|
490
|
+
return Promise.reject(Error('Missing required fields in arguments or context'))
|
|
491
|
+
}
|
|
492
|
+
if (authorizationRequestData.presentationDefinitions.length > 1) {
|
|
493
|
+
return Promise.reject(Error('Multiple presentation definitions present'))
|
|
376
494
|
}
|
|
377
495
|
|
|
378
|
-
return getSelectableCredentials(authorizationRequestData
|
|
496
|
+
return getSelectableCredentials(authorizationRequestData.presentationDefinitions[0].definition, context)
|
|
379
497
|
}
|
|
380
498
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @public
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
const schema = require('../plugin.schema.json')
|
|
5
5
|
export { schema }
|
|
6
6
|
export { DidAuthSiopOpAuthenticator, didAuthSiopOpAuthenticatorMethods } from './agent/DidAuthSiopOpAuthenticator'
|
|
7
7
|
export { Siopv2Machine } from './machine/Siopv2Machine'
|
|
@@ -9,4 +9,3 @@ export * from './machine/CallbackStateListener'
|
|
|
9
9
|
export * from './session'
|
|
10
10
|
export * from './types'
|
|
11
11
|
export * from './link-handler'
|
|
12
|
-
export * from './utils/dcql'
|
|
@@ -51,7 +51,7 @@ const Siopv2HasSelectableCredentialsAndContactGuard = (_ctx: Siopv2MachineContex
|
|
|
51
51
|
throw new Error('Missing contact request data in context')
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
return authorizationRequestData.
|
|
54
|
+
return authorizationRequestData.presentationDefinitions !== undefined
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
const Siopv2CreateContactGuard = (_ctx: Siopv2MachineContext, _event: Siopv2MachineEventTypes): boolean => {
|
|
@@ -67,7 +67,7 @@ const Siopv2HasSelectedRequiredCredentialsGuard = (_ctx: Siopv2MachineContext, _
|
|
|
67
67
|
throw new Error('Missing authorization request data in context')
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
if (authorizationRequestData.
|
|
70
|
+
if (authorizationRequestData.presentationDefinitions === undefined || authorizationRequestData.presentationDefinitions.length === 0) {
|
|
71
71
|
throw Error('No presentation definitions present')
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -87,7 +87,7 @@ const Siopv2IsSiopOnlyGuard = (_ctx: Siopv2MachineContext, _event: Siopv2Machine
|
|
|
87
87
|
throw new Error('Missing authorization request data in context')
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
return authorizationRequestData.
|
|
90
|
+
return authorizationRequestData.presentationDefinitions === undefined
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
const Siopv2IsSiopWithOID4VPGuard = (_ctx: Siopv2MachineContext, _event: Siopv2MachineEventTypes): boolean => {
|
|
@@ -101,7 +101,7 @@ const Siopv2IsSiopWithOID4VPGuard = (_ctx: Siopv2MachineContext, _event: Siopv2M
|
|
|
101
101
|
throw new Error('Missing selectableCredentialsMap in context')
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
return authorizationRequestData.
|
|
104
|
+
return authorizationRequestData.presentationDefinitions !== undefined
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
const createSiopv2Machine = (opts: CreateSiopv2MachineOpts): Siopv2StateMachine => {
|