diff options
Diffstat (limited to 'tvix/nix-compat/src/narinfo/mod.rs')
-rw-r--r-- | tvix/nix-compat/src/narinfo/mod.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tvix/nix-compat/src/narinfo/mod.rs b/tvix/nix-compat/src/narinfo/mod.rs index ac904099453e..e64fb10d7ac8 100644 --- a/tvix/nix-compat/src/narinfo/mod.rs +++ b/tvix/nix-compat/src/narinfo/mod.rs @@ -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<'_> { |