Files
motr/middleware/webauthn/middleware.go
Prad Nukala 786fef8399 Implement Database Migrations (#12)
* feat: enhance modularity by relocating core packages

* refactor: move chart components to dashboard package

* refactor: restructure database access layer

* refactor: rename credential descriptor to credentials for clarity

* feat: enhance development environment configuration for database interactions

* feat: integrate go-task for database migrations

* feat: introduce middleware for market data and WebAuthn
2025-05-29 15:07:20 -04:00

36 lines
625 B
Go

//go:build js && wasm
// +build js,wasm
package webauthn
import (
"errors"
"github.com/labstack/echo/v4"
)
type Context struct {
echo.Context
}
// Middleware is a middleware that adds a new key to the context
func Middleware() echo.MiddlewareFunc {
return func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
ctx := &Context{
Context: c,
}
return next(ctx)
}
}
}
// Unwrap unwraps the session context
func Unwrap(c echo.Context) (*Context, error) {
cc := c.(*Context)
if cc == nil {
return nil, errors.New("failed to unwrap session context")
}
return cc, nil
}