forked from coracle/zooid
Expand signable kinds to include pinboards
This commit is contained in:
+11
-3
@@ -437,11 +437,19 @@ func (m *ManagementStore) removeRoleFromMembers(roleID string) error {
|
|||||||
|
|
||||||
// Signing
|
// Signing
|
||||||
|
|
||||||
|
// signableKinds is the allowlist of event kinds the relay is willing to sign on an admin's
|
||||||
|
// behalf. Any kind not in this list is rejected outright.
|
||||||
|
var signableKinds = []nostr.Kind{
|
||||||
|
nostr.KindApplicationSpecificData, // 30078
|
||||||
|
30067,
|
||||||
|
39067,
|
||||||
|
}
|
||||||
|
|
||||||
// SignEvent signs an event template with the relay's identity key on an admin's behalf, then
|
// SignEvent signs an event template with the relay's identity key on an admin's behalf, then
|
||||||
// stores and broadcasts it before returning the signed event. Only kind 30078 (application-specific
|
// stores and broadcasts it before returning the signed event. Only kinds in signableKinds are
|
||||||
// data) is supported for now; every other kind is rejected outright.
|
// supported; every other kind is rejected outright.
|
||||||
func (m *ManagementStore) SignEvent(kind nostr.Kind, createdAt nostr.Timestamp, tags nostr.Tags, content string) (nostr.Event, error) {
|
func (m *ManagementStore) SignEvent(kind nostr.Kind, createdAt nostr.Timestamp, tags nostr.Tags, content string) (nostr.Event, error) {
|
||||||
if kind != nostr.KindApplicationSpecificData {
|
if !slices.Contains(signableKinds, kind) {
|
||||||
return nostr.Event{}, errors.New("kind not allowed")
|
return nostr.Event{}, errors.New("kind not allowed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user