Skip to content

Commit

Permalink
feat(siwe-parser): support optional scheme being provided for domain
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasEllul committed Mar 19, 2024
1 parent 0e63b05 commit 0262dce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/siwe-parser/lib/abnf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down
13 changes: 13 additions & 0 deletions test/parsing_positive.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}

0 comments on commit 0262dce

Please sign in to comment.