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.
Methods
Section titled “Methods”verify_and_decode
Section titled “verify_and_decode”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.
Errors
Section titled “Errors”SignedError::Signature before any decoding, or SignedError::Decode.
from_json
Section titled “from_json”pub fn from_json(json: &SignedJson, key: &PublicKey, min_suite: u8) -> Result<Self, SignedError>Self::verify_and_decode for the JSON form {bytes, sig}.
Errors
Section titled “Errors”SignedError::SignatureEncoding for a malformed sig, else as verify_and_decode.
object
Section titled “object”pub const fn object(&self) -> &TThe decoded object.
into_object
Section titled “into_object”pub fn into_object(self) -> TThe decoded object, consuming the wrapper.
pub fn bytes(&self) -> &[u8]The canonical bytes B.
signature
Section titled “signature”pub const fn signature(&self) -> &SignatureThe signature.
pub fn hash(&self) -> [u8; 32]SHA3-256(B): the object’s identity (never the signature, the protocol).
to_json
Section titled “to_json”pub fn to_json(&self) -> SignedJsonThe JSON form {bytes, sig}.
Trait implementations
Section titled “Trait implementations”Clone, Debug, Eq, From<Signed<T>>, PartialEq, StructuralPartialEq