@sphereon/ssi-sdk.siopv2-oid4vp-op-auth 0.33.1-feature.vcdm2.tsup.32 → 0.33.1-next.3
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/agent/DidAuthSiopOpAuthenticator.d.ts +36 -0
- package/dist/agent/DidAuthSiopOpAuthenticator.d.ts.map +1 -0
- package/dist/agent/DidAuthSiopOpAuthenticator.js +392 -0
- package/dist/agent/DidAuthSiopOpAuthenticator.js.map +1 -0
- package/dist/index.d.ts +8 -555
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -2420
- package/dist/index.js.map +1 -1
- package/dist/link-handler/index.d.ts +22 -0
- package/dist/link-handler/index.d.ts.map +1 -0
- package/dist/link-handler/index.js +57 -0
- package/dist/link-handler/index.js.map +1 -0
- package/dist/localization/Localization.d.ts +9 -0
- package/dist/localization/Localization.d.ts.map +1 -0
- package/dist/localization/Localization.js +46 -0
- package/dist/localization/Localization.js.map +1 -0
- package/dist/localization/translations/en.json +9 -0
- package/dist/localization/translations/nl.json +8 -0
- package/dist/machine/CallbackStateListener.d.ts +3 -0
- package/dist/machine/CallbackStateListener.d.ts.map +1 -0
- package/dist/machine/CallbackStateListener.js +48 -0
- package/dist/machine/CallbackStateListener.js.map +1 -0
- package/dist/machine/Siopv2Machine.d.ts +8 -0
- package/dist/machine/Siopv2Machine.d.ts.map +1 -0
- package/dist/machine/Siopv2Machine.js +364 -0
- package/dist/machine/Siopv2Machine.js.map +1 -0
- package/dist/services/IdentifierService.d.ts +3 -0
- package/dist/services/IdentifierService.d.ts.map +1 -0
- package/dist/services/IdentifierService.js +28 -0
- package/dist/services/IdentifierService.js.map +1 -0
- package/dist/services/Siopv2MachineService.d.ts +18 -0
- package/dist/services/Siopv2MachineService.d.ts.map +1 -0
- package/dist/services/Siopv2MachineService.js +299 -0
- package/dist/services/Siopv2MachineService.js.map +1 -0
- package/dist/session/OID4VP.d.ts +72 -0
- package/dist/session/OID4VP.d.ts.map +1 -0
- package/dist/session/OID4VP.js +224 -0
- package/dist/session/OID4VP.js.map +1 -0
- package/dist/session/OpSession.d.ts +39 -0
- package/dist/session/OpSession.d.ts.map +1 -0
- package/dist/session/OpSession.js +365 -0
- package/dist/session/OpSession.js.map +1 -0
- package/dist/session/functions.d.ts +37 -0
- package/dist/session/functions.d.ts.map +1 -0
- package/dist/session/functions.js +163 -0
- package/dist/session/functions.js.map +1 -0
- package/dist/session/index.d.ts +4 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +20 -0
- package/dist/session/index.js.map +1 -0
- package/dist/types/IDidAuthSiopOpAuthenticator.d.ts +120 -0
- package/dist/types/IDidAuthSiopOpAuthenticator.d.ts.map +1 -0
- package/dist/types/IDidAuthSiopOpAuthenticator.js +10 -0
- package/dist/types/IDidAuthSiopOpAuthenticator.js.map +1 -0
- package/dist/types/error/index.d.ts +8 -0
- package/dist/types/error/index.d.ts.map +1 -0
- package/dist/types/error/index.js +3 -0
- package/dist/types/error/index.js.map +1 -0
- package/dist/types/identifier/index.d.ts +53 -0
- package/dist/types/identifier/index.d.ts.map +1 -0
- package/dist/types/identifier/index.js +5 -0
- package/dist/types/identifier/index.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +22 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/machine/index.d.ts +124 -0
- package/dist/types/machine/index.d.ts.map +1 -0
- package/dist/types/machine/index.js +57 -0
- package/dist/types/machine/index.js.map +1 -0
- package/dist/types/siop-service/index.d.ts +80 -0
- package/dist/types/siop-service/index.d.ts.map +1 -0
- package/dist/types/siop-service/index.js +14 -0
- package/dist/types/siop-service/index.js.map +1 -0
- package/dist/utils/CredentialUtils.d.ts +23 -0
- package/dist/utils/CredentialUtils.d.ts.map +1 -0
- package/dist/utils/CredentialUtils.js +65 -0
- package/dist/utils/CredentialUtils.js.map +1 -0
- package/dist/utils/dcql.d.ts +5 -0
- package/dist/utils/dcql.d.ts.map +1 -0
- package/dist/utils/dcql.js +37 -0
- package/dist/utils/dcql.js.map +1 -0
- package/package.json +30 -41
- package/src/agent/DidAuthSiopOpAuthenticator.ts +14 -13
- package/src/session/OpSession.ts +13 -13
- package/dist/index.cjs +0 -2451
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -559
package/src/session/OpSession.ts
CHANGED
|
@@ -27,14 +27,14 @@ import {
|
|
|
27
27
|
W3CVerifiablePresentation,
|
|
28
28
|
} from '@sphereon/ssi-types'
|
|
29
29
|
import { IIdentifier, IVerifyResult, TKeyType } from '@veramo/core'
|
|
30
|
+
import Debug from 'debug'
|
|
30
31
|
import { v4 } from 'uuid'
|
|
31
32
|
import { IOPOptions, IOpSessionArgs, IOpSessionGetOID4VPArgs, IOpsSendSiopAuthorizationResponseArgs, IRequiredContext } from '../types'
|
|
32
33
|
import { createOP } from './functions'
|
|
33
34
|
import { OID4VP } from './OID4VP'
|
|
34
35
|
import { PEX } from '@sphereon/pex'
|
|
35
|
-
import { Loggers } from '@sphereon/ssi-types'
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const debug = Debug(`sphereon:sdk:siop:op-session`)
|
|
38
38
|
|
|
39
39
|
export class OpSession {
|
|
40
40
|
public readonly ts = new Date().getDate()
|
|
@@ -100,9 +100,9 @@ export class OpSession {
|
|
|
100
100
|
public async getSupportedDIDMethods(didPrefix?: boolean): Promise<string[]> {
|
|
101
101
|
const agentMethods = this.getAgentDIDMethodsSupported({ didPrefix })
|
|
102
102
|
let rpMethods = await this.getRPDIDMethodsSupported({ didPrefix, agentMethods })
|
|
103
|
-
|
|
103
|
+
debug(`RP supports subject syntax types: ${JSON.stringify(this.getSubjectSyntaxTypesSupported())}`)
|
|
104
104
|
if (rpMethods.dids.length === 0) {
|
|
105
|
-
|
|
105
|
+
debug(`RP does not support DIDs. Supported: ${JSON.stringify(this.getSubjectSyntaxTypesSupported())}`)
|
|
106
106
|
return []
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -125,7 +125,7 @@ export class OpSession {
|
|
|
125
125
|
|
|
126
126
|
private getAgentDIDMethodsSupported(opts: { didPrefix?: boolean }) {
|
|
127
127
|
const agentMethods = this.options.supportedDIDMethods?.map((method) => convertDidMethod(method, opts.didPrefix))
|
|
128
|
-
|
|
128
|
+
debug(`agent methods: ${JSON.stringify(agentMethods)}`)
|
|
129
129
|
return agentMethods
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -139,17 +139,17 @@ export class OpSession {
|
|
|
139
139
|
let keyType: TKeyType | undefined
|
|
140
140
|
const agentMethods =
|
|
141
141
|
(opts.agentMethods ?? this.getAgentDIDMethodsSupported(opts))?.map((method) => convertDidMethod(method, opts.didPrefix)) ?? []
|
|
142
|
-
|
|
142
|
+
debug(`agent methods supported: ${JSON.stringify(agentMethods)}`)
|
|
143
143
|
const authReq = await this.getAuthorizationRequest()
|
|
144
144
|
const subjectSyntaxTypesSupported = authReq.registrationMetadataPayload?.subject_syntax_types_supported
|
|
145
145
|
?.map((method) => convertDidMethod(method, opts.didPrefix))
|
|
146
146
|
.filter((val) => !val.startsWith('did'))
|
|
147
|
-
|
|
147
|
+
debug(`subject syntax types supported in rp method supported: ${JSON.stringify(subjectSyntaxTypesSupported)}`)
|
|
148
148
|
const aud = await authReq.authorizationRequest.getMergedProperty<string>('aud')
|
|
149
149
|
let rpMethods: string[] = []
|
|
150
150
|
if (aud && aud.startsWith('did:')) {
|
|
151
151
|
const didMethod = convertDidMethod(parseDid(aud).method, opts.didPrefix)
|
|
152
|
-
|
|
152
|
+
debug(`aud did method: ${didMethod}`)
|
|
153
153
|
|
|
154
154
|
// The RP knows our DID, so we can use it to determine the supported DID methods
|
|
155
155
|
// If the aud did:method is not in the supported types, there still is something wrong, unless the RP signals to support all did methods
|
|
@@ -172,7 +172,7 @@ export class OpSession {
|
|
|
172
172
|
(authReq.issuer?.includes('.ebsi.eu') || (await authReq.authorizationRequest.getMergedProperty<string>('client_id'))?.includes('.ebsi.eu'))
|
|
173
173
|
let codecName: string | undefined = undefined
|
|
174
174
|
if (isEBSI && (!aud || !aud.startsWith('http'))) {
|
|
175
|
-
|
|
175
|
+
debug(`EBSI detected, adding did:key to supported DID methods for RP`)
|
|
176
176
|
const didKeyMethod = convertDidMethod('did:key', opts.didPrefix)
|
|
177
177
|
if (!agentMethods?.includes(didKeyMethod)) {
|
|
178
178
|
throw Error(`EBSI detected, but agent did not support did:key. Please reconfigure agent`)
|
|
@@ -187,7 +187,7 @@ export class OpSession {
|
|
|
187
187
|
public async getSupportedIdentifiers(opts?: { createInCaseNoDIDFound?: boolean }): Promise<IIdentifier[]> {
|
|
188
188
|
// todo: we also need to check signature algo
|
|
189
189
|
const methods = await this.getSupportedDIDMethods(true)
|
|
190
|
-
|
|
190
|
+
debug(`supported DID methods (did: prefix = true): ${JSON.stringify(methods)}`)
|
|
191
191
|
if (methods.length === 0) {
|
|
192
192
|
throw Error(`No DID methods are supported`)
|
|
193
193
|
}
|
|
@@ -195,7 +195,7 @@ export class OpSession {
|
|
|
195
195
|
.didManagerFind()
|
|
196
196
|
.then((ids: IIdentifier[]) => ids.filter((id) => methods.includes(id.provider)))
|
|
197
197
|
if (identifiers.length === 0) {
|
|
198
|
-
|
|
198
|
+
debug(`No identifiers available in agent supporting methods ${JSON.stringify(methods)}`)
|
|
199
199
|
if (opts?.createInCaseNoDIDFound !== false) {
|
|
200
200
|
const { codecName, keyType } = await this.getRPDIDMethodsSupported({
|
|
201
201
|
didPrefix: true,
|
|
@@ -205,11 +205,11 @@ export class OpSession {
|
|
|
205
205
|
provider: methods[0],
|
|
206
206
|
options: { codecName, keyType, type: keyType }, // both keyType and type, because not every did provider has the same param
|
|
207
207
|
})
|
|
208
|
-
|
|
208
|
+
debug(`Created a new identifier for the SIOP interaction: ${identifier.did}`)
|
|
209
209
|
identifiers.push(identifier)
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
debug(`supported identifiers: ${JSON.stringify(identifiers.map((id) => id.did))}`)
|
|
213
213
|
return identifiers
|
|
214
214
|
}
|
|
215
215
|
|