Exporting the client state to Authenticate the enrolled user
Having successfully enrolled a user via IDV Bridge SaaS, it is critical that integrators export the client state to support account recovery and ongoing authentication via the Mobile SDK
Exporting the Client State (RSA-wrapped AES key)
Once a user has completed enrollment, you can export their client state. This produces an encrypted backup that can be restored or transferred securely to another device.
Overview
The export process uses a hybrid encryption flow combining RSA and AES:
Generate a random AES-256 symmetric key (
client_state_key).Encrypt this key using the Keyless RSA public key with
RSAES-OAEP-SHA-256.Send the RSA-encrypted AES key (hex-encoded) in the
Kl-Client-State-Keyheader.Keyless decrypts it internally and uses the AES key to encrypt the client state with AES-GCM-SIV.
You receive a binary blob which can be decrypted locally using the same AES key.
Note: In sandbox environments, the returned ciphertext may also be compatible with AES-GCM, so standard AES-GCM decryption can be used if AES-GCM-SIV support is unavailable.
Endpoint
Method: POST
Path:
/v1/users/{customer}/{username}/export-client-stateRequired Headers:
Kl-Key-Id
Registered RSA key alias (e.g. alias/kl-core-production-authentication-service-image-key-sandbox)
Kl-Key-Algorithm
Must be RSAES-OAEP-SHA-256
Kl-Client-State-Key
RSA-encrypted AES key (hex-encoded)
Kl-Client-State-Algorithm
AES-GCM-SIV
Kl-Client-State-Type
BACKUP
Kl-Api-Key
Your Keyless API key
Accept
application/octet-stream
Example Implementation (Python)
Below is a full working example using requests and cryptography.
⚠️ Replace placeholders (
<your-api-key>,<your-customer>,<your-username>,<your-public-key>) with real configuration values.
Example Response
Status: 200 OK
Content-Type: application/octet-stream
Binary blob: nonce || ciphertext
After successful decryption, the plaintext contains the user’s client state in JSON:
Common Errors
422
bytes_invalid_encoding
Kl-Client-State-Key must be hex-encoded (not Base64).
409
IMAGE_ENCRYPTION_ERROR
The server couldn’t decrypt the key. Ensure your RSA public key matches the alias and OAEP-SHA-256 is used.
400 / 401
Unauthorized
Invalid or missing API key.
—
cryptography.exceptions.InvalidTag
AES key or nonce mismatch — check byte order and header setup.
Last updated
Was this helpful?