Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add authed pubkey to ReqAccepter #106

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (s *Server) doReq(ctx context.Context, ws *WebSocket, request []json.RawMes
}

if accepter, ok := s.relay.(ReqAccepter); ok {
if !accepter.AcceptReq(ctx, id, filters) {
if !accepter.AcceptReq(ctx, id, filters, ws.authed) {
return "REQ filters are not accepted"
}
}
Expand Down
2 changes: 1 addition & 1 deletion interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type ReqAccepter interface {
// AcceptReq is called for every nostr request filters received by the
// server. If the returned value is true, the filtres is passed on to
// [Storage.QueryEvent].
AcceptReq(context.Context, string, nostr.Filters) bool
AcceptReq(ctx context.Context, id string, filters nostr.Filters, authedPubkey string) bool
}

// Auther is the interface for implementing NIP-42.
Expand Down