π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Share Museum account KDF fixture
Manav Rathifb37689b7a73
diff --git a/rust/crates/contacts/tests/support/auth.rs b/rust/crates/contacts/tests/support/auth.rsindex c37e5a90fa..093c679bee 100644--- a/rust/crates/contacts/tests/support/auth.rs+++ b/rust/crates/contacts/tests/support/auth.rs@@ -14,7 +14,7 @@ use ente_core::{auth::{SrpSession, generate_srp_setup_with_login_key},crypto::{Key, SecretKey, SecretVec, decode_b64, encode_b64, kdf, secretbox},};-use ente_test_support::HARDCODED_OTT;+use ente_test_support::{HARDCODED_OTT, account_fixture};use hmac::{Hmac, KeyInit, Mac};use sha1::Sha1;use uuid::Uuid;@@ -24,12 +24,6 @@ use crate::CLIENT_PACKAGE;type HmacSha1 = Hmac<Sha1>;-const FIXTURE_PASSWORD: &str = "space-e2e-fixture-password";-// Reuse Space's Argon2id(FIXTURE_PASSWORD, 16 Γ 0x42, 256 MiB, 16 ops).-const FIXTURE_KEK: &str = "HuSa1eJkbjlGQ/Th/Qwf7/ezjTSMrPcc1ZHdAfVup4c=";-const FIXTURE_KEK_SALT: &str = "QkJCQkJCQkJCQkJCQkJCQg==";-const FIXTURE_MEM_LIMIT: i32 = 268_435_456;-const FIXTURE_OPS_LIMIT: i32 = 16;const SRP_A_LEN: usize = 512;#[derive(Debug, Clone)]@@ -162,7 +156,7 @@ pub async fn create_fixture_account(endpoint: &str, email_prefix: &str) -> TestAlet auth_token = verification.token.expect("signup should return a token");client.set_auth_token(Some(auth_token.clone()));- let kek = Key::try_from_slice(&decode_b64(FIXTURE_KEK).unwrap()).unwrap();+ let kek = Key::try_from_slice(&decode_b64(account_fixture::KEK).unwrap()).unwrap();let master_key = Key::generate();let recovery_key = Key::generate();let secret_key = SecretKey::generate();@@ -172,15 +166,15 @@ pub async fn create_fixture_account(endpoint: &str, email_prefix: &str) -> TestAlet encrypted_master_with_recovery = secretbox::encrypt(master_key.as_bytes(), &recovery_key);let encrypted_recovery_with_master = secretbox::encrypt(recovery_key.as_bytes(), &master_key);let key_attributes = KeyAttributes {- kek_salt: FIXTURE_KEK_SALT.into(),+ kek_salt: account_fixture::KEK_SALT.into(),kek_hash: None,encrypted_key: encode_b64(&encrypted_master_key.encrypted_data),key_decryption_nonce: encode_b64(encrypted_master_key.nonce.as_bytes()),public_key: encode_b64(public_key.as_bytes()),encrypted_secret_key: encode_b64(&encrypted_secret_key.encrypted_data),secret_key_decryption_nonce: encode_b64(encrypted_secret_key.nonce.as_bytes()),- mem_limit: FIXTURE_MEM_LIMIT,- ops_limit: FIXTURE_OPS_LIMIT,+ mem_limit: account_fixture::MEM_LIMIT,+ ops_limit: account_fixture::OPS_LIMIT,master_key_encrypted_with_recovery_key: Some(encode_b64(&encrypted_master_with_recovery.encrypted_data,)),@@ -233,7 +227,7 @@ pub async fn create_fixture_account(endpoint: &str, email_prefix: &str) -> TestATestAccount {email,- password: FIXTURE_PASSWORD.into(),+ password: account_fixture::PASSWORD.into(),user_id: verification.id,auth_token,master_key: master_key.as_bytes().to_vec(),diff --git a/rust/crates/test-support/src/lib.rs b/rust/crates/test-support/src/lib.rsindex 65a0de2bf0..a0e01f2b92 100644--- a/rust/crates/test-support/src/lib.rs+++ b/rust/crates/test-support/src/lib.rs@@ -21,3 +21,13 @@ pub const HARDCODED_OTT: &str = "123456";/// See [`HARDCODED_OTT`].pub const HARDCODED_OTT_EMAIL_SUFFIX: &str = "@example.org";++/// Precomputed sensitive KDF fixture for Museum accounts.+pub mod account_fixture {+ pub const PASSWORD: &str = "museum-account-fixture-password";+ // Argon2id(PASSWORD, 16 Γ 0x4d, 256 MiB, 16 ops).+ pub const KEK: &str = "EwUWye3Qiu3bep2oujaO8oJvUgIdn0DSOk2g0oZ+AWs=";+ pub const KEK_SALT: &str = "TU1NTU1NTU1NTU1NTU1NTQ==";+ pub const MEM_LIMIT: i32 = 268_435_456;+ pub const OPS_LIMIT: i32 = 16;+}diff --git a/rust/space/tests/support/auth.rs b/rust/space/tests/support/auth.rsindex c25be172ad..bf19c2e97f 100644--- a/rust/space/tests/support/auth.rs+++ b/rust/space/tests/support/auth.rs@@ -4,16 +4,11 @@ use ente_core::{auth::{SrpSession, generate_srp_setup_with_login_key},crypto::{Key, SecretKey, decode_b64, encode_b64, kdf, secretbox},};-use ente_test_support::{HARDCODED_OTT, HARDCODED_OTT_EMAIL_SUFFIX};+use ente_test_support::{HARDCODED_OTT, HARDCODED_OTT_EMAIL_SUFFIX, account_fixture};use uuid::Uuid;use super::{CLIENT_PACKAGE, USER_AGENT};-// Argon2id("space-e2e-fixture-password", 16 Γ 0x42, 256 MiB, 16 ops).-const FIXTURE_KEK: &str = "HuSa1eJkbjlGQ/Th/Qwf7/ezjTSMrPcc1ZHdAfVup4c=";-const FIXTURE_KEK_SALT: &str = "QkJCQkJCQkJCQkJCQkJCQg==";-const FIXTURE_MEM_LIMIT: i32 = 268_435_456;-const FIXTURE_OPS_LIMIT: i32 = 16;const SRP_A_LEN: usize = 512;pub struct TestAccount {@@ -41,7 +36,7 @@ pub async fn create_account(endpoint: &str, email_prefix: &str) -> TestAccount {let auth_token = verification.token.expect("signup should return a token");client.set_auth_token(Some(auth_token.clone()));- let kek = Key::try_from_slice(&decode_b64(FIXTURE_KEK).unwrap()).unwrap();+ let kek = Key::try_from_slice(&decode_b64(account_fixture::KEK).unwrap()).unwrap();let master_key = Key::generate();let recovery_key = Key::generate();let secret_key = SecretKey::generate();@@ -51,15 +46,15 @@ pub async fn create_account(endpoint: &str, email_prefix: &str) -> TestAccount {let encrypted_master_with_recovery = secretbox::encrypt(master_key.as_bytes(), &recovery_key);let encrypted_recovery_with_master = secretbox::encrypt(recovery_key.as_bytes(), &master_key);let key_attributes = KeyAttributes {- kek_salt: FIXTURE_KEK_SALT.into(),+ kek_salt: account_fixture::KEK_SALT.into(),kek_hash: None,encrypted_key: encode_b64(&encrypted_master_key.encrypted_data),key_decryption_nonce: encode_b64(encrypted_master_key.nonce.as_bytes()),public_key: encode_b64(public_key.as_bytes()),encrypted_secret_key: encode_b64(&encrypted_secret_key.encrypted_data),secret_key_decryption_nonce: encode_b64(encrypted_secret_key.nonce.as_bytes()),- mem_limit: FIXTURE_MEM_LIMIT,- ops_limit: FIXTURE_OPS_LIMIT,+ mem_limit: account_fixture::MEM_LIMIT,+ ops_limit: account_fixture::OPS_LIMIT,master_key_encrypted_with_recovery_key: Some(encode_b64(&encrypted_master_with_recovery.encrypted_data,)),