Skip to main content

NodeProvisionRequest

Struct NodeProvisionRequest 

Source
pub struct NodeProvisionRequest {
    pub root_seed: RootSeed,
    pub deploy_env: DeployEnv,
    pub network: Network,
    pub google_auth_code: Option<String>,
    pub allow_gvfs_access: bool,
    pub encrypted_seed: Option<Vec<u8>>,
}
Expand description

The client sends this request to the provisioning node.

Fields§

§root_seed: RootSeed

The secret root seed the client wants to provision into the node.

§deploy_env: DeployEnv

The DeployEnv that this RootSeed should be bound to.

§network: Network

The Network that this RootSeed should be bound to.

§google_auth_code: Option<String>

The auth code which can used to obtain a set of GDrive credentials.

  • Applicable only in staging/prod.
  • If provided, the provisioning node will acquire the full set of GDrive credentials and persist them (encrypted ofc) in Lexe’s DB.
  • If NOT provided, the provisioning node will attempt to use a set of GDrive credentials which have already been persisted to Lexe’s DB.
§allow_gvfs_access: bool

Whether this provision instance is allowed to access the user’s GoogleVfs. In order to ensure that different provision instances do not overwrite each other’s updates to the GoogleVfs, this paramater must only be true for at most one provision instance at a time.

  • The mobile app must always set this to true, and must ensure that it is only (re-)provisioning one instance at a time. Node version approval and revocation (which requires mutating the GoogleVfs) can only be handled if this is set to true.
  • Running nodes, which initiate root seed replication, must always set this to false, so that replicating instances will not overwrite updates made by (re-)provisioning instances.

NOTE that it is always possible that while this instance is provisioning, the user’s node is also running. Even when this parameter is true, the provision instance must be careful not to mutate GoogleVfs data which can also be mutated by a running user node, unless a persistence race between the provision and run modes is acceptable.

See GoogleVfs::gid_cache for more info on GVFS consistency.

§encrypted_seed: Option<Vec<u8>>

The password-encrypted RootSeed which can be backed up in GDrive.

  • Applicable only in staging/prod, and if GDrive is enabled.
  • Requires allow_gvfs_access=true if Some; errors otherwise.
  • If Some, and GDrive is enabled, the provision instance will back up this encrypted RootSeed in Google Drive. If a backup already exists, it is overwritten.
  • If None, and GDrive is enabled, and we are missing a backup, provision will error.
  • The mobile app should set this to Some at least on the very first provision. The mobile app can also pass None to avoid unnecessary work when it is known that the user already has a root seed backup.
  • Replication (from running nodes) should always set this to None.
  • We require the client to password-encrypt prior to sending the provision request to prevent leaking the length of the password. It also shifts the burden of running the 600K HMAC iterations from the provision instance to the mobile app.

Trait Implementations§

Source§

impl Debug for NodeProvisionRequest

Source§

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

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

impl<'de> Deserialize<'de> for NodeProvisionRequest

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 Serialize for NodeProvisionRequest

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

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<F, T, U> Apply<F, U> for T
where F: FnOnce(T) -> U,

Source§

fn apply(self, f: F) -> U

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

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