syft.core.common.message

Classes

AbstractMessage([id])

EventualSyftMessage(address[, msg_id])

EventualSyftMessageWithoutReply(address[, ...])

ImmediateSyftMessage(address[, msg_id])

ImmediateSyftMessageWithReply(reply_to, address)

ImmediateSyftMessageWithoutReply(address[, ...])

SignedEventualSyftMessageWithoutReply(...[, ...])

SignedImmediateSyftMessageWithReply(address, ...)

SignedImmediateSyftMessageWithoutReply(...)

SignedMessage(address, obj_type, signature, ...)

SignedMessages are :class:`SyftMessage`s that have been signed by someone.

SyftMessage(address[, msg_id])

SyftMessages are an abstraction that represents information that is sent between a Client and a Node.

SyftMessageWithReply(address[, msg_id])

SyftMessageWithoutReply(address[, msg_id])

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 a Node. 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

A SignedMessage

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 a is_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.