def SendAuditKey(remote_idurl, encrypted_payload, packet_id=None, timeout=10, wide=False, callbacks={}): if _Debug: lg.out( _DebugLevel, "p2p_service.SendAuditKey to %s with %d bytes in json payload data" % (remote_idurl, len(encrypted_payload))) if packet_id is None: packet_id = packetid.UniqueID() outpacket = signed.Packet( Command=commands.AuditKey(), OwnerID=my_id.getLocalID(), CreatorID=my_id.getLocalID(), PacketID=packet_id, Payload=encrypted_payload, RemoteID=remote_idurl, ) gateway.outbox(outpacket, wide=wide, callbacks=callbacks, response_timeout=timeout) return outpacket
def _on_inbox_packet_received(self, newpacket, info, status, error_message): from p2p import commands from access import key_ring if newpacket.Command == commands.Key(): return key_ring.on_key_received(newpacket, info, status, error_message) elif newpacket.Command == commands.AuditKey(): return key_ring.on_audit_key_received(newpacket, info, status, error_message) return False
def _on_inbox_packet_received(self, newpacket, info, status, error_message): from p2p import commands from access import key_ring if newpacket.Command == commands.Key(): # TODO: work in progress : need to store history of all keys transfers return key_ring.on_key_received(newpacket, info, status, error_message) elif newpacket.Command == commands.AuditKey(): return key_ring.on_audit_key_received(newpacket, info, status, error_message) return False