Transport API Reference
Low-level transport details for sealing and unsealing messages
Defines the message transport, including message signatures.
- shapeshifter_uftp.transport.seal_message(message: PayloadMessage, private_key: str) bytes[source]
Sign a message using the provided private key. The message should be of type PayloadMessage (or any subtype thereof). The private key should be given in base64-encoded form.
The message will be returned as an opaque blob op base64 bytes. (In reality, this is the 64-byte signature prepended to the original XML message.)
- shapeshifter_uftp.transport.unseal_message(message: bytes, public_key: str) PayloadMessage[source]
Validate a message’s signature using the provided public key. The message can be given as a string or as bytes. The public key should be given in base64-encoded form.
The message will be returned as a PayloadMessage object.
- shapeshifter_uftp.transport.to_xml(message: PayloadMessage) str[source]
Serialize the given PayloadMessage into an XML string.
- shapeshifter_uftp.transport.from_xml(message: str | bytes)[source]
Parse the given message string into a Shapeshifter UFTP object.
- shapeshifter_uftp.transport.to_json(message: PayloadMessage)[source]
Serializes the given PayloadMessage to json. Useful when transferring the message outside of shapeshifter-uftp.
- shapeshifter_uftp.transport.from_json(message: str, message_type: type)[source]
Parse the given json string into a message of the given type.