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. mppx decodes request and opaque from their base64url-encoded JCS strings back to structured values. If the serialized header contains an opaque parameter, the parsed value is accessible via 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.