@otp-service/provider-sms-twilio 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.
Files changed (2) hide show
  1. package/README.md +53 -0
  2. package/package.json +4 -3
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # @otp-service/provider-sms-twilio
2
+
3
+ **`OtpDelivery`** adapter that sends OTP challenges via **Twilio Programmable SMS**. 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-sms-twilio @otp-service/core
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Provide **`TwilioHttpClient`** (usually `fetch` to Twilio’s API), account credentials, and **`from`** number.
16
+
17
+ ```ts
18
+ import { createTwilioSmsProvider } from "@otp-service/provider-sms-twilio";
19
+
20
+ const delivery = createTwilioSmsProvider({
21
+ accountSid: process.env.TWILIO_ACCOUNT_SID!,
22
+ authToken: process.env.TWILIO_AUTH_TOKEN!,
23
+ from: process.env.TWILIO_FROM!,
24
+ httpClient: {
25
+ post: (url, input) =>
26
+ fetch(url, {
27
+ method: "POST",
28
+ headers: input.headers,
29
+ body: input.body
30
+ }).then(async (response) => ({
31
+ json: () => response.json(),
32
+ status: response.status
33
+ }))
34
+ }
35
+ });
36
+ ```
37
+
38
+ See **`CreateTwilioSmsProviderOptions`** in **`dist/index.d.ts`** for details.
39
+
40
+ ## Security
41
+
42
+ - Keep **`authToken`** server-side only.
43
+ - Prefer Twilio-segmented secrets and least-privilege API keys where available.
44
+
45
+ ## Related packages
46
+
47
+ - [`@otp-service/core`](https://www.npmjs.com/package/@otp-service/core)
48
+ - [`@otp-service/starter`](https://www.npmjs.com/package/@otp-service/starter) — **`createTwilioSmsOtpService`** composition
49
+
50
+ ## Links
51
+
52
+ - Repository: [github.com/Suraj-H/otp-service-package-v2](https://github.com/Suraj-H/otp-service-package-v2)
53
+ - 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-sms-twilio",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "Twilio SMS 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.0"
35
+ "@otp-service/core": "0.1.1"
35
36
  },
36
37
  "scripts": {
37
38
  "build": "tsup --config tsup.config.ts",