use crate::wallets::structures::Wallet; impl Wallet { pub fn has_valid_public_key_bytes(public_key_bytes: &[u8]) -> bool { // Public keys must match the FN-DSA public key byte length exactly. if public_key_bytes.len() != Self::PUBLIC_KEY_LENGTH { return false; } // FN-DSA encoded public keys carry the security parameter in the first byte. public_key_bytes[0] == Self::FN_DSA_LOGN as u8 } pub fn short_address_validation(short_address: &str) -> bool { // Accept either canonical short-address bytes or vanity-address bytes. let short_address_bytes = match Self::short_address_to_bytes(short_address) .or_else(|| Self::vanity_address_to_bytes(short_address)) { Some(bytes) => bytes, None => return false, }; // The final byte must match the currently compiled network. short_address_bytes[Self::SHORT_ADDRESS_BYTES_LENGTH - 1] == Self::current_network_byte() } }