@@ -11,8 +11,12 @@ export class OpenId4VcController extends ConsumptionBaseController {
1111 super ( ConsumptionControllerName . OpenId4VcController , parent ) ;
1212 }
1313
14+ private get fetchInstance ( ) : typeof fetch {
15+ return this . parent . consumptionConfig . fetchInstance ?? fetch ;
16+ }
17+
1418 public async fetchCredentialOffer ( credentialOfferUrl : string ) : Promise < { data : string } > {
15- const holder = new Holder ( this . parent . accountController , this . parent . attributes ) ;
19+ const holder = new Holder ( this . parent . accountController , this . parent . attributes , this . fetchInstance ) ;
1620 await holder . initializeAgent ( "96213c3d7fc8d4d6754c7a0fd969598e" ) ;
1721 const res = await holder . resolveCredentialOffer ( credentialOfferUrl ) ;
1822 return {
@@ -25,7 +29,7 @@ export class OpenId4VcController extends ConsumptionBaseController {
2529 requestedCredentialOffers : string [ ] ,
2630 pinCode ?: string
2731 ) : Promise < { data : string ; id : string ; type : string ; displayInformation : string | undefined } > {
28- const holder = new Holder ( this . parent . accountController , this . parent . attributes ) ;
32+ const holder = new Holder ( this . parent . accountController , this . parent . attributes , this . fetchInstance ) ;
2933 await holder . initializeAgent ( "96213c3d7fc8d4d6754c7a0fd969598e" ) ;
3034 const credentialOffer = JSON . parse ( fetchedCredentialOffer ) ;
3135 const credentials = await holder . requestAndStoreCredentials ( credentialOffer , { credentialsToRequest : requestedCredentialOffers , txCode : pinCode } ) ;
@@ -43,7 +47,7 @@ export class OpenId4VcController extends ConsumptionBaseController {
4347 }
4448
4549 public async processCredentialOffer ( credentialOffer : string ) : Promise < { data : string ; id : string ; type : string ; displayInformation : string | undefined } > {
46- const holder = new Holder ( this . parent . accountController , this . parent . attributes ) ;
50+ const holder = new Holder ( this . parent . accountController , this . parent . attributes , this . fetchInstance ) ;
4751 await holder . initializeAgent ( "96213c3d7fc8d4d6754c7a0fd969598e" ) ;
4852 const res = await holder . resolveCredentialOffer ( credentialOffer ) ;
4953 const credentials = await holder . requestAndStoreCredentials ( res , { credentialsToRequest : Object . keys ( res . offeredCredentialConfigurations ) } ) ;
@@ -63,7 +67,7 @@ export class OpenId4VcController extends ConsumptionBaseController {
6367 public async resolveAuthorizationRequest (
6468 requestUrl : string
6569 ) : Promise < { authorizationRequest : OpenId4VpResolvedAuthorizationRequest ; usedCredentials : { id : string ; data : string ; type : string ; displayInformation ?: string } [ ] } > {
66- const holder = new Holder ( this . parent . accountController , this . parent . attributes ) ;
70+ const holder = new Holder ( this . parent . accountController , this . parent . attributes , this . fetchInstance ) ;
6771 await holder . initializeAgent ( "96213c3d7fc8d4d6754c7a0fd969598e" ) ;
6872 const authorizationRequest = await holder . resolveAuthorizationRequest ( requestUrl ) ;
6973
@@ -90,7 +94,7 @@ export class OpenId4VcController extends ConsumptionBaseController {
9094 public async acceptAuthorizationRequest (
9195 authorizationRequest : OpenId4VpResolvedAuthorizationRequest
9296 ) : Promise < { status : number ; message : string | Record < string , unknown > | null } > {
93- const holder = new Holder ( this . parent . accountController , this . parent . attributes ) ;
97+ const holder = new Holder ( this . parent . accountController , this . parent . attributes , this . fetchInstance ) ;
9498 await holder . initializeAgent ( "96213c3d7fc8d4d6754c7a0fd969598e" ) ;
9599 // parse the credential type to be sdjwt
96100
@@ -101,7 +105,7 @@ export class OpenId4VcController extends ConsumptionBaseController {
101105 }
102106
103107 public async getVerifiableCredentials ( ids ?: string [ ] ) : Promise < { id : string ; data : string ; type : string ; displayInformation ?: string } [ ] > {
104- const holder = new Holder ( this . parent . accountController , this . parent . attributes ) ;
108+ const holder = new Holder ( this . parent . accountController , this . parent . attributes , this . fetchInstance ) ;
105109 await holder . initializeAgent ( "96213c3d7fc8d4d6754c7a0fd969598e" ) ;
106110
107111 const credentials = await holder . getVerifiableCredentials ( ids ) ;
0 commit comments