From 929d089e567389d7495afb075e58e7be1daf958b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Sun, 25 Feb 2024 11:57:04 +0100 Subject: [PATCH] Add a type for the counter id --- src/ikm.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ikm.rs b/src/ikm.rs index 080fb70..24a63bb 100644 --- a/src/ikm.rs +++ b/src/ikm.rs @@ -6,6 +6,7 @@ use std::time::{Duration, SystemTime}; const IKM_STRUCT_SIZE: usize = 57; const IKM_CONTENT_SIZE: usize = 32; +pub(crate) type CounterId = u32; pub(crate) type IkmId = u32; #[derive(Debug)] @@ -66,7 +67,7 @@ impl InputKeyMaterial { #[derive(Debug, Default)] pub struct InputKeyMaterialList { ikm_lst: Vec, - id_counter: u32, + id_counter: CounterId, } impl InputKeyMaterialList { @@ -119,7 +120,7 @@ impl InputKeyMaterialList { } Ok(Self { ikm_lst, - id_counter: u32::from_le_bytes(data[0..4].try_into().unwrap()), + id_counter: CounterId::from_le_bytes(data[0..4].try_into().unwrap()), }) }