@lumiapassport/ui-kit 1.16.1 → 1.16.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/dist/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/iframe/oauth/x.js +72 -14
- package/dist/index.cjs +19 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/iframe/index.html
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<meta http-equiv="X-Content-Type-Options" content="nosniff" />
|
|
16
16
|
<meta http-equiv="Referrer-Policy" content="strict-origin-when-cross-origin" />
|
|
17
17
|
|
|
18
|
-
<title>Lumia Passport Secure Wallet - iframe version 1.16.
|
|
18
|
+
<title>Lumia Passport Secure Wallet - iframe version 1.16.2</title>
|
|
19
19
|
|
|
20
20
|
<!-- Styles will be injected by build process -->
|
|
21
21
|
<style>
|
package/dist/iframe/main.js
CHANGED
|
@@ -4411,7 +4411,7 @@ var SigningManager = class extends TokenRefreshApiClient {
|
|
|
4411
4411
|
};
|
|
4412
4412
|
|
|
4413
4413
|
// src/iframe/main.ts
|
|
4414
|
-
var IFRAME_VERSION = "1.16.
|
|
4414
|
+
var IFRAME_VERSION = "1.16.2";
|
|
4415
4415
|
var IframeWallet = class {
|
|
4416
4416
|
constructor() {
|
|
4417
4417
|
console.log("=".repeat(60));
|
package/dist/iframe/oauth/x.js
CHANGED
|
@@ -153,6 +153,8 @@ async function startOAuthFlow() {
|
|
|
153
153
|
/**
|
|
154
154
|
* Handle successful OAuth after backend redirect
|
|
155
155
|
* Backend processes callback and redirects back with success=true
|
|
156
|
+
* If authCode is present, exchanges it for tokens (Safari ITP fix)
|
|
157
|
+
* Otherwise falls back to cookie-based verify (desktop browsers)
|
|
156
158
|
*/
|
|
157
159
|
async function handleBackendSuccess() {
|
|
158
160
|
try {
|
|
@@ -166,32 +168,88 @@ async function handleBackendSuccess() {
|
|
|
166
168
|
throw new Error('Missing TSS URL. Check build-time configuration.');
|
|
167
169
|
}
|
|
168
170
|
|
|
169
|
-
//
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
// Check for auth code (new flow for Safari ITP compatibility)
|
|
172
|
+
const authCode = urlParams.get('authCode');
|
|
173
|
+
let userData;
|
|
174
|
+
let tokens = null;
|
|
173
175
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
if (authCode) {
|
|
177
|
+
// New flow: Exchange auth code for tokens (fixes Safari ITP issues)
|
|
178
|
+
console.log('[X OAuth] Auth code present, exchanging for tokens...');
|
|
179
|
+
|
|
180
|
+
const exchangeEndpoint = PROJECT_ID
|
|
181
|
+
? `${TSS_URL}/api/auth/exchange-code?projectId=${encodeURIComponent(PROJECT_ID)}`
|
|
182
|
+
: `${TSS_URL}/api/auth/exchange-code`;
|
|
183
|
+
|
|
184
|
+
const exchangeResponse = await fetch(exchangeEndpoint, {
|
|
185
|
+
method: 'POST',
|
|
186
|
+
headers: { 'Content-Type': 'application/json' },
|
|
187
|
+
body: JSON.stringify({ code: authCode })
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
if (!exchangeResponse.ok) {
|
|
191
|
+
const errorData = await exchangeResponse.json().catch(() => ({}));
|
|
192
|
+
console.error('[X OAuth] Code exchange failed:', exchangeResponse.status, errorData);
|
|
193
|
+
throw new Error(errorData.error || 'Failed to exchange auth code');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const exchangeData = await exchangeResponse.json();
|
|
197
|
+
console.log('[X OAuth] Code exchange successful:', { userId: exchangeData.userId, hasKeyshare: exchangeData.hasKeyshare });
|
|
198
|
+
|
|
199
|
+
// Extract tokens for postMessage
|
|
200
|
+
tokens = {
|
|
201
|
+
accessToken: exchangeData.accessToken,
|
|
202
|
+
refreshToken: exchangeData.refreshToken
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// Build userData in the same format as verify endpoint
|
|
206
|
+
userData = {
|
|
207
|
+
valid: true,
|
|
208
|
+
userId: exchangeData.userId,
|
|
209
|
+
sessionId: exchangeData.sessionId,
|
|
210
|
+
expiresIn: exchangeData.expiresIn,
|
|
211
|
+
hasKeyshare: exchangeData.hasKeyshare,
|
|
212
|
+
displayName: exchangeData.displayName,
|
|
213
|
+
providers: exchangeData.providers
|
|
214
|
+
};
|
|
215
|
+
} else {
|
|
216
|
+
// Legacy flow: Use cookies (works on desktop browsers)
|
|
217
|
+
console.log('[X OAuth] No auth code, falling back to cookie-based verify...');
|
|
178
218
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
219
|
+
const verifyEndpoint = PROJECT_ID
|
|
220
|
+
? `${TSS_URL}/api/auth/verify?projectId=${encodeURIComponent(PROJECT_ID)}`
|
|
221
|
+
: `${TSS_URL}/api/auth/verify`;
|
|
222
|
+
|
|
223
|
+
const verifyResponse = await fetch(verifyEndpoint, {
|
|
224
|
+
method: 'GET',
|
|
225
|
+
credentials: 'include',
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
if (!verifyResponse.ok) {
|
|
229
|
+
console.error('[X OAuth] Verify failed:', verifyResponse.status);
|
|
230
|
+
throw new Error('Failed to verify authentication. Session may not be created.');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
userData = await verifyResponse.json();
|
|
182
234
|
}
|
|
183
235
|
|
|
184
|
-
const userData = await verifyResponse.json();
|
|
185
236
|
console.log('[X OAuth] Authentication verified:', userData);
|
|
186
237
|
|
|
187
238
|
// Send success to opener
|
|
188
239
|
if (window.opener) {
|
|
189
|
-
|
|
240
|
+
const message = {
|
|
190
241
|
type: 'X_AUTH_SUCCESS',
|
|
191
242
|
provider: 'x',
|
|
192
243
|
user: userData,
|
|
193
244
|
mode: MODE
|
|
194
|
-
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
// Include tokens if we have them (new flow)
|
|
248
|
+
if (tokens) {
|
|
249
|
+
message.tokens = tokens;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
window.opener.postMessage(message, '*');
|
|
195
253
|
|
|
196
254
|
// Mark that we've sent the auth result
|
|
197
255
|
authResultSent = true;
|
package/dist/index.cjs
CHANGED
|
@@ -3380,6 +3380,24 @@ var init_iframe_manager = __esm({
|
|
|
3380
3380
|
});
|
|
3381
3381
|
} else if (event.data.type === "X_AUTH_SUCCESS" && eventProvider === "x" && providerKey === "x") {
|
|
3382
3382
|
this.log("[IframeManager] X auth successful from popup:", event.data);
|
|
3383
|
+
if (event.data.tokens) {
|
|
3384
|
+
this.log("[IframeManager] Tokens received in postMessage, storing via jwtTokenManager");
|
|
3385
|
+
Promise.resolve().then(() => (init_auth(), auth_exports)).then(({ jwtTokenManager: jwtTokenManager4 }) => {
|
|
3386
|
+
return jwtTokenManager4.setTokens({
|
|
3387
|
+
accessToken: event.data.tokens.accessToken,
|
|
3388
|
+
refreshToken: event.data.tokens.refreshToken,
|
|
3389
|
+
userId: event.data.user.userId,
|
|
3390
|
+
expiresIn: event.data.user.expiresIn || 3600,
|
|
3391
|
+
hasKeyshare: event.data.user.hasKeyshare || false,
|
|
3392
|
+
displayName: event.data.user.displayName || null,
|
|
3393
|
+
providers: event.data.user.providers || ["x"]
|
|
3394
|
+
});
|
|
3395
|
+
}).then(() => {
|
|
3396
|
+
this.log("[IframeManager] Tokens stored successfully");
|
|
3397
|
+
}).catch((tokenError) => {
|
|
3398
|
+
this.log("[IframeManager] Warning: Failed to store tokens:", tokenError);
|
|
3399
|
+
});
|
|
3400
|
+
}
|
|
3383
3401
|
finalize({
|
|
3384
3402
|
success: true,
|
|
3385
3403
|
user: event.data.user,
|
|
@@ -5672,7 +5690,7 @@ function Header() {
|
|
|
5672
5690
|
// package.json
|
|
5673
5691
|
var package_default = {
|
|
5674
5692
|
name: "@lumiapassport/ui-kit",
|
|
5675
|
-
version: "1.16.
|
|
5693
|
+
version: "1.16.2",
|
|
5676
5694
|
description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
|
|
5677
5695
|
type: "module",
|
|
5678
5696
|
main: "./dist/index.cjs",
|