LastDeviceRecovery

Last-device recovery, format version 1 (docs/last-device-recovery.md). Recovery statement:

u32 length | target userId (UTF-8) | u32 length | target deviceId (UTF-8)
recovery public key (32)
challenge ID (16)
challenge nonce (32)
expected authentication epoch: i64 (>= 1)
challenge expiry: i64, epoch milliseconds
replacement public key (32)

Each construction prefixes u32 length | domain (UTF-8):

  • recovery authorization, Ed25519 by the recovery key: KSecureMessage-LastDeviceRecovery-v1;

  • proof of possession, Ed25519 by the replacement key: KSecureMessage-LastDeviceRecovery-PoP-v1;

  • LastDeviceRecoveryId, SHA-256: KSecureMessage-LastDeviceRecoveryId-v1.

The key registration's proof of possession signs u32 length | KSecureMessage-LastDeviceRecoveryKey-PoP-v1 | u32 length | userId (UTF-8) | recovery public key (32).

Integers are big-endian. No domain is shared with server request authentication, device recovery or routine rotation.

Properties

Link copied to clipboard

How long a server-issued challenge is valid: issuedAt + CHALLENGE_LIFETIME = expiresAt.

Link copied to clipboard
const val PUBLIC_KEY_SIZE: Int

Size of a recovery or replacement public key (Ed25519).

Link copied to clipboard
const val SIGNATURE_SIZE: Int

Size of a signature (Ed25519).

Functions

Link copied to clipboard

The bytes the recovery key signs.

Link copied to clipboard

The recovery of challenge's target to replacement, signed by recoveryKey and by replacement. Throws IllegalArgumentException if both keys are the same.

Link copied to clipboard

The bytes the recovery key signs when it is registered for userId.

Link copied to clipboard

The bytes the replacement key signs.

Link copied to clipboard
Link copied to clipboard

The registration of key for userId, with the key's proof of possession.

Link copied to clipboard

true if registration's proof of possession verifies with its public key.

Link copied to clipboard

true if the proof of possession verifies with the statement's replacement key.

Link copied to clipboard

true if authorization's recovery signature verifies with recoveryPublicKey. The server passes the user's registered recovery key. Does not check the proof of possession.