Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcinwasowicz/f65e5a223ed47485d37ecc7977e21523 to your computer and use it in GitHub Desktop.
Save marcinwasowicz/f65e5a223ed47485d37ecc7977e21523 to your computer and use it in GitHub Desktop.
Fix SWIE Message Validator on dev env
diff --git a/lib/utils/siwe-utils.js b/lib/utils/siwe-utils.js
index ec538c34b6..ef996a137c 100644
--- a/lib/utils/siwe-utils.js
+++ b/lib/utils/siwe-utils.js
@@ -3,7 +3,7 @@
import invariant from 'invariant';
import { SiweMessage } from 'siwe';
-import { isDev } from './dev-utils.js';
+// import { isDev } from './dev-utils.js';
import type { SIWEMessage } from '../types/siwe-types.js';
const siweNonceRegex: RegExp = /^[a-zA-Z0-9]{17}$/;
@@ -45,19 +45,18 @@ function createSIWEMessage(
}
function isValidSIWEDomain(candidate: string): boolean {
- return isDev
- ? candidate === 'localhost:3000'
- : candidate === 'comm.app' || candidate === 'web.comm.app';
+ return candidate === 'comm.app' || candidate === 'web.comm.app';
}
function isValidSIWEURI(candidate: string): boolean {
- return isDev
- ? candidate === 'http://localhost:3000'
- : candidate === 'https://comm.app' || candidate === 'https://web.comm.app';
+ return (
+ candidate === 'https://comm.app' || candidate === 'https://web.comm.app'
+ );
}
// Verify that the SIWEMessage is a well formed Comm SIWE Auth message.
function isValidSIWEMessage(candidate: SIWEMessage): boolean {
+ console.log(candidate);
return (
candidate.statement !== null &&
candidate.statement !== undefined &&
diff --git a/native/account/siwe-panel.react.js b/native/account/siwe-panel.react.js
index 02dd3fbed5..c6d77bcad6 100644
--- a/native/account/siwe-panel.react.js
+++ b/native/account/siwe-panel.react.js
@@ -27,9 +27,9 @@ import type { BottomSheetRef } from '../types/bottom-sheet.js';
import { UnknownErrorAlertDetails } from '../utils/alert-messages.js';
import Alert from '../utils/alert.js';
import { getContentSigningKey } from '../utils/crypto-utils.js';
-import { defaultLandingURLPrefix } from '../utils/url-utils.js';
+// import { defaultLandingURLPrefix } from '../utils/url-utils.js';
-const commSIWE = `${defaultLandingURLPrefix}/siwe`;
+const commSIWE = `https://comm.app/siwe`;
const getSIWENonceLoadingStatusSelector = createLoadingStatusSelector(
getSIWENonceActionTypes,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment