1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-27 17:23:00 +00:00

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
This commit is contained in:
zBNF 2022-10-11 21:01:31 -04:00 committed by GitHub
parent 83cf774073
commit e058e7c7b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {