Skip to content
LogoLogo

Credential.serialize

Serialize a Credential to a header

Serializes a Credential to the Authorization header format.

Usage

import { ,  } from 'mppx'
 
const  = .({
  : 'abc123',
  : 'charge',
  : 'tempo',
  : 'mpp.dev',
  : { : '1000000', : '0x...', : '0x...' },
})
 
const  = .({
  ,
  : { : '0x...' },
})
 
const  = .()
// => 'Payment eyJjaGFsbGVuZ2UiOnsi...'

Return type

type ReturnType = string

A string suitable for the Authorization header value.

When the Credential includes an echoed Challenge, mppx keeps the HTTP wire format intact: challenge.request and challenge.opaque serialize as the same base64url-encoded strings that came from the Challenge header.

Parameters

credential

  • Type: Credential

The Credential to serialize.