Add signevent to nip86
This commit is contained in:
@@ -48,6 +48,7 @@ type RelayManagementAPI struct {
|
||||
DeleteRole func(ctx context.Context, id string) error
|
||||
AssignRole func(ctx context.Context, pubkey nostr.PubKey, roleID string) error
|
||||
UnassignRole func(ctx context.Context, pubkey nostr.PubKey, roleID string) error
|
||||
SignEvent func(ctx context.Context, kind nostr.Kind, createdAt nostr.Timestamp, tags nostr.Tags, content string) (nostr.Event, error)
|
||||
Generic func(ctx context.Context, request nip86.Request) (nip86.Response, error)
|
||||
}
|
||||
|
||||
@@ -375,6 +376,14 @@ func (rl *Relay) HandleNIP86(w http.ResponseWriter, r *http.Request) {
|
||||
} else {
|
||||
resp.Result = true
|
||||
}
|
||||
case nip86.SignEvent:
|
||||
if rl.ManagementAPI.SignEvent == nil {
|
||||
resp.Error = fmt.Sprintf("method %s not supported", thing.MethodName())
|
||||
} else if result, err := rl.ManagementAPI.SignEvent(ctx, thing.Kind, thing.CreatedAt, thing.Tags, thing.Content); err != nil {
|
||||
resp.Error = err.Error()
|
||||
} else {
|
||||
resp.Result = result
|
||||
}
|
||||
case nip86.ListDisallowedKinds:
|
||||
if rl.ManagementAPI.ListDisallowedKinds == nil {
|
||||
resp.Error = fmt.Sprintf("method %s not supported", thing.MethodName())
|
||||
|
||||
Reference in New Issue
Block a user