diff --git a/nip46/dynamic-signer.go b/nip46/dynamic-signer.go index 6fcf40f..63db51d 100644 --- a/nip46/dynamic-signer.go +++ b/nip46/dynamic-signer.go @@ -40,9 +40,6 @@ func NewDynamicSigner( // unless it is nil, this is called after every event is signed 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 { return DynamicSigner{ getHandlerSecretKey: getHandlerSecretKey, diff --git a/nip52/calendar_event.go b/nip52/calendar_event.go index 71c95ae..7b9514c 100644 --- a/nip52/calendar_event.go +++ b/nip52/calendar_event.go @@ -30,7 +30,7 @@ type CalendarEvent struct { } type Participant struct { - PubKey string + PubKey nostr.PubKey Relay string Role string } @@ -77,9 +77,9 @@ func ParseCalendarEvent(event nostr.Event) CalendarEvent { case "g": calev.Geohashes = append(calev.Geohashes, tag[1]) case "p": - if nostr.IsValid32ByteHex(tag[1]) { + if pk, err := nostr.PubKeyFromHex(tag[1]); err == nil { part := Participant{ - PubKey: tag[1], + PubKey: pk, } if len(tag) > 2 { part.Relay = tag[2] @@ -129,7 +129,7 @@ func (calev CalendarEvent) ToHashtags() nostr.Tags { tags = append(tags, nostr.Tag{"g", geohash}) } 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 { tags = append(tags, nostr.Tag{"r", reference}) diff --git a/sdk/hints/lmdbh/db.go b/sdk/hints/lmdbh/db.go index a47b875..002f280 100644 --- a/sdk/hints/lmdbh/db.go +++ b/sdk/hints/lmdbh/db.go @@ -153,7 +153,7 @@ func (lh *LMDBHints) PrintScores() { } defer cursor.Close() - var lastPubkey string + var lastPubkey nostr.PubKey i := 0 for k, v, err := cursor.Get(nil, nil, lmdb.First); err == nil; k, v, err = cursor.Get(nil, nil, lmdb.Next) { diff --git a/sdk/hints/lmdbh/keys.go b/sdk/hints/lmdbh/keys.go index 34c4854..6d33356 100644 --- a/sdk/hints/lmdbh/keys.go +++ b/sdk/hints/lmdbh/keys.go @@ -2,7 +2,6 @@ package lmdbh import ( "encoding/binary" - "encoding/hex" "fiatjaf.com/nostr" ) @@ -14,8 +13,8 @@ func encodeKey(pubhintkey nostr.PubKey, relay string) []byte { return k } -func parseKey(k []byte) (pubkey string, relay string) { - pubkey = hex.EncodeToString(k[0:32]) +func parseKey(k []byte) (pubkey nostr.PubKey, relay string) { + pubkey = nostr.PubKey(k[0:32]) relay = string(k[32:]) return }