[][src]Struct sequoia_store::Key

pub struct Key { /* fields omitted */ }

Represents a key in the store.

A Key is a handle to a stored Cert. We make this explicit because we associate metadata with Certs.


impl Key[src]

pub fn cert(&self) -> Result<Cert>[src]

Returns the Cert.

pub fn stats(&self) -> Result<Stats>[src]

Returns stats for this key.

pub fn import(&self, cert: &Cert) -> Result<Cert>[src]

Updates this stored key with the given Cert.

If the new key cert matches the current key, i.e. they have the same fingerprint, both keys are merged and normalized. The returned key contains all packets known to Sequoia, and should be used instead of cert.

If the new key does not match the current key, Error::Conflict is returned.


let mapping = Mapping::open(&ctx, net::Policy::Offline,
                            REALM_CONTACTS, "default")?;
let fp = "3E8877C877274692975189F5D03F6F865226FE8B".parse().unwrap();
let binding = mapping.add("Testy McTestface", &fp)?;
let key = binding.key()?;
let r = key.import(&old)?;
assert_eq!(r.fingerprint(), old.fingerprint());
let r = key.import(&new);
assert!(r.is_err()); // conflict

pub fn log(&self) -> Result<LogIter>[src]

Lists all log entries related to this key.

Trait Implementations

impl Debug for Key[src]

Auto Trait Implementations

impl !RefUnwindSafe for Key

impl !Send for Key

impl !Sync for Key

impl Unpin for Key

impl !UnwindSafe for Key

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,