refactor(crypto): move Integrable trait to arbiter-crypto
This commit is contained in:
6
server/crates/arbiter-crypto/src/integrity.rs
Normal file
6
server/crates/arbiter-crypto/src/integrity.rs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
use crate::hashing::Hashable;
|
||||||
|
|
||||||
|
pub trait Integrable: Hashable {
|
||||||
|
const KIND: &'static str;
|
||||||
|
const VERSION: i32 = 1;
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user