more refactor
This commit is contained in:
		| @@ -41,6 +41,9 @@ pub const SHARED_SECRET_LENGTH: usize = 32; | ||||
| /// Length of a shared secret in bytes after encoding to base64url | ||||
| #[allow(dead_code)] | ||||
| pub const SHARED_SECRET_LENGTH_ENCODED: usize = 43; | ||||
| /// Length of a route id in bytes | ||||
| #[allow(dead_code)] | ||||
| pub const ROUTE_ID_LENGTH: usize = 32; | ||||
|  | ||||
| ////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| @@ -260,3 +263,4 @@ byte_array_type!(Signature, SIGNATURE_LENGTH); | ||||
| byte_array_type!(PublicKeyDistance, PUBLIC_KEY_LENGTH); | ||||
| byte_array_type!(Nonce, NONCE_LENGTH); | ||||
| byte_array_type!(SharedSecret, SHARED_SECRET_LENGTH); | ||||
| byte_array_type!(RouteId, ROUTE_ID_LENGTH); | ||||
|   | ||||
| @@ -11,6 +11,7 @@ use rkyv::{Archive as RkyvArchive, Deserialize as RkyvDeserialize, Serialize as | ||||
| pub type CryptoKind = FourCC; | ||||
|  | ||||
| /// Sort best crypto kinds first | ||||
| /// Better crypto kinds are 'less', ordered toward the front of a list | ||||
| pub fn compare_crypto_kind(a: &CryptoKind, b: &CryptoKind) -> cmp::Ordering { | ||||
|     let a_idx = VALID_CRYPTO_KINDS.iter().position(|k| k == a); | ||||
|     let b_idx = VALID_CRYPTO_KINDS.iter().position(|k| k == b); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user