pub struct PublicKey { /* private fields */ }Expand description
A Minisign public key
This struct represents a Minisign public key, which can be used to verify signatures. A public key can be created from a base64 string, read from a file, or parsed from a string in minisign.pub format.
The public key contains an Ed25519 key, a key ID for signature matching, and optionally an untrusted comment.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn from_base64(public_key_b64: &str) -> Result<Self, Error>
pub fn from_base64(public_key_b64: &str) -> Result<Self, Error>
Create a Minisign public key from a base64 string
Sourcepub fn decode(lines_str: &str) -> Result<Self, Error>
pub fn decode(lines_str: &str) -> Result<Self, Error>
Create a Minisign public key from a string, as in the minisign.pub
file
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Load a Minisign key from a file (such as the minisign.pub file)
Sourcepub fn untrusted_comment(&self) -> Option<&str>
pub fn untrusted_comment(&self) -> Option<&str>
Return the untrusted comment, if there is one
Sourcepub fn verify(
&self,
bin: &[u8],
signature: &Signature,
allow_legacy: bool,
) -> Result<(), Error>
pub fn verify( &self, bin: &[u8], signature: &Signature, allow_legacy: bool, ) -> Result<(), Error>
Verify that signature is a valid signature for bin using this public
key allow_legacy should only be set to true in order to support
signatures made by older versions of Minisign.
Sourcepub fn verify_stream<'a>(
&'a self,
signature: &'a Signature,
) -> Result<StreamVerifier<'a>, Error>
pub fn verify_stream<'a>( &'a self, signature: &'a Signature, ) -> Result<StreamVerifier<'a>, Error>
Sets up a stream verifier that can be use iteratively.