IO Wallet SDK
    Preparing search index...

    Function parseCredentialOfferUri

    • Parses a credential offer URI and extracts the scheme and parameters.

      This function supports three URL schemes for credential offers:

      • openid-credential-offer:// - Standard OpenID scheme (custom URL scheme)
      • haip-vci:// - High Assurance Interoperability Profile scheme (custom URL scheme)
      • https:// - HTTPS Universal Links (preferred method)

      Credential offers can be transmitted in two ways:

      • By value: The credential_offer parameter contains the JSON directly (URL-encoded)
      • By reference: The credential_offer_uri parameter points to a URL where the JSON can be fetched

      Parameters

      Returns Promise<
          {
              credential_offer?: string;
              credential_offer_uri?: string;
              scheme: "openid-credential-offer"
              | "haip-vci"
              | "https";
          },
      >

      Parsed credential offer URI components with scheme and parameters

      If the URI is invalid, uses an unsupported scheme, or is missing required parameters

      const parsed = await parseCredentialOfferUri({
      uri: "openid-credential-offer://?credential_offer=%7B%22credential_issuer%22%3A..."
      });
      console.log(parsed.scheme); // "openid-credential-offer"
      console.log(parsed.credential_offer); // URL-decoded JSON string
      const parsed = await parseCredentialOfferUri({
      uri: "https://wallet.example.com/credential-offer?credential_offer_uri=https://issuer.example.com/offers/123"
      });
      console.log(parsed.scheme); // "https"
      console.log(parsed.credential_offer_uri); // "https://issuer.example.com/offers/123"
      const parsed = await parseCredentialOfferUri({
      uri: "openid-credential-offer://?credential_offer=...",
      allowedSchemes: ["openid-credential-offer"] // Only allow standard OpenID scheme
      });