@rhinestone/1auth 0.7.2 → 0.7.4

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.mjs CHANGED
@@ -2984,7 +2984,7 @@ var OneAuthClient = class {
2984
2984
  * @param cleanup - Idempotent teardown function that closes and removes the dialog.
2985
2985
  * @returns A `SigningResult` discriminated union.
2986
2986
  */
2987
- waitForIntentSigningResponse(requestId, dialog, _iframe, cleanup) {
2987
+ waitForIntentSigningResponse(requestId, dialog, iframe, cleanup) {
2988
2988
  const dialogOrigin = this.getDialogOrigin();
2989
2989
  return new Promise((resolve) => {
2990
2990
  const handleMessage = (event) => {
@@ -3010,7 +3010,7 @@ var OneAuthClient = class {
3010
3010
  }
3011
3011
  });
3012
3012
  }
3013
- } else if (message?.type === "PASSKEY_CLOSE") {
3013
+ } else if (message?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
3014
3014
  window.removeEventListener("message", handleMessage);
3015
3015
  cleanup();
3016
3016
  resolve({
@@ -3041,12 +3041,13 @@ var OneAuthClient = class {
3041
3041
  * forward to the execute endpoint.
3042
3042
  *
3043
3043
  * @param dialog - The `<dialog>` element wrapping the signing iframe.
3044
- * @param _iframe - Unused; kept for signature consistency with other wait helpers.
3044
+ * @param iframe - The signing iframe; used to authenticate the source of
3045
+ * `PASSKEY_CLOSE` so a sibling same-origin dialog can't forge a rejection.
3045
3046
  * @param cleanup - Idempotent teardown that closes and removes the dialog.
3046
3047
  * @returns A `SigningResult` extended with an optional `signedHash` field
3047
3048
  * populated when the dialog performs message signing.
3048
3049
  */
3049
- waitForSigningResponse(dialog, _iframe, cleanup) {
3050
+ waitForSigningResponse(dialog, iframe, cleanup) {
3050
3051
  const dialogOrigin = this.getDialogOrigin();
3051
3052
  return new Promise((resolve) => {
3052
3053
  const handleMessage = (event) => {
@@ -3077,7 +3078,7 @@ var OneAuthClient = class {
3077
3078
  }
3078
3079
  });
3079
3080
  }
3080
- } else if (message?.type === "PASSKEY_CLOSE") {
3081
+ } else if (message?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
3081
3082
  window.removeEventListener("message", handleMessage);
3082
3083
  cleanup();
3083
3084
  resolve({
@@ -3160,7 +3161,7 @@ var OneAuthClient = class {
3160
3161
  }
3161
3162
  });
3162
3163
  }
3163
- } else if (message?.type === "PASSKEY_CLOSE") {
3164
+ } else if (message?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
3164
3165
  window.removeEventListener("message", handleMessage);
3165
3166
  cleanup();
3166
3167
  resolve({
@@ -3410,7 +3411,7 @@ var OneAuthClient = class {
3410
3411
  );
3411
3412
  }
3412
3413
  });
3413
- } else if (event.data?.type === "PASSKEY_CLOSE") {
3414
+ } else if (event.data?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
3414
3415
  teardown();
3415
3416
  cleanup();
3416
3417
  resolve({ ready: false });
@@ -4433,7 +4434,7 @@ var OneAuthClient = class {
4433
4434
  blindSigning
4434
4435
  }, dialogOrigin);
4435
4436
  resolve(true);
4436
- } else if (event.data?.type === "PASSKEY_CLOSE") {
4437
+ } else if (event.data?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
4437
4438
  teardown();
4438
4439
  cleanup();
4439
4440
  resolve(false);
@@ -5076,7 +5077,7 @@ var OneAuthClient = class {
5076
5077
  message: "Permission grant failed"
5077
5078
  }
5078
5079
  });
5079
- } else if (data?.type === "PASSKEY_CLOSE") {
5080
+ } else if (data?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
5080
5081
  teardown();
5081
5082
  cleanup();
5082
5083
  resolve({