pub struct PrivateKey { /* private fields */ }
Implementations§
Source§impl PrivateKey
impl PrivateKey
pub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_hex(&self) -> String
pub fn from_random() -> PrivateKey
pub fn compress_public_key(&self, should_compress: bool) -> PrivateKey
Source§impl PrivateKey
Native Exported Methods
impl PrivateKey
Native Exported Methods
pub fn to_wif(&self) -> Result<String, BSVErrors>
pub fn from_wif(wif_string: &str) -> Result<PrivateKey, BSVErrors>
pub fn from_hex(hex_str: &str) -> Result<PrivateKey, BSVErrors>
Sourcepub fn sign_message(&self, msg: &[u8]) -> Result<Signature, BSVErrors>
pub fn sign_message(&self, msg: &[u8]) -> Result<Signature, BSVErrors>
Standard ECDSA Message Signing using SHA256 as the digestg
pub fn from_bytes(bytes: &[u8]) -> Result<PrivateKey, BSVErrors>
pub fn to_public_key(&self) -> Result<PublicKey, BSVErrors>
Sourcepub fn encrypt_message(
&self,
message: &[u8],
) -> Result<ECIESCiphertext, BSVErrors>
pub fn encrypt_message( &self, message: &[u8], ) -> Result<ECIESCiphertext, BSVErrors>
Encrypt a message to the public key of this private key.
Sourcepub fn decrypt_message(
&self,
ciphertext: &ECIESCiphertext,
sender_pub_key: &PublicKey,
) -> Result<Vec<u8>, BSVErrors>
pub fn decrypt_message( &self, ciphertext: &ECIESCiphertext, sender_pub_key: &PublicKey, ) -> Result<Vec<u8>, BSVErrors>
Decrypt a message that was sent to the public key corresponding to this private key.
Trait Implementations§
Source§impl Clone for PrivateKey
impl Clone for PrivateKey
Source§fn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for PrivateKey
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnwindSafe for PrivateKey
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