pub struct SecretKey(/* private fields */);Expand description
Wrapper around secp256k1 secret key represented as 32-byte array.
Implementations§
Source§impl SecretKey
impl SecretKey
Sourcepub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn from_bytes(bytes: [u8; 32]) -> Self
Creates new secret key from 32-byte array.
Sourcepub fn from_slice(bytes: &[u8]) -> Result<Self, KeyError>
pub fn from_slice(bytes: &[u8]) -> Result<Self, KeyError>
Creates new secret key from slice of bytes. Panics if slice is not 32 bytes long.
Sourcepub fn from_hex(hex: &str) -> Result<Self, KeyError>
pub fn from_hex(hex: &str) -> Result<Self, KeyError>
Creates new secret key from hex string. Panics if string is not 32 bytes long.
Sourcepub fn public_key(&self) -> Result<PublicKey, KeyError>
pub fn public_key(&self) -> Result<PublicKey, KeyError>
Returns public key corresponding to this secret key.
Trait Implementations§
Source§impl Ord for SecretKey
impl Ord for SecretKey
Source§impl PartialOrd for SecretKey
impl PartialOrd for SecretKey
impl Copy for SecretKey
impl Eq for SecretKey
impl StructuralPartialEq for SecretKey
Auto Trait Implementations§
impl Freeze for SecretKey
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