hydra-webauthn/internal/storage/user_repository.go

28 lines
1.1 KiB
Go

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)
}