Skip to main content

Function: verifyEnvelope()

verifyEnvelope(secret, headers, payload, nowMs, options?): object

Defined in: packages/agentos/src/io/channels/meetings/signing.ts:77

The receiving side: the three headers, the raw payload and the receiver's clock.

Parameters​

secret​

string

The destination's nonempty secret, used as UTF-8 bytes without base64 decoding.

headers​

Record<string, string | string[] | undefined>

The delivery's headers; the timestamp must contain only ASCII digits and is authenticated literally.

payload​

string

The body exactly as it arrived, before any parse.

nowMs​

number

The receiver's clock, in milliseconds since the epoch.

options?​

windowMs, how far the delivery's time may be from nowMs (ENVELOPE_WINDOW_MS when absent); names, the header names (DEFAULT_ENVELOPE_HEADERS when absent).

names?​

EnvelopeHeaderNames

windowMs?​

number

Returns​

object

{ valid: true }, or valid: false with why: an empty secret, a header missing, a bad timestamp, a timestamp outside the window (including a NaN clock or window), or a signature that does not match.

error?​

optional error: string

valid​

valid: boolean