[][src]Struct nkeys::KeyPair

pub struct KeyPair { /* fields omitted */ }

The main interface used for reading and writing nkey-encoded key pairs, including seeds and public keys.

Methods

impl KeyPair[src]

pub fn new(kp_type: KeyPairType) -> KeyPair[src]

pub fn new_user() -> KeyPair[src]

Creates a new user key pair with a seed that has a U prefix

pub fn new_account() -> KeyPair[src]

Creates a new account key pair with a seed that has an A prefix

pub fn new_operator() -> KeyPair[src]

Creates a new operator key pair with a seed that has an O prefix

pub fn new_cluster() -> KeyPair[src]

Creates a new cluster key pair with a seed that has the C prefix

pub fn new_server() -> KeyPair[src]

Creates a new server key pair with a seed that has the N prefix

pub fn new_module() -> KeyPair[src]

Creates a new module (e.g. WebAssembly) key pair with a seed that has the M prefix

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

Returns the encoded public key of this key pair

pub fn sign(&self, input: &[u8]) -> Result<Vec<u8>, Error>[src]

Attempts to sign the given input with the key pair's seed

pub fn verify(&self, input: &[u8], sig: &[u8]) -> Result<(), Error>[src]

Attempts to verify that the given signature is valid for the given input

pub fn seed(&self) -> Result<String, Error>[src]

Attempts to return the encoded string for this key pair's seed. Remember that this value should be treated as a secret

pub fn from_public_key(source: &str) -> Result<KeyPair, Error>[src]

Attempts to produce a public-only key pair from the given encoded string

pub fn from_seed(source: &str) -> Result<KeyPair, Error>[src]

Attempts to produce a full key pair from the given encoded seed string

Trait Implementations

impl Clone for KeyPair[src]

impl Debug for KeyPair[src]

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<T> Any for T where
    T: 'static + ?Sized
[src]

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,