pub struct CacheSigner { /* private fields */ }Expand description
Signs narinfo metadata with an ed25519 key pair.
Implementations§
Source§impl CacheSigner
impl CacheSigner
Sourcepub fn new(key_name: String, secret_key: SigningKey) -> Self
pub fn new(key_name: String, secret_key: SigningKey) -> Self
Create a signer from a key name and raw 32-byte secret key.
Sourcepub fn public_key(&self) -> VerifyingKey
pub fn public_key(&self) -> VerifyingKey
Return the public (verifying) key.
Sourcepub fn public_key_string(&self) -> String
pub fn public_key_string(&self) -> String
Format the public key as keyname:base64pubkey for distribution.
Sourcepub fn secret_key_string(&self) -> String
pub fn secret_key_string(&self) -> String
Format the secret key as keyname:base64(secret||public) (Nix format).
Nix stores signing keys as 64 bytes: the 32-byte secret seed concatenated with the 32-byte public key, then base64-encoded.
Sourcepub fn from_secret_key_string(s: &str) -> Result<Self, CacheError>
pub fn from_secret_key_string(s: &str) -> Result<Self, CacheError>
Parse a secret key from the keyname:base64(secret||public) format.
§Errors
Returns an error if the format is invalid or the base64 decoding fails.
Sourcepub fn sign_narinfo(&self, info: &NarInfo) -> String
pub fn sign_narinfo(&self, info: &NarInfo) -> String
Sign a narinfo and return the signature string (keyname:base64sig).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CacheSigner
impl RefUnwindSafe for CacheSigner
impl Send for CacheSigner
impl Sync for CacheSigner
impl Unpin for CacheSigner
impl UnsafeUnpin for CacheSigner
impl UnwindSafe for CacheSigner
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more