diff --git a/server/src/main.rs b/server/src/main.rs index 0e06b98..19bffc8 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -535,7 +535,7 @@ async fn serve( num_candidates ); - let public_key = wireguard_control::Key::from_base64(&config.private_key)?.generate_public(); + let public_key = wireguard_control::Key::from_base64(&config.private_key)?.get_public(); let db = Arc::new(Mutex::new(conn)); let endpoints = spawn_endpoint_refresher(interface, network); spawn_expired_invite_sweeper(db.clone()); @@ -720,7 +720,7 @@ mod tests { async fn test_incorrect_public_key() -> Result<(), Error> { let server = test::Server::new()?; - let key = Key::generate_private().generate_public(); + let key = Key::generate_private().get_public(); let path = if cfg!(feature = "v6-test") { format!("http://[{}]/v1/admin/peers", test::WG_MANAGE_PEER_IP) diff --git a/server/src/test.rs b/server/src/test.rs index 178a05e..41386b6 100644 --- a/server/src/test.rs +++ b/server/src/test.rs @@ -83,7 +83,7 @@ impl Server { let test_dir = tempfile::tempdir()?; let test_dir_path = test_dir.path(); - let public_key = Key::generate_private().generate_public(); + let public_key = Key::generate_private().get_public(); // Run the init wizard to initialize the database and create basic // cidrs and peers. let interface = "test".to_string(); diff --git a/shared/src/interface_config.rs b/shared/src/interface_config.rs index 55c20d1..c359610 100644 --- a/shared/src/interface_config.rs +++ b/shared/src/interface_config.rs @@ -139,7 +139,7 @@ impl InterfaceConfig { impl InterfaceInfo { pub fn public_key(&self) -> Result { Ok(wireguard_control::Key::from_base64(&self.private_key)? - .generate_public() + .get_public() .to_base64()) } } diff --git a/wireguard-control/src/backends/userspace.rs b/wireguard-control/src/backends/userspace.rs index 23a3225..3e34039 100644 --- a/wireguard-control/src/backends/userspace.rs +++ b/wireguard-control/src/backends/userspace.rs @@ -149,7 +149,7 @@ impl ConfigParser { .device_info .private_key .as_ref() - .map(|k| k.generate_public()); + .map(|k| k.get_public()); }, "listen_port" => { self.device_info.listen_port = Some(value.parse().map_err(|_| InvalidData)?) diff --git a/wireguard-control/src/key.rs b/wireguard-control/src/key.rs index 55ee368..5c696ac 100644 --- a/wireguard-control/src/key.rs +++ b/wireguard-control/src/key.rs @@ -56,7 +56,7 @@ impl Key { /// Generates a public key for this private key. #[must_use] - pub fn generate_public(&self) -> Self { + pub fn get_public(&self) -> Self { use curve25519_dalek::scalar::Scalar; use curve25519_dalek::constants::ED25519_BASEPOINT_TABLE; @@ -115,7 +115,7 @@ mod test { let pubkey = "DD5yKRfzExcV5+kDnTroDgCU15latdMjiQ59j1hEuk8="; let private = Key::from_base64(privkey).unwrap(); - let public = Key::generate_public(&private); + let public = Key::get_public(&private); assert_eq!(public.to_base64(), pubkey); } @@ -164,12 +164,12 @@ impl fmt::Debug for Key { impl KeyPair { pub fn generate() -> Self { let private = Key::generate_private(); - let public = private.generate_public(); + let public = private.get_public(); KeyPair { private, public } } pub fn from_private(key: Key) -> Self { - let public = key.generate_public(); + let public = key.get_public(); KeyPair { private: key, public, @@ -216,7 +216,7 @@ mod tests { use crate::key::Key; let privkey = Key::generate_private(); - let pubkey = privkey.generate_public(); + let pubkey = privkey.get_public(); assert_ne!(privkey, pubkey); }