mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
Brought legal warning back after temporarily disabling it for development
This commit is contained in:
parent
4b893bee79
commit
3adda3f323
3 changed files with 14 additions and 166 deletions
|
|
@ -26,8 +26,6 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
@ -42,9 +40,11 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/console"
|
"github.com/ethereum/go-ethereum/console"
|
||||||
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/node"
|
"github.com/ethereum/go-ethereum/node"
|
||||||
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
"github.com/ethereum/go-ethereum/signer/core"
|
"github.com/ethereum/go-ethereum/signer/core"
|
||||||
"github.com/ethereum/go-ethereum/signer/rules"
|
"github.com/ethereum/go-ethereum/signer/rules"
|
||||||
|
|
@ -330,10 +330,9 @@ func initialize(c *cli.Context) error {
|
||||||
// If using the stdioui, we can't do the 'confirm'-flow
|
// If using the stdioui, we can't do the 'confirm'-flow
|
||||||
fmt.Fprintf(logOutput, legalWarning)
|
fmt.Fprintf(logOutput, legalWarning)
|
||||||
} else {
|
} else {
|
||||||
// Temporarily disabled
|
if !confirm(legalWarning) {
|
||||||
//if !confirm(legalWarning) {
|
return fmt.Errorf("aborted by user")
|
||||||
// return fmt.Errorf("aborted by user")
|
}
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(c.Int(logLevelFlag.Name)), log.StreamHandler(logOutput, log.TerminalFormat(true))))
|
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(c.Int(logLevelFlag.Name)), log.StreamHandler(logOutput, log.TerminalFormat(true))))
|
||||||
|
|
@ -556,15 +555,14 @@ func readMasterKey(ctx *cli.Context, ui core.SignerUI) ([]byte, error) {
|
||||||
var password string
|
var password string
|
||||||
// If ui is not nil, get the password from ui.
|
// If ui is not nil, get the password from ui.
|
||||||
if ui != nil {
|
if ui != nil {
|
||||||
// Temporarily disabled
|
resp, err := ui.OnInputRequired(core.UserInputRequest{
|
||||||
//resp, err := ui.OnInputRequired(core.UserInputRequest{
|
Title: "Master Password",
|
||||||
// Title: "Master Password",
|
Prompt: "Please enter the password to decrypt the master seed",
|
||||||
// Prompt: "Please enter the password to decrypt the master seed",
|
IsPassword: true})
|
||||||
// IsPassword: true})
|
if err != nil {
|
||||||
//if err != nil {
|
return nil, err
|
||||||
// return nil, err
|
}
|
||||||
//}
|
password = resp.Text
|
||||||
//password = resp.Text
|
|
||||||
} else {
|
} else {
|
||||||
password = getPassPhrase("Decrypt master seed of clef", false)
|
password = getPassPhrase("Decrypt master seed of clef", false)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,150 +0,0 @@
|
||||||
# Specs
|
|
||||||
`encode(domainSeparator : 𝔹²⁵⁶, message : 𝕊) = "\x19\x01EthereumSignedMessage\n" ‖ domainSeparator ‖ hashStruct(message)`
|
|
||||||
- data adheres to 𝕊, a structure defined in the rigorous eip-712
|
|
||||||
- `\x01` is needed to comply with EIP-191
|
|
||||||
- `domainSeparator` and `hashStruct` are defined below
|
|
||||||
|
|
||||||
## A) domainSeparator
|
|
||||||
`domainSeparator = hashStruct(eip712Domain)`
|
|
||||||
<br/>
|
|
||||||
<br/>
|
|
||||||
Struct named `EIP712Domain` with one or more of the below fields:
|
|
||||||
|
|
||||||
- `string name`
|
|
||||||
- `string version`
|
|
||||||
- `uint256 chainId`, as per EIP-155
|
|
||||||
- `address verifyingContract`
|
|
||||||
- `bytes32 salt`
|
|
||||||
|
|
||||||
## B) hashStruct
|
|
||||||
`hashStruct(s : 𝕊) = keccak256(typeHash ‖ encodeData(s))`
|
|
||||||
<br/>
|
|
||||||
`typeHash = keccak256(encodeType(typeOf(s)))`
|
|
||||||
|
|
||||||
### i) encodeType
|
|
||||||
- `name ‖ "(" ‖ member₁ ‖ "," ‖ member₂ ‖ "," ‖ … ‖ memberₙ ")"`
|
|
||||||
- each member is written as `type ‖ " " ‖ name`
|
|
||||||
- encodings cascade down and are sorted by name
|
|
||||||
|
|
||||||
Example: `Mail(Person from,Person to,string contents)Person(string name,address wallet)`
|
|
||||||
|
|
||||||
### ii) encodeData
|
|
||||||
- `enc(value₁) ‖ enc(value₂) ‖ … ‖ enc(valueₙ)`
|
|
||||||
- each encoded member is 32-byte long
|
|
||||||
|
|
||||||
#### a) atomic
|
|
||||||
|
|
||||||
- `bool` => `uint256`
|
|
||||||
- `address` => `uint160`
|
|
||||||
- `int8:int256` and `uint8:uint256` => sign-extended `uint256` in big endian order
|
|
||||||
- `bytes1:31` => `bytes32`
|
|
||||||
|
|
||||||
#### b) dynamic
|
|
||||||
|
|
||||||
- `bytes` => `keccak256(bytes)`
|
|
||||||
- `string` => `keccak256(string)`
|
|
||||||
|
|
||||||
#### c) referenced
|
|
||||||
|
|
||||||
- `array` => `keccak256(encodeData(array))`
|
|
||||||
- `struct` => `rec(keccak256(hashStruct(struct)))`
|
|
||||||
|
|
||||||
## C) Algo
|
|
||||||
- hashStruct
|
|
||||||
- encodeType
|
|
||||||
- encodeData
|
|
||||||
- if primitive
|
|
||||||
- encode
|
|
||||||
- else
|
|
||||||
- if array
|
|
||||||
- encodeData
|
|
||||||
- else if struct
|
|
||||||
- hashStruct
|
|
||||||
- else
|
|
||||||
- break
|
|
||||||
|
|
||||||
## D) Example
|
|
||||||
### Query
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"jsonrpc": "2.0",
|
|
||||||
"method": "account_signTypedData",
|
|
||||||
"params": [
|
|
||||||
"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
|
|
||||||
{
|
|
||||||
"types": {
|
|
||||||
"EIP712Domain": [
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "version",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "chainId",
|
|
||||||
"type": "uint256"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "verifyingContract",
|
|
||||||
"type": "address"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Person": [
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "wallet",
|
|
||||||
"type": "address"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Mail": [
|
|
||||||
{
|
|
||||||
"name": "from",
|
|
||||||
"type": "Person"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "to",
|
|
||||||
"type": "Person"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "contents",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"primaryType": "Mail",
|
|
||||||
"domain": {
|
|
||||||
"name": "Ether Mail",
|
|
||||||
"version": "1",
|
|
||||||
"chainId": 1,
|
|
||||||
"verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"from": {
|
|
||||||
"name": "Cow",
|
|
||||||
"wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"name": "Bob",
|
|
||||||
"wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"
|
|
||||||
},
|
|
||||||
"contents": "Hello, Bob!"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"id": 1
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Response
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"id":1,
|
|
||||||
"jsonrpc": "2.0",
|
|
||||||
"result": "0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
@ -637,7 +637,7 @@ function ApproveSignData(r){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message := []byte("baz bazonk foo")
|
message := []byte("baz bazonk foo")
|
||||||
hash, msg := core.SignHash(message)
|
hash, msg := core.SignTextPlain(message)
|
||||||
raw := hexutil.Bytes(message)
|
raw := hexutil.Bytes(message)
|
||||||
addr, _ := mixAddr("0x694267f14675d7e1b9494fd8d72fefe1755710fa")
|
addr, _ := mixAddr("0x694267f14675d7e1b9494fd8d72fefe1755710fa")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue