From 9b013d74d6251b0530e7fb9e8ea6672d49b4e216 Mon Sep 17 00:00:00 2001 From: Paul Berg Date: Fri, 2 Nov 2018 10:19:25 +0100 Subject: [PATCH] Changed the property type required by signData from bytes to interface{} --- cmd/clef/audit.log | 148 ++++++++++++ cmd/clef/main.go | 4 +- signer/core/api.go | 30 +-- signer/core/auditlog.go | 18 +- signer/core/signed_data.go | 392 ++++++++++++++++++++------------ signer/core/signed_data_test.go | 28 ++- 6 files changed, 422 insertions(+), 198 deletions(-) diff --git a/cmd/clef/audit.log b/cmd/clef/audit.log index 85b2cc1f8d..0ce97ab5fe 100644 --- a/cmd/clef/audit.log +++ b/cmd/clef/audit.log @@ -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: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-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 diff --git a/cmd/clef/main.go b/cmd/clef/main.go index 0d56149590..2828837592 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -666,8 +666,8 @@ func testExternalUI(api *core.SignerAPI) { checkErr("SignTransaction", err) _, err = api.SignData(ctx, "text/plain", common.MixedcaseAddress{}, common.Hex2Bytes("01020304")) checkErr("SignData", err) - _, err = api.SignTypedData(ctx, common.MixedcaseAddress{}, core.TypedData{}) - checkErr("SignTypedData", err) + //_, err = api.SignTypedData(ctx, common.MixedcaseAddress{}, core.TypedData{}) + //checkErr("SignTypedData", err) _, err = api.List(ctx) checkErr("List", err) _, err = api.New(ctx) diff --git a/signer/core/api.go b/signer/core/api.go index 136b3682a4..4903937372 100644 --- a/signer/core/api.go +++ b/signer/core/api.go @@ -47,9 +47,9 @@ type ExternalAPI interface { // SignTransaction request to sign the specified transaction SignTransaction(ctx context.Context, args SendTxArgs, methodSelector *string) (*ethapi.SignTransactionResult, error) // 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) - 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(ctx context.Context, contentType string, data hexutil.Bytes, sig hexutil.Bytes) (common.Address, error) // Export - request to export an account @@ -108,30 +108,6 @@ type Metadata struct { 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 func MetadataFromContext(ctx context.Context) Metadata { m := Metadata{"NA", "NA", "NA", "", ""} // batman @@ -199,7 +175,7 @@ type ( SignDataRequest struct { ContentType string `json:"content_type"` Address common.MixedcaseAddress `json:"address"` - Rawdata hexutil.Bytes `json:"raw_data"` + Rawdata interface{} `json:"raw_data"` Message string `json:"message"` Hash hexutil.Bytes `json:"hash"` Meta Metadata `json:"meta"` diff --git a/signer/core/auditlog.go b/signer/core/auditlog.go index c89c50f79e..b9769b16e9 100644 --- a/signer/core/auditlog.go +++ b/signer/core/auditlog.go @@ -62,21 +62,21 @@ func (l *AuditLogger) SignTransaction(ctx context.Context, args SendTxArgs, meth return res, e } -func (l *AuditLogger) SignData(ctx context.Context, contentType string, addr common.MixedcaseAddress, data hexutil.Bytes) (hexutil.Bytes, error) { +func (l *AuditLogger) SignData(ctx context.Context, contentType string, addr common.MixedcaseAddress, data interface{}) (hexutil.Bytes, error) { l.log.Info("SignData", "type", "request", "metadata", MetadataFromContext(ctx).String(), - "addr", addr.String(), "data", common.Bytes2Hex(data), "content-type", contentType) + "addr", addr.String(), "data", data, "content-type", contentType) b, e := l.api.SignData(ctx, contentType, addr, data) l.log.Info("SignData", "type", "response", "data", common.Bytes2Hex(b), "error", e) return b, e } -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(), - "addr", addr.String(), "data", data) - b, e := l.api.SignTypedData(ctx, addr, data) - l.log.Info("SignTypedData", "type", "response", "data", common.Bytes2Hex(b), "error", e) - return b, e -} +//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(), +// "addr", addr.String(), "data", data) +// b, e := l.api.SignTypedData(ctx, addr, data) +// l.log.Info("SignTypedData", "type", "response", "data", common.Bytes2Hex(b), "error", e) +// return b, e +//} 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(), diff --git a/signer/core/signed_data.go b/signer/core/signed_data.go index eb5df4d893..f86845ed2f 100644 --- a/signer/core/signed_data.go +++ b/signer/core/signed_data.go @@ -19,7 +19,6 @@ package core import ( "bytes" "context" - "encoding/json" "errors" "fmt" "math/big" @@ -39,6 +38,30 @@ import ( "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 { Address common.Address Message hexutil.Bytes @@ -67,7 +90,7 @@ type EIP712Domain struct { Version string `json:"version"` ChainId *big.Int `json:"chainId"` VerifyingContract string `json:"verifyingContract"` - Salt hexutil.Bytes `json:"salt"` + Salt string `json:"salt"` } const ( @@ -115,8 +138,8 @@ func (api *SignerAPI) Sign(ctx context.Context, addr common.MixedcaseAddress, re // depending on the content-type specified. // // Different types of validation occur. -func (api *SignerAPI) SignData(ctx context.Context, contentType string, addr common.MixedcaseAddress, data hexutil.Bytes) (hexutil.Bytes, error) { - var req, err = api.determineSignatureFormat(contentType, addr, data) +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) if err != nil { 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 // charset, ok := params["charset"] // 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 mediaType, _, err := mime.ParseMediaType(contentType) if err != nil { @@ -145,26 +168,32 @@ func (api *SignerAPI) determineSignatureFormat(contentType string, addr common.M switch mediaType { case TextValidator.Mime: // Data with an intended validator - if len(data) < common.AddressLength { - return nil, errors.New("validator address and data undefined") + validatorData, err := UnmarshalValidatorData(data) + if err != nil { + return nil, err } - if len(data) == common.AddressLength { - return nil, errors.New("no data to sign") - } - sighash, msg := SignTextValidator(data) - fmt.Printf("%s", sighash) - req = &SignDataRequest{Rawdata: data, Message: msg, Hash: sighash, ContentType: mediaType} + sighash, msg := SignTextValidator(validatorData) + fmt.Printf("sighash:%s", sighash) + req = &SignDataRequest{Rawdata: validatorData, Message: msg, Hash: sighash, ContentType: mediaType} break - case TextPlain.Mime: - // Sign calculates an Ethereum ECDSA signature for: - // hash = keccak256("\x19${byteVersion}Ethereum Signed Message:\n${message length}${message}") - sighash, msg := SignTextPlain(data) - req = &SignDataRequest{Rawdata: data, Message: msg, Hash: sighash, ContentType: mediaType} + case DataTyped.Mime: + // Signs EIP-712 conformant typed data + // hash = keccak256("\x19${byteVersion}${domainSeparator}${hashStruct(message)}") + typedData, err := UnmarshalTypedData(data) + if err != nil { + return nil, err + } + sighash, msg := SignDataTyped(typedData) + req = &SignDataRequest{Rawdata: typedData, Message: msg, Hash: sighash, ContentType: mediaType} break case ApplicationClique.Mime: // Clique is the Ethereum PoA standard + cliqueData, err := hexutil.Decode(data.(string)) + if err != nil { + return nil, err + } header := &types.Header{} - if err := rlp.DecodeBytes(data, header); err != nil { + if err := rlp.DecodeBytes(cliqueData, header); err != nil { return nil, err } sighash, err := SignCliqueHeader(header) @@ -172,7 +201,17 @@ func (api *SignerAPI) determineSignatureFormat(contentType string, addr common.M return nil, err } 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 default: 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. // // hash = keccak256("\x19\x00"${address}${data}). -func SignTextValidator(data hexutil.Bytes) (hexutil.Bytes, string) { - address := common.BytesToAddress(data[:common.AddressLength]) - message := data[common.AddressLength:] - hash := fmt.Sprintf("\x19\x00%s%s", address, string(message)) - return crypto.Keccak256(hexutil.Bytes(hash)), hash +func SignTextValidator(validatorData ValidatorData) (hexutil.Bytes, string) { + msg := fmt.Sprintf("\x19\x00%s%s", string(validatorData.Address.Bytes()), string(validatorData.Message)) + fmt.Printf("SignTextValidator:%s\n", msg) + return crypto.Keccak256([]byte(msg)), msg } -// 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 // contained at the end of the extra data. // @@ -226,7 +264,7 @@ func SignCliqueHeader(header *types.Header) (hexutil.Bytes, error) { 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 // signing of transactions. // @@ -234,39 +272,48 @@ func SignCliqueHeader(header *types.Header) (hexutil.Bytes, error) { func SignTextPlain(data hexutil.Bytes) (hexutil.Bytes, string) { // The letter `E` is \x45 in hex, retrofitting // https://github.com/ethereum/go-ethereum/pull/2940/commits - hash := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), string(data)) - return crypto.Keccak256(hexutil.Bytes(hash)), hash + msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), data) + 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 // hash = keccak256("\x19${byteVersion}${domainSeparator}${hashStruct(message)}") -func (api *SignerAPI) SignTypedData(ctx context.Context, addr common.MixedcaseAddress, typedData TypedData) (hexutil.Bytes, error) { - domainSeparator := typedData.HashStruct("EIP712Domain", typedData.Domain.Map()) - typedDataHash := typedData.HashStruct(typedData.PrimaryType, typedData.Message) - typedDataJson, err := json.Marshal(typedData.Map()) - if err != nil { - return nil, err - } - buffer := bytes.Buffer{} - buffer.WriteString("\x19") - buffer.WriteString("\x01") - buffer.WriteString(common.Bytes2Hex(domainSeparator)) - buffer.WriteString(common.Bytes2Hex(typedDataHash)) - req := &SignDataRequest{ - Rawdata: typedDataJson, - Message: buffer.String(), - Hash: crypto.Keccak256(buffer.Bytes()), - ContentType: DataTyped.Mime, - } - signature, err := api.Sign(ctx, addr, req) - if err != nil { - api.UI.ShowError(err.Error()) - return nil, err - } - return signature, nil -} +//func (api *SignerAPI) SignTypedData(ctx context.Context, addr common.MixedcaseAddress, typedData TypedData) (hexutil.Bytes, error) { +// domainSeparator := typedData.HashStruct("EIP712Domain", typedData.Domain.Map()) +// typedDataHash := typedData.HashStruct(typedData.PrimaryType, typedData.Message) +// typedDataJson, err := json.Marshal(typedData.Map()) +// if err != nil { +// return nil, err +// } +// buffer := bytes.Buffer{} +// buffer.WriteString("\x19") +// buffer.WriteString("\x01") +// buffer.WriteString(common.Bytes2Hex(domainSeparator)) +// buffer.WriteString(common.Bytes2Hex(typedDataHash)) +// req := &SignDataRequest{ +// Rawdata: typedDataJson, +// Message: buffer.String(), +// Hash: crypto.Keccak256(buffer.Bytes()), +// ContentType: DataTyped.Mime, +// } +// signature, err := api.Sign(ctx, addr, req) +// if err != nil { +// api.UI.ShowError(err.Error()) +// return nil, err +// } +// 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)` func (typedData *TypedData) HashStruct(primaryType string, data EIP712Data) hexutil.Bytes { 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)) } -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 hexutil.Bytes(_interface.(string)) - default: - break - } - - panic(fmt.Errorf("unrecognized interface type %T", _interface)) - return hexutil.Bytes{} -} - -// encodeData generates the following encoding: +// EncodeData generates the following encoding: // `enc(value₁) ‖ enc(value₂) ‖ … ‖ enc(valueₙ)` // // 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 } -// 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) { - 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 { return common.Address{}, err } - switch mediaType { - 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) - } + return crypto.PubkeyToAddress(*rpk), nil } -// UnmarshalJSON validates the input data -func (typedData *TypedData) UnmarshalJSON(data hexutil.Bytes) error { - type input struct { - Types EIP712Types `json:"types"` - PrimaryType string `json:"primaryType"` - Domain EIP712Domain `json:"domain"` - Message EIP712Data `json:"message"` +// UnmarshalValidatorData converts the bytes input to typed data +func UnmarshalValidatorData(data interface{}) (ValidatorData, error) { + raw := data.(map[string]interface{}) + + addr, ok := raw["address"].(string) + addrBytes, err := hexutil.Decode(addr) + if err != nil { + return ValidatorData{}, err + } + if !ok || len(addrBytes) == 0 { + return ValidatorData{}, errors.New("validator address is undefined") } - var raw input - if err := json.Unmarshal(data, &raw); err != nil { - return err + message, ok := raw["message"].(string) + messageBytes, err := hexutil.Decode(message) + if err != nil { + return ValidatorData{}, err + } + if !ok || len(messageBytes) == 0 { + return ValidatorData{}, errors.New("message is undefined") } - if raw.Types == nil { - return errors.New("types are undefined") - } - if err := raw.Types.IsValid(); err != 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 + return ValidatorData{ + Address: common.BytesToAddress(addrBytes), + Message: messageBytes, + }, 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 func (typedData *TypedData) Map() map[string]interface{} { dataMap := map[string]interface{}{ - "Types": typedData.Types, - "Domain": typedData.Domain.Map(), - "PrimaryType": typedData.PrimaryType, - "Message": typedData.Message, + "types": typedData.Types, + "domain": typedData.Domain.Map(), + "primaryType": typedData.PrimaryType, + "message": typedData.Message, } return dataMap diff --git a/signer/core/signed_data_test.go b/signer/core/signed_data_test.go index 30396574f0..060e139d3f 100644 --- a/signer/core/signed_data_test.go +++ b/signer/core/signed_data_test.go @@ -21,6 +21,7 @@ import ( "fmt" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" "math/big" "testing" ) @@ -77,10 +78,10 @@ var domainStandard = EIP712Domain{ "1", big.NewInt(1), "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", - nil, + "", } -var dataStandard = map[string]interface{}{ +var messageStandard = map[string]interface{}{ "from": map[string]interface{}{ "name": "Cow", "wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826", @@ -93,12 +94,19 @@ var dataStandard = map[string]interface{}{ } var typedData = TypedData{ - typesStandard, - primaryType, - domainStandard, - dataStandard, + Types: typesStandard, + PrimaryType: primaryType, + Domain: domainStandard, + Message: messageStandard, } +//var typedDataMap = map[string]interface{}{ +// "types": typesStandard, +// "primaryType": primaryType, +// "domain": domainStandard, +// "message": messageStandard, +//} + func TestSignData(t *testing.T) { api, control := setup(t) //Create two accounts @@ -113,7 +121,7 @@ func TestSignData(t *testing.T) { control <- "Y" 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 { t.Errorf("Expected nil-data, got %x", signature) } @@ -121,7 +129,7 @@ func TestSignData(t *testing.T) { t.Errorf("Expected ErrLocked! %v", err) } 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 { t.Errorf("Expected nil-data, got %x", signature) } @@ -131,7 +139,7 @@ func TestSignData(t *testing.T) { // text/plain control <- "Y" 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 { t.Fatal(err) } @@ -141,7 +149,7 @@ func TestSignData(t *testing.T) { // data/typed control <- "Y" 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 { t.Fatal(err) }