Trait oasis_runtime_sdk::crypto::signature::Signer

source ·
pub trait Signer: Send + Sync {
    // Required methods
    fn random(rng: &mut impl RngCore) -> 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 RngCore) -> 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.

Implementations on Foreign Types§

source§

impl<T: CoreSigner> Signer for &T

source§

fn random(_rng: &mut impl RngCore) -> 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