Skip to main content

Ed25519KeyPair

Struct Ed25519KeyPair 

Source
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

Source

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).

Source

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).

Source

pub fn from_seed_slice(seed: &[u8]) -> Result<Self>

Build a key pair from a seed slice, validating its length.

Source

pub fn seed(&self) -> [u8; 32]

The 32-byte private seed.

Source

pub fn public_key(&self) -> [u8; 32]

The 32-byte public key.

Source

pub fn sign(&self, message: &[u8]) -> [u8; 64]

Sign a message, returning the 64-byte signature.

Source

pub fn public_multikey(&self) -> String

The public key as a Multikey string (z-prefixed base58btc).

Source

pub fn did_key(&self) -> String

The did:key form of the public key.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.