Skip to content
LogoLogo

Challenge.deserialize

Deserialize a Challenge from a header

Deserializes a WWW-Authenticate header value to a Challenge.

Usage

import {  } from 'mppx'
 
const  = 'Payment id="abc123", realm="mpp.dev", method="tempo", intent="charge", request="eyJhbW91bnQiOi..."'
const  = .()

With method type narrowing

Use a method definition to get type-safe access to method-specific request fields.

import {  } from 'mppx'
import {  } from 'mppx/tempo'
 
const  = 'Payment id="abc123", realm="mpp.dev", method="tempo", intent="charge", request="eyJhbW91bnQiOi..."'
const  = .(, { : [.] })

Return type

type ReturnType = Challenge

The deserialized Challenge object. Auth-param names are case-insensitive. mppx decodes request from its base64url-encoded JCS string and restores Unicode escaped by Challenge.serialize. The optional header value identifies the HTTP field for the Payment Credential. The opaque auth-param remains unchanged on Challenge.opaque; Challenge.deserialize doesn't expand it into Challenge.meta.

Parameters

options (optional)

  • Type: { methods?: readonly Method.Method[] }

Optional settings to narrow the Challenge type using method intents.

value

  • Type: string

The WWW-Authenticate header value.