@truly-you/trulyyou-web-sdk 0.1.21 → 0.1.22
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/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/sdk/TrulyYouSDK.ts +38 -0
package/package.json
CHANGED
package/src/sdk/TrulyYouSDK.ts
CHANGED
|
@@ -1202,6 +1202,44 @@ export class TrulyYouSDK {
|
|
|
1202
1202
|
console.warn('[SDK]: ⚠️ WARNING - No keyId received from Device B via socket! Data:', data)
|
|
1203
1203
|
}
|
|
1204
1204
|
console.log('[SDK]: ✅ Using keyId from Device B:', deviceBKeyId, '(extracted from socket)')
|
|
1205
|
+
|
|
1206
|
+
// Store handoff keyId in localStorage (Device A - desktop)
|
|
1207
|
+
if (deviceBKeyId && this.brandingCache?.authFlowId) {
|
|
1208
|
+
const authFlowId = this.brandingCache.authFlowId
|
|
1209
|
+
const handoffStorageKey = `trulyYouKeyId_${authFlowId}_handoff`
|
|
1210
|
+
|
|
1211
|
+
// Store in same-origin localStorage
|
|
1212
|
+
if (typeof window !== 'undefined') {
|
|
1213
|
+
localStorage.setItem(handoffStorageKey, deviceBKeyId)
|
|
1214
|
+
console.log('[SDK]: ✅ Stored handoff keyId in localStorage:', handoffStorageKey, '=', deviceBKeyId)
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
// Also store in TrulyYou frontend's localStorage via iframe
|
|
1218
|
+
try {
|
|
1219
|
+
const frontendUrl = this.frontendUrl
|
|
1220
|
+
const iframe = document.createElement('iframe')
|
|
1221
|
+
iframe.style.cssText = 'position: fixed; top: -9999px; left: -9999px; width: 1px; height: 1px; border: none; opacity: 0; pointer-events: none;'
|
|
1222
|
+
|
|
1223
|
+
const storeUrl = new URL(`${frontendUrl}/store-handoff-keyid.html`)
|
|
1224
|
+
storeUrl.searchParams.set('authFlowId', authFlowId)
|
|
1225
|
+
storeUrl.searchParams.set('keyId', deviceBKeyId)
|
|
1226
|
+
|
|
1227
|
+
iframe.src = storeUrl.toString()
|
|
1228
|
+
document.body.appendChild(iframe)
|
|
1229
|
+
|
|
1230
|
+
// Clean up after a delay
|
|
1231
|
+
setTimeout(() => {
|
|
1232
|
+
if (iframe.parentNode) {
|
|
1233
|
+
iframe.parentNode.removeChild(iframe)
|
|
1234
|
+
}
|
|
1235
|
+
}, 2000)
|
|
1236
|
+
|
|
1237
|
+
console.log('[SDK]: ✅ Stored handoff keyId in TrulyYou frontend localStorage via iframe')
|
|
1238
|
+
} catch (error) {
|
|
1239
|
+
console.warn('[SDK]: Failed to store handoff keyId in TrulyYou frontend localStorage:', error)
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1205
1243
|
const result: SigningResult = {
|
|
1206
1244
|
signature: signature,
|
|
1207
1245
|
keyId: deviceBKeyId,
|