Skip to content

Commit

Permalink
narinfo: Fix reading of secret key file
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Sep 20, 2024
1 parent 2dad87a commit 62c104c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/Hydra/View/NARInfo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use Nix::Manifest;
use Nix::Store;
use Nix::Utils;
use Hydra::Helper::Nix;
use File::Slurp qw/readFile/;
use base qw/Catalyst::View/;

sub process {
Expand Down Expand Up @@ -38,7 +39,11 @@ sub process {
# Optionally, sign the NAR info file we just created.
my $secretKeyFile = $c->config->{binary_cache_secret_key_file};
if (defined $secretKeyFile) {
my $secretKey = readFile $secretKeyFile;
my $secretKey = "";
open my $fh, '<', $secretKeyFile or die "Could not open file '$secretKeyFile' $!";
while (<$fh>) {
$secretKey .= $_;
}
my $fingerprint = fingerprintPath($storePath, $narHash, $narSize, $refs);
my $sig = signString($secretKey, $fingerprint);
$info .= "Sig: $sig\n";
Expand Down

0 comments on commit 62c104c

Please sign in to comment.