DPoPKeyManager

Properties

Link copied to clipboard

RFC 9449 token type string. Canonical casing — compare via isDPoPTokenType since RFC 6749 §5.1 does not mandate casing; servers may return "dpop", "DPoP", or any variant.

Functions

Link copied to clipboard

Idempotently deletes the key pair for alias.

Link copied to clipboard

Drops the cached key handle for alias without deleting its AndroidKeyStore entry. Use when signing with a cached handle fails — e.g. the backing keystore entry was evicted out-of-band — so the next loadKeyPair re-reads from the keystore and converges on the correct state (reload the real key, or null → fail fast to re-auth) instead of repeatedly signing with a dead handle.

Link copied to clipboard

Mints a new key pair on a miss. Use ONLY on the binding paths (/authorize, native login) where a DPoP key is supposed to be created. On the refresh / resource-decoration paths the key is already bound at login, so use loadKeyPair instead — minting there would sign a proof with a thumbprint the server never bound.

Link copied to clipboard
fun hasCompleteDPoPCredentials(credentialsIdentifier: String?, tokenType: String?): Boolean

Returns whether the persisted fields required to use tokenType are internally consistent. A DPoP-bound credential must identify the key pair used for its proof; Bearer and transitional credentials do not require that identifier.

Link copied to clipboard

Returns true iff a key pair is already present in the AndroidKeyStore for the given alias. Side-effect-free — does NOT mint a key pair on miss.

Link copied to clipboard
fun hasKeyPairForCredentialsIdentifier(credentialsIdentifier: String?): Boolean

Convenience overload — computes the alias for credentialsIdentifier and calls hasKeyPair.

Link copied to clipboard

Returns true iff tokenType matches "DPoP" case-insensitively (RFC 6749 §5.1). Handles null/empty safely — never returns true for those.

Link copied to clipboard

Returns true only for Android KeyStore failures that prove the bound key can never be used.

Link copied to clipboard

Load-only lookup: returns the key pair already bound for alias, or null if no key is present. Unlike generateOrLoadKeyPair this NEVER mints a key on a miss — it is the side-effect-free primitive the refresh and request-decoration paths must use so a credential whose bound key has gone missing (device restore, keystore eviction) fails fast and routes to re-auth instead of silently signing with a non-bound key.

Link copied to clipboard
fun shouldAttachDPoP(credentialsIdentifier: String?, tokenType: String?): Boolean

Decides whether a DPoP proof should be attached to a request for a credential identified by credentialsIdentifier.