passkeys

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FinalizeLoginEndpoint

func FinalizeLoginEndpoint(svc Service) endpoint.Endpoint

func FinalizeLoginHandler

func FinalizeLoginHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

func FinalizeRegistrationEndpoint

func FinalizeRegistrationEndpoint(svc Service) endpoint.Endpoint

func FinalizeRegistrationHandler

func FinalizeRegistrationHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

func FinalizeTransactionEndpoint added in v1.0.1

func FinalizeTransactionEndpoint(svc Service) endpoint.Endpoint

func FinalizeTransactionHandler added in v1.0.1

func FinalizeTransactionHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

func InitializeLoginEndpoint

func InitializeLoginEndpoint(svc Service) endpoint.Endpoint

func InitializeLoginHandler

func InitializeLoginHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

func InitializeRegistrationEndpoint

func InitializeRegistrationEndpoint(svc Service) endpoint.Endpoint

func InitializeRegistrationHandler

func InitializeRegistrationHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

func InitializeTransactionEndpoint added in v1.0.1

func InitializeTransactionEndpoint(svc Service) endpoint.Endpoint

func InitializeTransactionHandler added in v1.0.1

func InitializeTransactionHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

Types

type Credential

type Credential struct {
	ID              string     `json:"id"`
	Name            *string    `json:"name,omitempty"`
	PublicKey       string     `json:"public_key"`
	AttestationType string     `json:"attestation_type"`
	AAGUID          uuid.UUID  `json:"aaguid"`
	LastUsedAt      *time.Time `json:"last_used_at,omitempty"`
	CreatedAt       time.Time  `json:"created_at"`
	Transports      []string   `json:"transports"`
	BackupEligible  bool       `json:"backup_eligible"`
	BackupState     bool       `json:"backup_state"`
	IsMFA           bool       `json:"is_mfa"`
}

type CredentialServie

type CredentialServie interface {
	ListCredentials(userID string) ([]*Credential, error)
	UpdateCredential(credentialID string, name string) error
	RemoveCredential(credentialID string) error
}

type FailureResult

type FailureResult struct {
	Title   string `json:"title"`
	Details string `json:"details"`
	Status  int    `json:"status"`
}

func (*FailureResult) Error

func (result *FailureResult) Error() string

type InitializeLoginRequest

type InitializeLoginRequest struct {
	UserID string `json:"user_id"`
}

type InitializeLoginResponse

type InitializeLoginResponse struct {
	Response  protocol.PublicKeyCredentialRequestOptions `json:"publicKey"`
	Mediation string                                     `json:"mediation"`
}

type InitializeRegistrationRequest

type InitializeRegistrationRequest struct {
	UserID   string `json:"user_id"`
	Username string `json:"username"`
}

type InitializeTransactionRequest

type InitializeTransactionRequest struct {
	UserID          string `json:"user_id"`
	TransactionID   string `json:"transaction_id"`
	TransactionData any    `json:"transaction_data"`
}

type InitializeTransactionResponse added in v1.0.1

type InitializeTransactionResponse struct {
	Response  protocol.PublicKeyCredentialRequestOptions `json:"publicKey"`
	Mediation string                                     `json:"mediation"`
}

type LoginService

type LoginService interface {
	InitializeLogin(userID string) (*protocol.CredentialAssertion, string, error)
	FinalizeLogin(req *protocol.ParsedCredentialAssertionData) (string, error)
	VerifyToken(token string) (*jwt.Token, error)
}

type PasskeyService

type PasskeyService interface {
	RegistrationService
	LoginService
	// CredentialServie
	TransactionService
}

type RegistrationService

type RegistrationService interface {
	InitializeRegistration(userID string, username string) (*protocol.CredentialCreation, error)
	FinalizeRegistration(req *protocol.ParsedCredentialCreationData) (string, error)
}

type Service

type Service interface {
	PasskeyService
}

func NewService

func NewService(cfg conf.PasskeysProvider) (Service, error)

type TokenResult

type TokenResult struct {
	Token string `json:"token"`
}

type TransactionService

type TransactionService interface {
	InitializeTransaction(req *InitializeTransactionRequest) (*protocol.CredentialAssertion, string, error)
	FinalizeTransaction(req *protocol.ParsedCredentialAssertionData) (string, error)
}

Jump to

Keyboard shortcuts

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