diff --git a/components/watcher/src/watcher.rs b/components/watcher/src/watcher.rs index d8937b9f..fa357b4b 100644 --- a/components/watcher/src/watcher.rs +++ b/components/watcher/src/watcher.rs @@ -309,7 +309,7 @@ impl WatcherData { Ok(()) } - /// Forward query to random registered witness and save its response to mailbox. + /// Forward query to registered witnesses and save its response to mailbox. async fn forward_query(&self, id: &IdentifierPrefix) -> Result<(), ActorError> { let witnesses = self.get_witnesses_for_prefix(&id)?; for witness in witnesses { diff --git a/components/watcher/watcher.yml b/components/watcher/watcher.yml index bc52c152..10e9ecea 100644 --- a/components/watcher/watcher.yml +++ b/components/watcher/watcher.yml @@ -1,6 +1,9 @@ db_path: "db/" public_url: "http://localhost:3236/" -seed: "Alntkt3u6dDgiQxTATr01dy8M72uuaZEf9eTdM-70Gk8" +seed: "Alntkt3u6dDgiQxTATr01dy8M72uuaZEf9eTdM-70Gk8" # Private key in CESR format + # used by the watcher. If this field + # is not provided, a randomly generated + # key pair will be used. http_port: 3236 initial_oobis: [] escrow_config: diff --git a/components/witness/witness.yml b/components/witness/witness.yml index a4e9cba9..e1a04140 100644 --- a/components/witness/witness.yml +++ b/components/witness/witness.yml @@ -1,6 +1,9 @@ db_path: "db/" http_port: 3232 public_url: "http://localhost:3232/" -seed: "ArwXoACJgOleVZ2PY7kXn7rA0II0mHYDhc6WrBH8fDAc" +seed: "ArwXoACJgOleVZ2PY7kXn7rA0II0mHYDhc6WrBH8fDAc" # Private key in CESR format + # used by the witness. If this field + # is not provided, a randomly generated + # key pair will be used. escrow_config: default_timeout: 60 diff --git a/keriox_core/src/prefix/seed.rs b/keriox_core/src/prefix/seed.rs index cd760291..b08eb791 100644 --- a/keriox_core/src/prefix/seed.rs +++ b/keriox_core/src/prefix/seed.rs @@ -161,3 +161,19 @@ fn test_derive_keypair() -> Result<(), Error> { Ok(()) } + +#[test] +fn test_derive_from_seed() { + use cesrox::primitives::codes::seed::SeedCode; + use rand::rngs::OsRng; + let ed_keypair = ed25519_dalek::Keypair::generate(&mut OsRng); + + let sp = SeedPrefix::new( + SeedCode::RandomSeed256Ed25519, + ed_keypair.secret.as_bytes().to_vec(), + ); + + let (derived_pub_key, derived_priv_key) = sp.derive_key_pair().unwrap(); + assert_eq!(derived_pub_key.key(), ed_keypair.public.to_bytes()); + assert_eq!(derived_priv_key.key(), ed_keypair.secret.to_bytes()); +}