mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-23 23:55:02 +01:00
add admin api key for creating accounts
This commit is contained in:
17
lib/tokens/admin.go
Normal file
17
lib/tokens/admin.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package tokens
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
)
|
||||
|
||||
func AdminTokenMiddleware(token string) echo.MiddlewareFunc {
|
||||
if token == "" {
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return next
|
||||
}
|
||||
}
|
||||
return middleware.KeyAuth(func(auth string, c echo.Context) (bool, error) {
|
||||
return auth == token, nil
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user