mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-07-01 19:11:05 +02:00
nip46: implement fmt.Stringer for request and response.
This commit is contained in:
@ -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)
|
||||||
|
Reference in New Issue
Block a user