diff --git a/components/web_discovery/browser/anonymous_credentials/data.rs b/components/web_discovery/browser/anonymous_credentials/data.rs index fd87748c6249..0a297be3664a 100644 --- a/components/web_discovery/browser/anonymous_credentials/data.rs +++ b/components/web_discovery/browser/anonymous_credentials/data.rs @@ -79,7 +79,7 @@ pub(crate) struct ECPProof { pub struct CredentialBIG(pub(crate) BIG); /// A result of starting the "join" process to acquire credentials. -pub struct StartJoinResult { +pub struct JoinInitialization { /// Private key which should be persisted for finishing the "join" /// process and future signing requests. pub gsk: CredentialBIG, diff --git a/components/web_discovery/browser/anonymous_credentials/join.rs b/components/web_discovery/browser/anonymous_credentials/join.rs index 96ceb816c63f..31d16855fc0b 100644 --- a/components/web_discovery/browser/anonymous_credentials/join.rs +++ b/components/web_discovery/browser/anonymous_credentials/join.rs @@ -15,8 +15,8 @@ use brave_miracl::{ }; use super::data::{ - ecp2_to_compat_bytes, CredentialBIG, ECPProof, GroupPublicKey, JoinRequest, JoinResponse, - StartJoinResult, UserCredentials, BIG_SIZE, ECP2_COMPAT_SIZE, ECP_SIZE, + ecp2_to_compat_bytes, CredentialBIG, ECPProof, GroupPublicKey, JoinInitialization, JoinRequest, + JoinResponse, UserCredentials, BIG_SIZE, ECP2_COMPAT_SIZE, ECP_SIZE, }; use super::util::{ ecp_challenge_equals, hash256, pair_normalized_triple_ate, random_mod_curve_order, @@ -104,7 +104,7 @@ fn verify_aux_fast(a: &ECP, b: &ECP, c: &ECP, d: &ECP, x: &ECP2, y: &ECP2, rng: w.equals(&fp12_one) } -pub fn start_join(rng: &mut RAND, challenge: &[u8]) -> StartJoinResult { +pub fn start_join(rng: &mut RAND, challenge: &[u8]) -> JoinInitialization { let gsk = random_mod_curve_order(rng); let q = g1mul(&G1_ECP, &gsk); @@ -112,7 +112,7 @@ pub fn start_join(rng: &mut RAND, challenge: &[u8]) -> StartJoinResult { let proof = make_ecp_proof(rng, &q, &gsk, &challenge_hash); - StartJoinResult { gsk: CredentialBIG(gsk), join_msg: JoinRequest { q, proof } } + JoinInitialization { gsk: CredentialBIG(gsk), join_msg: JoinRequest { q, proof } } } pub fn finish_join( diff --git a/components/web_discovery/browser/anonymous_credentials/lib.rs b/components/web_discovery/browser/anonymous_credentials/lib.rs index 0912eb60612d..81ac79068da2 100644 --- a/components/web_discovery/browser/anonymous_credentials/lib.rs +++ b/components/web_discovery/browser/anonymous_credentials/lib.rs @@ -54,7 +54,7 @@ pub type Result = std::result::Result; #[cxx::bridge(namespace = "web_discovery")] mod ffi { - struct StartJoinResult { + struct JoinInitialization { gsk: Vec, join_request: Vec, } @@ -99,7 +99,10 @@ mod ffi { fn new_anonymous_credentials_manager() -> Box; fn new_anonymous_credentials_with_fixed_seed() -> Box; - fn start_join(self: &mut AnonymousCredentialsManager, challenge: &[u8]) -> StartJoinResult; + fn start_join( + self: &mut AnonymousCredentialsManager, + challenge: &[u8], + ) -> JoinInitialization; fn finish_join( self: &mut AnonymousCredentialsManager, public_key: &GroupPublicKey, @@ -219,9 +222,9 @@ fn new_anonymous_credentials_with_fixed_seed() -> Box StartJoinResult { + fn start_join(&mut self, challenge: &[u8]) -> JoinInitialization { let result = self.0.start_join(challenge); - StartJoinResult { + JoinInitialization { gsk: result.gsk.to_bytes().to_vec(), join_request: result.join_msg.to_bytes().to_vec(), } diff --git a/components/web_discovery/browser/anonymous_credentials/manager.rs b/components/web_discovery/browser/anonymous_credentials/manager.rs index f364f5ff38c5..b9d07708b856 100644 --- a/components/web_discovery/browser/anonymous_credentials/manager.rs +++ b/components/web_discovery/browser/anonymous_credentials/manager.rs @@ -37,7 +37,7 @@ impl CredentialManager { /// Creates a "join" requests to be sent to the credential issuer, /// for a given challenge. - pub fn start_join(&mut self, challenge: &[u8]) -> StartJoinResult { + pub fn start_join(&mut self, challenge: &[u8]) -> JoinInitialization { start_join(&mut self.rng, challenge) }