@withpotter/auth-core — module reference
HTTP routes this module mounts, plus its internal use-cases, entities, and repositories. The exhaustive request/response contract is the engine’s OpenAPI document at /docs; the layered structure below follows the package internal architecture.
HTTP routes
Accounts /accounts
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /accounts/:id | Yes | Get an account by id |
GET | /accounts/google/url | Yes | Get Google OAuth consent URL |
GET | /accounts/me | Yes | Get the currently signed-in account |
GET | /accounts/me/devices | Yes | List active device sessions for the current account |
GET | /accounts/me/organizations | Yes | List organizations the current account belongs to |
POST | /accounts | Yes | Sign up |
POST | /accounts/forgot-password | Yes | Start password reset |
POST | /accounts/google/callback | Yes | Complete Google sign-in |
POST | /accounts/google/link | Yes | Link Google to an existing password account |
POST | /accounts/login | Yes | Log in with email + password |
POST | /accounts/logout | Yes | Log out (clears the session cookie) |
POST | /accounts/me/devices/revoke-others | Yes | Revoke every device session except the current one |
POST | /accounts/resend-verification | Yes | Resend the email verification link |
POST | /accounts/reset-password | Yes | Complete password reset using emailed token |
POST | /accounts/verify-email | Yes | Verify email using emailed token |
PUT | /accounts/me | Yes | Update the current account\u2019s profile |
PUT | /accounts/me/email | Yes | Change email (requires password) |
PUT | /accounts/me/password | Yes | Change password (requires current password) |
DELETE | /accounts/me | Yes | Delete the current account |
DELETE | /accounts/me/devices/:deviceId | Yes | Revoke a specific device session |
Internals
Use-cases
Application operations. Each is a single-purpose class with one execute() method.
| Use-case | Signature |
|---|---|
ChangeEmailUseCase | execute(accountId: string, dto: ChangeEmailDto): Promise<{ success: boolean }> |
ChangePasswordUseCase | execute(accountId: string, dto: ChangePasswordDto): Promise<{ success: boolean }> |
CreateAccountWithPasswordUseCase | execute(input: CreateAccountWithPasswordInput): Promise<Account> |
CreateDeviceSessionUseCase | execute(data: CreateDeviceSessionData): Promise<DeviceSession> |
DeleteAccountUseCase | execute(accountId: string): Promise<{ success: boolean }> |
ForgotPasswordUseCase | execute(email: string): Promise<ForgotPasswordResult> |
GetAccountUseCase | execute(accountId: string): Promise<AccountResponseDto> |
GoogleSignInCallbackUseCase | execute(dto: GoogleSignInCallbackDto, ctx: RequestContext): Promise<GoogleSignInCallbackResult> |
GoogleSignInUrlUseCase | execute(): GoogleSignInUrlResult |
IssueLoginSessionUseCase | execute(account: Account, deviceContext?: DeviceContext): Promise<LoginResult> |
LinkGoogleToAccountUseCase | execute(dto: LinkGoogleToAccountDto, ctx: RequestContext): Promise<LoginResult> |
ListDevicesUseCase | execute(accountId: string, currentSessionId?: string): Promise<DeviceSessionDto[]> |
ListMyOrganizationsUseCase | execute(accountId: string): Promise<OrganizationResponseDto[]> |
LoginUseCase | execute(dto: LoginDto, ctx: RequestContext): Promise<LoginResult> |
ResendVerificationUseCase | execute(accountId: string): Promise<{ message: string }> |
ResetPasswordUseCase | execute(resetToken: string, newPassword: string): Promise<ResetPasswordResult> |
RevokeDeviceUseCase | execute(accountId: string, deviceId: string): Promise<void> |
RevokeOtherDevicesUseCase | execute(accountId: string, currentSessionId: string): Promise<void> |
SignupUseCase | execute(dto: CreateAccountDto, ctx: RequestContext): Promise<SignupResult> |
UpdateAccountUseCase | execute(accountId: string, dto: UpdateAccountDto): Promise<AccountResponseDto> |
VerifyAccountEmailUseCase | execute(token: string): Promise<{ message: string; verified: boolean }> |
Services
SessionCookieService
Generated from the module’s source. Routes are relative to the engine root
(default http://localhost:3001). For full request/response schemas use the live
OpenAPI document.