@@ -100,7 +100,7 @@ export class PEX {
100
100
const presentationsCopy : OriginalVerifiablePresentation [ ] = JSON . parse ( JSON . stringify ( presentationsArray ) ) ;
101
101
102
102
const wrappedPresentations : WrappedVerifiablePresentation [ ] = presentationsCopy . map ( ( p ) =>
103
- SSITypesBuilder . mapExternalVerifiablePresentationToWrappedVP ( p , this . options ?. hasher ) ,
103
+ SSITypesBuilder . mapExternalVerifiablePresentationToWrappedVP ( p ) ,
104
104
) ;
105
105
106
106
let presentationSubmission = opts ?. presentationSubmission ;
@@ -189,10 +189,8 @@ export class PEX {
189
189
restrictToDIDMethods ?: string [ ] ;
190
190
} ,
191
191
) : EvaluationResults {
192
- const wrappedVerifiableCredentials : WrappedVerifiableCredential [ ] = SSITypesBuilder . mapExternalVerifiableCredentialsToWrappedVcs (
193
- verifiableCredentials ,
194
- this . options ?. hasher ,
195
- ) ;
192
+ const wrappedVerifiableCredentials : WrappedVerifiableCredential [ ] =
193
+ SSITypesBuilder . mapExternalVerifiableCredentialsToWrappedVcs ( verifiableCredentials ) ;
196
194
197
195
// TODO: So we have state in the form of this property which is set in the constructor, but we are overwriting it here. We need to retrhink how to instantiate PEX
198
196
this . _evaluationClientWrapper = new EvaluationClientWrapper ( ) ;
@@ -234,11 +232,7 @@ export class PEX {
234
232
const pd : IInternalPresentationDefinition = SSITypesBuilder . toInternalPresentationDefinition ( presentationDefinition ) ;
235
233
// TODO: So we have state in the form of this property which is set in the constructor, but we are overwriting it here. We need to retrhink how to instantiate PEX
236
234
this . _evaluationClientWrapper = new EvaluationClientWrapper ( ) ;
237
- return this . _evaluationClientWrapper . selectFrom (
238
- pd ,
239
- SSITypesBuilder . mapExternalVerifiableCredentialsToWrappedVcs ( verifiableCredentialCopy , this . options ?. hasher ) ,
240
- opts ,
241
- ) ;
235
+ return this . _evaluationClientWrapper . selectFrom ( pd , SSITypesBuilder . mapExternalVerifiableCredentialsToWrappedVcs ( verifiableCredentialCopy ) , opts ) ;
242
236
}
243
237
244
238
public presentationSubmissionFrom (
@@ -255,11 +249,7 @@ export class PEX {
255
249
} ,
256
250
) : PresentationSubmission {
257
251
const pd : IInternalPresentationDefinition = SSITypesBuilder . toInternalPresentationDefinition ( presentationDefinition ) ;
258
- return this . _evaluationClientWrapper . submissionFrom (
259
- pd ,
260
- SSITypesBuilder . mapExternalVerifiableCredentialsToWrappedVcs ( selectedCredentials , this . options ?. hasher ) ,
261
- opts ,
262
- ) ;
252
+ return this . _evaluationClientWrapper . submissionFrom ( pd , SSITypesBuilder . mapExternalVerifiableCredentialsToWrappedVcs ( selectedCredentials ) , opts ) ;
263
253
}
264
254
265
255
/**
@@ -294,7 +284,6 @@ export class PEX {
294
284
...opts ,
295
285
// We only pass in the submission in case it needs to be included in the presentation
296
286
presentationSubmission : presentationSubmissionLocation === PresentationSubmissionLocation . PRESENTATION ? presentationSubmission : undefined ,
297
- hasher : this . options ?. hasher ,
298
287
} ) ;
299
288
this . updateSdJwtCredentials ( presentations ) ;
300
289
return {
@@ -320,13 +309,8 @@ export class PEX {
320
309
throw Error ( `At least a verifiable credential needs to be passed in to create a presentation` ) ;
321
310
}
322
311
const verifiableCredential = ( Array . isArray ( selectedCredentials ) ? selectedCredentials : [ selectedCredentials ] ) as W3CVerifiableCredential [ ] ;
323
- if ( verifiableCredential . some ( ( c ) => CredentialMapper . isSdJwtDecodedCredential ( c ) || CredentialMapper . isSdJwtEncoded ( c ) ) ) {
324
- if ( ! this . options ?. hasher ) {
325
- throw new Error ( 'Hasher must be provided when creating a presentation with an SD-JWT VC' ) ;
326
- }
327
- }
328
312
329
- const wVCs = verifiableCredential . map ( ( vc ) => CredentialMapper . toWrappedVerifiableCredential ( vc , { hasher : this . options ?. hasher } ) ) ;
313
+ const wVCs = verifiableCredential . map ( ( vc ) => CredentialMapper . toWrappedVerifiableCredential ( vc ) ) ;
330
314
const holders = Array . from ( new Set ( wVCs . flatMap ( ( wvc ) => getSubjectIdsAsString ( wvc . credential as ICredential ) ) ) ) ;
331
315
const holder = opts ?. holderDID ?? ( holders . length === 1 ? holders [ 0 ] : undefined ) ;
332
316
@@ -371,7 +355,7 @@ export class PEX {
371
355
if ( CredentialMapper . isSdJwtDecodedCredential ( vc ) ) {
372
356
result . push ( vc as PartialSdJwtDecodedVerifiableCredential ) ;
373
357
} else if ( CredentialMapper . isSdJwtEncoded ( vc ) ) {
374
- const decoded = CredentialMapper . decodeVerifiableCredential ( vc , opts ?. hasher ) ;
358
+ const decoded = CredentialMapper . decodeVerifiableCredential ( vc ) ;
375
359
result . push ( decoded as PartialSdJwtDecodedVerifiableCredential ) ;
376
360
} else {
377
361
// This should be jwt or json-ld
@@ -586,13 +570,10 @@ export class PEX {
586
570
// Select type without kbJwt as isSdJwtDecodedCredential and won't accept the partial sdvc type
587
571
if ( CredentialMapper . isSdJwtDecodedCredential ( presentation as SdJwtDecodedVerifiableCredential ) ) {
588
572
const sdJwtCredential = presentation as SdJwtDecodedVerifiableCredential ;
589
- if ( ! this . options ?. hasher ) {
590
- throw new Error ( 'Hasher must be provided when creating a presentation with an SD-JWT VC' ) ;
591
- }
592
573
593
574
// extract sd_alg or default to sha-256
594
575
const hashAlg = sdJwtCredential . signedPayload . _sd_alg ?? 'sha-256' ;
595
- const sdHash = calculateSdHash ( sdJwtCredential . compactSdJwtVc , hashAlg , this . options . hasher ) ;
576
+ const sdHash = calculateSdHash ( sdJwtCredential . compactSdJwtVc , hashAlg ) ;
596
577
597
578
const kbJwt = {
598
579
// alg MUST be set by the signer
0 commit comments