diff --git a/khatru/nip86.go b/khatru/nip86.go index fab0b0a..7131da9 100644 --- a/khatru/nip86.go +++ b/khatru/nip86.go @@ -31,10 +31,10 @@ type RelayManagementAPI struct { ChangeRelayName func(ctx context.Context, name string) error ChangeRelayDescription func(ctx context.Context, desc string) error ChangeRelayIcon func(ctx context.Context, icon string) error - AllowKind func(ctx context.Context, kind int) error - DisallowKind func(ctx context.Context, kind int) error - ListAllowedKinds func(ctx context.Context) ([]int, error) - ListDisallowedKinds func(ctx context.Context) ([]int, error) + AllowKind func(ctx context.Context, kind nostr.Kind) error + DisallowKind func(ctx context.Context, kind nostr.Kind) error + ListAllowedKinds func(ctx context.Context) ([]nostr.Kind, error) + ListDisallowedKinds func(ctx context.Context) ([]nostr.Kind, error) BlockIP func(ctx context.Context, ip net.IP, reason string) error UnblockIP func(ctx context.Context, ip net.IP, reason string) error ListBlockedIPs func(ctx context.Context) ([]nip86.IPReason, error) diff --git a/nip86/methods.go b/nip86/methods.go index f284eb9..aa34189 100644 --- a/nip86/methods.go +++ b/nip86/methods.go @@ -122,7 +122,7 @@ func DecodeRequest(req Request) (MethodParams, error) { if !ok || math.Trunc(kind) != kind { return nil, fmt.Errorf("invalid kind '%v' for '%s'", req.Params[0], req.Method) } - return AllowKind{int(kind)}, nil + return AllowKind{nostr.Kind(kind)}, nil case "disallowkind": if len(req.Params) == 0 { return nil, fmt.Errorf("invalid number of params for '%s'", req.Method) @@ -131,7 +131,7 @@ func DecodeRequest(req Request) (MethodParams, error) { if !ok || math.Trunc(kind) != kind { return nil, fmt.Errorf("invalid kind '%v' for '%s'", req.Params[0], req.Method) } - return DisallowKind{int(kind)}, nil + return DisallowKind{nostr.Kind(kind)}, nil case "listallowedkinds": return ListAllowedKinds{}, nil case "blockip": @@ -308,13 +308,13 @@ type ChangeRelayIcon struct { func (ChangeRelayIcon) MethodName() string { return "changerelayicon" } type AllowKind struct { - Kind int + Kind nostr.Kind } func (AllowKind) MethodName() string { return "allowkind" } type DisallowKind struct { - Kind int + Kind nostr.Kind } func (DisallowKind) MethodName() string { return "disallowkind" }