Struct baru::Wallet [−][src]
pub struct Wallet { /* fields omitted */ }
Implementations
pub fn initialize_new(
name: String,
password: String,
root_xprv: ExtendedPrivateKey<SecretKey>,
chain: Chain
) -> Result<Self>
pub fn initialize_existing(
name: String,
password: String,
xprv_ciphertext: String,
chain: Chain
) -> Result<Self>
Encrypts the extended private key with the encryption key.
Choice of nonce
We store the extended private key on disk and as such have to use a constant nonce, otherwise we would not be able to decrypt it again. The encryption only happens once and as such, there is conceptually only one message and we are not “reusing” the nonce which would be insecure.
Derive the blinding key.
Choice of salt
We choose to not add a salt because the ikm is already a randomly-generated, secret value with decent entropy.
Choice of ikm
We derive the blinding key from the secret key to avoid having to store two secret values on disk.
Choice of info
We choose to tag the derived key with b"BLINDING_KEY"
in case we ever want to derive something else from the secret key.