Skip to content
LogoLogo

Challenge.serialize

Serialize a Challenge to a header

Serializes a Challenge to the WWW-Authenticate header format.

Usage

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

Return type

type ReturnType = string

A string suitable for the WWW-Authenticate header value.

The serialized string includes optional fields when present: description, digest, expires, and opaque (server-defined correlation data set via meta in Challenge.from). In HTTP headers, request and opaque are emitted as base64url-encoded JCS JSON strings.

Parameters

challenge

  • Type: Challenge

The Challenge to serialize.