Struct ruma_signatures::Ed25519KeyPair[][src]

pub struct Ed25519KeyPair { /* fields omitted */ }
Expand description

An Ed25519 key pair.

Implementations

impl Ed25519KeyPair[src]

pub fn new(document: &[u8], version: String) -> Result<Self, Error>[src]

Initializes a new key pair.

Parameters

  • document: PKCS8-formatted bytes containing the private & public keys.
  • version: The “version” of the key used for this signature. Versions are used as an identifier to distinguish signatures generated from different keys but using the same algorithm on the same homeserver.

Errors

Returns an error if the public and private keys provided are invalid for the implementing algorithm.

pub fn generate() -> Result<Vec<u8>, Error>[src]

Generates a new key pair.

Returns

Returns a Vec representing a pkcs8-encoded private/public keypair

Errors

Returns an error if the generation failed.

pub fn version(&self) -> &str[src]

Returns the version string for this keypair.

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

Returns the public key.

Trait Implementations

impl Debug for Ed25519KeyPair[src]

fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult[src]

Formats the value using the given formatter. Read more

impl KeyPair for Ed25519KeyPair[src]

fn sign(&self, message: &[u8]) -> Signature[src]

Signs a JSON object. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.