Skip to main content

Abstract Class: BaseRegistrationRouteSQL

Defined in: src/routes/sql/BaseRegistrationRouteSQL.ts:8

Provides a simple account registration flow that verifies an e-mail or phone number using OTP authentication before creating the account.

The registration flow:

  1. Client calls POST /start with either an e-mail address of phone number to verify.
  2. Sends an OTP code to the provided email or phone number in step 1.
  3. Client calls POST /verify with the email or phone number and OTP code.
  4. If OTP code is verified, creates a new User and Alias, returns a valid JWT token.

Extends

Constructors

Constructor

new BaseRegistrationRouteSQL(): BaseRegistrationRouteSQL

Returns

BaseRegistrationRouteSQL

Inherited from

BaseRegistrationRoute.constructor

Properties

aliasClass

protected aliasClass: any = AliasSQL

Defined in: src/routes/sql/BaseRegistrationRouteSQL.ts:9

Overrides

BaseRegistrationRoute.aliasClass


aliasRepo?

protected optional aliasRepo?: RepoUtils<AliasSQL>

Defined in: src/routes/BaseRegistrationRoute.ts:77

Inherited from

BaseRegistrationRoute.aliasRepo


defaultScopes

protected defaultScopes: string[] = []

Defined in: src/routes/BaseRegistrationRoute.ts:57

Inherited from

BaseRegistrationRoute.defaultScopes


jwtConfig?

protected optional jwtConfig?: any

Defined in: src/routes/BaseRegistrationRoute.ts:60

Inherited from

BaseRegistrationRoute.jwtConfig


logger

protected logger: any

Defined in: src/routes/BaseRegistrationRoute.ts:63

Inherited from

BaseRegistrationRoute.logger


messagingUtils?

protected optional messagingUtils?: MessagingUtils

Defined in: src/routes/BaseRegistrationRoute.ts:66

Inherited from

BaseRegistrationRoute.messagingUtils


rateLimiter?

protected optional rateLimiter?: RateLimiter

Defined in: src/routes/BaseRegistrationRoute.ts:69

Inherited from

BaseRegistrationRoute.rateLimiter


tokenUtils?

protected optional tokenUtils?: TokenUtils

Defined in: src/routes/BaseRegistrationRoute.ts:72

Inherited from

BaseRegistrationRoute.tokenUtils


trustedProxies

protected trustedProxies: string[] = []

Defined in: src/routes/BaseRegistrationRoute.ts:75

Inherited from

BaseRegistrationRoute.trustedProxies


userClass

protected userClass: any = UserSQL

Defined in: src/routes/sql/BaseRegistrationRouteSQL.ts:10

Overrides

BaseRegistrationRoute.userClass


userRepo?

protected optional userRepo?: RepoUtils<UserSQL>

Defined in: src/routes/BaseRegistrationRoute.ts:78

Inherited from

BaseRegistrationRoute.userRepo

Methods

initialize()

protected initialize(): Promise<void>

Defined in: src/routes/BaseRegistrationRoute.ts:81

Returns

Promise<void>

Inherited from

BaseRegistrationRoute.initialize


start()

start(body, req): Promise<Record<string, never>>

Defined in: src/routes/BaseRegistrationRoute.ts:108

Sends a one-time verification code to the provided e-mail address or phone number.

Parameters

body

StartBody

req

HttpRequest

Returns

Promise<Record<string, never>>

Inherited from

BaseRegistrationRoute.start


verify()

verify(body, req, res): Promise<AuthResult>

Defined in: src/routes/BaseRegistrationRoute.ts:194

Verifies the one-time code sent by start(). On success, creates a new User and verified Alias and returns an JWT token.

Parameters

body

VerifyBody

req

HttpRequest

res

HttpResponse

Returns

Promise<AuthResult>

Inherited from

BaseRegistrationRoute.verify