nip46: revamp dynamic signer, require a ctx on HandleRequest().

This commit is contained in:
fiatjaf
2024-10-14 16:26:01 -03:00
parent ee5ca07d6d
commit e05dbb5d51
3 changed files with 69 additions and 103 deletions

View File

@@ -1,6 +1,7 @@
package nip46
import (
"context"
"encoding/json"
"fmt"
"regexp"
@@ -26,10 +27,11 @@ type Response struct {
type Signer interface {
GetSession(clientPubkey string) (Session, bool)
HandleRequest(event *nostr.Event) (req Request, resp Response, eventResponse nostr.Event, err error)
HandleRequest(context.Context, *nostr.Event) (req Request, resp Response, eventResponse nostr.Event, err error)
}
type Session struct {
PublicKey string
SharedKey []byte // nip04
ConversationKey [32]byte // nip44
}