Enum rosetta_crypto::SecretKey
source · pub enum SecretKey {
EcdsaSecp256k1(SigningKey<Secp256k1>),
EcdsaRecoverableSecp256k1(SigningKey<Secp256k1>),
EcdsaSecp256r1(SigningKey<NistP256>),
Ed25519(Keypair),
Sr25519(Keypair, Option<MiniSecretKey>),
}
Expand description
Secret key used for constructing signatures.
Variants§
EcdsaSecp256k1(SigningKey<Secp256k1>)
ECDSA with secp256k1.
EcdsaRecoverableSecp256k1(SigningKey<Secp256k1>)
ECDSA with secp256k1 in Ethereum compatible format.
EcdsaSecp256r1(SigningKey<NistP256>)
ECDSA with NIST P-256.
Ed25519(Keypair)
Ed25519.
Sr25519(Keypair, Option<MiniSecretKey>)
Schnorrkel used by substrate/polkadot.
Implementations§
source§impl SecretKey
impl SecretKey
sourcepub fn from_bytes(algorithm: Algorithm, bytes: &[u8]) -> Result<Self>
pub fn from_bytes(algorithm: Algorithm, bytes: &[u8]) -> Result<Self>
Creates a secret key from a byte sequence for a given signing algorithm.
sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Returns the public key used for verifying signatures.
sourcepub fn sign(&self, msg: &[u8], context_param: &str) -> Signature
pub fn sign(&self, msg: &[u8], context_param: &str) -> Signature
Signs a message and returns it’s signature.
sourcepub fn sign_prehashed(&self, hash: &[u8]) -> Result<Signature>
pub fn sign_prehashed(&self, hash: &[u8]) -> Result<Signature>
Signs a prehashed message and returns it’s signature.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for SecretKey
impl Send for SecretKey
impl Sync for SecretKey
impl Unpin for SecretKey
impl UnwindSafe for SecretKey
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more