Provides authentication credentials to the SDK.
Implementors are responsible for:
token or authorizationState.expiry_at when the credential has a known expiration so the SDK can schedule refresh.The SDK owns the credential lifecycle: it calls authenticate once during initialization
and, if refresh is provided and expiry_at is set, schedules automatic refresh before expiry.
The SDK selects exactly one refresh mechanism per session, evaluated at connect time (and re-evaluated on reconnect):
When the SDK falls back to the developer-provided refresh() because the SAT
lacked sat:refresh scope, a credential_refresh_fallback event is emitted on
SignalWire.warnings$ so
application code can observe the transition.
Mint a SAT via POST /api/fabric/subscribers/tokens with fingerprint and
scope: ["sat:refresh"] (both currently optional on that endpoint) to enable
the Client Bound SAT path; otherwise provide refresh() here.
Obtains fresh credentials before the current ones expire. Optional. Implementor responsibilities: - Resolve with a new SDKCredential containing an updated token (or authorizationState) and expiry_at. - Reject (throw) if refresh is not possible — the SDK will stop the refresh schedule. SDK behavior: - Only called when expiry_at was set on the previous credential AND the SAT does not carry sat:refresh scope (otherwise the SDK refreshes internally via Client Bound SAT). See the precedence table above. - Scheduled automatically before expiry; implementors do not need to manage timing. - On rejection, the refresh schedule stops and the session continues with the current credentials until they expire.
Obtains the initial credentials. Called once during client initialization.
Implementor responsibilities:
context.fingerprint is provided, forward it to the server-side token
endpoint with scope: "sat:refresh" to enable automatic token refresh.
Ignoring context.fingerprint causes the SDK to fall back to refresh()
(if provided) or end the session at expiry.SDK behavior:
SignalWire().Authentication context provided by the SDK at credential-request time. See AuthenticateContext.
Promise<SDKCredential>