Struct nix_compat::narinfo::signature::Signature
source · pub struct Signature<S> {
name: S,
bytes: SignatureBytes,
}
Fields§
§name: S
§bytes: SignatureBytes
Implementations§
source§impl<S> Signature<S>
impl<S> Signature<S>
Represents the signatures that Nix emits. It consists of a name (an identifier for a public key), and an ed25519 signature (64 bytes). It is generic over the string type that’s used for the name, and there’s SignatureRef as a type alias for one containing &str.
sourcepub fn new(name: S, bytes: SignatureBytes) -> Self
pub fn new(name: S, bytes: SignatureBytes) -> Self
Constructs a new Signature from a name and public key.
sourcepub fn parse<'a>(input: &'a str) -> Result<Self, Error>
pub fn parse<'a>(input: &'a str) -> Result<Self, Error>
Parses a Signature from a string containing the name, a colon, and 64
base64-encoded bytes (plus padding).
These strings are commonly seen in the Signature:
field of a NARInfo
file.
sourcepub fn bytes(&self) -> &SignatureBytes
pub fn bytes(&self) -> &SignatureBytes
Returns the 64 bytes of signatures.
sourcepub fn verify(&self, fingerprint: &[u8], verifying_key: &VerifyingKey) -> bool
pub fn verify(&self, fingerprint: &[u8], verifying_key: &VerifyingKey) -> bool
For a given fingerprint and ed25519 verifying key, ensure if the signature is valid.
sourcepub fn as_ref(&self) -> SignatureRef<'_>
pub fn as_ref(&self) -> SignatureRef<'_>
Constructs a SignatureRef from this signature.
Trait Implementations§
source§impl<'a, 'de, S> Deserialize<'de> for Signature<S>
impl<'a, 'de, S> Deserialize<'de> for Signature<S>
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<S: PartialEq> PartialEq for Signature<S>
impl<S: PartialEq> PartialEq for Signature<S>
impl<S: Eq> Eq for Signature<S>
impl<S> StructuralPartialEq for Signature<S>
Auto Trait Implementations§
impl<S> Freeze for Signature<S>where
S: Freeze,
impl<S> RefUnwindSafe for Signature<S>where
S: RefUnwindSafe,
impl<S> Send for Signature<S>where
S: Send,
impl<S> Sync for Signature<S>where
S: Sync,
impl<S> Unpin for Signature<S>where
S: Unpin,
impl<S> UnwindSafe for Signature<S>where
S: UnwindSafe,
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