@sphereon/ssi-sdk.siopv2-oid4vp-op-auth 0.34.1-next.3 → 0.34.1-next.323
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 +647 -1070
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +723 -118
- package/dist/index.d.ts +723 -118
- package/dist/index.js +607 -1030
- package/dist/index.js.map +1 -1
- package/package.json +24 -24
- package/src/agent/DidAuthSiopOpAuthenticator.ts +10 -145
- package/src/index.ts +2 -1
- package/src/machine/Siopv2Machine.ts +5 -5
- package/src/services/Siopv2MachineService.ts +140 -267
- package/src/session/OID4VP.ts +151 -292
- package/src/session/OpSession.ts +11 -119
- package/src/session/functions.ts +1 -8
- package/src/types/IDidAuthSiopOpAuthenticator.ts +6 -59
- package/src/types/identifier/index.ts +0 -4
- package/src/types/machine/index.ts +1 -1
- package/src/types/siop-service/index.ts +12 -10
- package/src/utils/CredentialUtils.ts +2 -40
- package/src/utils/dcql.ts +26 -19
package/src/session/OID4VP.ts
CHANGED
|
@@ -1,322 +1,181 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { PartialSdJwtKbJwt } from '@sphereon/pex/dist/main/lib/index.js'
|
|
2
|
+
import { calculateSdHash } from '@sphereon/pex/dist/main/lib/utils/index.js'
|
|
3
|
+
import { isManagedIdentifierDidResult, ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'
|
|
4
|
+
import { UniqueDigitalCredential } from '@sphereon/ssi-sdk.credential-store'
|
|
5
|
+
import { defaultGenerateDigest } from '@sphereon/ssi-sdk.sd-jwt'
|
|
4
6
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
private readonly session: OpSession
|
|
26
|
-
private readonly allIdentifiers: string[]
|
|
27
|
-
private readonly hasher?: HasherSync
|
|
28
|
-
|
|
29
|
-
private constructor(args: IOID4VPArgs) {
|
|
30
|
-
const { session, allIdentifiers, hasher = defaultHasher } = args
|
|
31
|
-
|
|
32
|
-
this.session = session
|
|
33
|
-
this.allIdentifiers = allIdentifiers ?? []
|
|
34
|
-
this.hasher = hasher
|
|
35
|
-
}
|
|
7
|
+
CredentialMapper,
|
|
8
|
+
DocumentFormat,
|
|
9
|
+
HasherSync,
|
|
10
|
+
Loggers,
|
|
11
|
+
OriginalVerifiableCredential,
|
|
12
|
+
SdJwtDecodedVerifiableCredential,
|
|
13
|
+
WrappedVerifiableCredential,
|
|
14
|
+
} from '@sphereon/ssi-types'
|
|
15
|
+
import { LOGGER_NAMESPACE, RequiredContext } from '../types'
|
|
16
|
+
|
|
17
|
+
const CLOCK_SKEW = 120
|
|
18
|
+
const logger = Loggers.DEFAULT.get(LOGGER_NAMESPACE)
|
|
19
|
+
|
|
20
|
+
export interface PresentationBuilderContext {
|
|
21
|
+
nonce: string
|
|
22
|
+
audience: string // clientId or origin
|
|
23
|
+
agent: RequiredContext['agent']
|
|
24
|
+
clockSkew?: number
|
|
25
|
+
hasher?: HasherSync
|
|
26
|
+
}
|
|
36
27
|
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Extracts the original credential from a UniqueDigitalCredential or WrappedVerifiableCredential
|
|
30
|
+
*/
|
|
31
|
+
function extractOriginalCredential(
|
|
32
|
+
credential: UniqueDigitalCredential | WrappedVerifiableCredential | OriginalVerifiableCredential,
|
|
33
|
+
): OriginalVerifiableCredential {
|
|
34
|
+
if (typeof credential === 'string') {
|
|
35
|
+
return credential
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
if ('digitalCredential' in credential) {
|
|
39
|
+
// UniqueDigitalCredential
|
|
40
|
+
const udc = credential as UniqueDigitalCredential
|
|
41
|
+
if (udc.originalVerifiableCredential) {
|
|
42
|
+
return udc.originalVerifiableCredential
|
|
45
43
|
}
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private getPresentationExchange(args: IGetPresentationExchangeArgs): PresentationExchange {
|
|
50
|
-
const { verifiableCredentials, allIdentifiers, hasher } = args
|
|
51
|
-
|
|
52
|
-
return new PresentationExchange({
|
|
53
|
-
allDIDs: allIdentifiers ?? this.allIdentifiers,
|
|
54
|
-
allVerifiableCredentials: verifiableCredentials,
|
|
55
|
-
hasher: hasher ?? this.hasher,
|
|
56
|
-
})
|
|
44
|
+
return udc.uniformVerifiableCredential as OriginalVerifiableCredential
|
|
57
45
|
}
|
|
58
46
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
opts?: {
|
|
63
|
-
forceNoCredentialsInVP?: boolean // Allow to create a VP without credentials, like EBSI is using it. Defaults to false
|
|
64
|
-
restrictToFormats?: Format
|
|
65
|
-
restrictToDIDMethods?: string[]
|
|
66
|
-
proofOpts?: ProofOptions
|
|
67
|
-
idOpts?: ManagedIdentifierOptsOrResult
|
|
68
|
-
skipDidResolution?: boolean
|
|
69
|
-
holderDID?: string
|
|
70
|
-
subjectIsHolder?: boolean
|
|
71
|
-
hasher?: HasherSync
|
|
72
|
-
applyFilter?: boolean
|
|
73
|
-
},
|
|
74
|
-
): Promise<VerifiablePresentationWithDefinition[]> {
|
|
75
|
-
return await Promise.all(credentialsWithDefinitions.map((cred) => this.createVerifiablePresentation(credentialRole, cred, opts)))
|
|
47
|
+
if ('original' in credential) {
|
|
48
|
+
// WrappedVerifiableCredential
|
|
49
|
+
return credential.original
|
|
76
50
|
}
|
|
77
51
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
opts?: {
|
|
82
|
-
forceNoCredentialsInVP?: boolean // Allow to create a VP without credentials, like EBSI is using it. Defaults to false
|
|
83
|
-
restrictToFormats?: Format
|
|
84
|
-
restrictToDIDMethods?: string[]
|
|
85
|
-
proofOpts?: ProofOptions
|
|
86
|
-
idOpts?: ManagedIdentifierOptsOrResult
|
|
87
|
-
skipDidResolution?: boolean
|
|
88
|
-
holder?: string
|
|
89
|
-
subjectIsHolder?: boolean
|
|
90
|
-
applyFilter?: boolean
|
|
91
|
-
hasher?: HasherSync
|
|
92
|
-
},
|
|
93
|
-
): Promise<VerifiablePresentationWithDefinition> {
|
|
94
|
-
const { subjectIsHolder, holder, forceNoCredentialsInVP = false } = { ...opts }
|
|
95
|
-
if (subjectIsHolder && holder) {
|
|
96
|
-
throw Error('Cannot both have subject is holder and a holderDID value at the same time (programming error)')
|
|
97
|
-
}
|
|
98
|
-
if (forceNoCredentialsInVP) {
|
|
99
|
-
selectedVerifiableCredentials.credentials = []
|
|
100
|
-
} else if (!selectedVerifiableCredentials?.credentials || selectedVerifiableCredentials.credentials.length === 0) {
|
|
101
|
-
throw Error('No verifiable verifiableCredentials provided for presentation definition')
|
|
102
|
-
}
|
|
52
|
+
// Already an OriginalVerifiableCredential
|
|
53
|
+
return credential as OriginalVerifiableCredential
|
|
54
|
+
}
|
|
103
55
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Gets the issuer/holder identifier from ManagedIdentifierOptsOrResult
|
|
58
|
+
*/
|
|
59
|
+
function getIdentifierString(identifier: ManagedIdentifierOptsOrResult): string {
|
|
60
|
+
// Check if it's a result type (has 'method' and 'opts' properties)
|
|
61
|
+
if ('opts' in identifier && 'method' in identifier) {
|
|
62
|
+
// It's a ManagedIdentifierResult
|
|
63
|
+
if (isManagedIdentifierDidResult(identifier)) {
|
|
64
|
+
return identifier.did
|
|
108
65
|
}
|
|
66
|
+
}
|
|
67
|
+
// For opts types or other result types, use issuer if available, otherwise kid
|
|
68
|
+
return identifier.issuer ?? identifier.kid ?? ''
|
|
69
|
+
}
|
|
109
70
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
? firstVC.credentialSubject[0].id
|
|
144
|
-
: firstVC.credentialSubject.id
|
|
145
|
-
if (holder) {
|
|
146
|
-
idOpts = { identifier: holder }
|
|
147
|
-
}
|
|
148
|
-
*/
|
|
149
|
-
} else if (opts?.holder) {
|
|
150
|
-
idOpts = { identifier: opts.holder }
|
|
71
|
+
/**
|
|
72
|
+
* Creates a Verifiable Presentation for a given credential in the appropriate format
|
|
73
|
+
* Ensures nonce/aud (or challenge/domain) are set according to OID4VP draft 28
|
|
74
|
+
*/
|
|
75
|
+
export async function createVerifiablePresentationForFormat(
|
|
76
|
+
credential: UniqueDigitalCredential | WrappedVerifiableCredential | OriginalVerifiableCredential,
|
|
77
|
+
identifier: ManagedIdentifierOptsOrResult,
|
|
78
|
+
context: PresentationBuilderContext,
|
|
79
|
+
): Promise<string | object> {
|
|
80
|
+
// FIXME find proper types
|
|
81
|
+
const { nonce, audience, agent, clockSkew = CLOCK_SKEW } = context
|
|
82
|
+
|
|
83
|
+
const originalCredential = extractOriginalCredential(credential)
|
|
84
|
+
const documentFormat = CredentialMapper.detectDocumentType(originalCredential)
|
|
85
|
+
|
|
86
|
+
logger.debug(`Creating VP for format: ${documentFormat}`)
|
|
87
|
+
|
|
88
|
+
switch (documentFormat) {
|
|
89
|
+
case DocumentFormat.SD_JWT_VC: {
|
|
90
|
+
// SD-JWT with KB-JWT
|
|
91
|
+
const decodedSdJwt = await CredentialMapper.decodeSdJwtVcAsync(
|
|
92
|
+
typeof originalCredential === 'string' ? originalCredential : (originalCredential as SdJwtDecodedVerifiableCredential).compactSdJwtVc,
|
|
93
|
+
defaultGenerateDigest,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
const hashAlg = decodedSdJwt.signedPayload._sd_alg ?? 'sha-256'
|
|
97
|
+
const sdHash = calculateSdHash(decodedSdJwt.compactSdJwtVc, hashAlg, defaultGenerateDigest)
|
|
98
|
+
|
|
99
|
+
const kbJwtPayload: PartialSdJwtKbJwt['payload'] = {
|
|
100
|
+
iat: Math.floor(Date.now() / 1000 - clockSkew),
|
|
101
|
+
sd_hash: sdHash,
|
|
102
|
+
nonce, // Always use the Authorization Request nonce
|
|
103
|
+
aud: audience, // Always use the Client Identifier or Origin
|
|
151
104
|
}
|
|
152
|
-
}
|
|
153
105
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
restrictToDIDMethods: opts?.restrictToDIDMethods,
|
|
161
|
-
filterOpts: {
|
|
162
|
-
verifiableCredentials: selectedVerifiableCredentials.credentials,
|
|
163
|
-
},
|
|
164
|
-
})
|
|
165
|
-
: {
|
|
166
|
-
definition: selectedVerifiableCredentials.definition,
|
|
167
|
-
credentials: selectedVerifiableCredentials.credentials,
|
|
168
|
-
}
|
|
106
|
+
const presentationResult = await agent.createSdJwtPresentation({
|
|
107
|
+
presentation: decodedSdJwt.compactSdJwtVc,
|
|
108
|
+
kb: {
|
|
109
|
+
payload: kbJwtPayload as any, // FIXME
|
|
110
|
+
},
|
|
111
|
+
})
|
|
169
112
|
|
|
170
|
-
|
|
171
|
-
return Promise.reject(Error(`No identifier options present at this point`))
|
|
113
|
+
return presentationResult.presentation
|
|
172
114
|
}
|
|
173
115
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
context: this.session.context,
|
|
178
|
-
domain: proofOptions.domain,
|
|
179
|
-
challenge: proofOptions.challenge,
|
|
180
|
-
format: opts?.restrictToFormats ?? selectedVerifiableCredentials.definition.definition.format,
|
|
181
|
-
skipDidResolution: opts?.skipDidResolution ?? false,
|
|
182
|
-
})
|
|
183
|
-
const identifier: ManagedIdentifierResult = await this.session.context.agent.identifierManagedGet(idOpts)
|
|
184
|
-
const verifiableCredentials = vcs.credentials.map((credential) =>
|
|
185
|
-
typeof credential === 'object' && 'digitalCredential' in credential ? credential.originalVerifiableCredential! : credential,
|
|
186
|
-
)
|
|
187
|
-
const presentationResult = await this.getPresentationExchange({
|
|
188
|
-
verifiableCredentials: verifiableCredentials,
|
|
189
|
-
allIdentifiers: this.allIdentifiers,
|
|
190
|
-
hasher: opts?.hasher,
|
|
191
|
-
}).createVerifiablePresentation(vcs.definition.definition, verifiableCredentials, signCallback, {
|
|
192
|
-
proofOptions,
|
|
193
|
-
// fixme: Update to newer siop-vp to not require dids here. But when Veramo is creating the VP it's still looking at this field to pass into didManagerGet
|
|
194
|
-
...(identifier && isManagedIdentifierDidResult(identifier) && { holderDID: identifier.did }),
|
|
195
|
-
})
|
|
116
|
+
case DocumentFormat.JSONLD: {
|
|
117
|
+
// JSON-LD VC - create JSON-LD VP with challenge and domain in proof
|
|
118
|
+
const vcObject = typeof originalCredential === 'string' ? JSON.parse(originalCredential) : originalCredential
|
|
196
119
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
? verifiablePresentation.proof.jwt
|
|
203
|
-
: verifiablePresentation,
|
|
204
|
-
)
|
|
120
|
+
const vpObject = {
|
|
121
|
+
'@context': ['https://www.w3.org/2018/credentials/v1'],
|
|
122
|
+
type: ['VerifiablePresentation'],
|
|
123
|
+
verifiableCredential: [vcObject],
|
|
124
|
+
}
|
|
205
125
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
126
|
+
// Create JSON-LD VP with proof
|
|
127
|
+
return await agent.createVerifiablePresentation({
|
|
128
|
+
presentation: vpObject,
|
|
129
|
+
proofFormat: 'lds',
|
|
130
|
+
challenge: nonce, // Authorization Request nonce as challenge
|
|
131
|
+
domain: audience, // Client Identifier or Origin as domain
|
|
132
|
+
keyRef: identifier.kmsKeyRef || identifier.kid,
|
|
133
|
+
})
|
|
212
134
|
}
|
|
213
|
-
}
|
|
214
135
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
): Promise<VerifiableCredentialsWithDefinition[]> {
|
|
227
|
-
const defs = await this.getPresentationDefinitions()
|
|
228
|
-
const result: VerifiableCredentialsWithDefinition[] = []
|
|
229
|
-
if (defs) {
|
|
230
|
-
for (const definition of defs) {
|
|
231
|
-
result.push(await this.filterCredentials(credentialRole, definition, opts))
|
|
232
|
-
}
|
|
136
|
+
case DocumentFormat.MSO_MDOC: {
|
|
137
|
+
// ISO mdoc - create mdoc VP token
|
|
138
|
+
// This is a placeholder implementation
|
|
139
|
+
// Full implementation would require:
|
|
140
|
+
// 1. Decode the mdoc using CredentialMapper or mdoc utilities
|
|
141
|
+
// 2. Build proper mdoc VP token with session transcript
|
|
142
|
+
// 3. Include nonce/audience in the session transcript
|
|
143
|
+
logger.warning('mso_mdoc format has basic support - production use requires proper mdoc VP token implementation')
|
|
144
|
+
|
|
145
|
+
return originalCredential
|
|
233
146
|
}
|
|
234
|
-
return result
|
|
235
|
-
}
|
|
236
147
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
148
|
+
default: {
|
|
149
|
+
// JWT VC - create JWT VP with nonce and aud in payload
|
|
150
|
+
const vcJwt = typeof originalCredential === 'string' ? originalCredential : JSON.stringify(originalCredential)
|
|
151
|
+
|
|
152
|
+
const identifierString = getIdentifierString(identifier)
|
|
153
|
+
|
|
154
|
+
// Create VP JWT using agent method
|
|
155
|
+
const vpPayload = {
|
|
156
|
+
iss: identifierString,
|
|
157
|
+
aud: audience, // Client Identifier or Origin
|
|
158
|
+
nonce, // Authorization Request nonce
|
|
159
|
+
vp: {
|
|
160
|
+
'@context': ['https://www.w3.org/2018/credentials/v1'],
|
|
161
|
+
type: ['VerifiablePresentation'],
|
|
162
|
+
holder: identifierString,
|
|
163
|
+
verifiableCredential: [vcJwt],
|
|
164
|
+
},
|
|
165
|
+
iat: Math.floor(Date.now() / 1000 - clockSkew),
|
|
166
|
+
exp: Math.floor(Date.now() / 1000 + 600 + clockSkew), // 10 minutes
|
|
253
167
|
}
|
|
254
|
-
})
|
|
255
168
|
|
|
256
|
-
|
|
257
|
-
await
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
} else {
|
|
264
|
-
return credential
|
|
265
|
-
}
|
|
266
|
-
}),
|
|
267
|
-
},
|
|
169
|
+
// Use the agent's JWT creation capability
|
|
170
|
+
const vpJwt = await agent.createVerifiablePresentation({
|
|
171
|
+
presentation: vpPayload.vp,
|
|
172
|
+
proofFormat: 'jwt',
|
|
173
|
+
domain: audience,
|
|
174
|
+
challenge: nonce,
|
|
175
|
+
keyRef: identifier.kmsKeyRef || identifier.kid,
|
|
268
176
|
})
|
|
269
|
-
).verifiableCredential
|
|
270
|
-
return {
|
|
271
|
-
definition: presentationDefinition,
|
|
272
|
-
credentials: credentials?.map((vc) => udcMap.get(vc)!) ?? [],
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
public async filterCredentialsWithSelectionStatus(
|
|
277
|
-
credentialRole: CredentialRole,
|
|
278
|
-
presentationDefinition: PresentationDefinitionWithLocation,
|
|
279
|
-
opts?: {
|
|
280
|
-
filterOpts?: { verifiableCredentials?: OriginalVerifiableCredential[]; filter?: FindDigitalCredentialArgs }
|
|
281
|
-
holderDIDs?: string[]
|
|
282
|
-
restrictToFormats?: Format
|
|
283
|
-
restrictToDIDMethods?: string[]
|
|
284
|
-
},
|
|
285
|
-
): Promise<SelectResults> {
|
|
286
|
-
const selectionResults: SelectResults = await this.getPresentationExchange({
|
|
287
|
-
verifiableCredentials: await this.getCredentials(credentialRole, opts?.filterOpts),
|
|
288
|
-
}).selectVerifiableCredentialsForSubmission(presentationDefinition.definition, opts)
|
|
289
|
-
if (selectionResults.errors && selectionResults.errors.length > 0) {
|
|
290
|
-
throw Error(JSON.stringify(selectionResults.errors))
|
|
291
|
-
} else if (selectionResults.areRequiredCredentialsPresent === Status.ERROR) {
|
|
292
|
-
throw Error(`Not all required credentials are available to satisfy the relying party's request`)
|
|
293
|
-
}
|
|
294
177
|
|
|
295
|
-
|
|
296
|
-
if (!matches || matches.length === 0 || !selectionResults.verifiableCredential || selectionResults.verifiableCredential.length === 0) {
|
|
297
|
-
throw Error(JSON.stringify(selectionResults.errors))
|
|
178
|
+
return vpJwt.proof?.jwt || vpJwt
|
|
298
179
|
}
|
|
299
|
-
return selectionResults
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
private async getCredentials(
|
|
303
|
-
credentialRole: CredentialRole,
|
|
304
|
-
filterOpts?: {
|
|
305
|
-
verifiableCredentials?: OriginalVerifiableCredential[]
|
|
306
|
-
filter?: FindDigitalCredentialArgs
|
|
307
|
-
},
|
|
308
|
-
): Promise<OriginalVerifiableCredential[]> {
|
|
309
|
-
if (filterOpts?.verifiableCredentials && filterOpts.verifiableCredentials.length > 0) {
|
|
310
|
-
return filterOpts.verifiableCredentials
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const filter = verifiableCredentialForRoleFilter(credentialRole, filterOpts?.filter)
|
|
314
|
-
const uniqueCredentials = await this.session.context.agent.crsGetUniqueCredentials({ filter })
|
|
315
|
-
return uniqueCredentials.map((uniqueVC: UniqueDigitalCredential) => {
|
|
316
|
-
const vc = uniqueVC.uniformVerifiableCredential!
|
|
317
|
-
const proof = Array.isArray(vc.proof) ? vc.proof : [vc.proof]
|
|
318
|
-
const jwtProof = proof.find((p: IProof) => p?.type === DEFAULT_JWT_PROOF_TYPE)
|
|
319
|
-
return jwtProof ? (jwtProof.jwt as CompactJWT) : vc
|
|
320
|
-
})
|
|
321
180
|
}
|
|
322
181
|
}
|