pub struct IntegrityProof {
pub nonce: [u8; 32],
pub timestamp: u64,
pub ttl: u64,
pub action_hash: [u8; 32],
pub action_type: ActionType,
pub capsule_hash: String,
pub status: VerificationStatus,
pub signature: Vec<u8>,
}Expand description
Cryptographic proof of action integrity
This struct provides tamper-evident proof that an action was approved by the Hope Genome system. It includes:
- Anti-replay protection (nonce + TTL)
- Action binding (prevents oracle attacks)
- Cryptographic signature (prevents forgery)
Fields§
§nonce: [u8; 32]Anti-replay nonce (256-bit random)
timestamp: u64Unix timestamp (seconds) when proof was created
ttl: u64Time-to-live in seconds (proof expires after this)
action_hash: [u8; 32]Hash of the action being approved (prevents oracle attacks)
action_type: ActionTypeType of action
capsule_hash: StringCurrent genome capsule hash (ties proof to specific genome state)
status: VerificationStatusVerification status
signature: Vec<u8>RSA signature (signs all above fields)
Implementations§
Source§impl IntegrityProof
impl IntegrityProof
Sourcepub fn new(action: &Action, capsule_hash: String, ttl: u64) -> Self
pub fn new(action: &Action, capsule_hash: String, ttl: u64) -> Self
Create a new proof (before signing)
Sourcepub fn signing_data(&self) -> Vec<u8> ⓘ
pub fn signing_data(&self) -> Vec<u8> ⓘ
Get the data that should be signed
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if proof has expired
§v1.6.0 Note
H-1 fix: Uses saturating_sub() to prevent integer underflow.
Sourcepub fn timestamp_string(&self) -> String
pub fn timestamp_string(&self) -> String
Get human-readable timestamp
Trait Implementations§
Source§impl Clone for IntegrityProof
impl Clone for IntegrityProof
Source§fn clone(&self) -> IntegrityProof
fn clone(&self) -> IntegrityProof
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IntegrityProof
impl Debug for IntegrityProof
Source§impl<'de> Deserialize<'de> for IntegrityProof
impl<'de> Deserialize<'de> for IntegrityProof
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for IntegrityProof
impl RefUnwindSafe for IntegrityProof
impl Send for IntegrityProof
impl Sync for IntegrityProof
impl Unpin for IntegrityProof
impl UnwindSafe for IntegrityProof
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more