Struct libkeycard::Keycard
source · [−]Expand description
A Keycard object is a collection of entries tied together in an authenticated blockchain. It consists of the root entry for the entity all the way through the current entry.
Fields
entries: Vec<Entry>Implementations
sourceimpl Keycard
impl Keycard
sourcepub fn from(data: &str) -> Result<Keycard, LKCError>
pub fn from(data: &str) -> Result<Keycard, LKCError>
Creates a new keycard entry chain from text.
sourcepub fn get_current(&self) -> Option<&Entry>
pub fn get_current(&self) -> Option<&Entry>
Returns the last entry of the keycard
sourcepub fn find(&self, hash: &CryptoString) -> Result<&Entry, LKCError>
pub fn find(&self, hash: &CryptoString) -> Result<&Entry, LKCError>
Finds the entry in a keycard which has the requested hash
sourcepub fn get_current_mut(&mut self) -> Option<&mut Entry>
pub fn get_current_mut(&mut self) -> Option<&mut Entry>
Returns a mutable reference to the last entry of the keycard
sourcepub fn chain(
&mut self,
spair: &SigningPair,
expires: u16
) -> Result<HashMap<&'static str, CryptoString>, LKCError>
pub fn chain(
&mut self,
spair: &SigningPair,
expires: u16
) -> Result<HashMap<&'static str, CryptoString>, LKCError>
Creates a new Entry object in the keycard. Organization keycards are complete and compliant when chain() returns. User keycards will require cross_sign() and user_sign() to be called before it is complete.
sourcepub fn cross_sign(&mut self, signing_pair: &SigningPair) -> Result<(), LKCError>
pub fn cross_sign(&mut self, signing_pair: &SigningPair) -> Result<(), LKCError>
This convenience method applies only to user keycards and is used to set the organization’s signature for the current entry.
sourcepub fn user_sign(
&mut self,
hash_algorithm: &str,
signing_pair: &SigningPair
) -> Result<(), LKCError>
pub fn user_sign(
&mut self,
hash_algorithm: &str,
signing_pair: &SigningPair
) -> Result<(), LKCError>
This convenience method applies only to user keycards and is used to add the final user signature and generate the hash for the entry. Once this has been applied, the current entry for the card should be compliant and should pass verification.
Auto Trait Implementations
impl RefUnwindSafe for Keycard
impl Send for Keycard
impl Sync for Keycard
impl Unpin for Keycard
impl UnwindSafe for Keycard
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more