Changed the property type required by signData from bytes to interface{}

This commit is contained in:
Paul Berg 2018-11-02 10:19:25 +01:00 committed by Martin Holst Swende
parent 9f9033710b
commit 4a1145aada
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
6 changed files with 420 additions and 200 deletions

View file

@ -254,3 +254,151 @@ t=2018-10-25T20:35:43+0200 lvl=info msg=SignData api=signer type=request metad
t=2018-10-25T20:41:50+0200 lvl=info msg=Configured api=signer audit log=audit.log t=2018-10-25T20:41:50+0200 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-25T20:42:06+0200 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:63054\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=608af3436e40964b9f2c7214953a3f03685f62b8deadbeef content-type=text/validator t=2018-10-25T20:42:06+0200 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:63054\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=608af3436e40964b9f2c7214953a3f03685f62b8deadbeef content-type=text/validator
t=2018-10-26T10:33:40+0200 lvl=info msg=Configured api=signer audit log=audit.log t=2018-10-26T10:33:40+0200 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T11:29:41+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T11:30:16+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T11:30:28+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:64014\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=608af3436e40964b9f2c7214953a3f03685f62b8deadbeef content-type=text/validator
t=2018-10-31T11:39:42+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T11:48:29+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T11:48:37+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:64737\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=608af3436e40964b9f2c7214953a3f03685f62b8deadbeef content-type=text/validator
t=2018-10-31T11:50:49+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T11:50:59+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:64820\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=608af3436e40964b9f2c7214953a3f03685f62b8deadbeef content-type=text/validator
t=2018-10-31T11:51:44+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T11:52:05+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:64849\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=608af3436e40964b9f2c7214953a3f03685f62b8deadbeef content-type=text/validator
t=2018-10-31T14:46:14+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T14:47:22+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:51211\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[message:0xcafebabe validator:0x0DDFb8Fe404fE28179580879A918c4e798866c08]" content-type=text/validator
t=2018-10-31T14:47:22+0100 lvl=info msg=SignData api=signer type=response data= error=nil
t=2018-10-31T15:45:57+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T15:46:31+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:51638\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[validator:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T15:46:31+0100 lvl=info msg=SignData api=signer type=response data= error="validator data not constructed correctly"
t=2018-10-31T15:46:57+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T15:47:00+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:51654\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[validator:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T15:47:00+0100 lvl=info msg=SignData api=signer type=response data= error="validator data not constructed correctly"
t=2018-10-31T16:24:12+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:24:30+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:29:29+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:51956\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[validator:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T16:35:14+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:35:19+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52038\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T16:35:19+0100 lvl=info msg=SignData api=signer type=response data= error="message is undefined"
t=2018-10-31T16:35:41+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:36:12+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52052\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T16:37:15+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:37:18+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52065\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[message:0xcafebabe address:0x0DDFb8Fe404fE28179580879A918c4e798866c08]" content-type=text/validator
t=2018-10-31T16:38:10+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:38:13+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52080\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0x1c]" content-type=text/validator
t=2018-10-31T16:38:39+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:38:42+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52097\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0x1c]" content-type=text/validator
t=2018-10-31T16:38:57+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:39:02+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52109\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[message:0xcafebabe address:0x0DDFb8Fe404fE28179580879A918c4e798866c08]" content-type=text/validator
t=2018-10-31T16:47:12+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:47:22+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52263\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T16:50:27+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:50:52+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:51:19+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:52:19+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T16:53:07+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52394\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T17:01:45+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T17:01:56+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T17:02:14+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52600\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T17:03:31+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T17:03:35+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52624\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T17:04:19+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T17:04:24+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52643\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[message:0xcafebabe address:0x0DDFb8Fe404fE28179580879A918c4e798866c08]" content-type=text/validator
t=2018-10-31T17:05:01+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T17:05:02+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52657\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T17:11:09+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T17:11:13+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52695\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T17:12:22+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T17:12:38+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T17:12:38+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:52724\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T19:15:08+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:16:59+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:49906\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T19:28:45+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:29:02+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:50208\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T19:29:21+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:29:32+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:50219\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T19:35:37+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:35:38+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:50288\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T19:36:22+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:36:29+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:50310\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[message:0xcafebabe address:0x0DDFb8Fe404fE28179580879A918c4e798866c08]" content-type=text/validator
t=2018-10-31T19:36:56+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:36:59+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:50328\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[message:0xcafebabe address:0x0DDFb8Fe404fE28179580879A918c4e798866c08]" content-type=text/validator
t=2018-10-31T19:40:24+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:40:26+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:50369\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[message:0xcafebabe address:0x0DDFb8Fe404fE28179580879A918c4e798866c08]" content-type=text/validator
t=2018-10-31T19:41:50+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:43:03+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:50469\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T19:43:58+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:44:14+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:50485\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xdeadbeef]" content-type=text/validator
t=2018-10-31T19:44:30+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:44:32+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:50501\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T19:47:37+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:47:56+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:50552\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-10-31T19:48:10+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-10-31T19:48:39+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:50567\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0x0DDFb8Fe404fE28179580879A918c4e798866c08 message:0xcafebabe]" content-type=text/validator
t=2018-11-01T19:16:25+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T19:16:31+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:57757\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[message:0xcafebabe address:0x0DDFb8Fe404fE28179580879A918c4e798866c08]" content-type=text/validator
t=2018-11-01T21:11:47+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:13:52+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59254\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090b1504cc9341bc18ce5d34d750545bb515fdc message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:14:40+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:14:48+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59317\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090b1504cc9341bc18ce5d34d750545bb515fdc message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:16:00+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:16:02+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59339\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090b1504cc9341bc18ce5d34d750545bb515fdc message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:18:49+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:18:50+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59375\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090b1504cc9341bc18ce5d34d750545bb515fdc message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:26:42+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:26:55+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59485\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090b1504cc9341bc18ce5d34d750545bb515fdc message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:34:20+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:34:24+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59590\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:37:05+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:37:48+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59652\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[message:0xcafebabe address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC]" content-type=text/validator
t=2018-11-01T21:43:00+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:43:02+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59721\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:44:59+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:45:01+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59759\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:45:19+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:45:21+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59771\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:46:31+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:46:33+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59786\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:48:12+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:48:13+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59830\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=0xcafebabe content-type=text/plain
t=2018-11-01T21:48:47+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:49:03+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:49:03+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59851\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=0xcafebabe content-type=text/plain
t=2018-11-01T21:50:58+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:51:02+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59872\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=0xcafebabe content-type=text/plain
t=2018-11-01T21:52:07+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:52:09+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59892\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=0xcafebabe content-type=text/plain
t=2018-11-01T21:52:21+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:52:22+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59904\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:53:12+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:53:14+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59919\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=0xcafebabe content-type=text/plain
t=2018-11-01T21:53:51+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:54:08+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59957\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=0xcafebabe content-type=text/plain
t=2018-11-01T21:54:21+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T21:54:26+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:59971\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T21:59:18+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:00:23+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60071\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=0xcafebabe content-type=text/plain
t=2018-11-01T22:00:57+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:01:04+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60083\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=0xcafebabe content-type=text/plain
t=2018-11-01T22:06:16+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:06:20+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60136\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T22:07:41+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:07:42+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60170\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T22:08:13+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:09:25+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60229\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T22:11:52+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:11:53+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60257\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T22:13:09+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:13:33+0100 lvl=info msg=EcRecover api=signer type=request metadata="{\"remote\":\"127.0.0.1:60277\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" data=cafebabe sig=d7cabcefb177b419f8c4d124cdf3487dfdf2f8e4cceb9bad5dfb8707130c9b7b394e0e7057335ce459145ff6d6b5bd52242c54e11ae5934637358930f2f6d0651b content-type=text/plain
t=2018-11-01T22:13:33+0100 lvl=info msg=EcRecover api=signer type=response address=0x66D76e6A80DC7D46d7EC1b79b15Dfa34c3C6eF21 error=nil
t=2018-11-01T22:13:44+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60277\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data=0xcafebabe content-type=text/plain
t=2018-11-01T22:15:03+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:15:24+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60301\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T22:15:36+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:15:39+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60319\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T22:23:05+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:23:20+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:23:27+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60494\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T22:23:54+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:23:56+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60509\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xd090B1504cC9341BC18cE5d34D750545bb515FdC message:0xcafebabe]" content-type=text/validator
t=2018-11-01T22:36:15+0100 lvl=info msg=Configured api=signer audit log=audit.log
t=2018-11-01T22:38:04+0100 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"127.0.0.1:60761\",\"local\":\"localhost:8550\",\"scheme\":\"HTTP/1.1\",\"User-Agent\":\"PostmanRuntime/7.3.0\",\"Origin\":\"\"}" addr="0x66d76e6a80dc7d46d7ec1b79b15dfa34c3c6ef21 [chksum INVALID]" data="map[address:0xE85E8fceAce32f641595bcAf5e16aba14667991D message:0xcafebabe]" content-type=text/validator

View file

@ -668,8 +668,8 @@ func testExternalUI(api *core.SignerAPI) {
checkErr("SignTransaction", err) checkErr("SignTransaction", err)
_, err = api.SignData(ctx, "text/plain", common.MixedcaseAddress{}, common.Hex2Bytes("01020304")) _, err = api.SignData(ctx, "text/plain", common.MixedcaseAddress{}, common.Hex2Bytes("01020304"))
checkErr("SignData", err) checkErr("SignData", err)
_, err = api.SignTypedData(ctx, common.MixedcaseAddress{}, core.TypedData{}) //_, err = api.SignTypedData(ctx, common.MixedcaseAddress{}, core.TypedData{})
checkErr("SignTypedData", err) //checkErr("SignTypedData", err)
_, err = api.List(ctx) _, err = api.List(ctx)
checkErr("List", err) checkErr("List", err)
_, err = api.New(ctx) _, err = api.New(ctx)

View file

@ -47,9 +47,9 @@ type ExternalAPI interface {
// SignTransaction request to sign the specified transaction // SignTransaction request to sign the specified transaction
SignTransaction(ctx context.Context, args SendTxArgs, methodSelector *string) (*ethapi.SignTransactionResult, error) SignTransaction(ctx context.Context, args SendTxArgs, methodSelector *string) (*ethapi.SignTransactionResult, error)
// SignData - request to sign the given data (plus prefix) // SignData - request to sign the given data (plus prefix)
SignData(ctx context.Context, contentType string, addr common.MixedcaseAddress, data hexutil.Bytes) (hexutil.Bytes, error) SignData(ctx context.Context, contentType string, addr common.MixedcaseAddress, data interface{}) (hexutil.Bytes, error)
// SignStructuredData - request to sign the given structured data (plus prefix) // SignStructuredData - request to sign the given structured data (plus prefix)
SignTypedData(ctx context.Context, addr common.MixedcaseAddress, data TypedData) (hexutil.Bytes, error) //SignTypedData(ctx context.Context, addr common.MixedcaseAddress, data TypedData) (hexutil.Bytes, error)
// EcRecover - recover public key from given message and signature // EcRecover - recover public key from given message and signature
EcRecover(ctx context.Context, contentType string, data hexutil.Bytes, sig hexutil.Bytes) (common.Address, error) EcRecover(ctx context.Context, contentType string, data hexutil.Bytes, sig hexutil.Bytes) (common.Address, error)
// Export - request to export an account // Export - request to export an account
@ -108,30 +108,6 @@ type Metadata struct {
Origin string `json:"Origin"` Origin string `json:"Origin"`
} }
type SigFormat struct {
Mime string
ByteVersion byte
}
var (
TextValidator = SigFormat{
"text/validator",
0x00,
}
DataTyped = SigFormat{
"data/typed",
0x01,
}
ApplicationClique = SigFormat{
"application/clique",
0x02,
}
TextPlain = SigFormat{
"text/plain",
0x45,
}
)
// MetadataFromContext extracts Metadata from a given context.Context // MetadataFromContext extracts Metadata from a given context.Context
func MetadataFromContext(ctx context.Context) Metadata { func MetadataFromContext(ctx context.Context) Metadata {
m := Metadata{"NA", "NA", "NA", "", ""} // batman m := Metadata{"NA", "NA", "NA", "", ""} // batman
@ -199,11 +175,7 @@ type (
SignDataRequest struct { SignDataRequest struct {
ContentType string `json:"content_type"` ContentType string `json:"content_type"`
Address common.MixedcaseAddress `json:"address"` Address common.MixedcaseAddress `json:"address"`
<<<<<<< HEAD Rawdata interface{} `json:"raw_data"`
Rawdata interface{} `json:"raw_data"`
=======
Rawdata hexutil.Bytes `json:"raw_data"`
>>>>>>> 834cf03b0... Named functions and defined a basic EIP191 content type list
Message string `json:"message"` Message string `json:"message"`
Hash hexutil.Bytes `json:"hash"` Hash hexutil.Bytes `json:"hash"`
Meta Metadata `json:"meta"` Meta Metadata `json:"meta"`

View file

@ -70,13 +70,13 @@ func (l *AuditLogger) SignData(ctx context.Context, contentType string, addr com
return b, e return b, e
} }
func (l *AuditLogger) SignTypedData(ctx context.Context, addr common.MixedcaseAddress, data TypedData) (hexutil.Bytes, error) { //func (l *AuditLogger) SignTypedData(ctx context.Context, addr common.MixedcaseAddress, data TypedData) (hexutil.Bytes, error) {
l.log.Info("SignTypedData", "type", "request", "metadata", MetadataFromContext(ctx).String(), // l.log.Info("SignTypedData", "type", "request", "metadata", MetadataFromContext(ctx).String(),
"addr", addr.String(), "data", data) // "addr", addr.String(), "data", data)
b, e := l.api.SignTypedData(ctx, addr, data) // b, e := l.api.SignTypedData(ctx, addr, data)
l.log.Info("SignTypedData", "type", "response", "data", common.Bytes2Hex(b), "error", e) // l.log.Info("SignTypedData", "type", "response", "data", common.Bytes2Hex(b), "error", e)
return b, e // return b, e
} //}
func (l *AuditLogger) EcRecover(ctx context.Context, contentType string, data hexutil.Bytes, sig hexutil.Bytes) (common.Address, error) { func (l *AuditLogger) EcRecover(ctx context.Context, contentType string, data hexutil.Bytes, sig hexutil.Bytes) (common.Address, error) {
l.log.Info("EcRecover", "type", "request", "metadata", MetadataFromContext(ctx).String(), l.log.Info("EcRecover", "type", "request", "metadata", MetadataFromContext(ctx).String(),

View file

@ -19,7 +19,6 @@ package core
import ( import (
"bytes" "bytes"
"context" "context"
"encoding/json"
"errors" "errors"
"fmt" "fmt"
"math/big" "math/big"
@ -39,6 +38,30 @@ import (
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
) )
type SigFormat struct {
Mime string
ByteVersion byte
}
var (
TextValidator = SigFormat{
"text/validator",
0x00,
}
DataTyped = SigFormat{
"data/typed",
0x01,
}
ApplicationClique = SigFormat{
"application/clique",
0x02,
}
TextPlain = SigFormat{
"text/plain",
0x45,
}
)
type ValidatorData struct { type ValidatorData struct {
Address common.Address Address common.Address
Message hexutil.Bytes Message hexutil.Bytes
@ -67,7 +90,7 @@ type EIP712Domain struct {
Version string `json:"version"` Version string `json:"version"`
ChainId *big.Int `json:"chainId"` ChainId *big.Int `json:"chainId"`
VerifyingContract string `json:"verifyingContract"` VerifyingContract string `json:"verifyingContract"`
Salt hexutil.Bytes `json:"salt"` Salt string `json:"salt"`
} }
const ( const (
@ -115,8 +138,8 @@ func (api *SignerAPI) Sign(ctx context.Context, addr common.MixedcaseAddress, re
// depending on the content-type specified. // depending on the content-type specified.
// //
// Different types of validation occur. // Different types of validation occur.
func (api *SignerAPI) SignData(ctx context.Context, contentType string, addr common.MixedcaseAddress, data hexutil.Bytes) (hexutil.Bytes, error) { func (api *SignerAPI) SignData(ctx context.Context, contentType string, addr common.MixedcaseAddress, data interface{}) (hexutil.Bytes, error) {
var req, err = api.determineSignatureFormat(contentType, addr, data) var req, err= api.determineSignatureFormat(contentType, addr, data)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -135,7 +158,7 @@ func (api *SignerAPI) SignData(ctx context.Context, contentType string, addr com
// resides in the 'params' returned as the second returnvalue from mime.ParseMediaType // resides in the 'params' returned as the second returnvalue from mime.ParseMediaType
// charset, ok := params["charset"] // charset, ok := params["charset"]
// As it is now, we accept any charset and just treat it as 'raw'. // As it is now, we accept any charset and just treat it as 'raw'.
func (api *SignerAPI) determineSignatureFormat(contentType string, addr common.MixedcaseAddress, data hexutil.Bytes) (*SignDataRequest, error) { func (api *SignerAPI) determineSignatureFormat(contentType string, addr common.MixedcaseAddress, data interface{}) (*SignDataRequest, error) {
var req *SignDataRequest var req *SignDataRequest
mediaType, _, err := mime.ParseMediaType(contentType) mediaType, _, err := mime.ParseMediaType(contentType)
if err != nil { if err != nil {
@ -145,26 +168,32 @@ func (api *SignerAPI) determineSignatureFormat(contentType string, addr common.M
switch mediaType { switch mediaType {
case TextValidator.Mime: case TextValidator.Mime:
// Data with an intended validator // Data with an intended validator
if len(data) < common.AddressLength { validatorData, err := UnmarshalValidatorData(data)
return nil, errors.New("validator address and data undefined") if err != nil {
return nil, err
} }
if len(data) == common.AddressLength { sighash, msg := SignTextValidator(validatorData)
return nil, errors.New("no data to sign") fmt.Printf("sighash:%s", sighash)
} req = &SignDataRequest{Rawdata: validatorData, Message: msg, Hash: sighash, ContentType: mediaType}
sighash, msg := SignTextValidator(data)
fmt.Printf("%s", sighash)
req = &SignDataRequest{Rawdata: data, Message: msg, Hash: sighash, ContentType: mediaType}
break break
case TextPlain.Mime: case DataTyped.Mime:
// Sign calculates an Ethereum ECDSA signature for: // Signs EIP-712 conformant typed data
// hash = keccak256("\x19${byteVersion}Ethereum Signed Message:\n${message length}${message}") // hash = keccak256("\x19${byteVersion}${domainSeparator}${hashStruct(message)}")
sighash, msg := SignTextPlain(data) typedData, err := UnmarshalTypedData(data)
req = &SignDataRequest{Rawdata: data, Message: msg, Hash: sighash, ContentType: mediaType} if err != nil {
return nil, err
}
sighash, msg := SignDataTyped(typedData)
req = &SignDataRequest{Rawdata: typedData, Message: msg, Hash: sighash, ContentType: mediaType}
break break
case ApplicationClique.Mime: case ApplicationClique.Mime:
// Clique is the Ethereum PoA standard // Clique is the Ethereum PoA standard
cliqueData, err := hexutil.Decode(data.(string))
if err != nil {
return nil, err
}
header := &types.Header{} header := &types.Header{}
if err := rlp.DecodeBytes(data, header); err != nil { if err := rlp.DecodeBytes(cliqueData, header); err != nil {
return nil, err return nil, err
} }
sighash, err := SignCliqueHeader(header) sighash, err := SignCliqueHeader(header)
@ -172,7 +201,17 @@ func (api *SignerAPI) determineSignatureFormat(contentType string, addr common.M
return nil, err return nil, err
} }
msg := fmt.Sprintf("clique block %d [0x%x]", header.Number, header.Hash()) msg := fmt.Sprintf("clique block %d [0x%x]", header.Number, header.Hash())
req = &SignDataRequest{Rawdata: data, Message: msg, Hash: sighash, ContentType: mediaType} req = &SignDataRequest{Rawdata: cliqueData, Message: msg, Hash: sighash, ContentType: mediaType}
break
case TextPlain.Mime:
// Calculates an Ethereum ECDSA signature for:
// hash = keccak256("\x19${byteVersion}Ethereum Signed Message:\n${message length}${message}")
plainData, err := hexutil.Decode(data.(string))
if err != nil {
return nil, err
}
sighash, msg := SignTextPlain(plainData)
req = &SignDataRequest{Rawdata: plainData, Message: msg, Hash: sighash, ContentType: mediaType}
break break
default: default:
return nil, fmt.Errorf("content type '%s' not implemented for signing", contentType) return nil, fmt.Errorf("content type '%s' not implemented for signing", contentType)
@ -181,18 +220,17 @@ func (api *SignerAPI) determineSignatureFormat(contentType string, addr common.M
} }
// signTextWithValidator signs the given message which can be further recovered // SignTextWithValidator signs the given message which can be further recovered
// with the given validator. // with the given validator.
// //
// hash = keccak256("\x19\x00"${address}${data}). // hash = keccak256("\x19\x00"${address}${data}).
func SignTextValidator(data hexutil.Bytes) (hexutil.Bytes, string) { func SignTextValidator(validatorData ValidatorData) (hexutil.Bytes, string) {
address := common.BytesToAddress(data[:common.AddressLength]) msg := fmt.Sprintf("\x19\x00%s%s", string(validatorData.Address.Bytes()), string(validatorData.Message))
message := data[common.AddressLength:] fmt.Printf("SignTextValidator:%s\n", msg)
hash := fmt.Sprintf("\x19\x00%s%s", address, string(message)) return crypto.Keccak256([]byte(msg)), msg
return crypto.Keccak256(hexutil.Bytes(hash)), hash
} }
// signCliqueHeader returns the hash which is used as input for the proof-of-authority // SignCliqueHeader returns the hash which is used as input for the proof-of-authority
// signing. It is the hash of the entire header apart from the 65 byte signature // signing. It is the hash of the entire header apart from the 65 byte signature
// contained at the end of the extra data. // contained at the end of the extra data.
// //
@ -226,7 +264,7 @@ func SignCliqueHeader(header *types.Header) (hexutil.Bytes, error) {
return hash.Bytes(), nil return hash.Bytes(), nil
} }
// signTextPlain is a helper function that calculates a hash for the given message that can be // SignTextPlain is a helper function that calculates a hash for the given message that can be
// safely used to calculate a signature from. This gives context to the signed message and prevents // safely used to calculate a signature from. This gives context to the signed message and prevents
// signing of transactions. // signing of transactions.
// //
@ -234,39 +272,48 @@ func SignCliqueHeader(header *types.Header) (hexutil.Bytes, error) {
func SignTextPlain(data hexutil.Bytes) (hexutil.Bytes, string) { func SignTextPlain(data hexutil.Bytes) (hexutil.Bytes, string) {
// The letter `E` is \x45 in hex, retrofitting // The letter `E` is \x45 in hex, retrofitting
// https://github.com/ethereum/go-ethereum/pull/2940/commits // https://github.com/ethereum/go-ethereum/pull/2940/commits
hash := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), string(data)) msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), data)
return crypto.Keccak256(hexutil.Bytes(hash)), hash return crypto.Keccak256([]byte(msg)), msg
}
// SignDataTyped signs EIP-712 conformant typed data
// hash = keccak256("\x19${byteVersion}${domainSeparator}${hashStruct(message)}")
func SignDataTyped(typedData TypedData) (hexutil.Bytes, string) {
domainSeparator := typedData.HashStruct("EIP712Domain", typedData.Domain.Map())
typedDataHash := typedData.HashStruct(typedData.PrimaryType, typedData.Message)
msg := fmt.Sprintf("\x19\x01%s%s", common.Bytes2Hex(domainSeparator), common.Bytes2Hex(typedDataHash))
return crypto.Keccak256(common.Hex2Bytes(msg)), msg
} }
// SignTypedData signs EIP-712 conformant typed data // SignTypedData signs EIP-712 conformant typed data
// hash = keccak256("\x19${byteVersion}${domainSeparator}${hashStruct(message)}") // hash = keccak256("\x19${byteVersion}${domainSeparator}${hashStruct(message)}")
func (api *SignerAPI) SignTypedData(ctx context.Context, addr common.MixedcaseAddress, typedData TypedData) (hexutil.Bytes, error) { //func (api *SignerAPI) SignTypedData(ctx context.Context, addr common.MixedcaseAddress, typedData TypedData) (hexutil.Bytes, error) {
domainSeparator := typedData.HashStruct("EIP712Domain", typedData.Domain.Map()) // domainSeparator := typedData.HashStruct("EIP712Domain", typedData.Domain.Map())
typedDataHash := typedData.HashStruct(typedData.PrimaryType, typedData.Message) // typedDataHash := typedData.HashStruct(typedData.PrimaryType, typedData.Message)
typedDataJson, err := json.Marshal(typedData.Map()) // typedDataJson, err := json.Marshal(typedData.Map())
if err != nil { // if err != nil {
return nil, err // return nil, err
} // }
buffer := bytes.Buffer{} // buffer := bytes.Buffer{}
buffer.WriteString("\x19") // buffer.WriteString("\x19")
buffer.WriteString("\x01") // buffer.WriteString("\x01")
buffer.WriteString(common.Bytes2Hex(domainSeparator)) // buffer.WriteString(common.Bytes2Hex(domainSeparator))
buffer.WriteString(common.Bytes2Hex(typedDataHash)) // buffer.WriteString(common.Bytes2Hex(typedDataHash))
req := &SignDataRequest{ // req := &SignDataRequest{
Rawdata: typedDataJson, // Rawdata: typedDataJson,
Message: buffer.String(), // Message: buffer.String(),
Hash: crypto.Keccak256(buffer.Bytes()), // Hash: crypto.Keccak256(buffer.Bytes()),
ContentType: DataTyped.Mime, // ContentType: DataTyped.Mime,
} // }
signature, err := api.Sign(ctx, addr, req) // signature, err := api.Sign(ctx, addr, req)
if err != nil { // if err != nil {
api.UI.ShowError(err.Error()) // api.UI.ShowError(err.Error())
return nil, err // return nil, err
} // }
return signature, nil // return signature, nil
} //}
// hashStruct generates the following encoding for the given domain and message: // HashStruct generates the following encoding for the given domain and message:
// `encode(domainSeparator : 𝔹²⁵⁶, message : 𝕊) = "\x19\x01" ‖ domainSeparator ‖ hashStruct(message)` // `encode(domainSeparator : 𝔹²⁵⁶, message : 𝕊) = "\x19\x01" ‖ domainSeparator ‖ hashStruct(message)`
func (typedData *TypedData) HashStruct(primaryType string, data EIP712Data) hexutil.Bytes { func (typedData *TypedData) HashStruct(primaryType string, data EIP712Data) hexutil.Bytes {
return crypto.Keccak256(typedData.EncodeData(primaryType, data)) return crypto.Keccak256(typedData.EncodeData(primaryType, data))
@ -336,28 +383,7 @@ func (typedData *TypedData) TypeHash(primaryType string) hexutil.Bytes {
return crypto.Keccak256(typedData.EncodeType(primaryType)) return crypto.Keccak256(typedData.EncodeType(primaryType))
} }
func bytesValueOf(_interface interface{}) hexutil.Bytes { // EncodeData generates the following encoding:
bytesValue, ok := _interface.(hexutil.Bytes)
if ok {
return bytesValue
}
switch reflect.TypeOf(_interface) {
case reflect.TypeOf(hexutil.Bytes{}):
return _interface.(hexutil.Bytes)
case reflect.TypeOf([]uint8{}):
return _interface.([]uint8)
case reflect.TypeOf(string("")):
return hexutil.Bytes(_interface.(string))
default:
break
}
panic(fmt.Errorf("unrecognized interface type %T", _interface))
return hexutil.Bytes{}
}
// encodeData generates the following encoding:
// `enc(value₁) ‖ enc(value₂) ‖ … ‖ enc(valueₙ)` // `enc(value₁) ‖ enc(value₂) ‖ … ‖ enc(valueₙ)`
// //
// each encoded member is 32-byte long // each encoded member is 32-byte long
@ -458,93 +484,159 @@ func (typedData *TypedData) EncodeData(primaryType string, data map[string]inter
return buffer.Bytes() // https://github.com/ethereumjs/ethereumjs-abi/blob/master/lib/index.js#L336 return buffer.Bytes() // https://github.com/ethereumjs/ethereumjs-abi/blob/master/lib/index.js#L336
} }
// Determines the content type and then recovers the address associated with the given sig func bytesValueOf(_interface interface{}) hexutil.Bytes {
bytesValue, ok := _interface.(hexutil.Bytes)
if ok {
return bytesValue
}
switch reflect.TypeOf(_interface) {
case reflect.TypeOf(hexutil.Bytes{}):
return _interface.(hexutil.Bytes)
case reflect.TypeOf([]uint8{}):
return _interface.([]uint8)
case reflect.TypeOf(string("")):
return common.Hex2Bytes(_interface.(string))
default:
break
}
panic(fmt.Errorf("unrecognized interface type %T", _interface))
return hexutil.Bytes{}
}
// EcRecover recovers the address associated with the given sig.
// Only compatible with `text/plain`
func (api *SignerAPI) EcRecover(ctx context.Context, contentType string, data hexutil.Bytes, sig hexutil.Bytes) (common.Address, error) { func (api *SignerAPI) EcRecover(ctx context.Context, contentType string, data hexutil.Bytes, sig hexutil.Bytes) (common.Address, error) {
mediaType, _, err := mime.ParseMediaType(contentType) // Returns the address for the Account that was used to create the signature.
//
// Note, this function is compatible with eth_sign and personal_sign. As such it recovers
// the address of:
// hash = keccak256("\x19${byteVersion}Ethereum Signed Message:\n${message length}${message}")
// addr = ecrecover(hash, signature)
//
// Note, the signature must conform to the secp256k1 curve R, S and V values, where
// the V value must be be 27 or 28 for legacy reasons.
//
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover
if len(sig) != 65 {
return common.Address{}, fmt.Errorf("signature must be 65 bytes long")
}
if sig[64] != 27 && sig[64] != 28 {
return common.Address{}, fmt.Errorf("invalid Ethereum signature (V is not 27 or 28)")
}
sig[64] -= 27 // Transform yellow paper V from 27/28 to 0/1
hash, _ := SignTextPlain(data)
rpk, err := crypto.SigToPub(hash, sig)
if err != nil { if err != nil {
return common.Address{}, err return common.Address{}, err
} }
switch mediaType { return crypto.PubkeyToAddress(*rpk), nil
case TextPlain.Mime:
// Returns the address for the Account that was used to create the signature.
//
// Note, this function is compatible with eth_sign and personal_sign. As such it recovers
// the address of:
// hash = keccak256("\x19${byteVersion}Ethereum Signed Message:\n${message length}${message}")
// addr = ecrecover(hash, signature)
//
// Note, the signature must conform to the secp256k1 curve R, S and V values, where
// the V value must be be 27 or 28 for legacy reasons.
//
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover
if len(sig) != 65 {
return common.Address{}, fmt.Errorf("signature must be 65 bytes long")
}
if sig[64] != 27 && sig[64] != 28 {
return common.Address{}, fmt.Errorf("invalid Ethereum signature (V is not 27 or 28)")
}
sig[64] -= 27 // Transform yellow paper V from 27/28 to 0/1
hash, _ := SignTextPlain(data)
rpk, err := crypto.SigToPub(hash, sig)
if err != nil {
return common.Address{}, err
}
return crypto.PubkeyToAddress(*rpk), nil
default:
return common.Address{}, fmt.Errorf("content type '%s' not implemented for ecRecover", contentType)
}
} }
// UnmarshalJSON validates the input data // UnmarshalValidatorData converts the bytes input to typed data
func (typedData *TypedData) UnmarshalJSON(data hexutil.Bytes) error { func UnmarshalValidatorData(data interface{}) (ValidatorData, error) {
type input struct { raw := data.(map[string]interface{})
Types EIP712Types `json:"types"`
PrimaryType string `json:"primaryType"` addr, ok := raw["address"].(string)
Domain EIP712Domain `json:"domain"` addrBytes, err := hexutil.Decode(addr)
Message EIP712Data `json:"message"` if err != nil {
return ValidatorData{}, err
}
if !ok || len(addrBytes) == 0 {
return ValidatorData{}, errors.New("validator address is undefined")
} }
var raw input message, ok := raw["message"].(string)
if err := json.Unmarshal(data, &raw); err != nil { messageBytes, err := hexutil.Decode(message)
return err if err != nil {
return ValidatorData{}, err
}
if !ok || len(messageBytes) == 0 {
return ValidatorData{}, errors.New("message is undefined")
} }
if raw.Types == nil { return ValidatorData{
return errors.New("types are undefined") Address: common.BytesToAddress(addrBytes),
} Message: messageBytes,
if err := raw.Types.IsValid(); err != nil { }, nil
return err
}
typedData.Types = raw.Types
if raw.Types["EIP712Domain"] == nil {
return errors.New("domain types are undefined")
}
if err := raw.Domain.IsValid(); err != nil {
return err
}
typedData.Domain = raw.Domain
if len(raw.PrimaryType) == 0 {
return errors.New("primary type is undefined")
}
typedData.PrimaryType = raw.PrimaryType
if raw.Message == nil {
return errors.New("message is undefined")
}
typedData.Message = raw.Message
return nil
} }
// UnmarshalTypedData converts the bytes input to typed data
func UnmarshalTypedData(data interface{}) (TypedData, error) {
raw := data.(map[string]interface{})
var _types, ok = raw["types"].(EIP712Types)
if !ok || _types == nil {
return TypedData{}, errors.New("types are undefined")
}
if err := _types.IsValid(); err != nil {
return TypedData{}, err
}
if _types["EIP712Domain"] == nil {
return TypedData{}, errors.New("domain types are undefined")
}
domain, err := UnmarshalDomain(data)
if err != nil {
return TypedData{}, err
}
primaryType, ok := raw["primaryType"].(string)
if !ok || len(primaryType) == 0 {
return TypedData{}, errors.New("primary type is undefined")
}
message, ok := raw["message"].(EIP712Data)
if !ok || message == nil {
return TypedData{}, errors.New("message is undefined")
}
return TypedData{
Types: _types,
PrimaryType: primaryType,
Domain: domain,
Message: message,
}, nil
}
// UnmarshalDomain converts the bytes input to a domain
func UnmarshalDomain(data interface{}) (EIP712Domain, error) {
raw := data.(map[string]interface{})["domain"].(map[string]interface{})
chainId := raw["chainId"].(*big.Int)
if chainId == big.NewInt(0) {
return EIP712Domain{}, errors.New("chainId must be specified according to EIP-155")
}
name, nameOk := raw["name"].(string)
version, versionOk := raw["version"].(string)
verifyingContract, verifyingContractOk := raw["verifyingContract"].(string)
salt, saltOk := raw["salt"].(string)
if (!nameOk || len(name) == 0) &&
(!versionOk || len(version) == 0) &&
(!verifyingContractOk || len(verifyingContract) == 0) &&
(!saltOk || len(salt) == 0) {
return EIP712Domain{}, errors.New("domain is undefined")
}
return EIP712Domain{
Name: name,
Version: version,
ChainId: chainId,
VerifyingContract: verifyingContract,
Salt: salt,
}, nil
}
// Map is a helper function to generate a map version of the typed data // Map is a helper function to generate a map version of the typed data
func (typedData *TypedData) Map() map[string]interface{} { func (typedData *TypedData) Map() map[string]interface{} {
dataMap := map[string]interface{}{ dataMap := map[string]interface{}{
"Types": typedData.Types, "types": typedData.Types,
"Domain": typedData.Domain.Map(), "domain": typedData.Domain.Map(),
"PrimaryType": typedData.PrimaryType, "primaryType": typedData.PrimaryType,
"Message": typedData.Message, "message": typedData.Message,
} }
return dataMap return dataMap

View file

@ -21,6 +21,7 @@ import (
"fmt" "fmt"
"github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"math/big" "math/big"
"testing" "testing"
) )
@ -77,10 +78,10 @@ var domainStandard = EIP712Domain{
"1", "1",
big.NewInt(1), big.NewInt(1),
"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
nil, "",
} }
var dataStandard = map[string]interface{}{ var messageStandard = map[string]interface{}{
"from": map[string]interface{}{ "from": map[string]interface{}{
"name": "Cow", "name": "Cow",
"wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826", "wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
@ -93,12 +94,19 @@ var dataStandard = map[string]interface{}{
} }
var typedData = TypedData{ var typedData = TypedData{
typesStandard, Types: typesStandard,
primaryType, PrimaryType: primaryType,
domainStandard, Domain: domainStandard,
dataStandard, Message: messageStandard,
} }
//var typedDataMap = map[string]interface{}{
// "types": typesStandard,
// "primaryType": primaryType,
// "domain": domainStandard,
// "message": messageStandard,
//}
func TestSignData(t *testing.T) { func TestSignData(t *testing.T) {
api, control := setup(t) api, control := setup(t)
//Create two accounts //Create two accounts
@ -113,7 +121,7 @@ func TestSignData(t *testing.T) {
control <- "Y" control <- "Y"
control <- "wrongpassword" control <- "wrongpassword"
signature, err := api.SignData(context.Background(), TextPlain.Mime, a, []byte("EHLO world")) signature, err := api.SignData(context.Background(), TextPlain.Mime, a, hexutil.Encode([]byte("EHLO world")))
if signature != nil { if signature != nil {
t.Errorf("Expected nil-data, got %x", signature) t.Errorf("Expected nil-data, got %x", signature)
} }
@ -121,7 +129,7 @@ func TestSignData(t *testing.T) {
t.Errorf("Expected ErrLocked! %v", err) t.Errorf("Expected ErrLocked! %v", err)
} }
control <- "No way" control <- "No way"
signature, err = api.SignData(context.Background(), TextPlain.Mime, a, []byte("EHLO world")) signature, err = api.SignData(context.Background(), TextPlain.Mime, a, hexutil.Encode([]byte("EHLO world")))
if signature != nil { if signature != nil {
t.Errorf("Expected nil-data, got %x", signature) t.Errorf("Expected nil-data, got %x", signature)
} }
@ -131,7 +139,7 @@ func TestSignData(t *testing.T) {
// text/plain // text/plain
control <- "Y" control <- "Y"
control <- "a_long_password" control <- "a_long_password"
signature, err = api.SignData(context.Background(), TextPlain.Mime, a, []byte("EHLO world")) signature, err = api.SignData(context.Background(), TextPlain.Mime, a, hexutil.Encode([]byte("EHLO world")))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -141,7 +149,7 @@ func TestSignData(t *testing.T) {
// data/typed // data/typed
control <- "Y" control <- "Y"
control <- "a_long_password" control <- "a_long_password"
signature, err = api.SignTypedData(context.Background(), a, typedData) signature, err = api.SignData(context.Background(), DataTyped.Mime, a, typedData.Map())
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }