@otp-service/provider-email-resend 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/provider-email-resend
|
|
2
|
+
|
|
3
|
+
**`OtpDelivery`** adapter that sends OTP challenges via the [Resend](https://resend.com/) HTTP API. Implements [`@otp-service/core`](https://www.npmjs.com/package/@otp-service/core) delivery contract.
|
|
4
|
+
|
|
5
|
+
**ESM only** · **Node.js ≥ 22** · **License:** MIT
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @otp-service/provider-email-resend @otp-service/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
You supply a thin **`ResendHttpClient`** (typically `fetch`) and API configuration. The factory returns an **`OtpDelivery`** you pass to **`createOtpService`**.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createResendEmailProvider } from "@otp-service/provider-email-resend";
|
|
19
|
+
|
|
20
|
+
const delivery = createResendEmailProvider({
|
|
21
|
+
apiKey: process.env.RESEND_API_KEY!,
|
|
22
|
+
from: "OTP <otp@yourdomain.com>",
|
|
23
|
+
httpClient: {
|
|
24
|
+
post: (url, input) =>
|
|
25
|
+
fetch(url, {
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: input.headers,
|
|
28
|
+
body: input.body
|
|
29
|
+
}).then(async (response) => ({
|
|
30
|
+
json: () => response.json(),
|
|
31
|
+
status: response.status
|
|
32
|
+
}))
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
See **`CreateResendEmailProviderOptions`** in **`dist/index.d.ts`** for full fields (subject template, etc.).
|
|
38
|
+
|
|
39
|
+
## Security
|
|
40
|
+
|
|
41
|
+
- Store **`apiKey`** in secrets, never in client-side code.
|
|
42
|
+
- Use a verified sending domain in Resend.
|
|
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) — **`createResendEmailOtpService`** composition
|
|
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/provider-email-resend",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Resend email delivery adapter for OTP challenges.",
|
|
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",
|