Abstract Class: BaseRegistrationRoute<U, A>
Defined in: src/routes/BaseRegistrationRoute.ts:49
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.
Extended by
Type Parameters
U
U extends User
A
A extends Alias
Constructors
Constructor
new BaseRegistrationRoute<
U,A>():BaseRegistrationRoute<U,A>
Returns
BaseRegistrationRoute<U, A>
Properties
aliasClass
abstractprotectedaliasClass:any
Defined in: src/routes/BaseRegistrationRoute.ts:50
aliasRepo?
protectedoptionalaliasRepo?:RepoUtils<A>
Defined in: src/routes/BaseRegistrationRoute.ts:77
defaultScopes
protecteddefaultScopes:string[] =[]
Defined in: src/routes/BaseRegistrationRoute.ts:57
jwtConfig?
protectedoptionaljwtConfig?:any
Defined in: src/routes/BaseRegistrationRoute.ts:60
logger
protectedlogger:any
Defined in: src/routes/BaseRegistrationRoute.ts:63
messagingUtils?
protectedoptionalmessagingUtils?:MessagingUtils
Defined in: src/routes/BaseRegistrationRoute.ts:66
rateLimiter?
protectedoptionalrateLimiter?:RateLimiter
Defined in: src/routes/BaseRegistrationRoute.ts:69
tokenUtils?
protectedoptionaltokenUtils?:TokenUtils
Defined in: src/routes/BaseRegistrationRoute.ts:72
trustedProxies
protectedtrustedProxies:string[] =[]
Defined in: src/routes/BaseRegistrationRoute.ts:75
userClass
abstractprotecteduserClass:any
Defined in: src/routes/BaseRegistrationRoute.ts:51
userRepo?
protectedoptionaluserRepo?:RepoUtils<U>
Defined in: src/routes/BaseRegistrationRoute.ts:78
Methods
initialize()
protectedinitialize():Promise<void>
Defined in: src/routes/BaseRegistrationRoute.ts:81
Returns
Promise<void>
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>>
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>