hydra-webauthn/internal/storage/user_repository.go

28 lines
1.1 KiB
Go
Raw Normal View History

2023-11-15 20:38:25 +01:00
package storage
import (
"context"
"github.com/go-webauthn/webauthn/webauthn"
)
type UserRepository interface {
CreateUser(ctx context.Context, username string, attributes map[string]any) (*User, error)
UpdateUserUsername(ctx context.Context, userID string, username string) (*User, error)
UpdateUserAttributes(ctx context.Context, userID string, attributes map[string]any) (*User, error)
AddUserCredential(ctx context.Context, userID string, credential *webauthn.Credential) (string, error)
RemoveUserCredential(ctx context.Context, userID string, credentialID string) error
GenerateRegistrationLink(ctx context.Context, userID string) (*RegistrationLink, error)
GetRegistrationLink(ctx context.Context, userID string) (*RegistrationLink, error)
GetRegistrationLinkByToken(ctx context.Context, token string) (*RegistrationLink, error)
ClearRegistrationLink(ctx context.Context, userID string) error
DeleteUserByID(ctx context.Context, userID string) error
FindUserByID(ctx context.Context, userID string) (*User, error)
FindUserByUsername(ctx context.Context, username string) (*User, error)
ListUsers(ctx context.Context) ([]UserHeader, error)
}