diff --git a/crates/common/src/hashchain.rs b/crates/common/src/hashchain.rs index a6593137..5ab7571f 100644 --- a/crates/common/src/hashchain.rs +++ b/crates/common/src/hashchain.rs @@ -8,10 +8,7 @@ use std::{ use crate::{ keys::VerifyingKey, - operation::{ - AddDataArgs, CreateAccountArgs, KeyOperationArgs, Operation, RegisterServiceArgs, - ServiceChallenge, ServiceChallengeInput, - }, + operation::{AddDataArgs, KeyOperationArgs, Operation}, tree::{Digest, Hasher}, }; @@ -69,16 +66,6 @@ impl Hashchain { Ok(hc) } - pub fn register_service(id: String, challenge: ServiceChallenge) -> Result { - let mut hc = Hashchain::empty(id.clone()); - let operation = Operation::RegisterService(RegisterServiceArgs { - id, - creation_gate: challenge, - }); - hc.perform_operation(operation)?; - Ok(hc) - } - pub fn empty(id: String) -> Self { Self { id, diff --git a/crates/common/src/test_utils.rs b/crates/common/src/test_utils.rs index 626fe722..703a397b 100644 --- a/crates/common/src/test_utils.rs +++ b/crates/common/src/test_utils.rs @@ -50,10 +50,10 @@ impl TestTreeState { pub fn register_service(&mut self, service_id: String) -> Service { let service_key = create_mock_signing_key(); - let hashchain = Hashchain::register_service( + let hashchain = Hashchain::from_operation(Operation::new_register_service( service_id.clone(), ServiceChallenge::from(service_key.clone()), - ) + )) .unwrap(); let key_hash = hashchain.get_keyhash(); diff --git a/crates/common/src/tree.rs b/crates/common/src/tree.rs index fda2c349..730525b7 100644 --- a/crates/common/src/tree.rs +++ b/crates/common/src/tree.rs @@ -468,9 +468,7 @@ where self.insert(account_key_hash, new_account_chain)?, )) } - Operation::RegisterService(RegisterServiceArgs { - id, creation_gate, .. - }) => { + Operation::RegisterService(RegisterServiceArgs { id, .. }) => { let hashed_id = Digest::hash(id); let key_hash = KeyHash::with::(hashed_id); @@ -483,7 +481,7 @@ where }; debug!("creating new hashchain for service id {}", id); - let chain = Hashchain::register_service(id.clone(), creation_gate.clone())?; + let chain = Hashchain::from_operation(operation.clone())?; Ok(Proof::Insert( self.insert(KeyHash::with::(hashed_id), chain)?,