fix some pubkeys that were strings still.
This commit is contained in:
@@ -40,9 +40,6 @@ func NewDynamicSigner(
|
|||||||
|
|
||||||
// unless it is nil, this is called after every event is signed
|
// unless it is nil, this is called after every event is signed
|
||||||
onEventSigned func(event nostr.Event),
|
onEventSigned func(event nostr.Event),
|
||||||
|
|
||||||
// unless it is nil, the results of this will be used in reply to get_relays
|
|
||||||
getRelays func(pubkey string) map[string]RelayReadWrite,
|
|
||||||
) DynamicSigner {
|
) DynamicSigner {
|
||||||
return DynamicSigner{
|
return DynamicSigner{
|
||||||
getHandlerSecretKey: getHandlerSecretKey,
|
getHandlerSecretKey: getHandlerSecretKey,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ type CalendarEvent struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Participant struct {
|
type Participant struct {
|
||||||
PubKey string
|
PubKey nostr.PubKey
|
||||||
Relay string
|
Relay string
|
||||||
Role string
|
Role string
|
||||||
}
|
}
|
||||||
@@ -77,9 +77,9 @@ func ParseCalendarEvent(event nostr.Event) CalendarEvent {
|
|||||||
case "g":
|
case "g":
|
||||||
calev.Geohashes = append(calev.Geohashes, tag[1])
|
calev.Geohashes = append(calev.Geohashes, tag[1])
|
||||||
case "p":
|
case "p":
|
||||||
if nostr.IsValid32ByteHex(tag[1]) {
|
if pk, err := nostr.PubKeyFromHex(tag[1]); err == nil {
|
||||||
part := Participant{
|
part := Participant{
|
||||||
PubKey: tag[1],
|
PubKey: pk,
|
||||||
}
|
}
|
||||||
if len(tag) > 2 {
|
if len(tag) > 2 {
|
||||||
part.Relay = tag[2]
|
part.Relay = tag[2]
|
||||||
@@ -129,7 +129,7 @@ func (calev CalendarEvent) ToHashtags() nostr.Tags {
|
|||||||
tags = append(tags, nostr.Tag{"g", geohash})
|
tags = append(tags, nostr.Tag{"g", geohash})
|
||||||
}
|
}
|
||||||
for _, part := range calev.Participants {
|
for _, part := range calev.Participants {
|
||||||
tags = append(tags, nostr.Tag{"p", part.PubKey, part.Relay, part.Role})
|
tags = append(tags, nostr.Tag{"p", part.PubKey.Hex(), part.Relay, part.Role})
|
||||||
}
|
}
|
||||||
for _, reference := range calev.References {
|
for _, reference := range calev.References {
|
||||||
tags = append(tags, nostr.Tag{"r", reference})
|
tags = append(tags, nostr.Tag{"r", reference})
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ func (lh *LMDBHints) PrintScores() {
|
|||||||
}
|
}
|
||||||
defer cursor.Close()
|
defer cursor.Close()
|
||||||
|
|
||||||
var lastPubkey string
|
var lastPubkey nostr.PubKey
|
||||||
i := 0
|
i := 0
|
||||||
|
|
||||||
for k, v, err := cursor.Get(nil, nil, lmdb.First); err == nil; k, v, err = cursor.Get(nil, nil, lmdb.Next) {
|
for k, v, err := cursor.Get(nil, nil, lmdb.First); err == nil; k, v, err = cursor.Get(nil, nil, lmdb.Next) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package lmdbh
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
|
||||||
|
|
||||||
"fiatjaf.com/nostr"
|
"fiatjaf.com/nostr"
|
||||||
)
|
)
|
||||||
@@ -14,8 +13,8 @@ func encodeKey(pubhintkey nostr.PubKey, relay string) []byte {
|
|||||||
return k
|
return k
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseKey(k []byte) (pubkey string, relay string) {
|
func parseKey(k []byte) (pubkey nostr.PubKey, relay string) {
|
||||||
pubkey = hex.EncodeToString(k[0:32])
|
pubkey = nostr.PubKey(k[0:32])
|
||||||
relay = string(k[32:])
|
relay = string(k[32:])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user