Skip to main content

Crate libkeri_watcher

Crate libkeri_watcher 

Source
Expand description

Local KEL watcher for libkeri.

A watcher follows another identifier’s KEL as that identifier’s witnesses serve it, and tells its owner when the KEL reaches a state the owner is waiting for. Its first use is delegation approval: a delegate waits for its delegator to anchor the delegate’s seal in a fully witnessed event, then completes the delegated event (Habery::complete_delegation).

This replaces both approaches keripy has used. In keripy 1.1 (Sealer) the delegate asked the delegator before going to its witnesses; in 1.2 and later (Anchorer) the delegate witnesses first and the delegator writes the authorizer seal into its own database when it confirms. Here neither side writes approval state for the other. The delegate trusts only the delegator’s KEL as the delegator’s witnesses serve it.

The core is sans-IO, following libkeri’s memory model (no threads, locks or async). DelegationWatch::next_request says what to fetch, the owner fetches it however it likes and hands the body to DelegationWatch::feed together with its Habery. The http feature adds an async driver on libkeri-http (http::wait_for_approval).

Modules§

http
Async driver for DelegationWatch over libkeri-http.

Structs§

DelegationWatch
Waits for the delegator of a local delegated identifier to approve its event at sn, by following the delegator’s KEL through the delegator’s witnesses (keripy: app/delegating.py Anchorer.processUnanchoredEscrow, but without the delegator or delegate writing the seal for the other).
Request
A fetch the owner should perform: an HTTP GET of url.
Source
One witness of the watched identifier and the URL it was resolved at.

Enums§

Outcome
What a fed response changed.
WatchError

Functions§

witness_oobi_url
The witness OOBI URL for aid at witness wit served from base ({base}/oobi/{aid}/witness/{wit}). keripy (1.1, 1.2, main) and libkeri-witness serve the full KEL there once its last event is fully witnessed.
witness_sources
The witnesses of aid as this Habery knows them: the witness list from aid’s current key state, each with the http URL learned from its OOBI. Witnesses without a known URL are skipped.