register

open suspend override fun register(context: Context, attestation: Attestation): Result<KeyPair>

Registers a new device by generating a fresh RSA key pair protected by user PIN.

This method performs the following steps:

  1. Prompts user for PIN through configured PIN collector

  2. Generates new RSA key pair with specified key size

  3. Creates self-signed certificate for the key pair

  4. Stores the key pair in password-protected keystore

  5. Persists encrypted keystore data to secure storage

The generated key pair is cached to avoid requesting PIN again during subsequent authentication calls in the same session.

Return

Result containing the generated KeyPair on success, or failure with exception

Parameters

context

Android context for any UI operations (not used in PIN auth)

attestation

Attestation type - only Attestation.None is supported

Throws

if PIN collection fails, key generation fails, or storage fails