@minimoth/sdk-node 0.1.1 → 0.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.
Files changed (2) hide show
  1. package/README.md +16 -7
  2. package/package.json +4 -1
package/README.md CHANGED
@@ -20,7 +20,7 @@ const client = new MiniMoth({
20
20
  })
21
21
 
22
22
  // Send OTP
23
- await client.otp.send({ phone: '919876543210' })
23
+ const { otpId } = await client.otp.send({ phone: '919876543210' })
24
24
 
25
25
  // Verify OTP
26
26
  const result = await client.otp.verify({ phone: '919876543210', otp: '123456' })
@@ -133,9 +133,17 @@ const { session } = result
133
133
  Send an OTP to the given phone number.
134
134
 
135
135
  - `phone` (string, required): Indian phone number (e.g. `919876543210`)
136
- - Returns: Promise<void>
136
+ - Returns: `Promise<{ otpId: string }>`
137
137
  - Throws: `MiniMothError` on rate limit or network error
138
138
 
139
+ #### `status(otpId)`
140
+
141
+ Check the delivery status of a sent OTP.
142
+
143
+ - `otpId` (string, required): ID returned by `send()`
144
+ - Returns: `Promise<{ otpId: string, channel: string | null, status: 'queued' | 'delivered' | 'failed', deliveredAt: string | null }>`
145
+ - Throws: `MiniMothError` on invalid ID or network error
146
+
139
147
  #### `verify(options)`
140
148
 
141
149
  Verify the OTP code and establish a session.
@@ -184,11 +192,12 @@ Revoke all tokens for a session.
184
192
  Common `MiniMothError.code` values:
185
193
 
186
194
  - `INVALID_OTP`: OTP code does not match
187
- - `OTP_EXPIRED`: OTP has expired (max 10 minutes)
188
- - `INVALID_TOKEN`: Token could not be decoded
189
- - `TOKEN_EXPIRED`: Access token has expired (use refresh to get new token)
190
- - `TOKEN_REVOKED`: Token was revoked (session logout or theft detected)
191
- - `RATE_LIMITED`: Too many requestswait before retrying
195
+ - `OTP_NOT_FOUND`: No active OTP found expired (10 min) or already used
196
+ - `OTP_RATE_LIMITED`: Too many OTP requests for this number — wait 10 minutes
197
+ - `VERIFY_RATE_LIMITED`: Too many incorrect attempts for this OTP request a new one
198
+ - `INVALID_ACCESS_TOKEN`: Access token is invalid or expired
199
+ - `SESSION_EXPIRED`: Session has expired or was revoked user must re-verify
200
+ - `INVALID_PHONE`: Phone number format is invalid
192
201
  - `INSUFFICIENT_BALANCE`: Account has insufficient credits/balance
193
202
  - `NETWORK_ERROR`: Network request failed
194
203
  - `UNKNOWN_ERROR`: Unexpected server error
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minimoth/sdk-node",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Official MiniMoth Node.js SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -17,6 +17,9 @@
17
17
  "dist"
18
18
  ],
19
19
  "license": "MIT",
20
+ "bugs": {
21
+ "email": "dev@minimoth.dev"
22
+ },
20
23
  "keywords": [
21
24
  "otp",
22
25
  "sms",