@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

MethodPathAuthDescription
GET/accounts/:idYesGet an account by id
GET/accounts/google/urlYesGet Google OAuth consent URL
GET/accounts/meYesGet the currently signed-in account
GET/accounts/me/devicesYesList active device sessions for the current account
GET/accounts/me/organizationsYesList organizations the current account belongs to
POST/accountsYesSign up
POST/accounts/forgot-passwordYesStart password reset
POST/accounts/google/callbackYesComplete Google sign-in
POST/accounts/google/linkYesLink Google to an existing password account
POST/accounts/loginYesLog in with email + password
POST/accounts/logoutYesLog out (clears the session cookie)
POST/accounts/me/devices/revoke-othersYesRevoke every device session except the current one
POST/accounts/resend-verificationYesResend the email verification link
POST/accounts/reset-passwordYesComplete password reset using emailed token
POST/accounts/verify-emailYesVerify email using emailed token
PUT/accounts/meYesUpdate the current account\u2019s profile
PUT/accounts/me/emailYesChange email (requires password)
PUT/accounts/me/passwordYesChange password (requires current password)
DELETE/accounts/meYesDelete the current account
DELETE/accounts/me/devices/:deviceIdYesRevoke a specific device session

Internals

Use-cases

Application operations. Each is a single-purpose class with one execute() method.

Use-caseSignature
ChangeEmailUseCaseexecute(accountId: string, dto: ChangeEmailDto): Promise<{ success: boolean }>
ChangePasswordUseCaseexecute(accountId: string, dto: ChangePasswordDto): Promise<{ success: boolean }>
CreateAccountWithPasswordUseCaseexecute(input: CreateAccountWithPasswordInput): Promise<Account>
CreateDeviceSessionUseCaseexecute(data: CreateDeviceSessionData): Promise<DeviceSession>
DeleteAccountUseCaseexecute(accountId: string): Promise<{ success: boolean }>
ForgotPasswordUseCaseexecute(email: string): Promise<ForgotPasswordResult>
GetAccountUseCaseexecute(accountId: string): Promise<AccountResponseDto>
GoogleSignInCallbackUseCaseexecute(dto: GoogleSignInCallbackDto, ctx: RequestContext): Promise<GoogleSignInCallbackResult>
GoogleSignInUrlUseCaseexecute(): GoogleSignInUrlResult
IssueLoginSessionUseCaseexecute(account: Account, deviceContext?: DeviceContext): Promise<LoginResult>
LinkGoogleToAccountUseCaseexecute(dto: LinkGoogleToAccountDto, ctx: RequestContext): Promise<LoginResult>
ListDevicesUseCaseexecute(accountId: string, currentSessionId?: string): Promise<DeviceSessionDto[]>
ListMyOrganizationsUseCaseexecute(accountId: string): Promise<OrganizationResponseDto[]>
LoginUseCaseexecute(dto: LoginDto, ctx: RequestContext): Promise<LoginResult>
ResendVerificationUseCaseexecute(accountId: string): Promise<{ message: string }>
ResetPasswordUseCaseexecute(resetToken: string, newPassword: string): Promise<ResetPasswordResult>
RevokeDeviceUseCaseexecute(accountId: string, deviceId: string): Promise<void>
RevokeOtherDevicesUseCaseexecute(accountId: string, currentSessionId: string): Promise<void>
SignupUseCaseexecute(dto: CreateAccountDto, ctx: RequestContext): Promise<SignupResult>
UpdateAccountUseCaseexecute(accountId: string, dto: UpdateAccountDto): Promise<AccountResponseDto>
VerifyAccountEmailUseCaseexecute(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.