pub struct Ed25519KeyPair { /* private fields */ }Expand description
An Ed25519 key pair. The 32-byte seed is the private key (RFC 8032).
Implementations§
Source§impl Ed25519KeyPair
impl Ed25519KeyPair
Sourcepub fn generate() -> Result<Self>
pub fn generate() -> Result<Self>
Generate a fresh key pair using the platform CSPRNG (getrandom; on WASM this is the JS crypto API via the getrandom “js” feature in the wasm wrapper crate).
Sourcepub fn from_seed(seed: &[u8; 32]) -> Self
pub fn from_seed(seed: &[u8; 32]) -> Self
Build a key pair from a 32-byte seed (deterministic; used for KATs and for importing an existing private key).
Sourcepub fn from_seed_slice(seed: &[u8]) -> Result<Self>
pub fn from_seed_slice(seed: &[u8]) -> Result<Self>
Build a key pair from a seed slice, validating its length.
Sourcepub fn public_key(&self) -> [u8; 32]
pub fn public_key(&self) -> [u8; 32]
The 32-byte public key.
Sourcepub fn sign(&self, message: &[u8]) -> [u8; 64]
pub fn sign(&self, message: &[u8]) -> [u8; 64]
Sign a message, returning the 64-byte signature.
Sourcepub fn public_multikey(&self) -> String
pub fn public_multikey(&self) -> String
The public key as a Multikey string (z-prefixed base58btc).
Auto Trait Implementations§
impl Forget for Ed25519KeyPair
impl Freeze for Ed25519KeyPair
impl Move for Ed25519KeyPair
impl RefUnwindSafe for Ed25519KeyPair
impl Send for Ed25519KeyPair
impl Sync for Ed25519KeyPair
impl Unpin for Ed25519KeyPair
impl UnsafeUnpin for Ed25519KeyPair
impl UnwindSafe for Ed25519KeyPair
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