Skip to main content

Habery

Struct Habery 

Source
pub struct Habery { /* private fields */ }

Implementations§

Source§

impl Habery

Source

pub fn open(name: &str, opts: HaberyOptions) -> Result<Self, KERIError>

Open (creating if needed) the keystore and database named name, then rebuild in-memory state from the database.

Source

pub fn reload(&mut self) -> Result<(), KERIError>

Rebuild key state, local prefixes and the Hab index from the database.

Source

pub fn make_hab( &mut self, name: &str, args: MakeHabArgs, ) -> Result<Hab<'_>, KERIError>

Incept a new local identifier named name and return a view of it.

Source

pub fn make_hab_ns( &mut self, name: &str, ns: Option<&str>, args: MakeHabArgs, ) -> Result<Hab<'_>, KERIError>

Like Habery::make_hab but within namespace ns.

Source

pub fn hab_by_pre(&mut self, pre: &str) -> Result<Hab<'_>, KERIError>

View of the local Hab with prefix pre.

Source

pub fn hab_by_name(&mut self, name: &str) -> Result<Hab<'_>, KERIError>

View of the local Hab named name (no namespace).

Source

pub fn ingest(&mut self, ims: &[u8], local: bool) -> Result<usize, KERIError>

Parse ims and route every message to the Kevery/Revery. local marks the source as protected (own messages) or not (anything from a peer).

An event short of signatures or witness signatures, an event whose prior event hasn’t arrived, an event that conflicts with one already accepted, or a receipt for an event not seen yet, is escrowed rather than treated as a failure; after routing, the escrows are processed, so signatures and receipts that arrive separately complete the event. Any other failure stops at that message and is returned.

Source

pub fn process_escrows(&mut self)

Retry escrowed events (keripy runs these continuously in its doers; here the owner calls this, and Habery::ingest does after each batch).

Source

pub fn habs(&self) -> impl Iterator<Item = (&str, &str)>

Names and prefixes of local Habs, in creation order.

Source

pub fn name(&self) -> &str

Source

pub fn path(&self) -> Option<PathBuf>

Filesystem path of the underlying database, if not temporary.

Source

pub fn db(&self) -> &Arc<Baser> ⓘ

Source

pub fn kevers(&self) -> &HashMap<String, Kever>

Key state for every known AID (local and remote).

Source

pub fn prefixes(&self) -> &IndexSet<String>

Prefixes of all local identifiers.

Source

pub fn kevery(&self) -> &Kevery

Source

pub fn kevery_mut(&mut self) -> &mut Kevery

Source§

impl Habery

Group (multisig) identifiers: keripy Habery.makeGroupHab / joinGroupHab and GroupHab.sign.

Source

pub fn group_members(&self, pre: &str) -> Option<&GroupMembers>

Membership of the local group Hab pre, or None if it is not a group.

Source

pub fn extract_merfers_migers( &self, smids: &[String], rmids: Option<&[String]>, ) -> Result<(Vec<Verfer>, Vec<Diger>), KERIError>

Current signing keys of smids and next key digests of rmids (default smids), one each, in member order, from their KELs (keripy extractMerfersMigers). Every member must have exactly one key.

Source

pub fn join_group_hab( &mut self, pre: &str, group: &str, mhab_name: &str, smids: &[String], rmids: Option<&[String]>, ) -> Result<Hab<'_>, KERIError>

Record a local group Hab group with prefix pre whose local member is the Hab mhab_name (keripy joinGroupHab). Does not process any event.

Source

pub fn join_group_inception( &mut self, group: &str, mhab_name: &str, smids: &[String], rmids: Option<&[String]>, proposal: &[u8], ) -> Result<Vec<u8>, KERIError>

Join a group whose inception another member proposed (keripy kli multisig join): check that proposal (a group icp with the proposer’s signatures) is the inception the members’ KELs imply, record the group Hab, add this member’s signature and process the event.

Returns the inception with every signature collected so far, to send back to the other members. If those meet the signing threshold the group is accepted now; otherwise the event waits in the partial-signature escrow for the remaining members’ signatures.

Source

pub fn make_group_hab( &mut self, group: &str, mhab_name: &str, smids: &[String], rmids: Option<&[String]>, isith: Option<TholderSith>, nsith: Option<TholderSith>, ) -> Result<Vec<u8>, KERIError>

Propose a new group identifier group with local member mhab_name (keripy makeGroupHab): build the group inception from the members’ current keys and next-key digests, sign it as the local member and process it. Unless this one signature meets isith, the event waits in the partial-signature escrow until the other members’ signatures are ingested.

Returns the inception with this member’s signature, for the other members to join (see Habery::join_group_inception). Thresholds default as in keripy: isith is a majority of the keys, nsith is isith.

Source

pub fn sign_as_member( &mut self, mid: &str, ser: &[u8], verfers: &[Verfer], ) -> Result<Vec<Siger>, KERIError>

Sign ser (a group event whose signing keys are verfers) with the local member mid’s contributed key, indexed at that key’s position in verfers (keripy GroupHab.sign, non-rotation case).

Source

pub fn complete_delegation( &mut self, pre: &str, sn: u64, ) -> Result<Option<Vec<u8>>, KERIError>

Complete a local delegated event once its delegator has approved it (keripy: app/delegating.py Anchorer.processUnanchoredEscrow).

pre must be a local delegated AID whose event at sn (a dip or drt) has been accepted. Approval is the delegator anchoring the seal {i: pre, s: sn, d: said} in a fully witnessed event of its own KEL, as this Habery has it: ingest the delegator’s KEL (as served by its witnesses) first. Nothing the delegate or the delegator sends directly counts as approval.

On approval, stores the source seal couple of the delegating event in aess and returns the event cloned with all its attachments (now with -G), ready to send to this AID’s witnesses. Returns None while the delegator’s KEL is unknown or has no fully witnessed anchor yet.

Source

pub fn pending_delegations( &self, ) -> Result<Vec<(String, u64, String)>, KERIError>

Delegated events waiting for approval by a local delegator: (pre, sn, said) from the delegable escrow, and from the misfit escrow those whose delegator is local (a delegator that fetched the event itself, e.g. from the delegate’s witnesses).

Source

pub fn approve_delegation( &mut self, delegator_alias: &str, delegate: &str, sn: u64, rotate: bool, ) -> Result<Vec<u8>, KERIError>

Approve delegated event sn of delegate as the local delegator delegator_alias (keripy kli delegate confirm): anchor the seal {i, s, d} in a new interaction (or, with rotate, rotation) event, then process the escrowed delegated event as local with that event as its source seal couple, as keripy main’s confirm does. Returns the anchoring event, for the delegator’s witnesses to receipt.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more