refactor(crypto): move Integrable trait to arbiter-crypto

This commit is contained in:
CleverWild
2026-06-29 16:58:35 +02:00
parent b843105533
commit 647f0c8519
3 changed files with 8 additions and 4 deletions

View File

@@ -0,0 +1,6 @@
use crate::hashing::Hashable;
pub trait Integrable: Hashable {
const KIND: &'static str;
const VERSION: i32 = 1;
}

View File

@@ -1,6 +1,7 @@
#[cfg(feature = "authn")] #[cfg(feature = "authn")]
pub mod authn; pub mod authn;
pub mod hashing; pub mod hashing;
pub mod integrity;
#[cfg(feature = "safecell")] #[cfg(feature = "safecell")]
pub mod safecell; pub mod safecell;

View File

@@ -52,10 +52,7 @@ pub const INTEGRITY_SUBKEY_TAG: &[u8] = b"arbiter/db-integrity-key/v1";
pub type HmacSha256 = Hmac<Sha256>; pub type HmacSha256 = Hmac<Sha256>;
pub trait Integrable: Hashable { pub use arbiter_crypto::integrity::Integrable;
const KIND: &'static str;
const VERSION: i32 = 1;
}
fn payload_hash(payload: &impl Hashable) -> [u8; 32] { fn payload_hash(payload: &impl Hashable) -> [u8; 32] {
let mut hasher = Sha256::new(); let mut hasher = Sha256::new();