mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-10-31 20:14:21 +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:
parent
83cf774073
commit
e058e7c7b7
|
@ -107,14 +107,16 @@ func NewInteractionServer(pubkey string, handler InteractionHandler) (*Interacti
|
||||||
}
|
}
|
||||||
|
|
||||||
s.httpHandler = http.HandlerFunc(s.handle)
|
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
|
return &s, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServeHTTP implements http.Handler.
|
// ServeHTTP implements http.Handler.
|
||||||
func (s *InteractionServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
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) {
|
func (s *InteractionServer) handle(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
Loading…
Reference in a new issue