Add signevent to nip86

This commit is contained in:
Jon Staab
2026-06-22 17:13:41 -07:00
parent a525b66054
commit fa7d25a59b
2 changed files with 74 additions and 0 deletions
+9
View File
@@ -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())