mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
tweaks
This commit is contained in:
parent
7ce73c5490
commit
bc95aa561e
4 changed files with 7 additions and 7 deletions
|
|
@ -39,7 +39,6 @@ var wantsMsg = ` wants you to sign in with your Ethereum account:\n`
|
|||
var address = `(0x[a-fA-F0-9]{40})\n`
|
||||
|
||||
// Optional statement (any line not containing "\n\n")
|
||||
// var statement = `(?:[^\n]+\n)?`
|
||||
var statement = `(?:.*\n)?`
|
||||
|
||||
// URI
|
||||
|
|
@ -77,13 +76,15 @@ var siweMessageRegex = regexp.MustCompile(`(?m)^` + scheme + domain + wantsMsg +
|
|||
|
||||
var ErrMalformedSIWEMessage = errors.New("the message is asking to sign in with Ethereum but does not conform to EIP-4361")
|
||||
|
||||
const suggestiveLanguage = "wants you to sign in with your Ethereum account"
|
||||
|
||||
func validateSIWE(req *SignDataRequest) error {
|
||||
for _, message := range req.Messages {
|
||||
s, ok := message.Value.(string)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if !strings.Contains(s, "wants you to sign in with your Ethereum account") {
|
||||
if !strings.Contains(s, suggestiveLanguage) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
},
|
||||
"domain is RFC 3986 authority with userinfo and port": {
|
||||
"msg": "test@127.0.0.1:8080 wants you to sign in with your Ethereum account:\n{{Account}}\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
||||
"request_context":{
|
||||
"request_context": {
|
||||
"transport": "https",
|
||||
"source": "test@127.0.0.1:8080"
|
||||
}
|
||||
|
|
|
|||
1
signer/core/testdata/siwe/warnings.json
vendored
1
signer/core/testdata/siwe/warnings.json
vendored
|
|
@ -32,5 +32,4 @@
|
|||
"No scheme - ://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body": "service.org wants you to sign in with your Ethereum account:\n0x{{Account}}\n\n\nURI: ://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
||||
"bad query - uri://user:pass@example.com:123/one/two.three ?q1=a1&q2=a2#body": "service.org wants you to sign in with your Ethereum account:\n0x{{Account}}\n\n\nURI: uri://user:pass@example.com:123/one/two.three ?q1=a1&q2=a2#body\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
||||
"bad fragment - uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2 #body": "service.org wants you to sign in with your Ethereum account:\n0x{{Account}}\n\n\nURI: uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2 #body\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue