use xhex everywhere.

This commit is contained in:
fiatjaf
2025-11-21 21:16:34 -03:00
parent 61b9717c5c
commit 55a43e46b7
46 changed files with 185 additions and 177 deletions

View File

@@ -2,7 +2,6 @@ package blossom
import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"io"
"mime"
@@ -128,7 +127,7 @@ func (bs BlossomServer) handleUpload(w http.ResponseWriter, r *http.Request) {
}
hash := sha256.Sum256(b)
hhash := hex.EncodeToString(hash[:])
hhash := nostr.HexEncodeToString(hash[:])
mimeType := mime.TypeByExtension(ext)
if mimeType == "" {
mimeType = "application/octet-stream"
@@ -443,7 +442,7 @@ func (bs BlossomServer) handleMirror(w http.ResponseWriter, r *http.Request) {
// calculate sha256
hash := sha256.Sum256(body)
hhash := hex.EncodeToString(hash[:])
hhash := nostr.HexEncodeToString(hash[:])
// verify hash against x tag
if auth.Tags.FindWithValue("x", hhash) == nil {