diff --git a/landing/siwe.react.js b/landing/siwe.react.js --- a/landing/siwe.react.js +++ b/landing/siwe.react.js @@ -24,7 +24,6 @@ import type { SIWEWebViewMessage } from 'lib/types/siwe-types.js'; import { getSIWEStatementForPublicKey, - siweStatementWithoutPublicKey, siweMessageSigningExplanationStatements, createSIWEMessage, } from 'lib/utils/siwe-utils.js'; @@ -79,9 +78,13 @@ React.useContext(SIWEContext); const onClick = React.useCallback(() => { invariant(siweNonce, 'nonce must be present during SIWE attempt'); - const statement = siwePrimaryIdentityPublicKey - ? getSIWEStatementForPublicKey(siwePrimaryIdentityPublicKey) - : siweStatementWithoutPublicKey; + invariant( + siwePrimaryIdentityPublicKey, + 'primaryIdentityPublicKey must be present during SIWE attempt', + ); + const statement = getSIWEStatementForPublicKey( + siwePrimaryIdentityPublicKey, + ); signInWithEthereum(address, signer, siweNonce, statement); }, [address, signer, siweNonce, siwePrimaryIdentityPublicKey]); diff --git a/lib/utils/siwe-utils.js b/lib/utils/siwe-utils.js --- a/lib/utils/siwe-utils.js +++ b/lib/utils/siwe-utils.js @@ -21,7 +21,7 @@ return primaryIdentityPublicKeyRegex.test(candidate); } -const siweStatementWithoutPublicKey: string = +const siweStatementLegalAgreement: string = 'By continuing, I accept the Comm Terms of Service: https://comm.app/terms'; function createSIWEMessage( @@ -59,10 +59,9 @@ // Verify that the SIWEMessage is a well formed Comm SIWE Auth message. function isValidSIWEMessage(candidate: SIWEMessage): boolean { return ( - (candidate.statement === siweStatementWithoutPublicKey || - (candidate.statement !== null && - candidate.statement !== undefined && - isValidSIWEStatementWithPublicKey(candidate.statement))) && + candidate.statement !== null && + candidate.statement !== undefined && + isValidSIWEStatementWithPublicKey(candidate.statement) && candidate.version === '1' && candidate.chainId === 1 && isValidSIWEDomain(candidate.domain) && @@ -77,7 +76,7 @@ isValidPrimaryIdentityPublicKey(publicKey), 'publicKey must be well formed in getSIWEStatementForPublicKey', ); - return `Device IdPubKey: ${publicKey} ${siweStatementWithoutPublicKey}`; + return `Device IdPubKey: ${publicKey} ${siweStatementLegalAgreement}`; } const siweStatementWithPublicKeyRegex = @@ -110,7 +109,6 @@ `identity is represented by your new Comm identity.`; export { - siweStatementWithoutPublicKey, isValidSIWENonce, isValidEthereumAddress, primaryIdentityPublicKeyRegex,