@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth 0.34.1-feature.SSISDK.50.98 → 0.34.1-feature.SSISDK.50.type.refactor.148

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth",
3
- "version": "0.34.1-feature.SSISDK.50.98+48bdc676",
3
+ "version": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
4
4
  "source": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -26,22 +26,22 @@
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-feature.SSISDK.45.92",
30
- "@sphereon/did-auth-siop-adapter": "0.19.1-feature.SSISDK.45.92",
31
- "@sphereon/oid4vc-common": "0.19.1-feature.SSISDK.45.92",
29
+ "@sphereon/did-auth-siop": "0.19.1-feature.DIIPv4.106",
30
+ "@sphereon/did-auth-siop-adapter": "0.19.1-feature.DIIPv4.106",
31
+ "@sphereon/oid4vc-common": "0.19.1-feature.DIIPv4.106",
32
32
  "@sphereon/pex": "5.0.0-unstable.28",
33
- "@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.50.98+48bdc676",
34
- "@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.SSISDK.50.98+48bdc676",
35
- "@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-feature.SSISDK.50.98+48bdc676",
36
- "@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.50.98+48bdc676",
37
- "@sphereon/ssi-sdk.credential-validation": "0.34.1-feature.SSISDK.50.98+48bdc676",
38
- "@sphereon/ssi-sdk.kv-store-temp": "0.34.1-feature.SSISDK.50.98+48bdc676",
39
- "@sphereon/ssi-sdk.mdl-mdoc": "0.34.1-feature.SSISDK.50.98+48bdc676",
40
- "@sphereon/ssi-sdk.pd-manager": "0.34.1-feature.SSISDK.50.98+48bdc676",
41
- "@sphereon/ssi-sdk.presentation-exchange": "0.34.1-feature.SSISDK.50.98+48bdc676",
42
- "@sphereon/ssi-sdk.sd-jwt": "0.34.1-feature.SSISDK.50.98+48bdc676",
43
- "@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-feature.SSISDK.50.98+48bdc676",
44
- "@sphereon/ssi-types": "0.34.1-feature.SSISDK.50.98+48bdc676",
33
+ "@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
34
+ "@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
35
+ "@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
36
+ "@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
37
+ "@sphereon/ssi-sdk.credential-validation": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
38
+ "@sphereon/ssi-sdk.kv-store-temp": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
39
+ "@sphereon/ssi-sdk.mdl-mdoc": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
40
+ "@sphereon/ssi-sdk.pd-manager": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
41
+ "@sphereon/ssi-sdk.presentation-exchange": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
42
+ "@sphereon/ssi-sdk.sd-jwt": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
43
+ "@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
44
+ "@sphereon/ssi-types": "0.34.1-feature.SSISDK.50.type.refactor.148+0cea6761",
45
45
  "@sphereon/wellknown-dids-client": "^0.1.3",
46
46
  "@veramo/core": "4.2.0",
47
47
  "@veramo/credential-w3c": "4.2.0",
@@ -84,5 +84,5 @@
84
84
  "OpenID Connect",
85
85
  "Authenticator"
86
86
  ],
87
- "gitHead": "48bdc676bed10bd17c66ed7dfdbd401c54925cbb"
87
+ "gitHead": "0cea6761aeae46ffd2b1d4cb51ce092c24edb192"
88
88
  }
@@ -7,6 +7,9 @@ import {
7
7
  VerifiedAuthorizationResponse,
8
8
  } from '@sphereon/did-auth-siop'
9
9
  import { getAgentResolver } from '@sphereon/ssi-sdk-ext.did-utils'
10
+ import { shaHasher as defaultHasher } from '@sphereon/ssi-sdk.core'
11
+
12
+ import type { ImportDcqlQueryItem } from '@sphereon/ssi-sdk.pd-manager'
10
13
  import {
11
14
  AdditionalClaims,
12
15
  CredentialMapper,
@@ -45,7 +48,6 @@ import {
45
48
  import { RPInstance } from '../RPInstance'
46
49
 
47
50
  import { ISIOPv2RP } from '../types/ISIOPv2RP'
48
- import { shaHasher as defaultHasher } from '@sphereon/ssi-sdk.core'
49
51
 
50
52
  export class SIOPv2RP implements IAgentPlugin {
51
53
  private readonly opts: ISiopv2RPOpts
@@ -227,7 +229,7 @@ export class SIOPv2RP implements IAgentPlugin {
227
229
  rp.get(context).then((rp) =>
228
230
  rp.verifyAuthorizationResponse(authResponse, {
229
231
  correlationId: args.correlationId,
230
- ...(args.dcqlQueryPayload ? { dcqlQuery: args.dcqlQueryPayload.dcqlQuery } : {}),
232
+ ...(args.dcqlQuery ? { dcqlQuery: args.dcqlQuery } : {}),
231
233
  audience: args.audience,
232
234
  }),
233
235
  ),
@@ -235,33 +237,18 @@ export class SIOPv2RP implements IAgentPlugin {
235
237
  }
236
238
 
237
239
  private async siopImportDefinitions(args: ImportDefinitionsArgs, context: IRequiredContext): Promise<void> {
238
- const { definitions, tenantId, version, versionControlMode } = args
240
+ const { importItems, tenantId, version, versionControlMode } = args
239
241
  await Promise.all(
240
- definitions.map(async (definitionPair) => {
241
- const definitionPayload = definitionPair.definitionPayload
242
- if (!definitionPayload && !definitionPair.dcqlPayload) {
243
- return Promise.reject(Error('Either dcqlPayload or definitionPayload must be suppplied'))
244
- }
245
-
246
- let definitionId: string
247
- if (definitionPair.dcqlPayload) {
248
- DcqlQuery.validate(definitionPair.dcqlPayload.dcqlQuery)
249
- console.log(`persisting DCQL definition ${definitionPair.dcqlPayload.queryId} with versionControlMode ${versionControlMode}`)
250
- definitionId = definitionPair.dcqlPayload.queryId
251
- }
252
- if (definitionPayload) {
253
- await context.agent.pexValidateDefinition({ definition: definitionPayload })
254
- console.log(`persisting PEX definition ${definitionPayload.id} / ${definitionPayload.name} with versionControlMode ${versionControlMode}`)
255
- definitionId = definitionPayload.id
256
- }
242
+ importItems.map(async (importItem: ImportDcqlQueryItem) => {
243
+ DcqlQuery.validate(importItem.dcqlQuery)
244
+ console.log(`persisting DCQL definition ${importItem.queryId} with versionControlMode ${versionControlMode}`)
257
245
 
258
246
  return context.agent.pdmPersistDefinition({
259
247
  definitionItem: {
260
- definitionId: definitionId!,
248
+ queryId: importItem.queryId!,
261
249
  tenantId: tenantId,
262
250
  version: version,
263
- definitionPayload,
264
- dcqlPayload: definitionPair.dcqlPayload,
251
+ dcqlQuery: importItem.dcqlQuery,
265
252
  },
266
253
  opts: { versionControlMode: versionControlMode },
267
254
  })
package/src/functions.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import {
2
- ClientIdScheme,
3
2
  ClientMetadataOpts,
4
3
  InMemoryRPSessionManager,
5
4
  PassBy,
@@ -28,7 +27,7 @@ import {
28
27
  } from '@sphereon/ssi-sdk-ext.identifier-resolution'
29
28
  import { JwtCompactResult } from '@sphereon/ssi-sdk-ext.jwt-service'
30
29
  import { IVerifySdJwtPresentationResult } from '@sphereon/ssi-sdk.sd-jwt'
31
- import { CredentialMapper, Hasher, OriginalVerifiableCredential, PresentationSubmission } from '@sphereon/ssi-types'
30
+ import { CredentialMapper, HasherSync, OriginalVerifiableCredential, PresentationSubmission } from '@sphereon/ssi-types'
32
31
  import { IVerifyCallbackArgs, IVerifyCredentialResult, VerifyCallback } from '@sphereon/wellknown-dids-client'
33
32
  // import { KeyAlgo, SuppliedSigner } from '@sphereon/ssi-sdk.core'
34
33
  import { TKeyType } from '@veramo/core'
@@ -69,7 +68,6 @@ export function getPresentationVerificationCallback(
69
68
  if (CredentialMapper.isSdJwtEncoded(args)) {
70
69
  const result: IVerifySdJwtPresentationResult = await context.agent.verifySdJwtPresentation({
71
70
  presentation: args,
72
- kb: true,
73
71
  })
74
72
  // fixme: investigate the correct way to handle this
75
73
  return { verified: !!result.payload }
@@ -117,7 +115,7 @@ export async function createRPBuilder(args: {
117
115
  const presentationDefinitionItems = await context.agent.pdmGetDefinitions({
118
116
  filter: [
119
117
  {
120
- definitionId: pexOpts.definitionId,
118
+ queryId: pexOpts.definitionId,
121
119
  version: pexOpts.version,
122
120
  tenantId: pexOpts.tenantId,
123
121
  },
@@ -126,9 +124,8 @@ export async function createRPBuilder(args: {
126
124
 
127
125
  if (presentationDefinitionItems.length > 0) {
128
126
  const presentationDefinitionItem = presentationDefinitionItems[0]
129
- definition = presentationDefinitionItem.definitionPayload
130
127
  if (!dcqlQuery && presentationDefinitionItem.dcqlPayload) {
131
- dcqlQuery = presentationDefinitionItem.dcqlPayload as DcqlQuery // cast from DcqlQueryREST back to valibot DcqlQuery
128
+ dcqlQuery = presentationDefinitionItem.dcqlPayload.dcqlQuery as DcqlQuery // cast from DcqlQueryREST back to valibot DcqlQuery
132
129
  }
133
130
  }
134
131
  }
@@ -161,7 +158,7 @@ export async function createRPBuilder(args: {
161
158
  uniresolverResolution: rpOpts.identifierOpts.resolveOpts?.noUniversalResolverFallback !== true,
162
159
  })
163
160
  //todo: probably wise to first look and see if we actually need the hasher to begin with
164
- let hasher: Hasher | undefined = rpOpts.credentialOpts?.hasher
161
+ let hasher: HasherSync | undefined = rpOpts.credentialOpts?.hasher
165
162
  if (!rpOpts.credentialOpts?.hasher || typeof rpOpts.credentialOpts?.hasher !== 'function') {
166
163
  hasher = defaultHasher
167
164
  }
@@ -197,18 +194,13 @@ export async function createRPBuilder(args: {
197
194
 
198
195
  const oidfOpts = identifierOpts.oidfOpts
199
196
  if (oidfOpts && isExternalIdentifierOIDFEntityIdOpts(oidfOpts)) {
200
- builder.withEntityId(oidfOpts.identifier, PropertyTarget.REQUEST_OBJECT).withClientIdScheme('entity_id', PropertyTarget.REQUEST_OBJECT)
197
+ builder.withEntityId(oidfOpts.identifier, PropertyTarget.REQUEST_OBJECT)
201
198
  } else {
202
199
  const resolution = await context.agent.identifierManagedGet(identifierOpts.idOpts)
203
- builder
204
- .withClientId(
205
- resolution.issuer ?? (isManagedIdentifierDidResult(resolution) ? resolution.did : resolution.jwkThumbprint),
206
- PropertyTarget.REQUEST_OBJECT,
207
- )
208
- .withClientIdScheme(
209
- (resolution.clientIdScheme as ClientIdScheme) ?? (identifierOpts.idOpts.clientIdScheme as ClientIdScheme),
210
- PropertyTarget.REQUEST_OBJECT,
211
- )
200
+ builder.withClientId(
201
+ resolution.issuer ?? (isManagedIdentifierDidResult(resolution) ? resolution.did : resolution.jwkThumbprint),
202
+ PropertyTarget.REQUEST_OBJECT,
203
+ )
212
204
  }
213
205
 
214
206
  if (hasher) {
@@ -222,9 +214,6 @@ export async function createRPBuilder(args: {
222
214
  //fixme: this has been removed in the new version of did-auth-siop
223
215
  // builder.withWellknownDIDVerifyCallback(getWellKnownDIDVerifyCallback(didOpts, context))
224
216
 
225
- if (definition) {
226
- builder.withPresentationDefinition({ definition }, PropertyTarget.REQUEST_OBJECT)
227
- }
228
217
  if (dcqlQuery) {
229
218
  builder.withDcqlQuery(dcqlQuery)
230
219
  }
@@ -23,13 +23,14 @@ import { ExternalIdentifierOIDFEntityIdOpts, IIdentifierResolution, ManagedIdent
23
23
  import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service'
24
24
  import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation'
25
25
  import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc'
26
- import { IPDManager, VersionControlMode } from '@sphereon/ssi-sdk.pd-manager'
26
+ import { IPDManager, VersionControlMode, ImportDcqlQueryItem } from '@sphereon/ssi-sdk.pd-manager'
27
27
  import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange'
28
28
  import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt'
29
29
  import { AuthorizationRequestStateStatus } from '@sphereon/ssi-sdk.siopv2-oid4vp-common'
30
- import { AdditionalClaims, DcqlQueryPayload, HasherSync } from '@sphereon/ssi-types'
30
+ import { AdditionalClaims, HasherSync } from '@sphereon/ssi-types'
31
31
  import { VerifyCallback } from '@sphereon/wellknown-dids-client'
32
32
  import { IAgentContext, ICredentialIssuer, ICredentialVerifier, IDIDManager, IKeyManager, IPluginMethodMap, IResolver } from '@veramo/core'
33
+ import { DcqlQuery } from 'dcql'
33
34
 
34
35
  import { Resolvable } from 'did-resolver'
35
36
  import { EventEmitter } from 'events'
@@ -107,16 +108,10 @@ export interface IVerifyAuthResponseStateArgs {
107
108
  definitionId?: string
108
109
  correlationId: string
109
110
  audience?: string
110
- dcqlQueryPayload?: DcqlQueryPayload
111
+ dcqlQuery?: DcqlQuery
111
112
  }
112
-
113
- export interface IDefinitionPair {
114
- definitionPayload?: IPresentationDefinition
115
- dcqlPayload?: DcqlQueryPayload
116
- }
117
-
118
113
  export interface ImportDefinitionsArgs {
119
- definitions: Array<IDefinitionPair>
114
+ importItems: Array<ImportDcqlQueryItem>
120
115
  tenantId?: string
121
116
  version?: string
122
117
  versionControlMode?: VersionControlMode