Abstract Class: BaseAuthOTPRoute<U, A, S>
Defined in: src/routes/BaseAuthOTPRoute.ts:21
Extended by
Type Parameters
U
U extends User
A
A extends Alias
S
S extends Secret
Constructors
Constructor
new BaseAuthOTPRoute<
U,A,S>():BaseAuthOTPRoute<U,A,S>
Returns
BaseAuthOTPRoute<U, A, S>
Properties
aliasClass
abstractprotectedaliasClass:any
Defined in: src/routes/BaseAuthOTPRoute.ts:22
aliasRepo?
protectedoptionalaliasRepo?:RepoUtils<A>
Defined in: src/routes/BaseAuthOTPRoute.ts:26
authMiddleware?
protectedoptionalauthMiddleware?:AuthMiddleware
Defined in: src/routes/BaseAuthOTPRoute.ts:29
jwtConfig?
protectedoptionaljwtConfig?:any
Defined in: src/routes/BaseAuthOTPRoute.ts:32
messagingUtils?
protectedoptionalmessagingUtils?:MessagingUtils
Defined in: src/routes/BaseAuthOTPRoute.ts:38
objectFactory?
protectedoptionalobjectFactory?:ObjectFactory
Defined in: src/routes/BaseAuthOTPRoute.ts:35
secretClass
abstractprotectedsecretClass:any
Defined in: src/routes/BaseAuthOTPRoute.ts:23
secretRepo?
protectedoptionalsecretRepo?:RepoUtils<S>
Defined in: src/routes/BaseAuthOTPRoute.ts:40
template
protectedtemplate:string="login-otp"
Defined in: src/routes/BaseAuthOTPRoute.ts:43
The name of the messaging template to use for sending notifications.
userClass
abstractprotecteduserClass:any
Defined in: src/routes/BaseAuthOTPRoute.ts:24
userRepo?
protectedoptionaluserRepo?:RepoUtils<U>
Defined in: src/routes/BaseAuthOTPRoute.ts:45
userUtils?
protectedoptionaluserUtils?:UserUtils<U,A>
Defined in: src/routes/BaseAuthOTPRoute.ts:47
Methods
authenticate()
authenticate(
user):Promise<AuthResult|undefined>
Defined in: src/routes/BaseAuthOTPRoute.ts:112
Authenticates the user using OTP and returns a JSON Web Token access token to be used with future API requests.
Parameters
user
JWTUser
Returns
Promise<AuthResult | undefined>
convertAliasType()
protectedconvertAliasType(type):OTPContactType
Defined in: src/routes/BaseAuthOTPRoute.ts:120
Parameters
type
Returns
getContact()
protectedgetContact(id):Promise<OTPContact|undefined>
Defined in: src/routes/BaseAuthOTPRoute.ts:136
Retrieves the alias with the given unique id.
Parameters
id
string
The unique id of the alias to retrieve.
Returns
Promise<OTPContact | undefined>
The alias if found, otherwise undefined.
getContacts()
protectedgetContacts(id):Promise<OTPContact[]>
Defined in: src/routes/BaseAuthOTPRoute.ts:156
Retrieves all aliases for the user with the given id.
Parameters
id
string
The unique id of the user to lookup.
Returns
Promise<OTPContact[]>
getUser()
protectedgetUser(uid):Promise<JWTUser|undefined>
Defined in: src/routes/BaseAuthOTPRoute.ts:196
Retrieves the user with the given unique id.
Parameters
uid
string
The unique id of the user to retrieve.
Returns
Promise<JWTUser | undefined>
The user if found, otherwise undefined.
initialize()
protectedinitialize():Promise<void>
Defined in: src/routes/BaseAuthOTPRoute.ts:53
Called on server startup to initialize the route with any defaults.
Returns
Promise<void>
notifyContact()
protectednotifyContact(contact,totp):Promise<void>
Defined in: src/routes/BaseAuthOTPRoute.ts:203
Parameters
contact
totp
string
Returns
Promise<void>