diff --git a/packages/siwe-parser/lib/abnf.ts b/packages/siwe-parser/lib/abnf.ts index 8815fe6d..a3238113 100644 --- a/packages/siwe-parser/lib/abnf.ts +++ b/packages/siwe-parser/lib/abnf.ts @@ -4,7 +4,7 @@ import { isEIP55Address, parseIntegerNumber } from "./utils"; const GRAMMAR = ` sign-in-with-ethereum = - domain %s" wants you to sign in with your Ethereum account:" LF + [ scheme "://" ] domain %s" wants you to sign in with your Ethereum account:" LF address LF LF [ statement LF ] diff --git a/test/parsing_positive.json b/test/parsing_positive.json index 05221a55..5e92711e 100644 --- a/test/parsing_positive.json +++ b/test/parsing_positive.json @@ -216,5 +216,18 @@ "nonce": "15050747", "issuedAt": "2022-06-30T14:08:51.382Z" } + }, + "domain contains optional scheme": { + "message": "https://example.com wants you to sign in with your Ethereum account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ExampleOrg Terms of Service: https://example.com/tos\n\nURI: https://example.com/login\nVersion: 1\nChain ID: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24Z", + "fields": { + "domain": "example.com", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "statement": "I accept the ExampleOrg Terms of Service: https://example.com/tos", + "uri": "https://example.com/login", + "version": "1", + "chainId": 1, + "nonce": "32891756", + "issuedAt": "2021-09-30T16:25:24Z" + } } }