DeviceRecovery
Device recovery format version 1 (docs/device-recovery.md). All three constructions share the recovery statement:
u32 length | target userId (UTF-8) | u32 length | target deviceId (UTF-8)
u32 length | authorizer userId (UTF-8) | u32 length | authorizer deviceId (UTF-8)
replacement public key (32)
timestamp: i64, epoch milliseconds
nonce (16)and prefix it with u32 length | domain (UTF-8):
authorization, Ed25519 by the authorizer's registered key:
KSecureMessage-DeviceRecovery-v1;proof of possession, Ed25519 by the replacement key:
KSecureMessage-DeviceRecovery-PoP-v1;DeviceRecoveryId, SHA-256:
KSecureMessage-DeviceRecoveryId-v1.
Integers are big-endian. The domains keep the three apart from each other and from server request signatures (KSecureMessage-ServerAuth-v1).
Properties
Size of a device authentication public key (Ed25519).
Size of a recovery signature (Ed25519).
Accepted clock difference in each direction, by the authorizer and the server: now - VALIDITY_WINDOW <= timestamp <= now + VALIDITY_WINDOW. The same as for server requests.
Functions
The bytes the authorizer signs.
Signs request with the authorizer's device authentication key pair. Checks nothing: the caller verifies the request first.
The target's request: replacement is the new key pair, target the device whose registration it replaces, authorizer the device that is asked to authorize it. timestamp is truncated to milliseconds.
The bytes the replacement key signs.
The ID of request's statement.
true if authorization's authorizer signature verifies with authorizerPublicKey. Does not check the proof of possession.
true if the request's proof of possession verifies with its replacement key.