From 4a5698ad2628bd038f7d4f48130e65b919415b4d Mon Sep 17 00:00:00 2001 From: diogo464 Date: Wed, 25 Feb 2026 18:44:15 +0000 Subject: updated decode key const to allow use outside crate --- src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 72fb58f..5a50355 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,10 +24,8 @@ pub use view::*; pub use ipnet; #[doc(hidden)] -pub const fn __decode_wg_key_const( - encoded: &str, -) -> [u8; netlink_packet_wireguard::WireguardAttribute::WG_KEY_LEN] { - key::decode_wg_key_const(encoded) +pub const fn __decode_wg_key_const(encoded: &str) -> Key { + Key::new_unchecked_from(key::decode_wg_key_const(encoded)) } /// Creates a [`Key`] from a canonical WireGuard base64 literal at compile time. @@ -48,7 +46,7 @@ pub const fn __decode_wg_key_const( #[macro_export] macro_rules! key { ($value:literal) => { - $crate::Key::new_unchecked_from($crate::__decode_wg_key_const($value)) + $crate::__decode_wg_key_const($value) }; } -- cgit