Skip to content
LogoLogo

Identity.Headers

Identity headers as data

Lowercase lists of identity headers, for code that must handle them without knowing each protocol, such as redirect handling or a proxy.

Usage

Strip identity proofs before forwarding a request, and drop upstream identity requirements from the response:

import * as  from 'mppx/identity'
 
export async function (: Request, : string) {
  const  = new (.)
  for (const  of ..) .() 
  const  = await (, { , : . })
  const  = new (.)
  for (const  of ..) .() 
  return new (., { : , : . })
}

mppx already does this in the client and the proxy:

  • Mppx.create on the client strips request headers, and each prover's headers, when following a cross-origin redirect.
  • The proxy strips request headers from requests it sends upstream and drops request and response headers from upstream responses.

Values

request

  • Type: readonly ['identity-attestation']

Bearer identity request headers. Anyone holding one can replay it until it expires, so it never crosses origins on a redirect or reaches upstream through a proxy.

response

  • Type: readonly ['identity-attestation-required', 'identity-required']

Identity response headers a proxy doesn't pass on from upstream. They ask the client for an identity the proxy decides on, not the upstream.

Prover headers

A prover that writes its own sensitive request header, such as a bearer token, declares it in Prover.headers. The client strips it on a cross-origin redirect, like Identity.Headers.request.

import type * as  from 'mppx/identity'
 
const : . = {
  : ['x-session-token'], 
  () {
    const  = new (.)
    .('X-Session-Token', ..!)
    return new (, {  })
  },
  : ['https://api.example.com'],
}