@proveanything/smartlinks 1.13.12 → 1.13.13

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.
@@ -1,4 +1,4 @@
1
- import type { AuthLoginResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, AuthKitConfig, MagicLinkSendResponse, MagicLinkVerifyResponse, UserProfile, ProfileUpdateData, SuccessResponse, SendWhatsAppRequest, SendWhatsAppResponse, VerifyWhatsAppResponse, WhatsAppStatusResponse, SendSmsVerifyRequest, SendSmsVerifyResponse, VerifySmsResponse, UpsertContactRequest, UpsertContactResponse } from "../types/authKit";
1
+ import type { AuthLoginResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, AuthKitConfig, MagicLinkSendResponse, MagicLinkVerifyResponse, UserProfile, ProfileUpdateData, SuccessResponse, SendWhatsAppRequest, SendWhatsAppResponse, ExchangeWhatsAppSessionResponse, VerifyWhatsAppResponse, WhatsAppStatusResponse, SendSmsVerifyRequest, SendSmsVerifyResponse, VerifySmsResponse, UpsertContactRequest, UpsertContactResponse } from "../types/authKit";
2
2
  /**
3
3
  * Namespace containing helper functions for the new AuthKit API.
4
4
  * Legacy collection-based authKit helpers retained (marked as *Legacy*).
@@ -33,6 +33,8 @@ export declare namespace authKit {
33
33
  function verifyWhatsApp(clientId: string, token: string, phoneNumber: string): Promise<VerifyWhatsAppResponse>;
34
34
  /** Poll WhatsApp verification status for a token (public). */
35
35
  function getWhatsAppStatus(clientId: string, token: string): Promise<WhatsAppStatusResponse>;
36
+ /** Exchange a verified WhatsApp token for an Auth Kit session (public). */
37
+ function exchangeWhatsAppSession(clientId: string, token: string, sessionKey: string): Promise<ExchangeWhatsAppSessionResponse>;
36
38
  /** Send an SMS click-to-verify link (public). */
37
39
  function sendSmsVerify(clientId: string, body: SendSmsVerifyRequest): Promise<SendSmsVerifyResponse>;
38
40
  /** Verify an SMS click-to-verify token via API (public). */
@@ -62,6 +62,11 @@ export var authKit;
62
62
  return request(`/authkit/${encodeURIComponent(clientId)}/auth/whatsapp/status?token=${encodedToken}`);
63
63
  }
64
64
  authKit.getWhatsAppStatus = getWhatsAppStatus;
65
+ /** Exchange a verified WhatsApp token for an Auth Kit session (public). */
66
+ async function exchangeWhatsAppSession(clientId, token, sessionKey) {
67
+ return post(`/authkit/${encodeURIComponent(clientId)}/auth/whatsapp/exchange-session`, { token, sessionKey });
68
+ }
69
+ authKit.exchangeWhatsAppSession = exchangeWhatsAppSession;
65
70
  /** Send an SMS click-to-verify link (public). */
66
71
  async function sendSmsVerify(clientId, body) {
67
72
  return post(`/authkit/${encodeURIComponent(clientId)}/auth/sms/send`, body);
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.13.12 | Generated: 2026-05-14T16:00:33.063Z
3
+ Version: 1.13.13 | Generated: 2026-05-15T11:06:27.909Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -3046,8 +3046,8 @@ interface WhatsAppReplyOptions {
3046
3046
  **SendWhatsAppRequest** (interface)
3047
3047
  ```typescript
3048
3048
  interface SendWhatsAppRequest {
3049
- phoneNumber?: string
3050
3049
  redirectUrl?: string
3050
+ prefillMessage?: string
3051
3051
  reply?: WhatsAppReplyOptions
3052
3052
  }
3053
3053
  ```
@@ -3058,10 +3058,21 @@ interface SendWhatsAppResponse {
3058
3058
  waLink: string
3059
3059
  code: string
3060
3060
  token: string
3061
+ sessionKey?: string
3061
3062
  expiresAt: string
3062
3063
  }
3063
3064
  ```
3064
3065
 
3066
+ **ExchangeWhatsAppSessionResponse** (interface)
3067
+ ```typescript
3068
+ interface ExchangeWhatsAppSessionResponse {
3069
+ success: boolean
3070
+ token: string
3071
+ user: AuthKitUser
3072
+ accountData?: Record<string, any>
3073
+ }
3074
+ ```
3075
+
3065
3076
  **VerifyWhatsAppResponse** (interface)
3066
3077
  ```typescript
3067
3078
  interface VerifyWhatsAppResponse {
@@ -8221,6 +8232,9 @@ Manually verify WhatsApp token if inbound webhook path is unavailable (public).
8221
8232
  **getWhatsAppStatus**(clientId: string, token: string) → `Promise<WhatsAppStatusResponse>`
8222
8233
  Poll WhatsApp verification status for a token (public).
8223
8234
 
8235
+ **exchangeWhatsAppSession**(clientId: string, token: string, sessionKey: string) → `Promise<ExchangeWhatsAppSessionResponse>`
8236
+ Exchange a verified WhatsApp token for an Auth Kit session (public).
8237
+
8224
8238
  **sendSmsVerify**(clientId: string, body: SendSmsVerifyRequest) → `Promise<SendSmsVerifyResponse>`
8225
8239
  Send an SMS click-to-verify link (public).
8226
8240
 
@@ -91,6 +91,7 @@ const wa = await authKit.sendWhatsApp(clientId);
91
91
  // Optional: pass redirect context and/or a post-verification reply
92
92
  // const wa = await authKit.sendWhatsApp(clientId, {
93
93
  // redirectUrl: 'https://app.example.com/checkout/continue',
94
+ // prefillMessage: 'Please let me bid in this auction. Code: {{token}}',
94
95
  // reply: {
95
96
  // cta: {
96
97
  // body: "You're verified and ready to bid.",
@@ -105,6 +106,12 @@ const wa = await authKit.sendWhatsApp(clientId);
105
106
  // Poll status while user switches to WhatsApp and back
106
107
  const status = await authKit.getWhatsAppStatus(clientId, wa.token);
107
108
 
109
+ // Optional: exchange verified WhatsApp proof for an Auth Kit session
110
+ if (status.status === 'verified' && wa.sessionKey) {
111
+ const session = await authKit.exchangeWhatsAppSession(clientId, wa.token, wa.sessionKey);
112
+ // session.token can be used as the authenticated bearer token
113
+ }
114
+
108
115
  // Optional fallback path if webhook confirmation is unavailable
109
116
  await authKit.verifyWhatsApp(clientId, wa.token, '+447911123456');
110
117
 
@@ -162,6 +169,19 @@ The following template placeholders are available in `reply.text`, `reply.cta` f
162
169
  | `{{clientId}}` | The Auth Kit client ID |
163
170
  | `{{token}}` | The verification token |
164
171
 
172
+ You can also set `prefillMessage` on `sendWhatsApp` to customize the text pre-filled in the `wa.me` deep link. If `{{token}}` is not present, the token is appended to the message.
173
+
174
+ #### Session exchange after verification
175
+
176
+ After polling returns `status === 'verified'`, exchange the verification proof for an Auth Kit login session:
177
+
178
+ ```ts
179
+ const session = await authKit.exchangeWhatsAppSession(clientId, wa.token, wa.sessionKey!);
180
+ // session: { success, token, user, accountData? }
181
+ ```
182
+
183
+ `sessionKey` is returned by `sendWhatsApp` and is used to mitigate token replay from contexts that did not initiate the browser flow.
184
+
165
185
  > **Note:** `redirectUrl` is optional. WhatsApp tokens are short hex strings (16 chars) for better UX.
166
186
 
167
187
  ### Google OAuth
package/dist/openapi.yaml CHANGED
@@ -8501,6 +8501,32 @@ paths:
8501
8501
  description: Unauthorized
8502
8502
  404:
8503
8503
  description: Not found
8504
+ /authkit/{clientId}/auth/whatsapp/exchange-session:
8505
+ post:
8506
+ tags:
8507
+ - authKit
8508
+ summary: Exchange a verified WhatsApp token for an Auth Kit session (public).
8509
+ operationId: authKit_exchangeWhatsAppSession
8510
+ security: []
8511
+ parameters:
8512
+ - name: clientId
8513
+ in: path
8514
+ required: true
8515
+ schema:
8516
+ type: string
8517
+ responses:
8518
+ 200:
8519
+ description: Success
8520
+ content:
8521
+ application/json:
8522
+ schema:
8523
+ $ref: "#/components/schemas/ExchangeWhatsAppSessionResponse"
8524
+ 400:
8525
+ description: Bad request
8526
+ 401:
8527
+ description: Unauthorized
8528
+ 404:
8529
+ description: Not found
8504
8530
  /authkit/{clientId}/auth/whatsapp/send:
8505
8531
  post:
8506
8532
  tags:
@@ -17892,10 +17918,10 @@ components:
17892
17918
  SendWhatsAppRequest:
17893
17919
  type: object
17894
17920
  properties:
17895
- phoneNumber:
17896
- type: string
17897
17921
  redirectUrl:
17898
17922
  type: string
17923
+ prefillMessage:
17924
+ type: string
17899
17925
  reply:
17900
17926
  $ref: "#/components/schemas/WhatsAppReplyOptions"
17901
17927
  SendWhatsAppResponse:
@@ -17907,6 +17933,8 @@ components:
17907
17933
  type: string
17908
17934
  token:
17909
17935
  type: string
17936
+ sessionKey:
17937
+ type: string
17910
17938
  expiresAt:
17911
17939
  type: string
17912
17940
  required:
@@ -17914,6 +17942,22 @@ components:
17914
17942
  - code
17915
17943
  - token
17916
17944
  - expiresAt
17945
+ ExchangeWhatsAppSessionResponse:
17946
+ type: object
17947
+ properties:
17948
+ success:
17949
+ type: boolean
17950
+ token:
17951
+ type: string
17952
+ user:
17953
+ $ref: "#/components/schemas/AuthKitUser"
17954
+ accountData:
17955
+ type: object
17956
+ additionalProperties: true
17957
+ required:
17958
+ - success
17959
+ - token
17960
+ - user
17917
17961
  VerifyWhatsAppResponse:
17918
17962
  type: object
17919
17963
  properties:
@@ -91,16 +91,23 @@ export interface WhatsAppReplyOptions {
91
91
  text?: string;
92
92
  }
93
93
  export interface SendWhatsAppRequest {
94
- phoneNumber?: string;
95
94
  redirectUrl?: string;
95
+ prefillMessage?: string;
96
96
  reply?: WhatsAppReplyOptions;
97
97
  }
98
98
  export interface SendWhatsAppResponse {
99
99
  waLink: string;
100
100
  code: string;
101
101
  token: string;
102
+ sessionKey?: string;
102
103
  expiresAt: string;
103
104
  }
105
+ export interface ExchangeWhatsAppSessionResponse {
106
+ success: boolean;
107
+ token: string;
108
+ user: AuthKitUser;
109
+ accountData?: Record<string, any>;
110
+ }
104
111
  export interface VerifyWhatsAppResponse {
105
112
  success: boolean;
106
113
  verified: boolean;
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.13.12 | Generated: 2026-05-14T16:00:33.063Z
3
+ Version: 1.13.13 | Generated: 2026-05-15T11:06:27.909Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -3046,8 +3046,8 @@ interface WhatsAppReplyOptions {
3046
3046
  **SendWhatsAppRequest** (interface)
3047
3047
  ```typescript
3048
3048
  interface SendWhatsAppRequest {
3049
- phoneNumber?: string
3050
3049
  redirectUrl?: string
3050
+ prefillMessage?: string
3051
3051
  reply?: WhatsAppReplyOptions
3052
3052
  }
3053
3053
  ```
@@ -3058,10 +3058,21 @@ interface SendWhatsAppResponse {
3058
3058
  waLink: string
3059
3059
  code: string
3060
3060
  token: string
3061
+ sessionKey?: string
3061
3062
  expiresAt: string
3062
3063
  }
3063
3064
  ```
3064
3065
 
3066
+ **ExchangeWhatsAppSessionResponse** (interface)
3067
+ ```typescript
3068
+ interface ExchangeWhatsAppSessionResponse {
3069
+ success: boolean
3070
+ token: string
3071
+ user: AuthKitUser
3072
+ accountData?: Record<string, any>
3073
+ }
3074
+ ```
3075
+
3065
3076
  **VerifyWhatsAppResponse** (interface)
3066
3077
  ```typescript
3067
3078
  interface VerifyWhatsAppResponse {
@@ -8221,6 +8232,9 @@ Manually verify WhatsApp token if inbound webhook path is unavailable (public).
8221
8232
  **getWhatsAppStatus**(clientId: string, token: string) → `Promise<WhatsAppStatusResponse>`
8222
8233
  Poll WhatsApp verification status for a token (public).
8223
8234
 
8235
+ **exchangeWhatsAppSession**(clientId: string, token: string, sessionKey: string) → `Promise<ExchangeWhatsAppSessionResponse>`
8236
+ Exchange a verified WhatsApp token for an Auth Kit session (public).
8237
+
8224
8238
  **sendSmsVerify**(clientId: string, body: SendSmsVerifyRequest) → `Promise<SendSmsVerifyResponse>`
8225
8239
  Send an SMS click-to-verify link (public).
8226
8240
 
package/docs/auth-kit.md CHANGED
@@ -91,6 +91,7 @@ const wa = await authKit.sendWhatsApp(clientId);
91
91
  // Optional: pass redirect context and/or a post-verification reply
92
92
  // const wa = await authKit.sendWhatsApp(clientId, {
93
93
  // redirectUrl: 'https://app.example.com/checkout/continue',
94
+ // prefillMessage: 'Please let me bid in this auction. Code: {{token}}',
94
95
  // reply: {
95
96
  // cta: {
96
97
  // body: "You're verified and ready to bid.",
@@ -105,6 +106,12 @@ const wa = await authKit.sendWhatsApp(clientId);
105
106
  // Poll status while user switches to WhatsApp and back
106
107
  const status = await authKit.getWhatsAppStatus(clientId, wa.token);
107
108
 
109
+ // Optional: exchange verified WhatsApp proof for an Auth Kit session
110
+ if (status.status === 'verified' && wa.sessionKey) {
111
+ const session = await authKit.exchangeWhatsAppSession(clientId, wa.token, wa.sessionKey);
112
+ // session.token can be used as the authenticated bearer token
113
+ }
114
+
108
115
  // Optional fallback path if webhook confirmation is unavailable
109
116
  await authKit.verifyWhatsApp(clientId, wa.token, '+447911123456');
110
117
 
@@ -162,6 +169,19 @@ The following template placeholders are available in `reply.text`, `reply.cta` f
162
169
  | `{{clientId}}` | The Auth Kit client ID |
163
170
  | `{{token}}` | The verification token |
164
171
 
172
+ You can also set `prefillMessage` on `sendWhatsApp` to customize the text pre-filled in the `wa.me` deep link. If `{{token}}` is not present, the token is appended to the message.
173
+
174
+ #### Session exchange after verification
175
+
176
+ After polling returns `status === 'verified'`, exchange the verification proof for an Auth Kit login session:
177
+
178
+ ```ts
179
+ const session = await authKit.exchangeWhatsAppSession(clientId, wa.token, wa.sessionKey!);
180
+ // session: { success, token, user, accountData? }
181
+ ```
182
+
183
+ `sessionKey` is returned by `sendWhatsApp` and is used to mitigate token replay from contexts that did not initiate the browser flow.
184
+
165
185
  > **Note:** `redirectUrl` is optional. WhatsApp tokens are short hex strings (16 chars) for better UX.
166
186
 
167
187
  ### Google OAuth
package/openapi.yaml CHANGED
@@ -8501,6 +8501,32 @@ paths:
8501
8501
  description: Unauthorized
8502
8502
  404:
8503
8503
  description: Not found
8504
+ /authkit/{clientId}/auth/whatsapp/exchange-session:
8505
+ post:
8506
+ tags:
8507
+ - authKit
8508
+ summary: Exchange a verified WhatsApp token for an Auth Kit session (public).
8509
+ operationId: authKit_exchangeWhatsAppSession
8510
+ security: []
8511
+ parameters:
8512
+ - name: clientId
8513
+ in: path
8514
+ required: true
8515
+ schema:
8516
+ type: string
8517
+ responses:
8518
+ 200:
8519
+ description: Success
8520
+ content:
8521
+ application/json:
8522
+ schema:
8523
+ $ref: "#/components/schemas/ExchangeWhatsAppSessionResponse"
8524
+ 400:
8525
+ description: Bad request
8526
+ 401:
8527
+ description: Unauthorized
8528
+ 404:
8529
+ description: Not found
8504
8530
  /authkit/{clientId}/auth/whatsapp/send:
8505
8531
  post:
8506
8532
  tags:
@@ -17892,10 +17918,10 @@ components:
17892
17918
  SendWhatsAppRequest:
17893
17919
  type: object
17894
17920
  properties:
17895
- phoneNumber:
17896
- type: string
17897
17921
  redirectUrl:
17898
17922
  type: string
17923
+ prefillMessage:
17924
+ type: string
17899
17925
  reply:
17900
17926
  $ref: "#/components/schemas/WhatsAppReplyOptions"
17901
17927
  SendWhatsAppResponse:
@@ -17907,6 +17933,8 @@ components:
17907
17933
  type: string
17908
17934
  token:
17909
17935
  type: string
17936
+ sessionKey:
17937
+ type: string
17910
17938
  expiresAt:
17911
17939
  type: string
17912
17940
  required:
@@ -17914,6 +17942,22 @@ components:
17914
17942
  - code
17915
17943
  - token
17916
17944
  - expiresAt
17945
+ ExchangeWhatsAppSessionResponse:
17946
+ type: object
17947
+ properties:
17948
+ success:
17949
+ type: boolean
17950
+ token:
17951
+ type: string
17952
+ user:
17953
+ $ref: "#/components/schemas/AuthKitUser"
17954
+ accountData:
17955
+ type: object
17956
+ additionalProperties: true
17957
+ required:
17958
+ - success
17959
+ - token
17960
+ - user
17917
17961
  VerifyWhatsAppResponse:
17918
17962
  type: object
17919
17963
  properties:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.13.12",
3
+ "version": "1.13.13",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",