nip46: implement fmt.Stringer for request and response.

This commit is contained in:
fiatjaf
2024-10-14 16:42:54 -03:00
parent e05dbb5d51
commit 022d4ce598

View File

@ -19,12 +19,22 @@ type Request struct {
Params []string `json:"params"` Params []string `json:"params"`
} }
func (r Request) String() string {
j, _ := json.Marshal(r)
return string(j)
}
type Response struct { type Response struct {
ID string `json:"id"` ID string `json:"id"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
Result string `json:"result,omitempty"` Result string `json:"result,omitempty"`
} }
func (r Response) String() string {
j, _ := json.Marshal(r)
return string(j)
}
type Signer interface { type Signer interface {
GetSession(clientPubkey string) (Session, bool) GetSession(clientPubkey string) (Session, bool)
HandleRequest(context.Context, *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)