pub struct KeyPair { /* private fields */ }Expand description
An Ed25519 signing key. Clones share one secret, which is wiped from
memory when the last of them is dropped (SigningKey zeroizes itself).
Implementations§
Source§impl KeyPair
impl KeyPair
pub fn generate() -> Self
pub fn from_secret(bytes: Zeroizing<[u8; 32]>) -> Self
Sourcepub fn load_or_create(path: &Path, uid: u32) -> Result<Self>
pub fn load_or_create(path: &Path, uid: u32) -> Result<Self>
Loads the key at path, creating it (mode 0600) if it does not
exist. An existing file is held to check_private.
Sourcepub fn load(path: &Path, uid: u32) -> Result<Self>
pub fn load(path: &Path, uid: u32) -> Result<Self>
Loads the key at path, which must be private to uid
(check_private).
Sourcepub fn load_carried(path: &Path, uid: u32) -> Result<(Self, bool)>
pub fn load_carried(path: &Path, uid: u32) -> Result<(Self, bool)>
Loads a key from wherever it was kept, a USB stick included, whose file system may show every file as readable by all: only the owner is checked. Says whether others may read the file, for a warning.
pub fn public_hex(&self) -> String
pub fn sign_hex(&self, msg: &[u8]) -> String
Trait Implementations§
Auto Trait Implementations§
impl Forget for KeyPair
impl Freeze for KeyPair
impl RefUnwindSafe for KeyPair
impl Send for KeyPair
impl Sync for KeyPair
impl Unpin for KeyPair
impl UnsafeUnpin for KeyPair
impl UnwindSafe for KeyPair
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more