IF Commons GitHub

physical/transport/mod

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-integrations-physical FR-004, 0004-integrations-physical FR-005, 0004-integrations-physical FR-006

The transports of exchange (commons integrations 0004-integrations-physical): an ExchangeTransport is a port, a record of functions, and this module gives HTTPS on Net's transport (a POST of a document to a partner's endpoint, with a bearer secret), the token request of OAuth2 backend services in the manner of SMART (a client credentials grant with a signed assertion, the signing a port), and the framing of MLLP over TCP. SFTP, AS2 and AS4 are specified and Planned.

What a partner answers is a payload: it is returned to the caller and never put in a failure, a log or a trace; a failure holds a kind and a status.

Source: commons/integrations/src/physical/transport/mod.ts

8 of 13 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Outboundtype
type Outbound = { readonly contentType: string; readonly body: string };

A document to send.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

Deliveredtypeno test imports it
type Delivered = { readonly status: number; readonly body: string };

What a partner gave back: a status and a body, which is a payload.

TransportFailuretypeno test imports it
type TransportFailure = { readonly kind: "refused" } | { readonly kind: "network" } | { readonly kind: "rejected"; readonly status: number };

Why nothing was delivered.

ExchangeTransporttype
type ExchangeTransport = { readonly send: (message: Outbound) => Promise<Result<Delivered, TransportFailure>> };

The transport port of exchange.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

httpsTransportfunction
function httpsTransport(t: Transport, endpoint: string, bearer: Secret): ExchangeTransport

HTTPS: a POST of the document to the endpoint, authorized by a bearer secret; a status of 400 or more is rejected, with the status only.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

AssertionClaimstype
type AssertionClaims = { readonly iss: string; readonly sub: string; readonly aud: string; readonly jti: string; readonly exp: number };

The claims of the assertion that proves the client to a token endpoint.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

AssertionSignertypeno test imports it
type AssertionSigner = { readonly sign: (claims: AssertionClaims) => Promise<Result<Secret, { readonly kind: "signing-failed" }>> };

The port that signs an assertion with the client's key: the key never leaves it.

TokenFailuretypeno test imports it
type TokenFailure = { readonly kind: "signing-failed" } | { readonly kind: "refused" } | { readonly kind: "network" } | { readonly kind: "rejected"; readonly status: number } | { readonly kind: "malformed" };

Why a token was not obtained.

backendServicesFormfunction
function backendServicesForm(assertion: Secret, scope: string): string

The form of a client credentials request that carries a signed assertion (RFC 7523, as SMART Backend Services uses it).

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

requestTokenfunction
function requestToken(t: Transport, tokenUrl: string, signer: AssertionSigner, claims: AssertionClaims, scope: string): Promise<Result<Secret, TokenFailure>>

A bearer secret from the token endpoint: it signs an assertion, posts the form and reads access_token of the answer.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

MLLPconstno test imports it
const MLLP: { readonly start: "\v"; readonly end: "\u001C"; readonly cr: "\r"; }

MLLP start block, end block and carriage return.

mllpFrameconst
const mllpFrame: (message: string) => string

A message in the framing of MLLP.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

mllpUnframefunction
function mllpUnframe(frame: string): string | undefined

The message of a frame, or undefined where the text is not one whole frame.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.