syft.core.common.message¶
Classes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SignedMessages are :class:`SyftMessage`s that have been signed by someone. |
|
SyftMessages are an abstraction that represents information that is sent between a |
|
|
|
- class syft.core.common.message.SyftMessage(address, msg_id=None)[source]¶
Bases:
syft.core.common.message.AbstractMessage
SyftMessages are an abstraction that represents information that is sent between a
Client
and aNode
. In Syft’s decentralized setup, we can easily see why SyftMessages are so important. This class cannot be used as-is: to get some useful objects, we need to derive from it. For instance,Action`s inherit from :class:`SyftMessage
. There are many types of SyftMessage which boil down to whether or not they are Sync or Async, and whether or not they expect a response.- address¶
the
Address
to which the message needs to be delivered.
- sign(signing_key)[source]¶
It’s important for all messages to be able to prove who they were sent from. This method endows every message with the ability for someone to “sign” (with a hash of the message) as the sender of the message so that someone else, at a later date, can verify the sender.
- Parameters
signing_key – The key to use to sign the SyftMessage.
- Returns
- class syft.core.common.message.SignedMessage(address, obj_type, signature, verify_key, message, msg_id=None)[source]¶
Bases:
syft.core.common.message.SyftMessage
SignedMessages are
SyftMessage`s that have been signed by someone. In addition to what has a :class:`SyftMessage
, they have a signature, a verify key and ais_valid()
property that is here to check that the message was really signed and sent by the verify key owner.- obj_type¶
the string representation of the type of the original message.
- Type
string
- signature¶
the signature of the message.
- Type
bytes
- verify_key¶
the signer’s public key with which the signature can be verified.
- Type
VerifyKey
- serialized_message¶
the serialized original message.
- static get_protobuf_schema()[source]¶
Return the type of protobuf object which stores a class of this type
As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.
Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.
- Returns
the type of protobuf object which corresponds to this class.