webauthn

package module
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 7 Imported by: 2

README

webauthn

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WebAuthnID

func WebAuthnID(uid uint64) []byte

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(user UserHandler, lazyInit ...func(echo.Context) *webauthn.Config) *Server

func (*Server) Init

func (s *Server) Init(cfg *webauthn.Config) error

func (*Server) Object

func (s *Server) Object(ctx echo.Context) *webauthn.WebAuthn

func (*Server) RegisterRoute

func (s *Server) RegisterRoute(r echo.RouteRegister)

func (*Server) RegisterRouteForLogin added in v0.2.5

func (s *Server) RegisterRouteForLogin(r echo.RouteRegister)

type Stage

type Stage int
const (
	StageBegin Stage = iota + 1
	StageFinish
)

type Type

type Type int
const (
	TypeRegister Type = iota + 1
	TypeLogin
	TypeUnbind
)

type User

type User struct {
	ID          uint64
	Name        string
	DisplayName string
	Icon        string
	Credentials []webauthn.Credential
}

func (*User) WebAuthnCredentials

func (u *User) WebAuthnCredentials() []webauthn.Credential

Credentials owned by the user

func (*User) WebAuthnDisplayName

func (u *User) WebAuthnDisplayName() string

Display Name of the user

func (*User) WebAuthnID

func (u *User) WebAuthnID() []byte

User ID according to the Relying Party

func (*User) WebAuthnIcon

func (u *User) WebAuthnIcon() string

User's icon url

func (*User) WebAuthnName

func (u *User) WebAuthnName() string

User Name according to the Relying Party

type UserHandler

type UserHandler interface {
	GetUser(ctx echo.Context, username string, opType Type, stage Stage) (webauthn.User, error)
	Register(ctx echo.Context, user webauthn.User, cred *webauthn.Credential) error
	Login(ctx echo.Context, user webauthn.User, cred *webauthn.Credential) error
	Unbind(ctx echo.Context, user webauthn.User, cred *webauthn.Credential) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL