Skip to main content

Module agreements

Module agreements 

Source
Expand description

First-class peer-agreement store — the terms of a relationship between parties.

This is P1 of docs/plans/rights-aware-peer-agreement-addressbook.md, the counterpart to the directory.rs addressbook (P0). Where the directory hosts the Parties (the addressbook, joined by pairwise DID) this module hosts the Agreements that govern each relationship.

An Agreement is the recorded terms of a relationship between parties, grounded in values-credentials (Agreement::values_anchors) — e.g. UDHR articles — rather than asserted from nowhere. Each term is an Undertaking (a right, obligation, prohibition, or permission) that may cite the values-credential it derives from (Undertaking::source). Formation is staged (FormationStage) and each party records its own ConsentState — the agreement is only fully consented once every party has ConsentState::Granted (see all_granted).

Following the crate’s store conventions (directory.rs, social_peers.rs), the pure list/consent helpers (set_consent, all_granted) carry the logic and are unit-tested in isolation, while the *_agreement(s) functions layer a thin pretty-JSON persistence step on top (a Vec<Agreement> at app_meta_dir()/agreements.json).

Structs§

Agreement
The recorded terms of a relationship between parties, grounded in values-credentials.
PartyConsent
One party’s consent record within an agreement.
Undertaking
One term of an agreement: a right, obligation, prohibition, or permission, optionally grounded in a values-credential.

Enums§

ConsentState
A party’s consent to an agreement.
FormationStage
Where an agreement is in its formation lifecycle.
UndertakingKind
The deontic character of a single term within an agreement.

Functions§

agreements_for
Every agreement involving did — as a party (Agreement::parties) OR as the relationship the agreement governs (Agreement::relationship_did).
all_granted
Is every party consented?
list_agreements
Load every stored agreement. Returns vec![] if the store file is absent or unreadable.
set_consent
Set party did’s consent to state, in place.
upsert_agreement
Insert-or-update a (keyed by Agreement::id), then persist the store.