pub struct SecretKey { /* private fields */ }Implementations§
Source§impl SecretKey
impl SecretKey
pub fn generate() -> Result<Self, SecpError>
pub fn from_hex(hex: &str) -> Result<Self, SecpError>
pub fn from_bytes(bytes: [u8; 32]) -> Result<Self, SecpError>
pub fn to_hex(&self) -> String
pub fn to_bytes(&self) -> [u8; 32]
pub fn public_key(&self) -> Result<PublicKey, SecpError>
pub fn xonly_public_key(&self) -> Result<XOnlyPublicKey, SecpError>
pub fn sign_schnorr_prehash( &self, digest32: [u8; 32], ) -> Result<SchnorrSignature, SecpError>
Sourcepub fn sign_schnorr_prehash_deterministic(
&self,
digest32: [u8; 32],
) -> Result<SchnorrSignature, SecpError>
pub fn sign_schnorr_prehash_deterministic( &self, digest32: [u8; 32], ) -> Result<SchnorrSignature, SecpError>
aux_rand をゼロ固定にした決定的 BIP-340 Schnorr 署名。
同じ秘密鍵・同じ digest に対して常に同じ署名バイト列を返す。
BIP-340 はフォールトアタック耐性のためフレッシュな aux_rand を推奨しており、
本 API はテスト互換や外部ツールとの fixture 照合用途に限って使用すること。
通常の署名用途では [sign_schnorr_prehash] を使うこと。
pub fn sign_ecdsa_prehash( &self, digest32: [u8; 32], ) -> Result<EcdsaSignature, SecpError>
Trait Implementations§
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 UnsafeUnpin 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