π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Flatten crypto/impl_pure into crypto
Manav Rathie454c4ca39d4
diff --git a/rust/crates/core/src/crypto/impl_pure/argon.rs b/rust/crates/core/src/crypto/argon.rssimilarity index 99%rename from rust/crates/core/src/crypto/impl_pure/argon.rsrename to rust/crates/core/src/crypto/argon.rsindex 94b2b942c6..0fe7b201d3 100644--- a/rust/crates/core/src/crypto/impl_pure/argon.rs+++ b/rust/crates/core/src/crypto/argon.rs@@ -339,7 +339,7 @@ pub fn derive_key_from_b64_salt(#[cfg(test)]mod tests {use super::*;- use crate::crypto::impl_pure::keys;+ use crate::crypto::keys;#[test]fn test_derive_key() {diff --git a/rust/crates/core/src/crypto/impl_pure/blob.rs b/rust/crates/core/src/crypto/blob.rssimilarity index 99%rename from rust/crates/core/src/crypto/impl_pure/blob.rsrename to rust/crates/core/src/crypto/blob.rsindex c8d2aa0538..8c6e102dc6 100644--- a/rust/crates/core/src/crypto/impl_pure/blob.rs+++ b/rust/crates/core/src/crypto/blob.rs@@ -194,7 +194,7 @@ pub fn decrypt_json_combined<T: serde::de::DeserializeOwned>(#[cfg(test)]mod tests {use super::*;- use crate::crypto::impl_pure::keys;+ use crate::crypto::keys;#[test]fn test_encrypt_decrypt() {diff --git a/rust/crates/core/src/crypto/impl_pure/hash.rs b/rust/crates/core/src/crypto/hash.rssimilarity index 100%rename from rust/crates/core/src/crypto/impl_pure/hash.rsrename to rust/crates/core/src/crypto/hash.rsdiff --git a/rust/crates/core/src/crypto/impl_pure/mod.rs b/rust/crates/core/src/crypto/impl_pure/mod.rsdeleted file mode 100644index af4ecaaa32..0000000000--- a/rust/crates/core/src/crypto/impl_pure/mod.rs+++ /dev/null@@ -1,27 +0,0 @@-//! Pure Rust cryptographic implementation.-//!-//! This module provides cryptographic operations using pure Rust crates from RustCrypto.-//! All operations maintain byte-for-byte compatibility with the libsodium implementation.--use std::sync::Once;--pub mod argon;-pub mod blob;-pub mod hash;-pub mod kdf;-pub mod keys;-pub mod sealed;-pub mod secretbox;-pub mod stream;--static INIT: Once = Once::new();--/// Initialize crypto backend. For pure Rust implementation, this is a no-op.-///-/// This function is provided for API compatibility with the libsodium backend.-pub fn init() -> crate::crypto::Result<()> {- INIT.call_once(|| {- // Pure Rust implementation doesn't require initialization- });- Ok(())-}diff --git a/rust/crates/core/src/crypto/impl_pure/kdf.rs b/rust/crates/core/src/crypto/kdf.rssimilarity index 100%rename from rust/crates/core/src/crypto/impl_pure/kdf.rsrename to rust/crates/core/src/crypto/kdf.rsdiff --git a/rust/crates/core/src/crypto/impl_pure/keys.rs b/rust/crates/core/src/crypto/keys.rssimilarity index 100%rename from rust/crates/core/src/crypto/impl_pure/keys.rsrename to rust/crates/core/src/crypto/keys.rsdiff --git a/rust/crates/core/src/crypto/mod.rs b/rust/crates/core/src/crypto/mod.rsindex e66870ecdf..5c645365ad 100644--- a/rust/crates/core/src/crypto/mod.rs+++ b/rust/crates/core/src/crypto/mod.rs@@ -61,6 +61,7 @@ use base64::{Engine,engine::general_purpose::{STANDARD as BASE64, URL_SAFE as BASE64_URL_SAFE},};+use std::sync::Once;use std::{fmt,ops::{Deref, DerefMut},@@ -69,14 +70,29 @@ use zeroize::Zeroize;mod error;-// Pure Rust implementation-mod impl_pure;--// Re-export the pure Rust implementation-pub use impl_pure::*;+pub mod argon;+pub mod blob;+pub mod hash;+pub mod kdf;+pub mod keys;+pub mod sealed;+pub mod secretbox;+pub mod stream;pub use error::{CryptoError, Result};+static INIT: Once = Once::new();++/// Initialize crypto backend. For the pure Rust implementation, this is a no-op.+///+/// This function is provided for API compatibility with the libsodium backend.+pub fn init() -> Result<()> {+ INIT.call_once(|| {+ // Pure Rust implementation doesn't require initialization+ });+ Ok(())+}+/// A heap-allocated byte buffer for sensitive material.////// `SecretVec` zeroizes its contents on drop and requires an explicitdiff --git a/rust/crates/core/src/crypto/impl_pure/sealed.rs b/rust/crates/core/src/crypto/sealed.rssimilarity index 99%rename from rust/crates/core/src/crypto/impl_pure/sealed.rsrename to rust/crates/core/src/crypto/sealed.rsindex 19028b3b64..eca34b7bb6 100644--- a/rust/crates/core/src/crypto/impl_pure/sealed.rs+++ b/rust/crates/core/src/crypto/sealed.rs@@ -220,7 +220,7 @@ pub fn open(ciphertext: &[u8], recipient_pk: &[u8], recipient_sk: &[u8]) -> Resu#[cfg(test)]mod tests {use super::*;- use crate::crypto::impl_pure::keys;+ use crate::crypto::keys;#[test]fn test_seal_open() {diff --git a/rust/crates/core/src/crypto/impl_pure/secretbox.rs b/rust/crates/core/src/crypto/secretbox.rssimilarity index 100%rename from rust/crates/core/src/crypto/impl_pure/secretbox.rsrename to rust/crates/core/src/crypto/secretbox.rsdiff --git a/rust/crates/core/src/crypto/impl_pure/stream.rs b/rust/crates/core/src/crypto/stream.rssimilarity index 100%rename from rust/crates/core/src/crypto/impl_pure/stream.rsrename to rust/crates/core/src/crypto/stream.rs