feat(tvix/nix-compat/narinfo): add fingerprint
This adds support to compute the fingerprint string, which is what's ed25519-signed in binary caches. Change-Id: I8947239c609896acfd7261f110450014bedf465a Reviewed-on: https://cl.tvl.fyi/c/depot/+/10080 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
bb18556bf3
commit
a834966efd
2 changed files with 64 additions and 0 deletions
|
|
@ -30,8 +30,11 @@ use crate::{
|
|||
store_path::StorePathRef,
|
||||
};
|
||||
|
||||
mod fingerprint;
|
||||
mod signature;
|
||||
|
||||
pub use fingerprint::fingerprint;
|
||||
|
||||
pub use signature::{Signature, SignatureError};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -282,6 +285,17 @@ impl<'a> NarInfo<'a> {
|
|||
flags,
|
||||
})
|
||||
}
|
||||
|
||||
/// Computes the fingerprint string for certain fields in this [NarInfo].
|
||||
/// This fingerprint is signed in [self.signatures].
|
||||
pub fn fingerprint(&self) -> String {
|
||||
fingerprint(
|
||||
&self.store_path,
|
||||
&self.nar_hash,
|
||||
self.nar_size,
|
||||
self.references.iter(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for NarInfo<'_> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue