Skip to main content

Signer

Trait Signer 

Source
pub trait Signer: Send + Sync {
    // Required methods
    fn random(rng: &mut impl TryCryptoRng) -> Result<Self, Error>
       where Self: Sized;
    fn new_from_seed(seed: &[u8]) -> Result<Self, Error>
       where Self: Sized;
    fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
       where Self: Sized;
    fn to_bytes(&self) -> Vec<u8> ⓘ;
    fn public_key(&self) -> PublicKey;
    fn sign(&self, context: &[u8], message: &[u8]) -> Result<Signature, Error>;
    fn sign_raw(&self, message: &[u8]) -> Result<Signature, Error>;
}
Expand description

Common trait for memory signers.

Required Methods§

Source

fn random(rng: &mut impl TryCryptoRng) -> Result<Self, Error>
where Self: Sized,

Create a new random signer.

Source

fn new_from_seed(seed: &[u8]) -> Result<Self, Error>
where Self: Sized,

Create a new signer from the given seed.

Source

fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

Recreate signer from a byte serialization.

Source

fn to_bytes(&self) -> Vec<u8> ⓘ

Serialize the signer into bytes.

Source

fn public_key(&self) -> PublicKey

Return the public key counterpart to the signer’s secret key.

Source

fn sign(&self, context: &[u8], message: &[u8]) -> Result<Signature, Error>

Generate a signature over the context and message.

Source

fn sign_raw(&self, message: &[u8]) -> Result<Signature, Error>

Generate a signature over the message.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Signer for Identity

Source§

fn random(_rng: &mut impl TryCryptoRng) -> Result<Self, Error>
where Self: Sized,

Source§

fn new_from_seed(_seed: &[u8]) -> Result<Self, Error>
where Self: Sized,

Source§

fn from_bytes(_bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

Source§

fn to_bytes(&self) -> Vec<u8> ⓘ

Source§

fn public_key(&self) -> PublicKey

Source§

fn sign(&self, context: &[u8], message: &[u8]) -> Result<Signature, Error>

Source§

fn sign_raw(&self, _message: &[u8]) -> Result<Signature, Error>

Source§

impl<T: CoreSigner> Signer for &T

Source§

fn random(_rng: &mut impl TryCryptoRng) -> Result<Self, Error>
where Self: Sized,

Source§

fn new_from_seed(_seed: &[u8]) -> Result<Self, Error>
where Self: Sized,

Source§

fn from_bytes(_bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

Source§

fn to_bytes(&self) -> Vec<u8> ⓘ

Source§

fn public_key(&self) -> PublicKey

Source§

fn sign(&self, context: &[u8], message: &[u8]) -> Result<Signature, Error>

Source§

fn sign_raw(&self, _message: &[u8]) -> Result<Signature, Error>

Source§

impl<T: Signer + ?Sized> Signer for Arc<T>

Source§

fn random(_rng: &mut impl TryCryptoRng) -> Result<Self, Error>
where Self: Sized,

Source§

fn new_from_seed(_seed: &[u8]) -> Result<Self, Error>
where Self: Sized,

Source§

fn from_bytes(_bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

Source§

fn to_bytes(&self) -> Vec<u8> ⓘ

Source§

fn public_key(&self) -> PublicKey

Source§

fn sign(&self, context: &[u8], message: &[u8]) -> Result<Signature, Error>

Source§

fn sign_raw(&self, message: &[u8]) -> Result<Signature, Error>

Implementors§

Source§

impl Signer for oasis_runtime_sdk::crypto::signature::ed25519::MemorySigner

Source§

impl Signer for oasis_runtime_sdk::crypto::signature::secp256k1::MemorySigner

Source§

impl Signer for oasis_runtime_sdk::crypto::signature::secp256r1::MemorySigner

Source§

impl Signer for oasis_runtime_sdk::crypto::signature::secp384r1::MemorySigner

Source§

impl Signer for oasis_runtime_sdk::crypto::signature::sr25519::MemorySigner