passkey

package
v0.0.0-...-04ccfb0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSessionNotFound = apierrors.NotFound.WithReason("WebAuthnSessionNotFound").New("webauthn session not found")
View Source
var ErrUserNotFound = apierrors.NotFound.WithReason("UserNotFound").New("user not found")

Functions

This section is empty.

Types

type Config

type Config struct {
	RPID                        string
	RPOrigin                    string
	RPDisplayName               string
	AttestationPreference       protocol.ConveyancePreference
	AuthenticatorSelection      protocol.AuthenticatorSelection
	MediationModalTimeout       int
	MediationConditionalTimeout int
}

type ConfigService

type ConfigService struct {
	Request            *http.Request
	TrustProxy         config.TrustProxy
	TranslationService TranslationService
}

func (*ConfigService) MakeConfig

func (s *ConfigService) MakeConfig() (*Config, error)

type CreationOptionsService

type CreationOptionsService struct {
	ConfigService   *ConfigService
	UserService     UserService
	IdentityService IdentityService
	Store           *Store
}

func (*CreationOptionsService) MakeCreationOptions

func (s *CreationOptionsService) MakeCreationOptions(userID string) (*model.WebAuthnCreationOptions, error)

MakeCreationOptions makes creation options which is ready for use.

type IdentityService

type IdentityService interface {
	ListByUser(userID string) ([]*identity.Info, error)
}

type RequestOptionsService

type RequestOptionsService struct {
	ConfigService   *ConfigService
	IdentityService IdentityService
	Store           *Store
}

func (*RequestOptionsService) MakeConditionalRequestOptions

func (s *RequestOptionsService) MakeConditionalRequestOptions() (*model.WebAuthnRequestOptions, error)

func (*RequestOptionsService) MakeModalRequestOptions

func (s *RequestOptionsService) MakeModalRequestOptions() (*model.WebAuthnRequestOptions, error)

func (*RequestOptionsService) MakeModalRequestOptionsWithUser

func (s *RequestOptionsService) MakeModalRequestOptionsWithUser(userID string) (*model.WebAuthnRequestOptions, error)

type Service

type Service struct {
	Store         *Store
	ConfigService *ConfigService
}

func (*Service) ConsumeAssertionResponse

func (s *Service) ConsumeAssertionResponse(assertionResponse []byte) (err error)

func (*Service) ConsumeAttestationResponse

func (s *Service) ConsumeAttestationResponse(attestationResponse []byte) (err error)

func (*Service) GetCredentialIDFromAssertionResponse

func (s *Service) GetCredentialIDFromAssertionResponse(assertionResponse []byte) (credentialID string, err error)

func (*Service) PeekAssertionResponse

func (s *Service) PeekAssertionResponse(assertionResponse []byte, attestationResponse []byte) (signCount int64, err error)

func (*Service) PeekAttestationResponse

func (s *Service) PeekAttestationResponse(attestationResponse []byte) (creationOptions *model.WebAuthnCreationOptions, credentialID string, signCount int64, err error)

type Session

type Session struct {
	Challenge       protocol.URLEncodedBase64      `json:"challenge"`
	CreationOptions *model.WebAuthnCreationOptions `json:"creation_options,omitempty"`
	RequestOptions  *model.WebAuthnRequestOptions  `json:"request_options,omitempty"`
}

Session is an object to associate a challenge with generated options. It is persisted in Redis.

type Store

type Store struct {
	Context context.Context
	Redis   *appredis.Handle
	AppID   config.AppID
}

func (*Store) ConsumeSession

func (s *Store) ConsumeSession(challenge protocol.URLEncodedBase64) (*Session, error)

func (*Store) CreateSession

func (s *Store) CreateSession(session *Session) error

func (*Store) PeekSession

func (s *Store) PeekSession(challenge protocol.URLEncodedBase64) (*Session, error)

type TranslationService

type TranslationService interface {
	RenderText(key string, args interface{}) (string, error)
}

type UserService

type UserService interface {
	Get(id string, role accesscontrol.Role) (*model.User, error)
}

Jump to

Keyboard shortcuts

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