mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
fix
This commit is contained in:
parent
302fb5aba1
commit
7ce73c5490
3 changed files with 167 additions and 46 deletions
|
|
@ -1102,10 +1102,16 @@ func TestSignInWithEtheriumValidMessages(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
jsonFile, err := os.ReadFile(filepath.Join("testdata", "siwe", "valid_messages.json"))
|
jsonFile, err := os.ReadFile(filepath.Join("testdata", "siwe", "valid_messages.json"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
tests := make(map[string]string)
|
var tests map[string]struct {
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
RequestContext struct {
|
||||||
|
Transport string `json:"transport"`
|
||||||
|
Source string `json:"source"`
|
||||||
|
} `json:"request_context"`
|
||||||
|
}
|
||||||
require.NoError(t, json.Unmarshal(jsonFile, &tests))
|
require.NoError(t, json.Unmarshal(jsonFile, &tests))
|
||||||
|
|
||||||
for testName, msg := range tests {
|
for testName, testData := range tests {
|
||||||
t.Run(testName, func(t *testing.T) {
|
t.Run(testName, func(t *testing.T) {
|
||||||
api, control := setup(t, true)
|
api, control := setup(t, true)
|
||||||
createAccount(control, api, t)
|
createAccount(control, api, t)
|
||||||
|
|
@ -1115,8 +1121,8 @@ func TestSignInWithEtheriumValidMessages(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
a := common.NewMixedcaseAddress(list[0])
|
a := common.NewMixedcaseAddress(list[0])
|
||||||
|
|
||||||
ctx := rpc.ContextWithMockPeerInfo(context.Background(), "https", "service.org")
|
ctx := rpc.ContextWithMockPeerInfo(context.Background(), cmp.Or(testData.RequestContext.Transport, "https"), cmp.Or(testData.RequestContext.Source, "service.org"))
|
||||||
message := strings.ReplaceAll(msg, "{{Account}}", a.Address().Hex())
|
message := strings.ReplaceAll(testData.Msg, "{{Account}}", a.Address().Hex())
|
||||||
|
|
||||||
control.approveCh <- "Y"
|
control.approveCh <- "Y"
|
||||||
control.inputCh <- "a_long_password"
|
control.inputCh <- "a_long_password"
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Message size
|
|
||||||
var messageSize = `(?:\d+)`
|
|
||||||
|
|
||||||
// Regular expression to match SIWE messages
|
// Regular expression to match SIWE messages
|
||||||
// Scheme (optional)
|
// Scheme (optional)
|
||||||
var scheme = `(?:([a-zA-Z][a-zA-Z0-9+\-.]*)://)?`
|
var scheme = `(?:([a-zA-Z][a-zA-Z0-9+\-.]*)://)?`
|
||||||
|
|
@ -42,7 +39,8 @@ var wantsMsg = ` wants you to sign in with your Ethereum account:\n`
|
||||||
var address = `(0x[a-fA-F0-9]{40})\n`
|
var address = `(0x[a-fA-F0-9]{40})\n`
|
||||||
|
|
||||||
// Optional statement (any line not containing "\n\n")
|
// Optional statement (any line not containing "\n\n")
|
||||||
var statement = `(?:[^\n]+\n)?`
|
// var statement = `(?:[^\n]+\n)?`
|
||||||
|
var statement = `(?:.*\n)?`
|
||||||
|
|
||||||
// URI
|
// URI
|
||||||
var uri = `URI: (?:.+)\n`
|
var uri = `URI: (?:.+)\n`
|
||||||
|
|
@ -72,7 +70,7 @@ var requestID = `(?:\nRequest ID: (?:[^\n]+))?`
|
||||||
var resources = `(?:\nResources:(?:\n- .+)+)?`
|
var resources = `(?:\nResources:(?:\n- .+)+)?`
|
||||||
|
|
||||||
// SIWE Message Regex
|
// SIWE Message Regex
|
||||||
var siweMessageRegex = regexp.MustCompile(`(?m)^` + messageSize + scheme + domain + wantsMsg +
|
var siweMessageRegex = regexp.MustCompile(`(?m)^` + scheme + domain + wantsMsg +
|
||||||
address + `\n` + statement + `\n` +
|
address + `\n` + statement + `\n` +
|
||||||
uri + version + chainID + nonce + issuedAt +
|
uri + version + chainID + nonce + issuedAt +
|
||||||
expiration + notBefore + requestID + resources + `$`)
|
expiration + notBefore + requestID + resources + `$`)
|
||||||
|
|
@ -89,7 +87,7 @@ func validateSIWE(req *SignDataRequest) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
patterns := siweMessageRegex.FindStringSubmatch(s)
|
patterns := siweMessageRegex.FindStringSubmatch(s[bytesUntilStartOfMessage(s):])
|
||||||
if patterns == nil {
|
if patterns == nil {
|
||||||
return ErrMalformedSIWEMessage
|
return ErrMalformedSIWEMessage
|
||||||
}
|
}
|
||||||
|
|
@ -127,3 +125,29 @@ func validateAddress(request *SignDataRequest, address string) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bytestUntilStartOfMessage calculates the prefix attached to the message being signed
|
||||||
|
// The first element of our message is the default "signed with etherium" prefix
|
||||||
|
// The second element of our message is the size of the message that will follow (in bytes)
|
||||||
|
// The third element is the "domain" that would like you to sign in, which can be an IP address.
|
||||||
|
// Differentiating a number potentially followed by another number is not pretty in regex.
|
||||||
|
// To resolve this, we calculate the number of characters required to represent the message and return
|
||||||
|
// that (and the size of the etherium prefix) so they can be trimmed from the start of our message when matching.
|
||||||
|
func bytesUntilStartOfMessage(s string) int {
|
||||||
|
const etheriumSignagureHeaderLength = 26
|
||||||
|
l := len(s) - etheriumSignagureHeaderLength
|
||||||
|
if l < 1 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var n int
|
||||||
|
for l > 0 {
|
||||||
|
l /= 10
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
if n < l {
|
||||||
|
n -= 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return etheriumSignagureHeaderLength + n
|
||||||
|
}
|
||||||
|
|
|
||||||
163
signer/core/testdata/siwe/valid_messages.json
vendored
163
signer/core/testdata/siwe/valid_messages.json
vendored
|
|
@ -1,37 +1,128 @@
|
||||||
{
|
{
|
||||||
"resources present": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri:",
|
"resources present": {
|
||||||
"resources empty": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:",
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri:"
|
||||||
"resources missing": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
},
|
||||||
"request-id present": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nRequest ID: request123",
|
"resources empty": {
|
||||||
"request-id empty": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nRequest ID: ",
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:"
|
||||||
"request-id missing": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
},
|
||||||
"statement present": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\nhave statement\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
"resources missing": {
|
||||||
"statement empty": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
"statement missing": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
},
|
||||||
"Resources: [uri:, uri://@]": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri:\n- uri://@",
|
"request-id present": {
|
||||||
"Resources: [uri://@:, uri://]": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://@:\n- uri://",
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nRequest ID: request123"
|
||||||
"Resources: [uri://:, uri:?]": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://:\n- uri:?",
|
},
|
||||||
"Resources: [uri:#, 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:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri:#\n- uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body",
|
"request-id empty": {
|
||||||
"Resources IPv4: [uri://10.10.10.10, uri://010.0.00.000]": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://10.10.10.10\n- uri://010.0.00.000",
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nRequest ID: "
|
||||||
"Resources IP-literal: [uri://[2001:db8::7], uri://[::ffff:129.144.52.38]]": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://[2001:db8::7]\n- uri://[::ffff:129.144.52.38]",
|
},
|
||||||
"Resources IP-literal: [uri://10.10.10.10.example.com/en/process, uri://[2606:2800:220:1:248:1893:25c8:1946]/test]": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://10.10.10.10.example.com/en/process\n- uri://[2606:2800:220:1:248:1893:25c8:1946]/test",
|
"request-id missing": {
|
||||||
"Resources IP-literal: [uri://[2001:db8::1]:80, uri://[2001:db8::1:ffff]:5128]": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://[2001:db8::1]:80\n- uri://[2001:db8::1:ffff]:5128",
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
"couple of optional fields": "service.org 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\nResources:\n- ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu\n- https://example.com/my-web2-claim.json",
|
},
|
||||||
"no optional field": "service.org 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",
|
"statement present": {
|
||||||
"timestamp without microseconds": "service.org 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:24Z",
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\nhave statement\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
"timezone not utc": "service.org 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-02:00",
|
},
|
||||||
"domain is RFC 3986 authority with IP": "127.0.0.1 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",
|
"statement empty": {
|
||||||
"domain is RFC 3986 authority with userinfo": "test@127.0.0.1 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",
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
"domain is RFC 3986 authority with port": "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",
|
},
|
||||||
"domain is localhost authority with port": "localhost: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",
|
"statement missing": {
|
||||||
"domain is RFC 3986 authority with userinfo and port": "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",
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
"no statement": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
},
|
||||||
"domain ipv6": "[::cafe] wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
"Resources: [uri:, uri://@]": {
|
||||||
"uri ipv6": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://[::cafe]\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri:\n- uri://@"
|
||||||
"uri ipv4": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://127.0.0.1\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
},
|
||||||
"uri with port": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://127.0.0.1:4361\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
"Resources: [uri://@:, uri://]": {
|
||||||
"uri ipv4 query params and fragment": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://127.0.0.1/?query=one#begin\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://@:\n- uri://"
|
||||||
"chainId not 1": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 4\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
},
|
||||||
"recovery byte starting at 0": "service.org wants you to sign in with your Ethereum account:\n0xc95EB884FE852e241D409234bfC7045CB9E31BD7\n\nSign in with Ethereum to Tally\n\nURI: https://service.org\nVersion: 1\nChain ID: 1\nNonce: 15050747\nIssued At: 2022-06-30T14:08:51.382Z",
|
"Resources: [uri://:, uri:?]": {
|
||||||
"domain contains optional scheme": "https://service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\nI accept the ExampleOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24Z"
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://:\n- uri:?"
|
||||||
}
|
},
|
||||||
|
"Resources: [uri:#, uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body]": {
|
||||||
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri:#\n- uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body"
|
||||||
|
},
|
||||||
|
"Resources IPv4: [uri://10.10.10.10, uri://010.0.00.000]": {
|
||||||
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://10.10.10.10\n- uri://010.0.00.000"
|
||||||
|
},
|
||||||
|
"Resources IP-literal: [uri://[2001:db8::7], uri://[::ffff:129.144.52.38]]": {
|
||||||
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://[2001:db8::7]\n- uri://[::ffff:129.144.52.38]"
|
||||||
|
},
|
||||||
|
"Resources IP-literal: [uri://10.10.10.10.example.com/en/process, uri://[2606:2800:220:1:248:1893:25c8:1946]/test]": {
|
||||||
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://10.10.10.10.example.com/en/process\n- uri://[2606:2800:220:1:248:1893:25c8:1946]/test"
|
||||||
|
},
|
||||||
|
"Resources IP-literal: [uri://[2001:db8::1]:80, uri://[2001:db8::1:ffff]:5128]": {
|
||||||
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: uri:\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- uri://[2001:db8::1]:80\n- uri://[2001:db8::1:ffff]:5128"
|
||||||
|
},
|
||||||
|
"couple of optional fields": {
|
||||||
|
"msg": "service.org 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\nResources:\n- ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu\n- https://example.com/my-web2-claim.json"
|
||||||
|
},
|
||||||
|
"no optional field": {
|
||||||
|
"msg": "service.org 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"
|
||||||
|
},
|
||||||
|
"timestamp without microseconds": {
|
||||||
|
"msg": "service.org 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:24Z"
|
||||||
|
},
|
||||||
|
"timezone not utc": {
|
||||||
|
"msg": "service.org 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-02:00"
|
||||||
|
},
|
||||||
|
"domain is RFC 3986 authority with IP": {
|
||||||
|
"msg": "127.0.0.1 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": {
|
||||||
|
"transport": "https",
|
||||||
|
"source": "127.0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domain is RFC 3986 authority with userinfo": {
|
||||||
|
"msg": "test@127.0.0.1 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": {
|
||||||
|
"transport": "https",
|
||||||
|
"source": "test@127.0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domain is RFC 3986 authority with port": {
|
||||||
|
"msg": "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": {
|
||||||
|
"transport": "https",
|
||||||
|
"source": "127.0.0.1:8080"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domain is localhost authority with port": {
|
||||||
|
"msg": "localhost: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": {
|
||||||
|
"transport": "https",
|
||||||
|
"source": "localhost:8080"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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":{
|
||||||
|
"transport": "https",
|
||||||
|
"source": "test@127.0.0.1:8080"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"no statement": {
|
||||||
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
|
},
|
||||||
|
"domain ipv6": {
|
||||||
|
"msg": "[::cafe] wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
||||||
|
"request_context": {
|
||||||
|
"transport": "https",
|
||||||
|
"source": "[::cafe]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uri ipv6": {
|
||||||
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://[::cafe]\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
|
},
|
||||||
|
"uri ipv4": {
|
||||||
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://127.0.0.1\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
|
},
|
||||||
|
"uri with port": {
|
||||||
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://127.0.0.1:4361\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
|
},
|
||||||
|
"uri ipv4 query params and fragment": {
|
||||||
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://127.0.0.1/?query=one#begin\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
|
},
|
||||||
|
"chainId not 1": {
|
||||||
|
"msg": "service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 4\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
|
},
|
||||||
|
"domain contains optional scheme": {
|
||||||
|
"msg": "https://service.org wants you to sign in with your Ethereum account:\n{{Account}}\n\nI accept the ExampleOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24Z"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue