Class: OtpService
Implements
OtpServiceInterface
Constructors
new OtpService()
new OtpService(
allOtpRepos
,settings
):OtpService
Parameters
Parameter | Type |
---|---|
allOtpRepos | Record <string , Repository <OtpInterface >> |
settings | OtpSettingsInterface |
Returns
Defined in
packages/nestjs-otp/src/services/otp.service.ts:31 (opens in a new tab)
Properties
Property | Modifier | Type |
---|---|---|
settings | readonly | OtpSettingsInterface |
Methods
clear()
clear(
assignment
,otp
,queryOptions
?):Promise
<void
>
Clear all otps for assign in given category.
Parameters
Parameter | Type | Description |
---|---|---|
assignment | string | The assignment of the repository |
otp | Pick <OtpInterface , "category" | "assignee" > | The otp to clear |
queryOptions ? | QueryOptionsInterface | - |
Returns
Promise
<void
>
Implementation of
OtpServiceInterface.clear
Defined in
packages/nestjs-otp/src/services/otp.service.ts:141 (opens in a new tab)
create()
create(
assignment
,otp
,queryOptions
?):Promise
<OtpInterface
>
Create a otp with a for the given assignee.
Parameters
Parameter | Type | Description |
---|---|---|
assignment | string | The otp assignment |
otp | OtpCreatableInterface | The data to create |
queryOptions ? | QueryOptionsInterface | - |
Returns
Promise
<OtpInterface
>
Implementation of
OtpServiceInterface.create
Defined in
packages/nestjs-otp/src/services/otp.service.ts:44 (opens in a new tab)
delete()
delete(
assignment
,otp
,queryOptions
?):Promise
<void
>
Delete a otp based on params
Parameters
Parameter | Type | Description |
---|---|---|
assignment | string | The otp assignment |
otp | Pick <OtpInterface , "category" | "assignee" | "passcode" > | The otp to delete |
queryOptions ? | QueryOptionsInterface | - |
Returns
Promise
<void
>
Implementation of
OtpServiceInterface.delete
Defined in
packages/nestjs-otp/src/services/otp.service.ts:122 (opens in a new tab)
deleteOtp()
protected
deleteOtp(assignment
,id
,queryOptions
?):Promise
<void
>
Internal
Delete OTP based on assignment
Parameters
Parameter | Type | Description |
---|---|---|
assignment | string | The assignment to delete id from |
id | string | string [] | The id or ids to delete |
queryOptions ? | QueryOptionsInterface | - |
Returns
Promise
<void
>
Defined in
packages/nestjs-otp/src/services/otp.service.ts:167 (opens in a new tab)
getAssignedOtps()
protected
getAssignedOtps(assignment
,otp
,queryOptions
?):Promise
<OtpInterface
[]>
Get all OTPs for assignee.
Parameters
Parameter | Type | Description |
---|---|---|
assignment | string | The assignment of the check |
otp | Pick <OtpInterface , "category" | "assignee" > | The otp to get assignments |
queryOptions ? | QueryOptionsInterface | - |
Returns
Promise
<OtpInterface
[]>
Defined in
packages/nestjs-otp/src/services/otp.service.ts:191 (opens in a new tab)
getAssignmentRepo()
protected
getAssignmentRepo(assignment
):Repository
<OtpInterface
>
Internal
Get the assignment repo for the given assignment.
Parameters
Parameter | Type | Description |
---|---|---|
assignment | string | The otp assignment |
Returns
Repository
<OtpInterface
>
Defined in
packages/nestjs-otp/src/services/otp.service.ts:261 (opens in a new tab)
getByPasscode()
protected
getByPasscode(assignment
,otp
,queryOptions
?):Promise
<null
|OtpInterface
>
Parameters
Parameter | Type |
---|---|
assignment | string |
otp | Pick <OtpInterface , "category" | "passcode" > |
queryOptions ? | QueryOptionsInterface |
Returns
Promise
<null
| OtpInterface
>
Defined in
packages/nestjs-otp/src/services/otp.service.ts:223 (opens in a new tab)
validate()
validate(
assignment
,otp
,deleteIfValid
,queryOptions
?):Promise
<null
|ReferenceAssigneeInterface
<ReferenceIdInterface
<string
>>>
Check if otp is valid
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
assignment | string | undefined | The otp assignment |
otp | Pick <OtpInterface , "category" | "passcode" > | undefined | The otp to validate |
deleteIfValid | boolean | false | If true, delete the otp if it is valid |
queryOptions ? | QueryOptionsInterface | undefined | - |
Returns
Promise
<null
| ReferenceAssigneeInterface
<ReferenceIdInterface
<string
>>>
Implementation of
OtpServiceInterface.validate
Defined in
packages/nestjs-otp/src/services/otp.service.ts:92 (opens in a new tab)
validateDto()
protected
validateDto<T
>(type
,data
):Promise
<T
>
Type Parameters
Type Parameter |
---|
T extends DeepPartial <OtpInterface > |
Parameters
Parameter | Type |
---|---|
type | Type <T > |
data | T |
Returns
Promise
<T
>
Defined in
packages/nestjs-otp/src/services/otp.service.ts:275 (opens in a new tab)