Class: SSFReceiver

SSFReceiver(config)

OpenID Shared Signals Framework 1.0 receiver with first-class CAEP handlers.

Register a handler per CAEP event: receiver.onSessionRevoked(async (evt) => { ... }) .onCredentialChange(async (evt) => { ... }); or pass them as handlers: { sessionRevoked, credentialChange, ... }. Any other event type (e.g. RISC) can be handled with onEvent(uri, handler).

Constructor

new SSFReceiver(config)

Parameters:
Name Type Description
config SSFReceiverConfig
Source:

Classes

SSFReceiver

Members

metadata

Transmitter metadata. @type {Record<string, any>}

Source:

stream

Current stream configuration. @type {Record<string, any>}

Source:

Methods

(async) addSubject(subject, optsopt)

Asks the transmitter to include events about a subject in this stream.

Parameters:
Name Type Attributes Description
subject object

RFC 9493 subject identifier, e.g. Subject.issSub(iss, sub)

opts Object <optional>

(TypeScript: { verified?: boolean })

Source:

(async) createStream()

Creates a stream using this receiver's delivery settings and requested events.

Source:

(async) deleteStream(optsopt)

Deletes the stream at the transmitter.

Parameters:
Name Type Attributes Description
opts Object <optional>

(TypeScript: { keepalive?: boolean }) keepalive: let the request outlive the page (used on pagehide).

Source:

(async) discover()

Loads transmitter metadata from its well-known SSF configuration endpoint.

Source:

(async) getStatus() → {Promise}

Source:
Returns:

(TypeScript: Promise<{ stream_id: string, status: 'enabled'|'paused'|'disabled', reason?: string }>)

Type
Promise

(async) listStreams() → {Promise.<Array.<object>>}

Source:
Returns:

All streams the transmitter has for this receiver.

Type
Promise.<Array.<object>>

off(eventType, handler) → {this}

Removes a handler previously registered with onEvent / on.

Parameters:
Name Type Description
eventType string
handler SecurityEventHandler
Source:
Returns:
Type
this

onAnyEvent(handler) → {this}

Called for every accepted event, after type-specific handlers.

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

onAssuranceLevelChange(handler) → {this}

CAEP assurance-level-change: authentication assurance changed (payload.current_level, previous_level, change_direction).

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

onCredentialChange(handler) → {this}

CAEP credential-change: a credential was created/revoked/updated/deleted (payload.credential_type, change_type).

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

onDeviceComplianceChange(handler) → {this}

CAEP device-compliance-change: device compliance changed (payload.current_status: "compliant" | "not-compliant").

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

onError(handler) → {this}

Called with (error, context) when a SET is rejected, a handler throws, or polling fails.

Parameters:
Name Type Description
handler SSFErrorHandler
Source:
Returns:
Type
this

onEvent(eventType, handler)

Registers a handler for any event type URI (CAEP, RISC, or custom).

Parameters:
Name Type Description
eventType string
handler SecurityEventHandler
Source:

onRiskLevelChange(handler) → {this}

CAEP risk-level-change: the risk level of a principal changed (payload.current_level, previous_level, risk_reason, principal).

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

onSessionEstablished(handler) → {this}

CAEP session-established: a new session was established (payload.acr, amr, fp_ua, ext_id).

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

onSessionPresented(handler) → {this}

CAEP session-presented: a session was presented to a service (payload.fp_ua, ext_id).

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

onSessionRevoked(handler) → {this}

CAEP session-revoked: the session(s) for the subject were revoked; terminate local sessions.

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

onStreamUpdated(handler) → {this}

SSF stream-updated event (payload.status, payload.reason).

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

onTokenClaimsChange(handler) → {this}

CAEP token-claims-change: claims in previously issued tokens changed (payload.claims).

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

onUnhandledEvent(handler) → {this}

Called for events with no type-specific handler.

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

onVerification(handler) → {this}

SSF verification event (payload.state).

Parameters:
Name Type Description
handler SecurityEventHandler
Source:
Returns:
Type
this

poll() → {Promise.<{received: number, moreAvailable: boolean}>}

Performs one RFC 8936 poll request, acknowledging previously processed SETs.

Source:
Returns:
Type
Promise.<{received: number, moreAvailable: boolean}>

pollNow()

Triggers an immediate poll (poll delivery only).

Source:

(async) receiveSet(token) → {Promise.<Array.<SecurityEvent>>}

Validates a SET and runs its handlers. Use this if you receive SETs through your own transport.

Parameters:
Name Type Description
token string

Compact JWS SET

Source:
Returns:

the dispatched events (empty for a replayed jti)

Type
Promise.<Array.<SecurityEvent>>

(async) removeSubject(subject)

Parameters:
Name Type Description
subject object
Source:

(async) replaceStream()

PUT (replace) the stream configuration.

Source:

(async) requestVerification(optsopt) → {Promise.<SecurityEvent>}

Requests a verification event (SSF §8.1.4) and resolves when it is received.

Parameters:
Name Type Attributes Description
opts Object <optional>

(TypeScript: { timeoutMs?: number, state?: string })

Source:
Returns:
Type
Promise.<SecurityEvent>

(async) start(optsopt)

Discovers the transmitter, creates (or reuses) a stream, and starts polling when using poll delivery. If the transmitter refuses a new stream because this receiver already has one (HTTP 409) or has as many as it may hold (HTTP 403 — iya-sts's answer past ssf.maxStreams), an existing stream is reused and re-pointed at this receiver's delivery settings: the one whose description is this receiver's, or else the first.

With catchUp, the SETs already queued on the stream are polled and dispatched before this resolves, e.g. so that a session revoked while the receiver was stopped is acted on before the session is used.

Parameters:
Name Type Attributes Description
opts Object <optional>

(TypeScript: { catchUp?: boolean })

Source:

(async) stop(optsopt)

Stops polling and optionally deletes the stream at the transmitter.

Parameters:
Name Type Attributes Description
opts Object <optional>

(TypeScript: { deleteStream?: boolean })

Source:

(async) updateStatus(status)

Parameters:
Name Type Description
status 'enabled' | 'paused' | 'disabled'
Source:

(async) updateStream()

PATCH the stream configuration.

Source:

(async) validateSet(token) → {Promise.<Array.<SecurityEvent>>}

Validates a SET (RFC 8417 / SSF 1.0 §4) without dispatching it. Duplicate jtis return an empty array.

Parameters:
Name Type Description
token string
Source:
Returns:
Type
Promise.<Array.<SecurityEvent>>