api

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GetCsrfTokenErrors                              = contract.MustOperationErrors("getCsrfToken")
	GetGoogleLoginOptionsErrors                     = contract.MustOperationErrors("getGoogleLoginOptions")
	LoginWithGoogleErrors                           = contract.MustOperationErrors("loginWithGoogle")
	LoginWithPasswordErrors                         = contract.MustOperationErrors("loginWithPassword")
	SignupDirectErrors                              = contract.MustOperationErrors("signupDirect")
	StartSignupChallengeErrors                      = contract.MustOperationErrors("startSignupChallenge")
	VerifySignupChallengeErrors                     = contract.MustOperationErrors("verifySignupChallenge")
	StartPasswordResetChallengeErrors               = contract.MustOperationErrors("startPasswordResetChallenge")
	VerifyPasswordResetChallengeErrors              = contract.MustOperationErrors("verifyPasswordResetChallenge")
	ResendChallengeErrors                           = contract.MustOperationErrors("resendChallenge")
	BeginPasskeyAuthenticationErrors                = contract.MustOperationErrors("beginPasskeyAuthentication")
	FinishPasskeyAuthenticationErrors               = contract.MustOperationErrors("finishPasskeyAuthentication")
	BeginPasskeyRegistrationErrors                  = contract.MustOperationErrors("beginPasskeyRegistration")
	FinishPasskeyRegistrationErrors                 = contract.MustOperationErrors("finishPasskeyRegistration")
	LogoutErrors                                    = contract.MustOperationErrors("logout")
	RefreshSessionErrors                            = contract.MustOperationErrors("refreshSession")
	RefreshTokensErrors                             = contract.MustOperationErrors("refreshTokens")
	GetCurrentUserErrors                            = contract.MustOperationErrors("getCurrentUser")
	GetCurrentAccountErrors                         = contract.MustOperationErrors("getCurrentAccount")
	ChangeCurrentUsernameErrors                     = contract.MustOperationErrors("changeCurrentUsername")
	StartCurrentUserEmailChangeErrors               = contract.MustOperationErrors("startCurrentUserEmailChange")
	VerifyCurrentUserEmailChangeErrors              = contract.MustOperationErrors("verifyCurrentUserEmailChange")
	AddCurrentUserPasswordErrors                    = contract.MustOperationErrors("addCurrentUserPassword")
	ChangeCurrentUserPasswordErrors                 = contract.MustOperationErrors("changeCurrentUserPassword")
	LinkCurrentUserGoogleErrors                     = contract.MustOperationErrors("linkCurrentUserGoogle")
	UnlinkCurrentUserAuthMethodErrors               = contract.MustOperationErrors("unlinkCurrentUserAuthMethod")
	DeleteCurrentUserPasskeyErrors                  = contract.MustOperationErrors("deleteCurrentUserPasskey")
	RevokeCurrentUserSessionErrors                  = contract.MustOperationErrors("revokeCurrentUserSession")
	RevokeCurrentUserOtherSessionsErrors            = contract.MustOperationErrors("revokeCurrentUserOtherSessions")
	SetCurrentUserPasswordErrors                    = contract.MustOperationErrors("setCurrentUserPassword")
	ListCurrentUserOrganizationsErrors              = contract.MustOperationErrors("listCurrentUserOrganizations")
	GetCurrentOrganizationErrors                    = contract.MustOperationErrors("getCurrentOrganization")
	ListCurrentOrganizationMembersErrors            = contract.MustOperationErrors("listCurrentOrganizationMembers")
	SwitchOrganizationErrors                        = contract.MustOperationErrors("switchOrganization")
	PreviewInvitationErrors                         = contract.MustOperationErrors("previewInvitation")
	AcceptInvitationErrors                          = contract.MustOperationErrors("acceptInvitation")
	LoginAndAcceptInvitationErrors                  = contract.MustOperationErrors("loginAndAcceptInvitation")
	AuthenticateAndAcceptInvitationWithGoogleErrors = contract.MustOperationErrors("authenticateAndAcceptInvitationWithGoogle")
	StartGoogleAccountRecoveryLinkErrors            = contract.MustOperationErrors("startGoogleAccountRecoveryLink")
	CompleteAccountRecoveryLinkWithPasswordErrors   = contract.MustOperationErrors("completeAccountRecoveryLinkWithPassword")
	CompleteAccountRecoveryLinkWithGoogleErrors     = contract.MustOperationErrors("completeAccountRecoveryLinkWithGoogle")
)

Functions

This section is empty.

Types

type APIHandler

type APIHandler struct {
	Auth           *auth.Service
	Passkeys       *passkey.Service
	Session        *session.Service
	Organizations  *organization.Service
	Challenge      *challenge.Service
	Verification   *challenge.VerificationCodeService
	Limiter        ratelimiter.AuthLimiter
	Logger         *slog.Logger
	Google         GoogleVerifier
	OAuthProviders oauth.OAuthProviders

	ChallengeEnabled     bool
	UsernameLoginEnabled bool
	AccessTTL            time.Duration
	RefreshTTL           time.Duration
}

func New

func New(
	auth *auth.Service,
	passkeys *passkey.Service,
	session *session.Service,
	organizations *organization.Service,
	challenge *challenge.Service,
	verification *challenge.VerificationCodeService,
	limiter ratelimiter.AuthLimiter,
	logger *slog.Logger,
	google GoogleVerifier,
	oauthProviders oauth.OAuthProviders,
	challengeEnabled bool,
	usernameLoginEnabled bool,
	accessTTL time.Duration,
	refreshTTL time.Duration,
) *APIHandler

func (*APIHandler) AcceptInvitation added in v0.16.0

func (*APIHandler) AddCurrentUserPassword added in v0.16.0

func (*APIHandler) ChangeCurrentUserPassword added in v0.16.0

func (*APIHandler) ChangeCurrentUsername added in v0.16.0

func (*APIHandler) DeleteCurrentUserPasskey added in v0.16.0

func (*APIHandler) FinishPasskeyRegistration added in v0.10.0

func (*APIHandler) GetCsrfToken added in v0.10.0

func (*APIHandler) GetCurrentAccount added in v0.16.0

func (*APIHandler) GetCurrentUser added in v0.10.0

func (*APIHandler) LinkCurrentUserGoogle added in v0.16.0

func (*APIHandler) LoginAndAcceptInvitation added in v0.16.0

func (*APIHandler) LoginWithGoogle added in v0.10.0

func (*APIHandler) LoginWithPassword added in v0.10.0

func (*APIHandler) Logout added in v0.10.0

func (*APIHandler) PreviewInvitation added in v0.16.0

func (*APIHandler) RefreshSession added in v0.10.0

func (*APIHandler) RefreshTokens added in v0.10.0

func (*APIHandler) ResendChallenge added in v0.10.0

func (*APIHandler) RevokeCurrentUserSession added in v0.16.0

func (*APIHandler) SetCurrentUserPassword added in v0.12.0

func (*APIHandler) SignupDirect added in v0.10.0

func (*APIHandler) StartSignupChallenge added in v0.10.0

func (*APIHandler) SwitchOrganization added in v0.10.0

func (*APIHandler) VerifySignupChallenge added in v0.10.0

type GoogleVerifier added in v0.16.0

type GoogleVerifier interface {
	VerifyIDToken(context.Context, string, string) (*google.Identity, error)
}

Jump to

Keyboard shortcuts

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