KERI Peer API¶
keri.peer.exchanging¶
keri.peer.exchanging module
- class keri.peer.exchanging.Exchanger(hby, handlers, cues=None, delta=datetime.timedelta(seconds=300))[source]¶
Peer to Peer KERI message Exchanger.
- __init__(hby, handlers, cues=None, delta=datetime.timedelta(seconds=300))[source]¶
Initialize instance
- Parameters:
hby (Haberyu) – database environment
handlers (list) – list of Handlers capable of responding to exn messages
cues (Deck) – of Cues i.e. notices of requests needing response
delta (timedelta) – message timeout window
- complete(said)[source]¶
- Parameters:
said (str) – qb64 said of exchange message to check status
- Returns:
True means exchange message is has been saved
- Return type:
bool
- escrowPSEvent(serder, tsgs, pathed)[source]¶
Escrow event that does not have enough signatures.
- Parameters:
serder (Serder) – instance of event
tsgs (list) – quadlet of prefixer seqner, saider, sigers
pathed (list) – list of bytes of attached paths
- lead(hab, said)[source]¶
Determines is current member represented by hab is the lead of an exn message
Lead is the signer of the exn with the lowest signing index
- Parameters:
hab (Hab) – Habitat for sending of exchange message represented by SAID
said (str) – qb64 SAID of exchange message
- Returns:
True means hab is the lead
- Return type:
bool
- processEvent(serder, tsgs=None, cigars=None, **kwargs)[source]¶
Process one serder event with attached indexed signatures representing a Peer to Peer exchange message.
- Parameters:
serder (Serder) – instance of event to process
tsgs (list) – tuples (quadruples) of form (prefixer, seqner, diger, [sigers]) where: prefixer is pre of trans endorser seqner is sequence number of trans endorser’s est evt for keys for sigs diger is digest of trans endorser’s est evt for keys for sigs [sigers] is list of indexed sigs from trans endorser’s keys from est evt
cigars (list) – of Cigar instances of attached non-trans sigs
- keri.peer.exchanging.cloneMessage(hby, said)[source]¶
Load and verify signatures on message exn
- Parameters:
hby (Habery) – database environment from which to clone message
said (str) – qb64 SAID of message exn to load
- Returns:
(serder, list) of message exn and pathed signatures on embedded attachments
- Return type:
tuple
- keri.peer.exchanging.exchange(route, payload, sender, recipient=None, date=None, dig=None, modifiers=None, embeds=None, version=(1, 0), kind='JSON')[source]¶
Create an exn message with the specified route and payload
- Parameters:
route (str) – to destination route of the message
payload (list | dict) – body of message to deliver to route
sender (str) – qb64 AID of sender of the exn
recipient (str)
date (str) – Iso8601 formatted date string to use for this request
dig (str)
modifiers (dict) – equivalent of query string of uri, modifiers for the request that are not part of the payload
embeds (dict) – named embeded KERI event CESR stream with attachments
version (Version) – is Version instance
kind (Serials) – is serialization kind
- keri.peer.exchanging.verify(hby, serder)[source]¶
Verify that the signatures in the database are valid for the provided exn
- Parameters:
hby (Habery) – database environment from which to verify message
serder (Serder) – exn serder to load and verify signatures for
- Returns:
True means threshold satisfyig signatures were loaded and verified successfully
- Return type:
bool