postex-auth-sdk-stage 2.3.1 → 3.0.0

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 CHANGED
@@ -141,6 +141,8 @@ async initiateAuth(
141
141
  **Returns:**
142
142
 
143
143
  - `status`: `'webauthn_challenge'` | `'otp_sent'`
144
+ - `message`: Backend initiation message
145
+ - `delivery`: OTP delivery metadata when status is `'otp_sent'`
144
146
  - `challenge`, `credentialIds`, `rp`: WebAuthn data if status is `'webauthn_challenge'`
145
147
 
146
148
  ---
@@ -154,7 +156,16 @@ Requires at least one identifier: `email`, `mobileNumber`, or `username`.
154
156
  async initiateOTP(
155
157
  identifier: string | { email?: string; mobileNumber?: string; username?: string }
156
158
  ): Promise<{
159
+ statusText?: string;
157
160
  message?: string;
161
+ statusCode?: number;
162
+ success?: boolean;
163
+ data?: {
164
+ delivery?: {
165
+ channel: 'email' | 'sms';
166
+ target: string;
167
+ };
168
+ };
158
169
  }>
159
170
  ```
160
171
 
@@ -193,13 +204,23 @@ async verifyOTP(otp: string): Promise<OTPVerifyResponse>
193
204
  Resend OTP code for the standard login OTP flow.
194
205
 
195
206
  ```typescript
196
- async resendOTP(): Promise<{ success: boolean; message?: string }>
207
+ async resendOTP(): Promise<{
208
+ message?: string;
209
+ success?: boolean;
210
+ data?: {
211
+ delivery?: {
212
+ channel: 'email' | 'sms';
213
+ target: string;
214
+ };
215
+ };
216
+ }>
197
217
  ```
198
218
 
199
219
  **Returns:**
200
220
 
201
- - `success`: Whether resend request was accepted
202
- - `message`: Optional backend message
221
+ - `message`: Backend resend message
222
+ - `success`: Whether resend request was accepted, when provided by the backend
223
+ - `data.delivery`: OTP delivery channel and masked target
203
224
 
204
225
  ---
205
226
 
package/dist/auth.d.ts CHANGED
@@ -26,8 +26,15 @@ interface AuthStatusResponse {
26
26
  }
27
27
  /** Response from POST /auth/initiate */
28
28
  type InitiateAuthStatusType = "webauthn_challenge" | "otp_sent";
29
+ type OTPDeliveryChannel = "email" | "sms";
30
+ interface OTPDeliveryMetadata {
31
+ channel: OTPDeliveryChannel;
32
+ target: string;
33
+ }
29
34
  interface InitiateAuthResponse {
30
35
  status: InitiateAuthStatusType;
36
+ message?: string;
37
+ delivery?: OTPDeliveryMetadata;
31
38
  challenge?: string;
32
39
  credentialIds?: string[];
33
40
  rp?: {
@@ -50,7 +57,16 @@ interface OTPInitiateResponse {
50
57
  success?: boolean;
51
58
  message?: string;
52
59
  data?: {
53
- message?: string;
60
+ delivery?: OTPDeliveryMetadata;
61
+ [key: string]: any;
62
+ };
63
+ [key: string]: any;
64
+ }
65
+ interface OTPResendResponse {
66
+ message?: string;
67
+ success?: boolean;
68
+ data?: {
69
+ delivery?: OTPDeliveryMetadata;
54
70
  [key: string]: any;
55
71
  };
56
72
  [key: string]: any;
@@ -151,7 +167,7 @@ export declare class AuthSDK {
151
167
  getStatus(identifier: AuthIdentifierInput, options?: RealmOptions): Promise<AuthStatusResponse>;
152
168
  /**
153
169
  * POST /auth/initiate - Unified entry: returns webauthn_challenge or otp_sent.
154
- * Sets auth_session cookie when otp_sent.
170
+ * Sets auth_session cookie and includes delivery metadata when otp_sent.
155
171
  */
156
172
  initiateAuth(identifier: AuthIdentifierInput, options?: RealmOptions): Promise<InitiateAuthResponse>;
157
173
  /**
@@ -165,13 +181,10 @@ export declare class AuthSDK {
165
181
  */
166
182
  verifyOTP(otp: string): Promise<OTPVerifyResponse>;
167
183
  /**
168
- * POST /resend - Resend OTP code to the user's email.
184
+ * POST /otp/resend - Resend OTP code to the user's email or mobile number.
169
185
  * No payload required, relies on auth_session cookie.
170
186
  */
171
- resendOTP(): Promise<{
172
- success: boolean;
173
- message?: string;
174
- }>;
187
+ resendOTP(): Promise<OTPResendResponse>;
175
188
  /**
176
189
  * POST /otp/signup/verify - Verify OTP for signup flow.
177
190
  * Stores tokens from the response when provided by backend.