bitwarden_crypto/keys/
user_key.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use crate::{
    rsa::{make_key_pair, RsaKeyPair},
    Result, SymmetricCryptoKey,
};

/// User Key
///
/// The User Key is the symmetric encryption key used to decrypt the user's vault.
pub struct UserKey(pub SymmetricCryptoKey);

impl UserKey {
    pub fn new(key: SymmetricCryptoKey) -> Self {
        Self(key)
    }

    pub fn make_key_pair(&self) -> Result<RsaKeyPair> {
        make_key_pair(&self.0)
    }
}