CredLink
Shared CredLink orchestration for PKOC credential exchange and offline time sync over BlueLink.
Responsibilities:
Session lifecycle (onSessionStart, onSessionEnd) and phone key management (validateLegacyPhoneKeys)
Queuing BlueLink operations and per-device timeouts
Thread-safe device registry and coordination with the internal exchange state machine
Platform cryptography is delegated to CredLinkCryptoHandler (Android Keystore + BouncyCastle, or iOS CryptoKit + Keychain via Swift).
Constructors
Functions
Creates a fresh P-256 credential for Ephemeral Temporary Access valid for two minutes. The key pair generated is only persisted in session memory and is purged on session end.
Removes the token unlock pass data associated with namespace.
ConnectivityListener callback; drives offline PKOC time-sync eligibility via networkAvailable.
Creates or reuses the P-256 key bound to a temporary-pass namespace.
Returns the wire-format PKOC public key for the current config.phoneKeysAlias, as hex.
Returns the persisted public key hex for userId and serverAddress without mutating the active phone key alias or CredLink session state.
Fetches the persisted token-unlock-pass persisted under the provided namespace
Clears in-memory CredLink state when a Bridge session ends. Long-term keys are preserved.
Resets in-memory CredLink state when a Bridge session starts. Long-term keys are preserved.
Queues a credential exchange or offline time-sync operation on BlueLink for peripheral.
Clears phone keys asynchronously for legacy callers. Prefer resetPhoneKeysAndWait.
Clears the in-memory phone key alias and all active exchange sessions. Keystore keys are preserved. The operation completes before this function returns so callers can safely start a new authenticated session afterward.
Scopes persisted phone keys to userId and serverAddress without generating new keys or contacting the server. Use when resuming an offline session.
Stores pass when credential identifies the active ephemeral setup session.
Persists the provided token-unlock-pass in platform secure storage under namespace.
Ensures a P-256 key pair exists for the given user and server, generating and persisting one if needed.