@otp-service/nest 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -0
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @otp-service/nest
|
|
2
|
+
|
|
3
|
+
NestJS **`DynamicModule`** factory and controller helper to expose OTP **generate** / **verify** routes backed by an [`@otp-service/core`](https://www.npmjs.com/package/@otp-service/core) **`OtpService`**.
|
|
4
|
+
|
|
5
|
+
**ESM only** · **Node.js ≥ 22** · **License:** MIT
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @otp-service/nest @otp-service/core @nestjs/common @nestjs/core reflect-metadata rxjs
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Peers: **`@nestjs/common`** and **`@nestjs/core`** `^11.0.0`. Use **`reflect-metadata`** and **`rxjs`** as required by your Nest app.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Pass a ready-built **`OtpService`** from [`@otp-service/core`](https://www.npmjs.com/package/@otp-service/core). The dynamic module registers the controller and the service token internally.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { Module } from "@nestjs/common";
|
|
21
|
+
import { createNestOtpModule } from "@otp-service/nest";
|
|
22
|
+
|
|
23
|
+
@Module({
|
|
24
|
+
imports: [createNestOtpModule({ otpService, pathPrefix: "otp" })]
|
|
25
|
+
})
|
|
26
|
+
export class AppModule {}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
For tests or advanced wiring you can also use **`createOtpController(pathPrefix)`** and **`OTP_SERVICE_TOKEN`**; see **`CreateNestOtpModuleOptions`** in **`dist/index.d.ts`**.
|
|
30
|
+
|
|
31
|
+
## Exports
|
|
32
|
+
|
|
33
|
+
| Export | Purpose |
|
|
34
|
+
|--------|---------|
|
|
35
|
+
| `createNestOtpModule` | `DynamicModule` with controller + `OtpService` provider |
|
|
36
|
+
| `createOtpController` | Standalone controller class factory |
|
|
37
|
+
| `OTP_SERVICE_TOKEN` | DI token for `OtpService` |
|
|
38
|
+
|
|
39
|
+
## Related packages
|
|
40
|
+
|
|
41
|
+
- [`@otp-service/core`](https://www.npmjs.com/package/@otp-service/core)
|
|
42
|
+
- Guide: [docs/guides/frameworks/nest.md](https://github.com/Suraj-H/otp-service-package-v2/blob/main/docs/guides/frameworks/nest.md)
|
|
43
|
+
|
|
44
|
+
## Links
|
|
45
|
+
|
|
46
|
+
- Repository: [github.com/Suraj-H/otp-service-package-v2](https://github.com/Suraj-H/otp-service-package-v2)
|
|
47
|
+
- Issues: [github.com/Suraj-H/otp-service-package-v2/issues](https://github.com/Suraj-H/otp-service-package-v2/issues)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otp-service/nest",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Nest module and controller helpers for OTP flows.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
|
-
"dist"
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md"
|
|
26
27
|
],
|
|
27
28
|
"engines": {
|
|
28
29
|
"node": ">=22.0.0"
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
"access": "public"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@otp-service/core": "0.1.
|
|
35
|
+
"@otp-service/core": "0.1.1"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
38
|
"@nestjs/common": "^11.0.0",
|