pub struct BottleInfo {
pub is_encrypted: bool,
pub is_signed: bool,
pub signers: Vec<Vec<u8>>,
pub recipients: Vec<Vec<u8>>,
}Expand description
Information about a bottle without decrypting it.
This structure provides metadata about a bottle’s encryption and signature status without requiring decryption keys.
§Example
use rust_bottle::*;
let bottle = Bottle::new(b"Message".to_vec());
let opener = Opener::new();
let info = opener.open_info(&bottle).unwrap();
assert!(!info.is_encrypted);
assert!(!info.is_signed);Fields§
§is_encrypted: boolWhether the bottle has any encryption layers
is_signed: boolWhether the bottle has any signature layers
signers: Vec<Vec<u8>>Public key fingerprints of all signers
recipients: Vec<Vec<u8>>Public key fingerprints of all recipients (if encrypted)
Implementations§
Source§impl BottleInfo
impl BottleInfo
Sourcepub fn is_signed_by(&self, public_key: &[u8]) -> bool
pub fn is_signed_by(&self, public_key: &[u8]) -> bool
Check if the bottle is signed by a specific public key.
This method compares the public key’s fingerprint against the list of signer fingerprints in the bottle.
§Arguments
public_key- The public key to check (any format)
§Returns
trueif the key’s fingerprint matches a signerfalseotherwise
§Example
use rust_bottle::*;
use rand::rngs::OsRng;
let mut bottle = Bottle::new(b"Message".to_vec());
let rng = &mut OsRng;
let key = Ed25519Key::generate(rng);
let pub_key = key.public_key_bytes();
bottle.sign(rng, &key, &pub_key).unwrap();
let opener = Opener::new();
let info = opener.open_info(&bottle).unwrap();
assert!(info.is_signed_by(&pub_key));Trait Implementations§
Source§impl Clone for BottleInfo
impl Clone for BottleInfo
Source§fn clone(&self) -> BottleInfo
fn clone(&self) -> BottleInfo
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 moreAuto Trait Implementations§
impl Freeze for BottleInfo
impl RefUnwindSafe for BottleInfo
impl Send for BottleInfo
impl Sync for BottleInfo
impl Unpin for BottleInfo
impl UnwindSafe for BottleInfo
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