Skip to content

Commit 3e03ec3

Browse files
committed
Cargo fmt
1 parent 0892687 commit 3e03ec3

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

crates/bitwarden-crypto/examples/protect_key_with_password.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ fn main() {
1919
// - Protect a send with a URL fragment secret
2020
// For this, the `PasswordProtectedKeyEnvelope` is used.
2121

22-
// Alice has a vault protected with a symmetric key. She wants the symmetric key protected with a PIN.
22+
// Alice has a vault protected with a symmetric key. She wants the symmetric key protected with
23+
// a PIN.
2324
let vault_key = ctx
2425
.generate_symmetric_key(ExampleSymmetricKey::VaultKey)
2526
.expect("Generating vault key should work");

crates/bitwarden-crypto/src/safe/password_protected_key_envelope.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
//! Password protected key envelope is a cryptographic building block that allows sealing a symmetric key
2-
//! with a low entropy secret (password, PIN, etc.).
1+
//! Password protected key envelope is a cryptographic building block that allows sealing a
2+
//! symmetric key with a low entropy secret (password, PIN, etc.).
33
//!
4-
//! It is implemented by using a KDF (Argon2ID) combined with secret key encryption (XChaCha20-Poly1305).
5-
//! The KDF prevents brute-force by requiring work to be done to derive the key from the password.
4+
//! It is implemented by using a KDF (Argon2ID) combined with secret key encryption
5+
//! (XChaCha20-Poly1305). The KDF prevents brute-force by requiring work to be done to derive the
6+
//! key from the password.
67
//!
7-
//! For the consumer, the output is an opaque blob that can be later unsealed with the same password. The
8-
//! KDF parameters and salt are contained in the envelope, and don't need to be provided for unsealing.
8+
//! For the consumer, the output is an opaque blob that can be later unsealed with the same
9+
//! password. The KDF parameters and salt are contained in the envelope, and don't need to be
10+
//! provided for unsealing.
911
//!
10-
//! Internally, the envelope is a CoseEncrypt object. The KDF parameters / salt are placed in the single
11-
//! recipient's unprotected headers. The output from the KDF - "envelope key", is used to wrap the
12-
//! symmetric key, that is sealed by the envelope.
12+
//! Internally, the envelope is a CoseEncrypt object. The KDF parameters / salt are placed in the
13+
//! single recipient's unprotected headers. The output from the KDF - "envelope key", is used to
14+
//! wrap the symmetric key, that is sealed by the envelope.
1315
1416
use std::{marker::PhantomData, num::TryFromIntError};
1517

0 commit comments

Comments
 (0)