@proveanything/smartlinks 1.13.15 → 1.13.17
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/dist/api/authKit.d.ts +4 -3
- package/dist/api/authKit.js +6 -2
- package/dist/docs/API_SUMMARY.md +30 -15
- package/dist/docs/auth-kit.md +29 -2
- package/dist/openapi.yaml +33 -3
- package/dist/types/authKit.d.ts +14 -0
- package/docs/API_SUMMARY.md +30 -15
- package/docs/auth-kit.md +29 -2
- package/openapi.yaml +33 -3
- package/package.json +1 -1
package/dist/api/authKit.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
1
|
+
import type { AuthLoginResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, AuthKitConfig, MagicLinkSendResponse, MagicLinkVerifyResponse, UserProfile, UpdateProfileResponse, 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*).
|
|
@@ -29,7 +29,7 @@ export declare namespace authKit {
|
|
|
29
29
|
function verifyPhoneCode(clientId: string, phoneNumber: string, code: string): Promise<PhoneVerifyResponse>;
|
|
30
30
|
/** Send a WhatsApp verification deep-link (public). */
|
|
31
31
|
function sendWhatsApp(clientId: string, body?: SendWhatsAppRequest): Promise<SendWhatsAppResponse>;
|
|
32
|
-
/** Manually verify WhatsApp token if inbound webhook path is unavailable (public). */
|
|
32
|
+
/** Manually verify WhatsApp token if inbound webhook path is unavailable (legacy/public fallback). */
|
|
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>;
|
|
@@ -62,7 +62,8 @@ export declare namespace authKit {
|
|
|
62
62
|
clientName?: string;
|
|
63
63
|
}): Promise<EmailVerificationActionResponse>;
|
|
64
64
|
function getProfile(clientId: string): Promise<UserProfile>;
|
|
65
|
-
|
|
65
|
+
/** Update the authenticated user's profile and replace the bearer token when refreshed claims are returned. */
|
|
66
|
+
function updateProfile(clientId: string, data: ProfileUpdateData): Promise<UpdateProfileResponse>;
|
|
66
67
|
function changePassword(clientId: string, currentPassword: string, newPassword: string): Promise<SuccessResponse>;
|
|
67
68
|
function changeEmail(clientId: string, newEmail: string, password: string, redirectUrl: string): Promise<SuccessResponse>;
|
|
68
69
|
function verifyEmailChange(clientId: string, token: string): Promise<SuccessResponse>;
|
package/dist/api/authKit.js
CHANGED
|
@@ -51,7 +51,7 @@ export var authKit;
|
|
|
51
51
|
return post(`/authkit/${encodeURIComponent(clientId)}/auth/whatsapp/send`, body);
|
|
52
52
|
}
|
|
53
53
|
authKit.sendWhatsApp = sendWhatsApp;
|
|
54
|
-
/** Manually verify WhatsApp token if inbound webhook path is unavailable (public). */
|
|
54
|
+
/** Manually verify WhatsApp token if inbound webhook path is unavailable (legacy/public fallback). */
|
|
55
55
|
async function verifyWhatsApp(clientId, token, phoneNumber) {
|
|
56
56
|
return post(`/authkit/${encodeURIComponent(clientId)}/auth/whatsapp/verify`, { token, phoneNumber });
|
|
57
57
|
}
|
|
@@ -122,8 +122,12 @@ export var authKit;
|
|
|
122
122
|
return request(`/authkit/${encodeURIComponent(clientId)}/account/profile`);
|
|
123
123
|
}
|
|
124
124
|
authKit.getProfile = getProfile;
|
|
125
|
+
/** Update the authenticated user's profile and replace the bearer token when refreshed claims are returned. */
|
|
125
126
|
async function updateProfile(clientId, data) {
|
|
126
|
-
|
|
127
|
+
const res = await post(`/authkit/${encodeURIComponent(clientId)}/account/update-profile`, data);
|
|
128
|
+
if (res.token)
|
|
129
|
+
setBearerToken(res.token);
|
|
130
|
+
return res;
|
|
127
131
|
}
|
|
128
132
|
authKit.updateProfile = updateProfile;
|
|
129
133
|
async function changePassword(clientId, currentPassword, newPassword) {
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.17 | Generated: 2026-05-15T20:47:03.471Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -3043,12 +3043,27 @@ interface WhatsAppReplyOptions {
|
|
|
3043
3043
|
}
|
|
3044
3044
|
```
|
|
3045
3045
|
|
|
3046
|
+
**WhatsAppContactData** (interface)
|
|
3047
|
+
```typescript
|
|
3048
|
+
interface WhatsAppContactData {
|
|
3049
|
+
name?: string
|
|
3050
|
+
firstName?: string
|
|
3051
|
+
lastName?: string
|
|
3052
|
+
displayName?: string
|
|
3053
|
+
email?: string
|
|
3054
|
+
source?: string
|
|
3055
|
+
customFields?: Record<string, unknown>
|
|
3056
|
+
externalIds?: Record<string, unknown>
|
|
3057
|
+
}
|
|
3058
|
+
```
|
|
3059
|
+
|
|
3046
3060
|
**SendWhatsAppRequest** (interface)
|
|
3047
3061
|
```typescript
|
|
3048
3062
|
interface SendWhatsAppRequest {
|
|
3049
3063
|
redirectUrl?: string
|
|
3050
3064
|
prefillMessage?: string
|
|
3051
3065
|
reply?: WhatsAppReplyOptions
|
|
3066
|
+
contactData?: WhatsAppContactData
|
|
3052
3067
|
}
|
|
3053
3068
|
```
|
|
3054
3069
|
|
|
@@ -8229,7 +8244,7 @@ Verify phone verification code (public).
|
|
|
8229
8244
|
Send a WhatsApp verification deep-link (public).
|
|
8230
8245
|
|
|
8231
8246
|
**verifyWhatsApp**(clientId: string, token: string, phoneNumber: string) → `Promise<VerifyWhatsAppResponse>`
|
|
8232
|
-
Manually verify WhatsApp token if inbound webhook path is unavailable (public).
|
|
8247
|
+
Manually verify WhatsApp token if inbound webhook path is unavailable (legacy/public fallback).
|
|
8233
8248
|
|
|
8234
8249
|
**getWhatsAppStatus**(clientId: string, token: string) → `Promise<WhatsAppStatusResponse>`
|
|
8235
8250
|
Poll WhatsApp verification status for a token (public).
|
|
@@ -8267,41 +8282,41 @@ Upsert contact identity after lightweight verification (public).
|
|
|
8267
8282
|
**getProfile**(clientId: string) → `Promise<UserProfile>`
|
|
8268
8283
|
Upsert contact identity after lightweight verification (public).
|
|
8269
8284
|
|
|
8270
|
-
**updateProfile**(clientId: string, data: ProfileUpdateData) → `Promise<
|
|
8271
|
-
|
|
8285
|
+
**updateProfile**(clientId: string, data: ProfileUpdateData) → `Promise<UpdateProfileResponse>`
|
|
8286
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8272
8287
|
|
|
8273
8288
|
**changePassword**(clientId: string, currentPassword: string, newPassword: string) → `Promise<SuccessResponse>`
|
|
8274
|
-
|
|
8289
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8275
8290
|
|
|
8276
8291
|
**changeEmail**(clientId: string, newEmail: string, password: string, redirectUrl: string) → `Promise<SuccessResponse>`
|
|
8277
|
-
|
|
8292
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8278
8293
|
|
|
8279
8294
|
**verifyEmailChange**(clientId: string, token: string) → `Promise<SuccessResponse>`
|
|
8280
|
-
|
|
8295
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8281
8296
|
|
|
8282
8297
|
**updatePhone**(clientId: string, phoneNumber: string, verificationCode: string) → `Promise<SuccessResponse>`
|
|
8283
|
-
|
|
8298
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8284
8299
|
|
|
8285
8300
|
**deleteAccount**(clientId: string, password: string, confirmText: string) → `Promise<SuccessResponse>`
|
|
8286
|
-
|
|
8301
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8287
8302
|
|
|
8288
8303
|
**load**(authKitId: string) → `Promise<AuthKitConfig>`
|
|
8289
|
-
|
|
8304
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8290
8305
|
|
|
8291
8306
|
**get**(collectionId: string, authKitId: string) → `Promise<AuthKitConfig>`
|
|
8292
|
-
|
|
8307
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8293
8308
|
|
|
8294
8309
|
**list**(collectionId: string, admin?: boolean) → `Promise<AuthKitConfig[]>`
|
|
8295
|
-
|
|
8310
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8296
8311
|
|
|
8297
8312
|
**create**(collectionId: string, data: any) → `Promise<AuthKitConfig>`
|
|
8298
|
-
|
|
8313
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8299
8314
|
|
|
8300
8315
|
**update**(collectionId: string, authKitId: string, data: any) → `Promise<AuthKitConfig>`
|
|
8301
|
-
|
|
8316
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8302
8317
|
|
|
8303
8318
|
**remove**(collectionId: string, authKitId: string) → `Promise<void>`
|
|
8304
|
-
|
|
8319
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8305
8320
|
|
|
8306
8321
|
### batch
|
|
8307
8322
|
|
package/dist/docs/auth-kit.md
CHANGED
|
@@ -82,6 +82,8 @@ const session = await authKit.verifyPhoneCode(clientId, '+61400000000', '123456'
|
|
|
82
82
|
|
|
83
83
|
Use these flows when you want low-friction verification before or without full account sign-in.
|
|
84
84
|
|
|
85
|
+
WhatsApp verification is token-first. The user does not type their phone number in your app for this flow; phone ownership is proven by the inbound WhatsApp sender number.
|
|
86
|
+
|
|
85
87
|
```ts
|
|
86
88
|
import { authKit } from '@proveanything/smartlinks';
|
|
87
89
|
|
|
@@ -92,6 +94,12 @@ const wa = await authKit.sendWhatsApp(clientId);
|
|
|
92
94
|
// const wa = await authKit.sendWhatsApp(clientId, {
|
|
93
95
|
// redirectUrl: 'https://app.example.com/checkout/continue',
|
|
94
96
|
// prefillMessage: 'Please let me bid in this auction. Code: {{token}}',
|
|
97
|
+
// contactData: {
|
|
98
|
+
// name: 'Jane Doe',
|
|
99
|
+
// email: 'jane@example.com',
|
|
100
|
+
// source: 'auction-checkout',
|
|
101
|
+
// customFields: { agreedToTerms: true },
|
|
102
|
+
// },
|
|
95
103
|
// reply: {
|
|
96
104
|
// cta: {
|
|
97
105
|
// body: "You're verified and ready to bid.",
|
|
@@ -112,7 +120,7 @@ if (status.status === 'verified' && wa.sessionKey) {
|
|
|
112
120
|
// session.token can be used as the authenticated bearer token
|
|
113
121
|
}
|
|
114
122
|
|
|
115
|
-
// Optional fallback path if webhook confirmation is unavailable
|
|
123
|
+
// Optional legacy fallback path if webhook confirmation is unavailable
|
|
116
124
|
await authKit.verifyWhatsApp(clientId, wa.token, '+447911123456');
|
|
117
125
|
|
|
118
126
|
// 2) Or send SMS click-to-verify link
|
|
@@ -126,6 +134,13 @@ await authKit.sendSmsVerify(clientId, {
|
|
|
126
134
|
await authKit.verifySms(clientId, '<token>', '+447911123456');
|
|
127
135
|
```
|
|
128
136
|
|
|
137
|
+
`contactData` is optional and is useful when you collect name/email before the customer switches to WhatsApp.
|
|
138
|
+
|
|
139
|
+
- Auth Kit stores `contactData` on the verification token metadata first.
|
|
140
|
+
- Contact details are written to durable contact storage only after WhatsApp verification succeeds.
|
|
141
|
+
- If the user abandons before verification, no contact is created.
|
|
142
|
+
- `contactData` must not include phone; the verified inbound WhatsApp sender number is always authoritative.
|
|
143
|
+
|
|
129
144
|
### Contact bootstrap / durable identity
|
|
130
145
|
|
|
131
146
|
After verification, upsert contact identity and store `contactId` on downstream records (raffle ticket, bid, claim intent).
|
|
@@ -182,7 +197,11 @@ const session = await authKit.exchangeWhatsAppSession(clientId, wa.token, wa.ses
|
|
|
182
197
|
|
|
183
198
|
`sessionKey` is returned by `sendWhatsApp` and is used to mitigate token replay from contexts that did not initiate the browser flow.
|
|
184
199
|
|
|
200
|
+
When `contactData.name` or explicit name parts were supplied on the original `sendWhatsApp` call, `session.user.displayName` and the returned bearer token claims are now seeded from the verified contact record instead of staying `null`.
|
|
201
|
+
|
|
185
202
|
> **Note:** `redirectUrl` is optional. WhatsApp tokens are short hex strings (16 chars) for better UX.
|
|
203
|
+
>
|
|
204
|
+
> **Legacy note:** `verifyWhatsApp` is for older phone-bound token flows. Prefer inbound WhatsApp token confirmation plus status polling for new implementations.
|
|
186
205
|
|
|
187
206
|
### Google OAuth
|
|
188
207
|
|
|
@@ -202,7 +221,13 @@ import { authKit } from '@proveanything/smartlinks';
|
|
|
202
221
|
const profile = await authKit.getProfile(clientId);
|
|
203
222
|
|
|
204
223
|
// Update profile
|
|
205
|
-
await authKit.updateProfile(clientId, {
|
|
224
|
+
const updatedProfile = await authKit.updateProfile(clientId, {
|
|
225
|
+
displayName: 'Alice B.',
|
|
226
|
+
avatarUrl: '...'
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// The SDK automatically swaps in updatedProfile.token so future auth.verify()
|
|
230
|
+
// and authenticated calls use fresh displayName/photoURL claims immediately.
|
|
206
231
|
|
|
207
232
|
// Change password
|
|
208
233
|
await authKit.changePassword(clientId, 'currentPass', 'newPass');
|
|
@@ -214,6 +239,8 @@ await authKit.changeEmail(clientId, 'newemail@example.com', 'password', redirect
|
|
|
214
239
|
await authKit.deleteAccount(clientId, 'password', 'DELETE');
|
|
215
240
|
```
|
|
216
241
|
|
|
242
|
+
`updateProfile` now returns a fresh bearer token together with the updated profile fields. The SDK replaces the in-memory bearer token automatically so token-backed identity reads stay current without an extra refresh step.
|
|
243
|
+
|
|
217
244
|
---
|
|
218
245
|
|
|
219
246
|
## Email verification
|
package/dist/openapi.yaml
CHANGED
|
@@ -8016,7 +8016,7 @@ paths:
|
|
|
8016
8016
|
post:
|
|
8017
8017
|
tags:
|
|
8018
8018
|
- authKit
|
|
8019
|
-
summary:
|
|
8019
|
+
summary: "Update the authenticated user's profile and replace the bearer token when refreshed claims are returned."
|
|
8020
8020
|
operationId: authKit_updateProfile
|
|
8021
8021
|
security: []
|
|
8022
8022
|
parameters:
|
|
@@ -8031,7 +8031,7 @@ paths:
|
|
|
8031
8031
|
content:
|
|
8032
8032
|
application/json:
|
|
8033
8033
|
schema:
|
|
8034
|
-
$ref: "#/components/schemas/
|
|
8034
|
+
$ref: "#/components/schemas/UpdateProfileResponse"
|
|
8035
8035
|
400:
|
|
8036
8036
|
description: Bad request
|
|
8037
8037
|
401:
|
|
@@ -8589,7 +8589,7 @@ paths:
|
|
|
8589
8589
|
post:
|
|
8590
8590
|
tags:
|
|
8591
8591
|
- authKit
|
|
8592
|
-
summary: Manually verify WhatsApp token if inbound webhook path is unavailable (public).
|
|
8592
|
+
summary: Manually verify WhatsApp token if inbound webhook path is unavailable (legacy/public fallback).
|
|
8593
8593
|
operationId: authKit_verifyWhatsApp
|
|
8594
8594
|
security: []
|
|
8595
8595
|
parameters:
|
|
@@ -17756,6 +17756,13 @@ components:
|
|
|
17756
17756
|
accountData:
|
|
17757
17757
|
type: object
|
|
17758
17758
|
additionalProperties: true
|
|
17759
|
+
UpdateProfileResponse:
|
|
17760
|
+
type: object
|
|
17761
|
+
properties:
|
|
17762
|
+
token:
|
|
17763
|
+
type: string
|
|
17764
|
+
required:
|
|
17765
|
+
- token
|
|
17759
17766
|
SuccessResponse:
|
|
17760
17767
|
type: object
|
|
17761
17768
|
properties:
|
|
@@ -17915,6 +17922,27 @@ components:
|
|
|
17915
17922
|
$ref: "#/components/schemas/WhatsAppReplyCta"
|
|
17916
17923
|
text:
|
|
17917
17924
|
type: string
|
|
17925
|
+
WhatsAppContactData:
|
|
17926
|
+
type: object
|
|
17927
|
+
properties:
|
|
17928
|
+
name:
|
|
17929
|
+
type: string
|
|
17930
|
+
firstName:
|
|
17931
|
+
type: string
|
|
17932
|
+
lastName:
|
|
17933
|
+
type: string
|
|
17934
|
+
displayName:
|
|
17935
|
+
type: string
|
|
17936
|
+
email:
|
|
17937
|
+
type: string
|
|
17938
|
+
source:
|
|
17939
|
+
type: string
|
|
17940
|
+
customFields:
|
|
17941
|
+
type: object
|
|
17942
|
+
additionalProperties: true
|
|
17943
|
+
externalIds:
|
|
17944
|
+
type: object
|
|
17945
|
+
additionalProperties: true
|
|
17918
17946
|
SendWhatsAppRequest:
|
|
17919
17947
|
type: object
|
|
17920
17948
|
properties:
|
|
@@ -17924,6 +17952,8 @@ components:
|
|
|
17924
17952
|
type: string
|
|
17925
17953
|
reply:
|
|
17926
17954
|
$ref: "#/components/schemas/WhatsAppReplyOptions"
|
|
17955
|
+
contactData:
|
|
17956
|
+
$ref: "#/components/schemas/WhatsAppContactData"
|
|
17927
17957
|
SendWhatsAppResponse:
|
|
17928
17958
|
type: object
|
|
17929
17959
|
properties:
|
package/dist/types/authKit.d.ts
CHANGED
|
@@ -21,6 +21,9 @@ export interface ProfileUpdateData {
|
|
|
21
21
|
photoURL?: string;
|
|
22
22
|
accountData?: Record<string, any>;
|
|
23
23
|
}
|
|
24
|
+
export interface UpdateProfileResponse extends UserProfile {
|
|
25
|
+
token: string;
|
|
26
|
+
}
|
|
24
27
|
export interface SuccessResponse {
|
|
25
28
|
success: boolean;
|
|
26
29
|
message?: string;
|
|
@@ -90,10 +93,21 @@ export interface WhatsAppReplyOptions {
|
|
|
90
93
|
/** Option C: plain-text fallback */
|
|
91
94
|
text?: string;
|
|
92
95
|
}
|
|
96
|
+
export interface WhatsAppContactData {
|
|
97
|
+
name?: string;
|
|
98
|
+
firstName?: string;
|
|
99
|
+
lastName?: string;
|
|
100
|
+
displayName?: string;
|
|
101
|
+
email?: string;
|
|
102
|
+
source?: string;
|
|
103
|
+
customFields?: Record<string, unknown>;
|
|
104
|
+
externalIds?: Record<string, unknown>;
|
|
105
|
+
}
|
|
93
106
|
export interface SendWhatsAppRequest {
|
|
94
107
|
redirectUrl?: string;
|
|
95
108
|
prefillMessage?: string;
|
|
96
109
|
reply?: WhatsAppReplyOptions;
|
|
110
|
+
contactData?: WhatsAppContactData;
|
|
97
111
|
}
|
|
98
112
|
export interface SendWhatsAppResponse {
|
|
99
113
|
waLink: string;
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.17 | Generated: 2026-05-15T20:47:03.471Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -3043,12 +3043,27 @@ interface WhatsAppReplyOptions {
|
|
|
3043
3043
|
}
|
|
3044
3044
|
```
|
|
3045
3045
|
|
|
3046
|
+
**WhatsAppContactData** (interface)
|
|
3047
|
+
```typescript
|
|
3048
|
+
interface WhatsAppContactData {
|
|
3049
|
+
name?: string
|
|
3050
|
+
firstName?: string
|
|
3051
|
+
lastName?: string
|
|
3052
|
+
displayName?: string
|
|
3053
|
+
email?: string
|
|
3054
|
+
source?: string
|
|
3055
|
+
customFields?: Record<string, unknown>
|
|
3056
|
+
externalIds?: Record<string, unknown>
|
|
3057
|
+
}
|
|
3058
|
+
```
|
|
3059
|
+
|
|
3046
3060
|
**SendWhatsAppRequest** (interface)
|
|
3047
3061
|
```typescript
|
|
3048
3062
|
interface SendWhatsAppRequest {
|
|
3049
3063
|
redirectUrl?: string
|
|
3050
3064
|
prefillMessage?: string
|
|
3051
3065
|
reply?: WhatsAppReplyOptions
|
|
3066
|
+
contactData?: WhatsAppContactData
|
|
3052
3067
|
}
|
|
3053
3068
|
```
|
|
3054
3069
|
|
|
@@ -8229,7 +8244,7 @@ Verify phone verification code (public).
|
|
|
8229
8244
|
Send a WhatsApp verification deep-link (public).
|
|
8230
8245
|
|
|
8231
8246
|
**verifyWhatsApp**(clientId: string, token: string, phoneNumber: string) → `Promise<VerifyWhatsAppResponse>`
|
|
8232
|
-
Manually verify WhatsApp token if inbound webhook path is unavailable (public).
|
|
8247
|
+
Manually verify WhatsApp token if inbound webhook path is unavailable (legacy/public fallback).
|
|
8233
8248
|
|
|
8234
8249
|
**getWhatsAppStatus**(clientId: string, token: string) → `Promise<WhatsAppStatusResponse>`
|
|
8235
8250
|
Poll WhatsApp verification status for a token (public).
|
|
@@ -8267,41 +8282,41 @@ Upsert contact identity after lightweight verification (public).
|
|
|
8267
8282
|
**getProfile**(clientId: string) → `Promise<UserProfile>`
|
|
8268
8283
|
Upsert contact identity after lightweight verification (public).
|
|
8269
8284
|
|
|
8270
|
-
**updateProfile**(clientId: string, data: ProfileUpdateData) → `Promise<
|
|
8271
|
-
|
|
8285
|
+
**updateProfile**(clientId: string, data: ProfileUpdateData) → `Promise<UpdateProfileResponse>`
|
|
8286
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8272
8287
|
|
|
8273
8288
|
**changePassword**(clientId: string, currentPassword: string, newPassword: string) → `Promise<SuccessResponse>`
|
|
8274
|
-
|
|
8289
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8275
8290
|
|
|
8276
8291
|
**changeEmail**(clientId: string, newEmail: string, password: string, redirectUrl: string) → `Promise<SuccessResponse>`
|
|
8277
|
-
|
|
8292
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8278
8293
|
|
|
8279
8294
|
**verifyEmailChange**(clientId: string, token: string) → `Promise<SuccessResponse>`
|
|
8280
|
-
|
|
8295
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8281
8296
|
|
|
8282
8297
|
**updatePhone**(clientId: string, phoneNumber: string, verificationCode: string) → `Promise<SuccessResponse>`
|
|
8283
|
-
|
|
8298
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8284
8299
|
|
|
8285
8300
|
**deleteAccount**(clientId: string, password: string, confirmText: string) → `Promise<SuccessResponse>`
|
|
8286
|
-
|
|
8301
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8287
8302
|
|
|
8288
8303
|
**load**(authKitId: string) → `Promise<AuthKitConfig>`
|
|
8289
|
-
|
|
8304
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8290
8305
|
|
|
8291
8306
|
**get**(collectionId: string, authKitId: string) → `Promise<AuthKitConfig>`
|
|
8292
|
-
|
|
8307
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8293
8308
|
|
|
8294
8309
|
**list**(collectionId: string, admin?: boolean) → `Promise<AuthKitConfig[]>`
|
|
8295
|
-
|
|
8310
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8296
8311
|
|
|
8297
8312
|
**create**(collectionId: string, data: any) → `Promise<AuthKitConfig>`
|
|
8298
|
-
|
|
8313
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8299
8314
|
|
|
8300
8315
|
**update**(collectionId: string, authKitId: string, data: any) → `Promise<AuthKitConfig>`
|
|
8301
|
-
|
|
8316
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8302
8317
|
|
|
8303
8318
|
**remove**(collectionId: string, authKitId: string) → `Promise<void>`
|
|
8304
|
-
|
|
8319
|
+
Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
|
|
8305
8320
|
|
|
8306
8321
|
### batch
|
|
8307
8322
|
|
package/docs/auth-kit.md
CHANGED
|
@@ -82,6 +82,8 @@ const session = await authKit.verifyPhoneCode(clientId, '+61400000000', '123456'
|
|
|
82
82
|
|
|
83
83
|
Use these flows when you want low-friction verification before or without full account sign-in.
|
|
84
84
|
|
|
85
|
+
WhatsApp verification is token-first. The user does not type their phone number in your app for this flow; phone ownership is proven by the inbound WhatsApp sender number.
|
|
86
|
+
|
|
85
87
|
```ts
|
|
86
88
|
import { authKit } from '@proveanything/smartlinks';
|
|
87
89
|
|
|
@@ -92,6 +94,12 @@ const wa = await authKit.sendWhatsApp(clientId);
|
|
|
92
94
|
// const wa = await authKit.sendWhatsApp(clientId, {
|
|
93
95
|
// redirectUrl: 'https://app.example.com/checkout/continue',
|
|
94
96
|
// prefillMessage: 'Please let me bid in this auction. Code: {{token}}',
|
|
97
|
+
// contactData: {
|
|
98
|
+
// name: 'Jane Doe',
|
|
99
|
+
// email: 'jane@example.com',
|
|
100
|
+
// source: 'auction-checkout',
|
|
101
|
+
// customFields: { agreedToTerms: true },
|
|
102
|
+
// },
|
|
95
103
|
// reply: {
|
|
96
104
|
// cta: {
|
|
97
105
|
// body: "You're verified and ready to bid.",
|
|
@@ -112,7 +120,7 @@ if (status.status === 'verified' && wa.sessionKey) {
|
|
|
112
120
|
// session.token can be used as the authenticated bearer token
|
|
113
121
|
}
|
|
114
122
|
|
|
115
|
-
// Optional fallback path if webhook confirmation is unavailable
|
|
123
|
+
// Optional legacy fallback path if webhook confirmation is unavailable
|
|
116
124
|
await authKit.verifyWhatsApp(clientId, wa.token, '+447911123456');
|
|
117
125
|
|
|
118
126
|
// 2) Or send SMS click-to-verify link
|
|
@@ -126,6 +134,13 @@ await authKit.sendSmsVerify(clientId, {
|
|
|
126
134
|
await authKit.verifySms(clientId, '<token>', '+447911123456');
|
|
127
135
|
```
|
|
128
136
|
|
|
137
|
+
`contactData` is optional and is useful when you collect name/email before the customer switches to WhatsApp.
|
|
138
|
+
|
|
139
|
+
- Auth Kit stores `contactData` on the verification token metadata first.
|
|
140
|
+
- Contact details are written to durable contact storage only after WhatsApp verification succeeds.
|
|
141
|
+
- If the user abandons before verification, no contact is created.
|
|
142
|
+
- `contactData` must not include phone; the verified inbound WhatsApp sender number is always authoritative.
|
|
143
|
+
|
|
129
144
|
### Contact bootstrap / durable identity
|
|
130
145
|
|
|
131
146
|
After verification, upsert contact identity and store `contactId` on downstream records (raffle ticket, bid, claim intent).
|
|
@@ -182,7 +197,11 @@ const session = await authKit.exchangeWhatsAppSession(clientId, wa.token, wa.ses
|
|
|
182
197
|
|
|
183
198
|
`sessionKey` is returned by `sendWhatsApp` and is used to mitigate token replay from contexts that did not initiate the browser flow.
|
|
184
199
|
|
|
200
|
+
When `contactData.name` or explicit name parts were supplied on the original `sendWhatsApp` call, `session.user.displayName` and the returned bearer token claims are now seeded from the verified contact record instead of staying `null`.
|
|
201
|
+
|
|
185
202
|
> **Note:** `redirectUrl` is optional. WhatsApp tokens are short hex strings (16 chars) for better UX.
|
|
203
|
+
>
|
|
204
|
+
> **Legacy note:** `verifyWhatsApp` is for older phone-bound token flows. Prefer inbound WhatsApp token confirmation plus status polling for new implementations.
|
|
186
205
|
|
|
187
206
|
### Google OAuth
|
|
188
207
|
|
|
@@ -202,7 +221,13 @@ import { authKit } from '@proveanything/smartlinks';
|
|
|
202
221
|
const profile = await authKit.getProfile(clientId);
|
|
203
222
|
|
|
204
223
|
// Update profile
|
|
205
|
-
await authKit.updateProfile(clientId, {
|
|
224
|
+
const updatedProfile = await authKit.updateProfile(clientId, {
|
|
225
|
+
displayName: 'Alice B.',
|
|
226
|
+
avatarUrl: '...'
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// The SDK automatically swaps in updatedProfile.token so future auth.verify()
|
|
230
|
+
// and authenticated calls use fresh displayName/photoURL claims immediately.
|
|
206
231
|
|
|
207
232
|
// Change password
|
|
208
233
|
await authKit.changePassword(clientId, 'currentPass', 'newPass');
|
|
@@ -214,6 +239,8 @@ await authKit.changeEmail(clientId, 'newemail@example.com', 'password', redirect
|
|
|
214
239
|
await authKit.deleteAccount(clientId, 'password', 'DELETE');
|
|
215
240
|
```
|
|
216
241
|
|
|
242
|
+
`updateProfile` now returns a fresh bearer token together with the updated profile fields. The SDK replaces the in-memory bearer token automatically so token-backed identity reads stay current without an extra refresh step.
|
|
243
|
+
|
|
217
244
|
---
|
|
218
245
|
|
|
219
246
|
## Email verification
|
package/openapi.yaml
CHANGED
|
@@ -8016,7 +8016,7 @@ paths:
|
|
|
8016
8016
|
post:
|
|
8017
8017
|
tags:
|
|
8018
8018
|
- authKit
|
|
8019
|
-
summary:
|
|
8019
|
+
summary: "Update the authenticated user's profile and replace the bearer token when refreshed claims are returned."
|
|
8020
8020
|
operationId: authKit_updateProfile
|
|
8021
8021
|
security: []
|
|
8022
8022
|
parameters:
|
|
@@ -8031,7 +8031,7 @@ paths:
|
|
|
8031
8031
|
content:
|
|
8032
8032
|
application/json:
|
|
8033
8033
|
schema:
|
|
8034
|
-
$ref: "#/components/schemas/
|
|
8034
|
+
$ref: "#/components/schemas/UpdateProfileResponse"
|
|
8035
8035
|
400:
|
|
8036
8036
|
description: Bad request
|
|
8037
8037
|
401:
|
|
@@ -8589,7 +8589,7 @@ paths:
|
|
|
8589
8589
|
post:
|
|
8590
8590
|
tags:
|
|
8591
8591
|
- authKit
|
|
8592
|
-
summary: Manually verify WhatsApp token if inbound webhook path is unavailable (public).
|
|
8592
|
+
summary: Manually verify WhatsApp token if inbound webhook path is unavailable (legacy/public fallback).
|
|
8593
8593
|
operationId: authKit_verifyWhatsApp
|
|
8594
8594
|
security: []
|
|
8595
8595
|
parameters:
|
|
@@ -17756,6 +17756,13 @@ components:
|
|
|
17756
17756
|
accountData:
|
|
17757
17757
|
type: object
|
|
17758
17758
|
additionalProperties: true
|
|
17759
|
+
UpdateProfileResponse:
|
|
17760
|
+
type: object
|
|
17761
|
+
properties:
|
|
17762
|
+
token:
|
|
17763
|
+
type: string
|
|
17764
|
+
required:
|
|
17765
|
+
- token
|
|
17759
17766
|
SuccessResponse:
|
|
17760
17767
|
type: object
|
|
17761
17768
|
properties:
|
|
@@ -17915,6 +17922,27 @@ components:
|
|
|
17915
17922
|
$ref: "#/components/schemas/WhatsAppReplyCta"
|
|
17916
17923
|
text:
|
|
17917
17924
|
type: string
|
|
17925
|
+
WhatsAppContactData:
|
|
17926
|
+
type: object
|
|
17927
|
+
properties:
|
|
17928
|
+
name:
|
|
17929
|
+
type: string
|
|
17930
|
+
firstName:
|
|
17931
|
+
type: string
|
|
17932
|
+
lastName:
|
|
17933
|
+
type: string
|
|
17934
|
+
displayName:
|
|
17935
|
+
type: string
|
|
17936
|
+
email:
|
|
17937
|
+
type: string
|
|
17938
|
+
source:
|
|
17939
|
+
type: string
|
|
17940
|
+
customFields:
|
|
17941
|
+
type: object
|
|
17942
|
+
additionalProperties: true
|
|
17943
|
+
externalIds:
|
|
17944
|
+
type: object
|
|
17945
|
+
additionalProperties: true
|
|
17918
17946
|
SendWhatsAppRequest:
|
|
17919
17947
|
type: object
|
|
17920
17948
|
properties:
|
|
@@ -17924,6 +17952,8 @@ components:
|
|
|
17924
17952
|
type: string
|
|
17925
17953
|
reply:
|
|
17926
17954
|
$ref: "#/components/schemas/WhatsAppReplyOptions"
|
|
17955
|
+
contactData:
|
|
17956
|
+
$ref: "#/components/schemas/WhatsAppContactData"
|
|
17927
17957
|
SendWhatsAppResponse:
|
|
17928
17958
|
type: object
|
|
17929
17959
|
properties:
|