@@ -294,65 +294,15 @@ const data = 'openid-credential-offer://?credential_offer_uri=...'
294294
295295const resolvedCredentialOffer = await agent .modules .openId4VcHolder .resolveCredentialOffer (data )
296296
297- await agent .modules .openId4VcHolder .acceptCredentialOfferUsingPreAuthorizedCode (
298- // First parameter is now the resolved credential offer
297+ const token = await holder .modules .openId4VcHolderModule .requestToken ({
299298 resolvedCredentialOffer ,
300- {
301- // has been renamed from proofOfPossessionVerificationMethodResolver to credentialBindingResolver
302- credentialBindingResolver : async ({
303- supportedDidMethods ,
304- keyType ,
305- supportsAllDidMethods ,
306- // supportsJwk now also passed
307- supportsJwk ,
308- credentialFormat ,
309- }) => {
310- // NOTE: example implementation. Adjust based on your needs
311- // Return the binding to the credential that should be used. Either did or jwk is supported
312-
313- if (supportsAllDidMethods || supportedDidMethods ?.includes (' did:key' )) {
314- const didResult = await agent .dids .create <KeyDidCreateOptions >({
315- method: ' key' ,
316- options: {
317- keyType ,
318- },
319- })
320-
321- if (didResult .didState .state !== ' finished' ) {
322- throw new Error (' DID creation failed.' )
323- }
324-
325- const didKey = DidKey .fromDid (didResult .didState .did )
326-
327- // you now need to return an object instead of VerificationMethod instance
328- // and method 'did' or 'jwk'
329- return {
330- method: ' did' ,
331- didUrl: ` ${didKey .did }#${didKey .key .fingerprint } ` ,
332- }
333- }
334-
335- // we also support plain jwk for sd-jwt only
336- if (supportsJwk && credentialFormat === OpenId4VciCredentialFormatProfile .SdJwtVc ) {
337- const key = await agent .wallet .createKey ({
338- keyType ,
339- })
340-
341- // you now need to return an object instead of VerificationMethod instance
342- // and method 'did' or 'jwk'
343- return {
344- method: ' jwk' ,
345- jwk: getJwkFromKey (key ),
346- }
347- }
299+ userPin: ' 1234' ,
300+ });
348301
349- throw new Error (' Unable to create a key binding' )
350- },
351-
352- verifyCredentialStatus: false ,
353- allowedProofOfPossessionSignatureAlgorithms: [JwaSignatureAlgorithm .EdDSA , JwaSignatureAlgorithm .ES256 ],
354- }
355- )
302+ const credentials = await holder .modules .openId4VcHolderModule .requestCredentials ({
303+ resolvedCredentialOffer ,
304+ token ,
305+ });
356306```
357307
358308<!-- /tabs-->
0 commit comments