pub struct Keypair(/* private fields */);Expand description
Wrapper around pkarr::Keypair that customizes PublicKey rendering.
Implementations§
Source§impl Keypair
impl Keypair
Sourcepub fn from_secret(secret: &[u8; 32]) -> Self
pub fn from_secret(secret: &[u8; 32]) -> Self
Construct a Keypair from a 32-byte secret.
Sourcepub fn from_secret_key_file(path: &Path) -> Result<Self, Error>
pub fn from_secret_key_file(path: &Path) -> Result<Self, Error>
Read a keypair from a pkarr secret key file.
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Return the PublicKey associated with this Keypair.
Display the returned key with .to_string() to get the pubky<z32> identifier or
PublicKey::z32() when you specifically need the bare z-base32 text (e.g. hostnames).
Sourcepub const fn as_inner(&self) -> &Keypair
pub const fn as_inner(&self) -> &Keypair
Borrow the inner pkarr::Keypair.
Sourcepub fn write_secret_key_file(&self, path: &Path) -> Result<(), Error>
pub fn write_secret_key_file(&self, path: &Path) -> Result<(), Error>
Persist the secret key to disk using the pkarr format.
Sourcepub fn into_inner(self) -> Keypair
pub fn into_inner(self) -> Keypair
Extract the inner pkarr::Keypair.
Methods from Deref<Target = Keypair>§
Sourcepub fn sign(&self, message: &[u8]) -> Signature
pub fn sign(&self, message: &[u8]) -> Signature
Signs a message with the private key of this Keypair.
Sourcepub fn verify(&self, message: &[u8], signature: &Signature) -> Result<(), Error>
pub fn verify(&self, message: &[u8], signature: &Signature) -> Result<(), Error>
Verifies a message against a given signature using this Keypair.
Sourcepub fn secret_key(&self) -> [u8; 32]
pub fn secret_key(&self) -> [u8; 32]
Returns the secret part of this Keypair.
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Returns the PublicKey of this Keypair.
Sourcepub fn to_z32(&self) -> String
pub fn to_z32(&self) -> String
Converts the public key of this Keypair to a z-base32 encoded string.
Sourcepub fn to_uri_string(&self) -> String
pub fn to_uri_string(&self) -> String
Converts the public key of this Keypair to a URI string.