@nevermined-io/payments
    Preparing search index...

    Function extractCredentialChallengeId

    • The stable identity of a credential: the challenge id it carries.

      The header bytes are NOT that identity. PAYMENT_SCHEME_BOUNDARY is case-insensitive and extractPaymentScheme returns the matched slice verbatim, so Payment x, payment x and Payment x are three different strings for one credential — and the body is base64url of JSON the BUYER assembles, so re-ordering its keys yields more. The backend collapses every one of them onto a single burn, because its own idempotency key is the decoded challenge id. Anything at the seller edge enforcing single-use has to key on the same thing, or a buyer flips one byte of case and buys the response again.

      Parameters

      • credential: string

      Returns string | null

      the challenge.id a token68 credential decodes to, or null when the credential cannot be decoded into one — a structured key="value" scheme (that shape is a challenge, never a credential), undecodable base64url JSON, or JSON without a non-empty string challenge.id. The backend rejects all of those anyway; returning null lets the caller refuse them without a round-trip rather than fall back to a key it cannot trust.