mirror of
https://github.com/cf-sonr/motr.git
synced 2026-01-12 02:59:13 +00:00
* 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
36 lines
625 B
Go
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
|
|
}
|