bitwarden_crypto/
lib.rs

1#![doc = include_str!("../README.md")]
2
3//! # Pinned heap data
4//!
5//! This crate uses a `Pin<Box<>>` strategy to ensure data is stored on the heap and not moved
6//! around. This pattern is commonly used for `GenericArray` since it's equivalent to `[u8; N]`
7//! which is a Copy type placed on the stack. To keep the compiler from making stack copies when
8//! moving this struct around, we use a Box to keep the values on the heap. We also pin the box to
9//! make sure that the contents can't be pulled out of the box and moved.
10
11#[cfg(not(feature = "no-memory-hardening"))]
12#[global_allocator]
13static ALLOC: ZeroizingAllocator<std::alloc::System> = ZeroizingAllocator(std::alloc::System);
14
15mod aes;
16mod enc_string;
17pub use enc_string::{EncString, UnsignedSharedKey};
18mod error;
19pub use error::CryptoError;
20pub(crate) use error::Result;
21mod fingerprint;
22pub use fingerprint::fingerprint;
23mod keys;
24pub use keys::*;
25mod rsa;
26pub use crate::rsa::RsaKeyPair;
27mod util;
28pub use util::{generate_random_alphanumeric, generate_random_bytes, pbkdf2};
29mod wordlist;
30pub use wordlist::EFF_LONG_WORD_LIST;
31mod store;
32pub use store::{KeyStore, KeyStoreContext};
33mod cose;
34mod traits;
35mod xchacha20;
36pub use traits::{Decryptable, Encryptable, IdentifyKey, KeyId, KeyIds};
37pub use zeroizing_alloc::ZeroAlloc as ZeroizingAllocator;
38
39#[cfg(feature = "uniffi")]
40uniffi::setup_scaffolding!();
41
42#[cfg(feature = "uniffi")]
43mod uniffi_support;