Skip to main content

reinit_user_crypto

Function reinit_user_crypto 

Source
pub(crate) async fn reinit_user_crypto(
    client: &Client,
    req: ReinitUserCryptoRequest,
) -> Result<(), ReinitUserCryptoError>
Expand description

Re-initialize the user’s cryptographic state during an unlock session for a V1 -> V2 upgrade. If the user is already V2 this function is a no-op.

Requires the SDK to be unlocked and the client to have registered a state bridge. Replaces the in-memory account cryptographic state with the provided one, and upgrades the active user key from V1 to V2. Performs local data migrations for the local user data key and pin key.

Intended for mobile clients with accountCryptographicState and V2UpgradeToken received in a sync for a V1 -> V2 encryption upgrade. This allows the client to apply the received account cryptographic state and update to reinitialize the SDK without tearing down and recreating the client.