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§
sourcefn random(rng: &mut impl RngCore) -> Result<Self, Error>where
Self: Sized,
fn random(rng: &mut impl RngCore) -> Result<Self, Error>where
Self: Sized,
Create a new random signer.
sourcefn new_from_seed(seed: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn new_from_seed(seed: &[u8]) -> Result<Self, Error>where
Self: Sized,
Create a new signer from the given seed.
sourcefn from_bytes(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_bytes(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
Recreate signer from a byte serialization.
sourcefn public_key(&self) -> PublicKey
fn public_key(&self) -> PublicKey
Return the public key counterpart to the signer’s secret key.