Skip to content

Struct signed::Signed

zaun_community_protocol::signed::Signed · Struct

pub struct Signed<T> { … }

A signed object whose signature has been made or verified, with its exact bytes.

pub fn verify_and_decode(bytes: &[u8], sig: &Signature, key: &PublicKey, min_suite: u8) -> Result<Self, SignedError>

Verifies sig over bytes under key with T’s context, then decodes.

SignedError::Signature before any decoding, or SignedError::Decode.

pub fn from_json(json: &SignedJson, key: &PublicKey, min_suite: u8) -> Result<Self, SignedError>

Self::verify_and_decode for the JSON form {bytes, sig}.

SignedError::SignatureEncoding for a malformed sig, else as verify_and_decode.

pub const fn object(&self) -> &T

The decoded object.

pub fn into_object(self) -> T

The decoded object, consuming the wrapper.

pub fn bytes(&self) -> &[u8]

The canonical bytes B.

pub const fn signature(&self) -> &Signature

The signature.

pub fn hash(&self) -> [u8; 32]

SHA3-256(B): the object’s identity (never the signature, the protocol).

pub fn to_json(&self) -> SignedJson

The JSON form {bytes, sig}.

Clone, Debug, Eq, From<Signed<T>>, PartialEq, StructuralPartialEq

Full rustdoc page