Skip to main content

AccountRequest

Enum AccountRequest 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Fields

§name: String

The account’s name.

§

Signup

Makes account name.

Fields

§name: String

The account’s name.

§salt: Vec<u8>

The salt and key derivation parameters the client used.

§auth_key: Vec<u8>

The auth key the client derived; the relay keeps only its hash.

§public_keys: Vec<u8>

The account’s public keys.

§wrapped_keys: Vec<u8>

The account’s private keys, wrapped by the client.

§invite: String

The invite the relay’s admin gave (#103): signup is closed without one.

§

Login

Logs in to account name with the auth key derived from its password.

Fields

§name: String

The account’s name.

§auth_key: Vec<u8>

The auth key.

§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.

Fields

§token: String

The login 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

§login: String

The login token.

§secret_hash: Vec<u8>

The SHA-256 of the enrollment secret.

§expires_in: u64

Seconds until it stops working (at most MAX_TOKEN_LIFETIME).

§uses: u32

How many machines it registers (1 to MAX_TOKEN_USES).

§

TokenList

The registration tokens of the logged-in account.

Fields

§login: String

The login token.

§

TokenRevoke

Revokes a registration token of the logged-in account.

Fields

§login: String

The login token.

§id: String

The token’s ID (TokenInfo::id).

§

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.

Fields

§secret: Vec<u8>

The token’s enrollment secret.

§

Register

Registers a machine with a registration token, taking one of its uses.

Fields

§secret: Vec<u8>

The token’s enrollment secret.

§machine_key: Vec<u8>

The machine’s Ed25519 public key, which it authenticates with.

§sealed_name: Vec<u8>

The machine’s display name, sealed to the account’s X25519 key.

§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

§login: String

The login token.

§id: String

The machine’s ID.

§cert: Vec<u8>

The account’s signature.

§

MachineList

The logged-in account’s machines.

Fields

§login: String

The login token.

§

MachineRemove

Removes a machine of the logged-in account: it can no longer connect.

Fields

§login: String

The login token.

§id: String

The machine’s ID.

§

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.

Fields

§login: String

The login token.

§

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

§login: String

The login token.

§auth_key: Vec<u8>

The current password’s auth key.

§salt: Vec<u8>

The new salt and key derivation parameters.

§new_auth_key: Vec<u8>

The new password’s auth key.

§wrapped_keys: Vec<u8>

The private keys wrapped under the new password.

§

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.

Fields

§login: String

The login token.

§auth_key: Vec<u8>

The password’s auth key.

§rotation: KeyRotation

The rotation.

§wrapped_keys: Vec<u8>

The new private keys, wrapped.

§machines: Vec<MachineRekey>

The machines, re-approved.

§

Unregister

A machine removes itself, proving it holds its key.

Fields

§machine: String

The machine’s ID.

§at: i64

When 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

§request: String

The request, as the JSON text that was signed.

§at: i64

When 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

Source

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).

Trait Implementations§

Source§

impl Clone for AccountRequest

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AccountRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AccountRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for AccountRequest

Source§

impl PartialEq for AccountRequest

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for AccountRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AccountRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.