diff --git a/Cargo.lock b/Cargo.lock index 98adf0e..b2fa37e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1393,7 +1393,6 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rrr" version = "0.1.0" -source = "git+https://github.com/recursive-record-registry/rrr.git?rev=5f11db585aabb6a6feaeb9fcd8ec79b93b9854f9#5f11db585aabb6a6feaeb9fcd8ec79b93b9854f9" dependencies = [ "aes-gcm", "argon2", @@ -1414,6 +1413,7 @@ dependencies = [ "proptest", "proptest-arbitrary-interop", "proptest-derive", + "rand", "serde", "serde_with", "sha2", diff --git a/Cargo.toml b/Cargo.toml index 2daee6a..5545a6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ color-eyre = "0.6.3" ed25519-dalek = { version = "2.1.1", features = ["rand_core", "pem"] } futures = "0.3.30" include_dir = { version = "0.7.4", features = ["nightly"] } -rrr = { git = "https://github.com/recursive-record-registry/rrr.git", rev = "5f11db585aabb6a6feaeb9fcd8ec79b93b9854f9" } +rrr = { git = "https://github.com/recursive-record-registry/rrr.git", rev = "782db4752ee74fc56199151e5b261f33b32cfbfa" } serde = { version = "1.0.203", features = ["derive"] } serde_bytes = "0.11.14" serde_with = "3.8.1" diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index 1cf4281..465a98a 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -53,7 +53,8 @@ impl Command { let root_predecessor_nonce = output_registry .config .kdf - .get_root_record_predecessor_nonce(); + .get_root_record_predecessor_nonce() + .clone(); // TODO: Verify target registry keys diff --git a/src/lib.rs b/src/lib.rs index e0bfbd1..d3be86e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,10 +61,10 @@ pub fn make_recursive<'a>( &input_registry.signing_keys, &hashed_key, &output_record, - 0.into(), // TODO - 0, // TODO - &[], // TODO - Some(&EncryptionAlgorithm::A256GCM), // TODO + 0.into(), // TODO + 0, // TODO + &[], // TODO + Some(&EncryptionAlgorithm::Aes256Gcm), // TODO force, ) .await?; diff --git a/src/owned/registry.rs b/src/owned/registry.rs index b0d7ffe..330c761 100644 --- a/src/owned/registry.rs +++ b/src/owned/registry.rs @@ -6,8 +6,7 @@ use rrr::crypto::kdf::KdfAlgorithm; use rrr::crypto::password_hash::{argon2::Argon2Params, PasswordHashAlgorithm}; use rrr::crypto::signature::{SigningKey, SigningKeyEd25519}; use rrr::registry::{ - ConfigParam, OutputLengthInBytes, RegistryConfig, RegistryConfigHash, RegistryConfigKdf, - SuccessionNonceLengthInBytes, + RegistryConfig, RegistryConfigHash, RegistryConfigKdf, }; use rrr::utils::serde::Secret; use rrr::{crypto::encryption::EncryptionAlgorithm, record::RecordKey}; @@ -45,7 +44,7 @@ impl OwnedRegistryConfig { pub fn get_root_record_key(&self) -> RecordKey { RecordKey { record_name: Default::default(), - predecessor_nonce: self.kdf.get_root_record_predecessor_nonce(), + predecessor_nonce: self.kdf.get_root_record_predecessor_nonce().clone(), } } } @@ -160,18 +159,13 @@ impl OwnedRegistry { let config = OwnedRegistryConfig { hash: RegistryConfigHash { - algorithm: PasswordHashAlgorithm::Argon2( - Argon2Params::default_with_random_pepper_of_recommended_length(&mut csprng), - ), - output_length_in_bytes: ConfigParam::<OutputLengthInBytes>::try_from(32).unwrap(), + algorithm: PasswordHashAlgorithm::Argon2(Argon2Params::default()), + output_length_in_bytes: Default::default(), }, - kdf: RegistryConfigKdf { - algorithm: KdfAlgorithm::Hkdf(HkdfParams::default()), - succession_nonce_length_in_bytes: - ConfigParam::<SuccessionNonceLengthInBytes>::try_from(32).unwrap(), - file_name_length_in_bytes: ConfigParam::try_from(8).unwrap(), - }, - encryption_algorithm: EncryptionAlgorithm::A256GCM, + kdf: RegistryConfigKdf::builder() + .with_algorithm(KdfAlgorithm::Hkdf(HkdfParams::default())) + .build_with_random_root_predecessor_nonce(csprng)?, + encryption_algorithm: EncryptionAlgorithm::Aes256Gcm, root_record_path: PathBuf::from("root"), signing_key_paths, };