about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
Diffstat (limited to 'tvix')
-rw-r--r--tvix/nar-bridge/pkg/http/nar_put.go3
-rw-r--r--tvix/nar-bridge/pkg/http/narinfo.go4
2 files changed, 5 insertions, 2 deletions
diff --git a/tvix/nar-bridge/pkg/http/nar_put.go b/tvix/nar-bridge/pkg/http/nar_put.go
index d074fcb20f00..9a4238e61395 100644
--- a/tvix/nar-bridge/pkg/http/nar_put.go
+++ b/tvix/nar-bridge/pkg/http/nar_put.go
@@ -9,6 +9,7 @@ import (
 	castorev1pb "code.tvl.fyi/tvix/castore/protos"
 	"code.tvl.fyi/tvix/nar-bridge/pkg/importer"
 	"github.com/go-chi/chi/v5"
+	mh "github.com/multiformats/go-multihash/core"
 	nixhash "github.com/nix-community/go-nix/pkg/hash"
 	"github.com/sirupsen/logrus"
 	log "github.com/sirupsen/logrus"
@@ -101,7 +102,7 @@ func registerNarPut(s *Server) {
 
 		// Compare the nar hash specified in the URL with the one that has been
 		// calculated while processing the NAR file.
-		narHash, err := nixhash.FromHashTypeAndDigest(0x12, narSha256)
+		narHash, err := nixhash.FromHashTypeAndDigest(mh.SHA2_256, narSha256)
 		if err != nil {
 			panic("must parse nixbase32")
 		}
diff --git a/tvix/nar-bridge/pkg/http/narinfo.go b/tvix/nar-bridge/pkg/http/narinfo.go
index 5d963c34f91d..c938baba6590 100644
--- a/tvix/nar-bridge/pkg/http/narinfo.go
+++ b/tvix/nar-bridge/pkg/http/narinfo.go
@@ -4,7 +4,9 @@ import (
 	"fmt"
 
 	storev1pb "code.tvl.fyi/tvix/store/protos"
+	mh "github.com/multiformats/go-multihash/core"
 	nixhash "github.com/nix-community/go-nix/pkg/hash"
+
 	"github.com/nix-community/go-nix/pkg/narinfo"
 	"github.com/nix-community/go-nix/pkg/narinfo/signature"
 	"github.com/nix-community/go-nix/pkg/nixbase32"
@@ -30,7 +32,7 @@ func ToNixNarInfo(p *storev1pb.PathInfo) (*narinfo.NarInfo, error) {
 
 	// produce nixhash for the narsha256.
 	narHash, err := nixhash.FromHashTypeAndDigest(
-		0x12, // SHA2_256
+		mh.SHA2_256,
 		p.GetNarinfo().GetNarSha256(),
 	)
 	if err != nil {