UMIS SDK
    Preparing search index...

    Function redeemOffer

    • Redeems an offer from resolveOffer for a credential bound to signer, with the pre-authorized-code flow of OpenID4VCI 1.0. Three requests, in this order:

      1. the token request (section 6.1), a form with the grant type, the pre-authorized code and the transaction code;
      2. a nonce from the nonce endpoint (section 7) when the issuer has one, else the c_nonce of the token response;
      3. the credential request (section 8.2), JSON with the configuration and a proof JWT (appendix F.1) in proofs.jwt, signed by signer, with the issuer as audience, opts.now as iat and the nonce, under Authorization: Bearer.

      txCode is the code the holder typed; an offer that asks for one and gets none is INVALID_ARGUMENT. The credential in the answer must read as an SD-JWT VC, be bound to the key of signer, be of the offered type and come from the issuer of the offer. An OAuth error (invalid_grant for a wrong transaction code, say) or anything else that breaks the protocol is PROTOCOL with the error code in the message; a server that cannot be reached is NETWORK. Redirects are refused as in resolveOffer.

      Parameters

      Returns Promise<{ decoded: DecodedCredential; sdJwtVc: string }>