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:
- Client calls
POST /startwith either an e-mail address of phone number to verify. - Sends an OTP code to the provided email or phone number in step 1.
- Client calls
POST /verifywith the email or phone number and OTP code. - If OTP code is verified, creates a new
UserandAlias, returns a valid JWT token.
Extends
Constructors
Constructor
new BaseRegistrationRouteSQL():
BaseRegistrationRouteSQL
Returns
BaseRegistrationRouteSQL
Inherited from
BaseRegistrationRoute.constructor
Properties
aliasClass
protectedaliasClass:any=AliasSQL
Defined in: src/routes/sql/BaseRegistrationRouteSQL.ts:9
Overrides
BaseRegistrationRoute.aliasClass
aliasRepo?
protectedoptionalaliasRepo?:RepoUtils<AliasSQL>
Defined in: src/routes/BaseRegistrationRoute.ts:77
Inherited from
BaseRegistrationRoute.aliasRepo
defaultScopes
protecteddefaultScopes:string[] =[]
Defined in: src/routes/BaseRegistrationRoute.ts:57
Inherited from
BaseRegistrationRoute.defaultScopes
jwtConfig?
protectedoptionaljwtConfig?:any
Defined in: src/routes/BaseRegistrationRoute.ts:60
Inherited from
BaseRegistrationRoute.jwtConfig
logger
protectedlogger:any
Defined in: src/routes/BaseRegistrationRoute.ts:63
Inherited from
messagingUtils?
protectedoptionalmessagingUtils?:MessagingUtils
Defined in: src/routes/BaseRegistrationRoute.ts:66
Inherited from
BaseRegistrationRoute.messagingUtils
rateLimiter?
protectedoptionalrateLimiter?:RateLimiter
Defined in: src/routes/BaseRegistrationRoute.ts:69
Inherited from
BaseRegistrationRoute.rateLimiter
tokenUtils?
protectedoptionaltokenUtils?:TokenUtils
Defined in: src/routes/BaseRegistrationRoute.ts:72
Inherited from
BaseRegistrationRoute.tokenUtils
trustedProxies
protectedtrustedProxies:string[] =[]
Defined in: src/routes/BaseRegistrationRoute.ts:75
Inherited from
BaseRegistrationRoute.trustedProxies
userClass
protecteduserClass:any=UserSQL
Defined in: src/routes/sql/BaseRegistrationRouteSQL.ts:10
Overrides
BaseRegistrationRoute.userClass
userRepo?
protectedoptionaluserRepo?:RepoUtils<UserSQL>
Defined in: src/routes/BaseRegistrationRoute.ts:78
Inherited from
BaseRegistrationRoute.userRepo
Methods
initialize()
protectedinitialize():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
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>