pub struct Habery { /* private fields */ }Implementations§
Source§impl Habery
impl Habery
Sourcepub fn open(name: &str, opts: HaberyOptions) -> Result<Self, KERIError>
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.
Sourcepub fn reload(&mut self) -> Result<(), KERIError>
pub fn reload(&mut self) -> Result<(), KERIError>
Rebuild key state, local prefixes and the Hab index from the database.
Sourcepub fn make_hab(
&mut self,
name: &str,
args: MakeHabArgs,
) -> Result<Hab<'_>, KERIError>
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.
Sourcepub fn make_hab_ns(
&mut self,
name: &str,
ns: Option<&str>,
args: MakeHabArgs,
) -> Result<Hab<'_>, KERIError>
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.
Sourcepub fn hab_by_pre(&mut self, pre: &str) -> Result<Hab<'_>, KERIError>
pub fn hab_by_pre(&mut self, pre: &str) -> Result<Hab<'_>, KERIError>
View of the local Hab with prefix pre.
Sourcepub fn hab_by_name(&mut self, name: &str) -> Result<Hab<'_>, KERIError>
pub fn hab_by_name(&mut self, name: &str) -> Result<Hab<'_>, KERIError>
View of the local Hab named name (no namespace).
Sourcepub fn ingest(&mut self, ims: &[u8], local: bool) -> Result<usize, KERIError>
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.
Sourcepub fn process_escrows(&mut self)
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).
Sourcepub fn habs(&self) -> impl Iterator<Item = (&str, &str)>
pub fn habs(&self) -> impl Iterator<Item = (&str, &str)>
Names and prefixes of local Habs, in creation order.
pub fn name(&self) -> &str
Sourcepub fn path(&self) -> Option<PathBuf>
pub fn path(&self) -> Option<PathBuf>
Filesystem path of the underlying database, if not temporary.
pub fn db(&self) -> &Arc<Baser> ⓘ
Sourcepub fn kevers(&self) -> &HashMap<String, Kever>
pub fn kevers(&self) -> &HashMap<String, Kever>
Key state for every known AID (local and remote).
pub fn kevery(&self) -> &Kevery
pub fn kevery_mut(&mut self) -> &mut Kevery
Source§impl Habery
Group (multisig) identifiers: keripy Habery.makeGroupHab / joinGroupHab
and GroupHab.sign.
impl Habery
Group (multisig) identifiers: keripy Habery.makeGroupHab / joinGroupHab
and GroupHab.sign.
Sourcepub fn group_members(&self, pre: &str) -> Option<&GroupMembers>
pub fn group_members(&self, pre: &str) -> Option<&GroupMembers>
Membership of the local group Hab pre, or None if it is not a group.
Sourcepub fn extract_merfers_migers(
&self,
smids: &[String],
rmids: Option<&[String]>,
) -> Result<(Vec<Verfer>, Vec<Diger>), KERIError>
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.
Sourcepub fn join_group_hab(
&mut self,
pre: &str,
group: &str,
mhab_name: &str,
smids: &[String],
rmids: Option<&[String]>,
) -> Result<Hab<'_>, KERIError>
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.
Sourcepub fn join_group_inception(
&mut self,
group: &str,
mhab_name: &str,
smids: &[String],
rmids: Option<&[String]>,
proposal: &[u8],
) -> Result<Vec<u8>, KERIError>
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.
Sourcepub 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>
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.
Sourcepub fn sign_as_member(
&mut self,
mid: &str,
ser: &[u8],
verfers: &[Verfer],
) -> Result<Vec<Siger>, KERIError>
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).
Sourcepub fn complete_delegation(
&mut self,
pre: &str,
sn: u64,
) -> Result<Option<Vec<u8>>, KERIError>
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.
Sourcepub fn pending_delegations(
&self,
) -> Result<Vec<(String, u64, String)>, KERIError>
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).
Sourcepub fn approve_delegation(
&mut self,
delegator_alias: &str,
delegate: &str,
sn: u64,
rotate: bool,
) -> Result<Vec<u8>, KERIError>
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.