AsymmetricKey

Struct AsymmetricKey 

Source
pub struct AsymmetricKey<P, S> {
    pub public_key: P,
    pub secret_key: Option<S>,
}
Expand description

A wrapper struct for an asymmetric key pair.

§Fields

  • public_key: the public key of the key pair.
  • secret_key: the optional private key of the key pair.

§Type Parameters

  • P: The type of the public key.
  • S: The type of the secret key.

Fields§

§public_key: P§secret_key: Option<S>

Implementations§

Source§

impl AsymmetricKey<VerifyingKey, SigningKey>

Source

pub fn get_x25519(&self) -> Result<X25519KeyPair, Error>

Returns the X25519 key pair corresponding to the Ed25519 key pair.

§Returns

A Result containing the X25519 key pair as X25519KeyPair or an Error.

Trait Implementations§

Source§

impl TryFrom<AsymmetricKey<PublicKey, StaticSecret>> for Jwk

Converts an X25519KeyPair to a Jwk.

Source§

fn try_from(keypair: X25519KeyPair) -> Result<Self, Self::Error>

Converts an X25519KeyPair to a Jwk.

§Arguments
  • keypair - The X25519KeyPair to convert.
§Returns

A Result containing the converted Jwk or an Error.

Source§

type Error = Error

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

impl TryFrom<AsymmetricKey<VerifyingKey, SigningKey>> for Jwk

Converts an Ed25519KeyPair to a Jwk.

Source§

fn try_from(keypair: Ed25519KeyPair) -> Result<Self, Self::Error>

Converts an Ed25519KeyPair to a Jwk.

§Arguments
  • keypair - The Ed25519KeyPair to convert.
§Returns

A Result containing the converted Jwk or an Error.

Source§

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations§

§

impl<P, S> Freeze for AsymmetricKey<P, S>
where P: Freeze, S: Freeze,

§

impl<P, S> RefUnwindSafe for AsymmetricKey<P, S>

§

impl<P, S> Send for AsymmetricKey<P, S>
where P: Send, S: Send,

§

impl<P, S> Sync for AsymmetricKey<P, S>
where P: Sync, S: Sync,

§

impl<P, S> Unpin for AsymmetricKey<P, S>
where P: Unpin, S: Unpin,

§

impl<P, S> UnwindSafe for AsymmetricKey<P, S>
where P: UnwindSafe, S: UnwindSafe,

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> Instrument for T

Source§

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

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

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = Infallible

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

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

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,