#[non_exhaustive]pub enum AccountRequest {
Show 17 variants
Salt {
name: String,
},
Signup {
name: String,
salt: Vec<u8>,
auth_key: Vec<u8>,
public_keys: Vec<u8>,
wrapped_keys: Vec<u8>,
invite: String,
},
Login {
name: String,
auth_key: Vec<u8>,
device_key: Vec<u8>,
},
Logout {
token: String,
},
TokenCreate {
login: String,
secret_hash: Vec<u8>,
expires_in: u64,
uses: u32,
},
TokenList {
login: String,
},
TokenRevoke {
login: String,
id: String,
},
TokenKeys {
secret: Vec<u8>,
},
Register {
secret: Vec<u8>,
machine_key: Vec<u8>,
sealed_name: Vec<u8>,
binding: Vec<u8>,
},
MachineApprove {
login: String,
id: String,
cert: Vec<u8>,
},
MachineList {
login: String,
},
MachineRemove {
login: String,
id: String,
},
Sessions {
login: String,
},
PasswordChange {
login: String,
auth_key: Vec<u8>,
salt: Vec<u8>,
new_auth_key: Vec<u8>,
wrapped_keys: Vec<u8>,
},
KeyRotate {
login: String,
auth_key: Vec<u8>,
rotation: KeyRotation,
wrapped_keys: Vec<u8>,
machines: Vec<MachineRekey>,
},
Unregister {
machine: String,
at: i64,
signature: Vec<u8>,
},
Proven {
request: String,
at: i64,
nonce: Vec<u8>,
signature: Vec<u8>,
},
}Expand description
A request to the relay’s account service.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Salt
The salt (with its key derivation parameters) of account name, to
derive its keys before logging in. A name with no account gets a salt
all the same, always the same for that name, so the answer does not
tell which names have accounts.
Signup
Makes account name.
Fields
Login
Logs in to account name with the auth key derived from its password.
Fields
device_key: Vec<u8>This device’s Ed25519 public key (#158): the login’s token works
only in a AccountRequest::Proven this key signed. A login
without one is refused.
Logout
Ends the login session of token.
TokenCreate
Makes a registration token for the logged-in account: the relay keeps the hash of its enrollment secret (the client keeps the secret), with its expiry and uses.
Fields
expires_in: u64Seconds until it stops working (at most MAX_TOKEN_LIFETIME).
uses: u32How many machines it registers (1 to MAX_TOKEN_USES).
TokenList
The registration tokens of the logged-in account.
TokenRevoke
Revokes a registration token of the logged-in account.
TokenKeys
The public keys of the account a registration token belongs to, for the machine to check against the token’s fingerprint before it registers. Uses nothing of the token.
Register
Registers a machine with a registration token, taking one of its uses.
Fields
binding: Vec<u8>Its proof it holds the token (#133): HMAC-SHA256 of
binding_bytes under the token’s binding key, which never
reaches the relay. The device that made the token checks it
before it approves the machine.
MachineApprove
Approves a machine of the logged-in account (#133): the account’s
signature of cert_bytes, which devices check before they trust
the machine’s key, name and records.
Fields
MachineList
The logged-in account’s machines.
MachineRemove
Removes a machine of the logged-in account: it can no longer connect.
Sessions
The logged-in account’s machines, each with the relay session it is served on now (if it is connected) and its sessions’ records (#87): all a device needs to attach, nothing carried by hand.
PasswordChange
Changes the logged-in account’s password (#89): its new salt, auth key and private keys wrapped under the new password, proven by the current password’s auth key. Every login of the account ends; the reply holds a new one.
Fields
KeyRotate
Replaces the logged-in account’s keys (#89): rotation, signed by the
current signing key, the new private keys wrapped under the password,
and each approved machine’s name and approval under the new keys,
proven by the password’s auth key. Every login of the account ends;
the reply holds a new one.
Unregister
A machine removes itself, proving it holds its key.
Fields
at: i64When it signed (Unix seconds); the relay takes it within
UNREGISTER_WINDOW of its own clock.
signature: Vec<u8>Its signature of unregister_message.
Proven
A request that carries a login token, signed by the device the login was made on (#158): a token without its device’s signature is refused, so a copied token, or a copied account file, works nowhere else.
Fields
at: i64When it was signed (Unix seconds); the relay takes it within
PROOF_WINDOW of its own clock, and each nonce once.
nonce: Vec<u8>PROOF_NONCE_LEN random bytes.
signature: Vec<u8>The device key’s signature of proof_bytes.
Implementations§
Source§impl AccountRequest
impl AccountRequest
Sourcepub fn login_token(&self) -> Option<&str>
pub fn login_token(&self) -> Option<&str>
The login token this request uses, if it is one that needs a login
(Logout’s token included).