Struct nix_compat::narinfo::Signature

source ·
pub struct Signature<S> {
    name: S,
    bytes: SignatureBytes,
}

Fields§

§name: S§bytes: SignatureBytes

Implementations§

source§

impl<S> Signature<S>
where S: Deref<Target = str>,

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.

source

pub fn new(name: S, bytes: SignatureBytes) -> Self

Constructs a new Signature from a name and public key.

source

pub fn parse<'a>(input: &'a str) -> Result<Self, Error>
where S: From<&'a str>,

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.

source

pub fn name(&self) -> &S

Returns the name field of the signature.

source

pub fn bytes(&self) -> &SignatureBytes

Returns the 64 bytes of signatures.

source

pub fn verify(&self, fingerprint: &[u8], verifying_key: &VerifyingKey) -> bool

For a given fingerprint and ed25519 verifying key, ensure if the signature is valid.

source

pub fn as_ref(&self) -> SignatureRef<'_>

Constructs a SignatureRef from this signature.

source

pub fn to_owned(&self) -> Signature<String>

Trait Implementations§

source§

impl<S: Clone> Clone for Signature<S>

source§

fn clone(&self) -> Signature<S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S: Debug> Debug for Signature<S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, 'de, S> Deserialize<'de> for Signature<S>
where S: Deref<Target = str> + From<&'a str>, 'de: 'a,

source§

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> Display for Signature<S>
where S: Display,

source§

fn fmt(&self, w: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S> Hash for Signature<S>
where S: AsRef<str>,

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl NixDeserialize for Signature<String>

source§

async fn try_deserialize<R>(reader: &mut R) -> Result<Option<Self>, R::Error>
where R: ?Sized + NixRead + Send,

Read a value from the reader. This returns an Option to support gracefull shutdown.
source§

fn deserialize<R>( reader: &mut R, ) -> impl Future<Output = Result<Self, R::Error>> + Send + '_
where R: ?Sized + NixRead + Send,

source§

impl NixSerialize for Signature<String>

source§

async fn serialize<W>(&self, writer: &mut W) -> Result<(), W::Error>
where W: NixWrite,

Write a value to the writer.
source§

impl<S: PartialEq> PartialEq for Signature<S>

source§

fn eq(&self, other: &Signature<S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<S> Serialize for Signature<S>
where S: Deref<Target = str> + Display,

source§

fn serialize<SR>(&self, serializer: SR) -> Result<SR::Ok, SR::Error>
where SR: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<S: Eq> Eq for Signature<S>

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,