[−][src]Struct ssb_keyfile::Keypair
A public/secret long-term key pair.
This is an Ed25519 key pair.
Fields
secret: SecretKeyThe secret half of the key pair. Keep private.
public: PublicKeyThe public half of the key pair. Feel free to share.
Implementations
impl Keypair[src]
pub const SIZE: usize[src]
Size of a key pair, in bytes (== 64).
pub fn from_slice(s: &[u8]) -> Option<Keypair>[src]
Deserialize a keypair from a byte slice.
The slice length must be 64; where the first 32 bytes are the secret key, and the second 32 bytes are the public key (libsodium's standard layout).
pub fn from_base64(s: &str) -> Option<Keypair>[src]
Deserialize from the bas64 representation. Ignores optional .ed25519 suffix.
Example
let s = "R6DKoOCt1Cj/IB2/ocvj2Eyp8AgmFdoJ9hH2TO4Tl8Yfapd5Lmw4pSpoY0WBEnqpHjz6UB4/QL2Wr0hWVAyi1w==.ed25519"; if let Some(keypair) = ssb_crypto::Keypair::from_base64(s) { // let auth = keypair.sign("hello".to_bytes()); // ... } else { panic!() }
Trait Implementations
impl AsBytes for Keypair[src]
fn only_derive_is_allowed_to_implement_this_trait() where
Keypair: Sized, [src]
Keypair: Sized,
fn as_bytes(&self) -> &[u8]
fn as_bytes_mut(&mut self) -> &mut [u8] where
Self: FromBytes,
Self: FromBytes,
impl Clone for Keypair[src]
impl Debug for Keypair[src]
impl FromBytes for Keypair[src]
fn only_derive_is_allowed_to_implement_this_trait() where
Keypair: Sized, [src]
Keypair: Sized,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,