@otp-service/redis-store 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 +52 -0
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @otp-service/redis-store
|
|
2
|
+
|
|
3
|
+
Redis-backed implementation of [`@otp-service/core`](https://www.npmjs.com/package/@otp-service/core) **`ChallengeStore`** for OTP challenge records (create, get, update, delete).
|
|
4
|
+
|
|
5
|
+
**ESM only** · **Node.js ≥ 22** · **License:** MIT
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @otp-service/redis-store @otp-service/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Bring your own **Redis client** that matches the small **`RedisStoreClient`** interface (string get/set/del with optional TTL on set).
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createRedisChallengeStore } from "@otp-service/redis-store";
|
|
19
|
+
|
|
20
|
+
const store = createRedisChallengeStore({
|
|
21
|
+
client: redisClient,
|
|
22
|
+
keyPrefix: "otp:myapp"
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const otpService = createOtpService({
|
|
26
|
+
store,
|
|
27
|
+
delivery,
|
|
28
|
+
signer,
|
|
29
|
+
policy,
|
|
30
|
+
/* ... */
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Implement **`RedisStoreClient`** for **`ioredis`**, **`node-redis`**, or any client that can implement **`get`**, **`set`** (with expiration), and **`del`**.
|
|
35
|
+
|
|
36
|
+
## Exports
|
|
37
|
+
|
|
38
|
+
| Export | Purpose |
|
|
39
|
+
|--------|---------|
|
|
40
|
+
| `createRedisChallengeStore` | Factory returning a `ChallengeStore` |
|
|
41
|
+
| `RedisStoreClient` | Port your Redis driver implements |
|
|
42
|
+
| `CreateRedisChallengeStoreOptions` | Configuration type |
|
|
43
|
+
|
|
44
|
+
## Related packages
|
|
45
|
+
|
|
46
|
+
- [`@otp-service/core`](https://www.npmjs.com/package/@otp-service/core)
|
|
47
|
+
- [`@otp-service/starter`](https://www.npmjs.com/package/@otp-service/starter) — wires Redis + providers for you
|
|
48
|
+
|
|
49
|
+
## Links
|
|
50
|
+
|
|
51
|
+
- Repository: [github.com/Suraj-H/otp-service-package-v2](https://github.com/Suraj-H/otp-service-package-v2)
|
|
52
|
+
- 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/redis-store",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Redis-backed challenge state storage for OTP services.",
|
|
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
|
"scripts": {
|
|
37
38
|
"build": "tsup --config tsup.config.ts",
|