@truly-you/trulyyou-web-sdk 0.1.13 → 0.1.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truly-you/trulyyou-web-sdk",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "TrulyYou Web SDK for secure authentication and payload signing",
5
5
  "type": "module",
6
6
  "main": "dist/index.esm.js",
@@ -320,40 +320,47 @@ export class TrulyYouSDK {
320
320
  }
321
321
 
322
322
  const handleMessage = async (event: MessageEvent) => {
323
- console.log('[SDK-PROBE]: Received message:', event.data, 'from origin:', event.origin)
323
+ const data = event.data as any
324
324
 
325
- try {
326
- const frontendOrigin = new URL(this.frontendUrl).origin
327
- console.log('[SDK-PROBE]: Checking origin - expected:', frontendOrigin, 'received:', event.origin)
328
- if (event.origin !== frontendOrigin) {
329
- console.log('[SDK-PROBE]: Origin mismatch, ignoring message')
330
- return
331
- }
325
+ // Log ALL messages during probe to debug
326
+ console.log('[SDK-PROBE-DEBUG]: Message received - type:', data?.type, 'origin:', event.origin, 'data:', data)
327
+
328
+ // Only process probe-related messages
329
+ if (data?.type === 'KEY_CHECK_RESULT' || data?.type === 'KEY_CHECK_FAILED') {
330
+ console.log('[SDK-PROBE]: Processing probe message:', event.data, 'from origin:', event.origin)
332
331
 
333
- } catch (e) {
334
- console.log('[SDK-PROBE]: Origin check failed, using hostname fallback')
335
- if (!event.origin.includes(window.location.hostname)) {
336
- console.log('[SDK-PROBE]: Hostname not in origin, ignoring message')
337
- return
332
+ try {
333
+ const frontendOrigin = new URL(this.frontendUrl).origin
334
+ console.log('[SDK-PROBE]: Checking origin - expected:', frontendOrigin, 'received:', event.origin)
335
+ if (event.origin !== frontendOrigin) {
336
+ console.log('[SDK-PROBE]: Origin mismatch, ignoring message')
337
+ return
338
+ }
339
+
340
+ } catch (e) {
341
+ console.log('[SDK-PROBE]: Origin check failed, using hostname fallback')
342
+ if (!event.origin.includes(window.location.hostname)) {
343
+ console.log('[SDK-PROBE]: Hostname not in origin, ignoring message')
344
+ return
345
+ }
338
346
  }
339
- }
340
347
 
341
- const data = event.data as any
342
- console.log('[SDK-PROBE]: Message passed origin check, type:', data?.type)
343
-
344
- if (data?.type === 'KEY_CHECK_RESULT') {
345
- console.log('[SDK-PROBE]: KEY_CHECK_RESULT received - hasKey:', data.hasKey, 'keyId:', data.keyId)
346
- cleanup()
347
- if (data.hasKey && data.keyId) {
348
- // Key found in localStorage - it will be validated when used in /api/signatures/create
349
- resolve(data.keyId)
350
- } else {
348
+ console.log('[SDK-PROBE]: Message passed origin check, type:', data?.type)
349
+
350
+ if (data?.type === 'KEY_CHECK_RESULT') {
351
+ console.log('[SDK-PROBE]: KEY_CHECK_RESULT received - hasKey:', data.hasKey, 'keyId:', data.keyId)
352
+ cleanup()
353
+ if (data.hasKey && data.keyId) {
354
+ // Key found in localStorage - it will be validated when used in /api/signatures/create
355
+ resolve(data.keyId)
356
+ } else {
357
+ resolve(null)
358
+ }
359
+ } else if (data?.type === 'KEY_CHECK_FAILED') {
360
+ console.log('[SDK-PROBE]: KEY_CHECK_FAILED received')
361
+ cleanup()
351
362
  resolve(null)
352
363
  }
353
- } else if (data?.type === 'KEY_CHECK_FAILED') {
354
- console.log('[SDK-PROBE]: KEY_CHECK_FAILED received')
355
- cleanup()
356
- resolve(null)
357
364
  }
358
365
  }
359
366