@smart-pay-chain/otp 2.1.0 → 2.1.2
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 +5 -5
- package/dist/http-client.js +1 -1
- package/dist/otp-client.d.ts.map +1 -1
- package/dist/otp-client.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ const client = new OtpClient({
|
|
|
79
79
|
|
|
80
80
|
// Send an OTP
|
|
81
81
|
const result = await client.sendOtp({
|
|
82
|
-
phoneNumber: '+
|
|
82
|
+
phoneNumber: '+995568000865',
|
|
83
83
|
channel: OtpChannel.SMS,
|
|
84
84
|
});
|
|
85
85
|
|
|
@@ -189,7 +189,7 @@ Send an OTP to a phone number using your preferred channel:
|
|
|
189
189
|
|
|
190
190
|
```typescript
|
|
191
191
|
const result = await client.sendOtp({
|
|
192
|
-
phoneNumber: '+
|
|
192
|
+
phoneNumber: '+995568000865', // Required: E.164 format
|
|
193
193
|
channel: OtpChannel.SMS, // Optional: SMS, WHATSAPP, or VOICE
|
|
194
194
|
ttl: 300, // Optional: Time-to-live (60-600 seconds)
|
|
195
195
|
length: 6, // Optional: Code length (4-8 digits)
|
|
@@ -292,7 +292,7 @@ router.post('/auth/send-otp', async (req, res) => {
|
|
|
292
292
|
// Mobile app calls your backend
|
|
293
293
|
fetch('https://yourapi.com/auth/send-otp', {
|
|
294
294
|
method: 'POST',
|
|
295
|
-
body: JSON.stringify({ phoneNumber: '+
|
|
295
|
+
body: JSON.stringify({ phoneNumber: '+995568000865' }),
|
|
296
296
|
});
|
|
297
297
|
```
|
|
298
298
|
|
|
@@ -346,13 +346,13 @@ The SDK automatically generates unique idempotency keys for send/resend operatio
|
|
|
346
346
|
```typescript
|
|
347
347
|
// Automatic idempotency (recommended)
|
|
348
348
|
const result = await client.sendOtp({
|
|
349
|
-
phoneNumber: '+
|
|
349
|
+
phoneNumber: '+995568000865',
|
|
350
350
|
// SDK auto-generates: X-Idempotency-Key: {timestamp}-{random}
|
|
351
351
|
});
|
|
352
352
|
|
|
353
353
|
// Manual idempotency key (for custom requirements)
|
|
354
354
|
const result = await client.sendOtp({
|
|
355
|
-
phoneNumber: '+
|
|
355
|
+
phoneNumber: '+995568000865',
|
|
356
356
|
idempotencyKey: 'my-unique-key-123',
|
|
357
357
|
});
|
|
358
358
|
```
|
package/dist/http-client.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.HttpClient = void 0;
|
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const errors_1 = require("./errors");
|
|
9
9
|
// SDK version - update this with each release
|
|
10
|
-
const SDK_VERSION = '2.
|
|
10
|
+
const SDK_VERSION = '2.1.2';
|
|
11
11
|
/**
|
|
12
12
|
* Detect the current platform
|
|
13
13
|
*/
|
package/dist/otp-client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp-client.d.ts","sourceRoot":"","sources":["../src/otp-client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAEhB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,YAAY,CAAiC;IACrD,OAAO,CAAC,qBAAqB,CAAuB;IACpD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAW;IAE5C;;;;OAIG;gBACS,MAAM,EAAE,eAAe;IAgBnC;;;;;;;;;;;;;;;;;;;OAmBG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IA0BhE;;;;;;;;;;;;;;;;;;;OAmBG;IACG,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAmBt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OAAO,CAAC,SAAS,CAAC;IAgBtD;;;;;;;;;;;;;;;;;;OAkBG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAkBtE;;;;;;;;;;;;;;;;;OAiBG;IACG,SAAS,CAAC,YAAY,UAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkChE;;;;;;;;;;;;OAYG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IASxC;;;;;;;;;;;;OAYG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IASpC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAM9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAQ5B"}
|
package/dist/otp-client.js
CHANGED
|
@@ -243,7 +243,13 @@ class OtpClient {
|
|
|
243
243
|
this.serverConfigFetchedAt = Date.now();
|
|
244
244
|
// Log warning if test mode is enabled
|
|
245
245
|
if (config.features.testMode) {
|
|
246
|
-
|
|
246
|
+
const testPhones = config.testMode?.testPhoneNumbers;
|
|
247
|
+
if (testPhones && testPhones.length > 0) {
|
|
248
|
+
console.warn('⚠️ Test mode is enabled on the server. Use test phone numbers:', testPhones.join(', '));
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
console.warn('⚠️ Test mode is enabled on the server.');
|
|
252
|
+
}
|
|
247
253
|
}
|
|
248
254
|
return config;
|
|
249
255
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart-pay-chain/otp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Official TypeScript SDK for Smart Pay Chain OTP Verification Service - Now with phone authentication, JWT tokens, admin support, and brand management",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|