a bunch of [32]byte conversions. still more needed.

This commit is contained in:
fiatjaf
2025-04-14 17:31:23 -03:00
parent 40535e6b19
commit b4268d649c
132 changed files with 857 additions and 879 deletions

View File

@@ -2,18 +2,17 @@ package sdk
import (
"encoding/binary"
"encoding/hex"
"github.com/nbd-wtf/go-nostr"
"fiatjaf.com/nostr"
)
var kvStoreLastFetchPrefix = byte('f')
func makeLastFetchKey(kind int, pubkey string) []byte {
func makeLastFetchKey(kind uint16, pubkey nostr.PubKey) []byte {
buf := make([]byte, 1+5+32)
buf[0] = kvStoreLastFetchPrefix
binary.LittleEndian.PutUint32(buf[1:], uint32(kind))
hex.Decode(buf[5:], []byte(pubkey))
copy(buf[5:], pubkey[:])
return buf
}