Bookmark

Envelope

Envelope Objects

class Envelope(BaseModel)

Represents an envelope for message communication between agents.

Attributes:

  • Name
    version
    Type
    _int_
    Description

    The envelope version.

  • Name
    sender
    Type
    _str_
    Description

    The sender's address.

  • Name
    target
    Type
    _str_
    Description

    The target's address.

  • Name
    session
    Type
    _UUID4_
    Description

    The session UUID that persists for back-and-forth dialogues between agents.

  • Name
    schema_digest
    Type
    _str_
    Description

    The schema digest for the enclosed message (alias for protocol).

  • Name
    protocol_digest
    Type
    _Optional[str]_
    Description

    The digest of the protocol associated with the message (optional).

  • Name
    payload
    Type
    _Optional[str]_
    Description

    The encoded message payload of the envelope (optional).

  • Name
    expires
    Type
    _Optional[int]_
    Description

    The expiration timestamp (optional).

  • Name
    nonce
    Type
    _Optional[int]_
    Description

    The nonce value (optional).

  • Name
    signature
    Type
    _Optional[str]_
    Description

    The envelope signature (optional).

encode_payload

def encode_payload(value: JsonStr)

Encode the payload value and store it in the envelope.

Arguments:

  • value JsonStr - The payload value to be encoded.

decode_payload

def decode_payload() -> Optional[Any]

Decode and retrieve the payload value from the envelope.

Returns:

  • Optional[Any] - The decoded payload value, or None if payload is not present.

sign

def sign(identity: Identity)

Sign the envelope using the provided identity.

Arguments:

  • identity Identity - The identity used for signing.

verify

def verify() -> bool

Verify the envelope's signature.

Returns:

  • bool - True if the signature is valid, False otherwise.

Was this page helpful?

Bookmark