pub struct KeyPair { /* private fields */ }Expand description
The keypair for confidential transfer.
Implementations§
source§impl KeyPair
impl KeyPair
sourcepub fn default_secp256k1() -> Self
pub fn default_secp256k1() -> Self
Default secp256k1 keypair
sourcepub fn default_ed25519() -> Self
pub fn default_ed25519() -> Self
Default ed25519 keypair
sourcepub fn to_secp256k1(&self) -> Result<(SECP256K1Scalar, SECP256K1G1)>
pub fn to_secp256k1(&self) -> Result<(SECP256K1Scalar, SECP256K1G1)>
Change to algebra Secp256k1 keypair
sourcepub fn to_ed25519(&self) -> Result<(Ed25519Fq, Ed25519Point)>
pub fn to_ed25519(&self) -> Result<(Ed25519Fq, Ed25519Point)>
Change to algebra Ristretto keypair
sourcepub fn generate_ed25519<R: CryptoRng + RngCore>(prng: &mut R) -> Self
pub fn generate_ed25519<R: CryptoRng + RngCore>(prng: &mut R) -> Self
Generate a Ed25519 key pair.
sourcepub fn generate_secp256k1<R: CryptoRng + RngCore>(prng: &mut R) -> Self
pub fn generate_secp256k1<R: CryptoRng + RngCore>(prng: &mut R) -> Self
Generate a Secp256k1 key pair.
sourcepub fn generate_secp256k1_from_bytes(bytes: &[u8]) -> Result<Self>
pub fn generate_secp256k1_from_bytes(bytes: &[u8]) -> Result<Self>
Generate a key pair from secret key bytes.
sourcepub fn generate_address<R: CryptoRng + RngCore>(prng: &mut R) -> Self
pub fn generate_address<R: CryptoRng + RngCore>(prng: &mut R) -> Self
Generate a Secp256k1 key pair with address.
sourcepub fn to_eth_address(&self) -> Result<Self>
pub fn to_eth_address(&self) -> Result<Self>
Convert to eth address keypair.
sourcepub fn get_pk_ref(&self) -> &PublicKey
pub fn get_pk_ref(&self) -> &PublicKey
Return a reference of the public key.
sourcepub fn get_sk_ref(&self) -> &SecretKey
pub fn get_sk_ref(&self) -> &SecretKey
Return a reference of the secret key.
Trait Implementations§
source§impl<'de> Deserialize<'de> for KeyPair
impl<'de> Deserialize<'de> for KeyPair
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl FromWasmAbi for KeyPair
impl FromWasmAbi for KeyPair
source§impl IntoWasmAbi for KeyPair
impl IntoWasmAbi for KeyPair
source§impl NoahFromToBytes for KeyPair
impl NoahFromToBytes for KeyPair
source§fn noah_to_bytes(&self) -> Vec<u8>
fn noah_to_bytes(&self) -> Vec<u8>
convert to bytes
source§fn noah_from_bytes(bytes: &[u8]) -> Result<Self>
fn noah_from_bytes(bytes: &[u8]) -> Result<Self>
reconstruct from bytes
source§impl OptionFromWasmAbi for KeyPair
impl OptionFromWasmAbi for KeyPair
source§impl OptionIntoWasmAbi for KeyPair
impl OptionIntoWasmAbi for KeyPair
source§impl PartialEq<KeyPair> for KeyPair
impl PartialEq<KeyPair> for KeyPair
source§impl RefFromWasmAbi for KeyPair
impl RefFromWasmAbi for KeyPair
source§impl RefMutFromWasmAbi for KeyPair
impl RefMutFromWasmAbi for KeyPair
impl Eq for KeyPair
impl StructuralEq for KeyPair
impl StructuralPartialEq for KeyPair
Auto Trait Implementations§
impl RefUnwindSafe for KeyPair
impl Send for KeyPair
impl Sync for KeyPair
impl Unpin for KeyPair
impl UnwindSafe for KeyPair
Blanket Implementations§
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abisource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.