Peer
A class in fastatp.peer (source).
Peer(
did: str | None = None,
signing_key: PrivateKey | Signer | None = None,
*,
resolver: DIDResolver | None = None,
authorize: AuthorizeHook | None = None,
)
Symmetric participant: a DID, optionally a signing key, a resolver.
did + signing_key let the peer own repos (PeerServer hosts
them); resolver (default: web_resolver) lets it verify other
peers' records. Either side can be omitted.
Attributes
didsigner: Signer | Noneresolver: DIDResolverauthorize
Methods
create_repo
async create_repo(store: Any = None, *, storage: Any = None) -> Any
A signed present-state repo for this peer's DID, over storage
(one database for blocks, heads and blobs) or a bare block store.
verify
async verify(
proof: bytes,
*,
expected_signer: str | None = None,
path: str | None = None,
context: Any = None,
) -> Lexicon
Verify a record proof and return the typed Lexicon instance.
Flow: parse the proof CAR -> commit did (issuer) -> resolve DID
document -> verify commit signature (rotation keys rejected) ->
re-derive the record's membership in the signed MST root -> parse the
record by $type -> run the authorize() hook.
A proof normally witnesses exactly one record; pass path
(collection/rkey) to select one from a multi-record slice.
Raises VerificationError subclasses (SignatureInvalid,
SignerMismatch, NotAuthorized, UnknownLexicon) for anything wrong
with the proof or the resolved document. Resolution failures
propagate as themselves so callers can retry: DIDNotFound
(miss) and DIDResolutionTimeout (transient network failure —
deliberately NOT wrapped as a verification failure).
verify_detailed
async verify_detailed(
proof: bytes,
*,
expected_signer: str | None = None,
path: str | None = None,
context: Any = None,
) -> VerifiedRecord
Like verify, but also returns the issuer DID, the record's
CID, and its collection/rkey path — all computed in the single CAR
decode verify already does. Callers that need this metadata (e.g.
push intake building an Envelope) use this to avoid a redundant decode.