Skip to content

Commit ec3db0f

Browse files
holimankaralabe
authored andcommitted
cmd/clef, signer: initial poc of the standalone signer (#16154)
* signer: introduce external signer command * cmd/signer, rpc: Implement new signer. Add info about remote user to Context * signer: refactored request/response, made use of urfave.cli * cmd/signer: Use common flags * cmd/signer: methods to validate calldata against abi * cmd/signer: work on abi parser * signer: add mutex around UI * cmd/signer: add json 4byte directory, remove passwords from api * cmd/signer: minor changes * cmd/signer: Use ErrRequestDenied, enable lightkdf * cmd/signer: implement tests * cmd/signer: made possible for UI to modify tx parameters * cmd/signer: refactors, removed channels in ui comms, added UI-api via stdin/out * cmd/signer: Made lowercase json-definitions, added UI-signer test functionality * cmd/signer: update documentation * cmd/signer: fix bugs, improve abi detection, abi argument display * cmd/signer: minor change in json format * cmd/signer: rework json communication * cmd/signer: implement mixcase addresses in API, fix json id bug * cmd/signer: rename fromaccount, update pythonpoc with new json encoding format * cmd/signer: make use of new abi interface * signer: documentation * signer/main: remove redundant option * signer: implement audit logging * signer: create package 'signer', minor changes * common: add 0x-prefix to mixcaseaddress in json marshalling + validation * signer, rules, storage: implement rules + ephemeral storage for signer rules * signer: implement OnApprovedTx, change signing response (API BREAKAGE) * signer: refactoring + documentation * signer/rules: implement dispatching to next handler * signer: docs * signer/rules: hide json-conversion from users, ensure context is cleaned * signer: docs * signer: implement validation rules, change signature of call_info * signer: fix log flaw with string pointer * signer: implement custom 4byte databsae that saves submitted signatures * signer/storage: implement aes-gcm-backed credential storage * accounts: implement json unmarshalling of url * signer: fix listresponse, fix gas->uint64 * node: make http/ipc start methods public * signer: add ipc capability+review concerns * accounts: correct docstring * signer: address review concerns * rpc: go fmt -s * signer: review concerns+ baptize Clef * signer,node: move Start-functions to separate file * signer: formatting
1 parent de2a7bb commit ec3db0f

37 files changed

+6283
-94
lines changed

accounts/url.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ func (u URL) MarshalJSON() ([]byte, error) {
7474
return json.Marshal(u.String())
7575
}
7676

77+
// UnmarshalJSON parses url.
78+
func (u *URL) UnmarshalJSON(input []byte) error {
79+
var textUrl string
80+
err := json.Unmarshal(input, &textUrl)
81+
if err != nil {
82+
return err
83+
}
84+
url, err := parseURL(textUrl)
85+
if err != nil {
86+
return err
87+
}
88+
u.Scheme = url.Scheme
89+
u.Path = url.Path
90+
return nil
91+
}
92+
7793
// Cmp compares x and y and returns:
7894
//
7995
// -1 if x < y

accounts/usbwallet/hub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (hub *Hub) refreshWallets() {
127127
// breaking the Ledger protocol if that is waiting for user confirmation. This
128128
// is a bug acknowledged at Ledger, but it won't be fixed on old devices so we
129129
// need to prevent concurrent comms ourselves. The more elegant solution would
130-
// be to ditch enumeration in favor of hutplug events, but that don't work yet
130+
// be to ditch enumeration in favor of hotplug events, but that don't work yet
131131
// on Windows so if we need to hack it anyway, this is more elegant for now.
132132
hub.commsLock.Lock()
133133
if hub.commsPend > 0 { // A confirmation is pending, don't refresh

accounts/usbwallet/wallet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ type wallet struct {
9999
//
100100
// As such, a hardware wallet needs two locks to function correctly. A state
101101
// lock can be used to protect the wallet's software-side internal state, which
102-
// must not be held exlusively during hardware communication. A communication
102+
// must not be held exclusively during hardware communication. A communication
103103
// lock can be used to achieve exclusive access to the device itself, this one
104104
// however should allow "skipping" waiting for operations that might want to
105105
// use the device, but can live without too (e.g. account self-derivation).

cmd/clef/4byte.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)