From e058e7c7b7cf9d19996e78f1f28b0607b2486838 Mon Sep 17 00:00:00 2001 From: zBNF <88048377+zBNF@users.noreply.github.com> Date: Tue, 11 Oct 2022 21:01:31 -0400 Subject: [PATCH] api: Allow disabling interaction pubkey verification (#350) * feat: add support for disabling signature verification * feat: refactor solution to not break api * feat: make InteractionServer.ServeHTTP use InteractionServer.httpHandler --- api/webhook/interactionserver.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/webhook/interactionserver.go b/api/webhook/interactionserver.go index ce86732..ff16f96 100644 --- a/api/webhook/interactionserver.go +++ b/api/webhook/interactionserver.go @@ -107,14 +107,16 @@ func NewInteractionServer(pubkey string, handler InteractionHandler) (*Interacti } s.httpHandler = http.HandlerFunc(s.handle) - s.httpHandler = s.withVerification(s.httpHandler) + if len(s.pubkey) != 0 { + s.httpHandler = s.withVerification(s.httpHandler) + } return &s, nil } // ServeHTTP implements http.Handler. func (s *InteractionServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { - s.withVerification(http.HandlerFunc(s.handle)).ServeHTTP(w, r) + s.httpHandler.ServeHTTP(w, r) } func (s *InteractionServer) handle(w http.ResponseWriter, r *http.Request) {