Skip to main content

SignedObject

Trait SignedObject 

Source
pub trait SignedObject: Encode + Decode {
    const CONTEXT: Context;

    // Provided methods
    fn to_bytes(&self) -> Result<Vec<u8>, EncodeError> { ... }
    fn decode_unverified(bytes: &[u8]) -> Result<Self, DecodeError> { ... }
    fn sign(self, sk: &SecretKey) -> Result<Signed<Self>, SignedError> { ... }
    fn sign_deterministic(
        self,
        sk: &SecretKey,
    ) -> Result<Signed<Self>, SignedError> { ... }
}
Expand description

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

Required Associated Constants§

Source

const CONTEXT: Context

The context the verifier supplies for this type (§3.5).

Provided Methods§

Source

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

The canonical bytes B.

§Errors

EncodeError when a field breaks its rule.

Source

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

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

§Errors

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

Source

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

Encodes and signs (hedged).

§Errors

SignedError when the object does not encode or signing fails.

Source

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

Encodes and signs deterministically. Golden test vectors only.

§Errors

SignedError when the object does not encode or signing fails.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl SignedObject for BotPackage

Source§

const CONTEXT: Context = Context::BotPackage

Source§

impl SignedObject for CommunityDescriptor

Source§

const CONTEXT: Context = Context::Descriptor

Source§

impl SignedObject for ExportManifest

Source§

const CONTEXT: Context = Context::ExportManifest

Source§

impl SignedObject for HostDelegation

Source§

const CONTEXT: Context = Context::Delegation

Source§

impl SignedObject for HostSessionProof

Source§

const CONTEXT: Context = Context::HostSession

Source§

impl SignedObject for KeyPackage

Source§

const CONTEXT: Context = Context::VoiceKeyPackage

Source§

impl SignedObject for MemberKeyRegistration

Source§

const CONTEXT: Context = Context::MemberKey

Source§

impl SignedObject for MemberReauth

Source§

const CONTEXT: Context = Context::MemberReauth

Source§

impl SignedObject for RootRotation

Source§

const CONTEXT: Context = Context::RootRotation

Source§

impl SignedObject for SenderKeys

Source§

const CONTEXT: Context = Context::VoiceSenderKeys