Skip to content

Trait signed::SignedObject

zaun_community_protocol::signed::SignedObject · Trait

pub trait SignedObject { … }

A signed object type: its canonical encoding (format byte first) and its context.

fn to_bytes(&self) -> Result<Vec<u8>, EncodeError>;

The canonical bytes B.

EncodeError when a field breaks its rule.

fn decode_unverified(bytes: &[u8]) -> Result<Self, DecodeError>;

Decodes canonical bytes without verifying them. Receivers use Signed::verify_and_decode.

DecodeError for non-canonical input or a broken field rule.

fn sign(self, sk: &SecretKey) -> Result<Signed<Self>, SignedError>;

Encodes and signs (hedged).

SignedError when the object does not encode or signing fails.

fn sign_deterministic(self, sk: &SecretKey) -> Result<Signed<Self>, SignedError>;

Encodes and signs deterministically. Golden test vectors only.

SignedError when the object does not encode or signing fails.

Full rustdoc page