Skip to content

Commit a0943b8

Browse files
authored
cmd/clef, signer: refresh tutorial, fix noticed issues (#19774)
* cmd/clef, signer: refresh tutorial, fix noticed issues * cmd/clef, signer: support removing stored keys (delpw + rules) * cmd/clef: polishes + Geth integration in the tutorial
1 parent 6bf5555 commit a0943b8

16 files changed

Lines changed: 704 additions & 521 deletions

‎cmd/clef/README.md‎

Lines changed: 67 additions & 95 deletions
Large diffs are not rendered by default.

‎cmd/clef/datatypes.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Example:
1111
"content_type": "text/plain",
1212
"address": "0xDEADbEeF000000000000000000000000DeaDbeEf",
1313
"raw_data": "GUV0aGVyZXVtIFNpZ25lZCBNZXNzYWdlOgoxMWhlbGxvIHdvcmxk",
14-
"message": [
14+
"messages": [
1515
{
1616
"name": "message",
1717
"value": "\u0019Ethereum Signed Message:\n11hello world",
@@ -133,7 +133,7 @@ This occurs _after_ successful completion of the entire signing procedure, but r
133133

134134
A ruleset that implements a rate limitation needs to know what transactions are sent out to the external interface. By hooking into this methods, the ruleset can maintain track of that count.
135135

136-
**OBS:** Note that if an attacker can restore your `clef` data to a previous point in time (e.g through a backup), the attacker can reset such windows, even if he/she is unable to decrypt the content.
136+
**OBS:** Note that if an attacker can restore your `clef` data to a previous point in time (e.g through a backup), the attacker can reset such windows, even if he/she is unable to decrypt the content.
137137

138138
The `OnApproved` method cannot be responded to, it's purely informative
139139

@@ -179,7 +179,7 @@ Example:
179179
```
180180
### ListRequest
181181

182-
Sent when a request has been made to list addresses. The UI is provided with the full `account`s, including local directory names. Note: this information is not passed back to the external caller, who only sees the `address`es.
182+
Sent when a request has been made to list addresses. The UI is provided with the full `account`s, including local directory names. Note: this information is not passed back to the external caller, who only sees the `address`es.
183183

184184
Example:
185185
```json

‎cmd/clef/extapi_changelog.md‎

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
### Changelog for external API
1+
## Changelog for external API
2+
3+
The API uses [semantic versioning](https://semver.org/).
4+
5+
TL;DR: Given a version number MAJOR.MINOR.PATCH, increment the:
6+
7+
* MAJOR version when you make incompatible API changes,
8+
* MINOR version when you add functionality in a backwards-compatible manner, and
9+
* PATCH version when you make backwards-compatible bug fixes.
10+
11+
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
12+
213

314
### 6.0.0
415

@@ -14,15 +25,15 @@ The addition of `contentType` makes it possible to use the method for different
1425
* signing clique headers,
1526
* signing plain personal messages,
1627
* The external method `account_signTypedData` implements [EIP-712](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md) and makes it possible to sign typed data.
17-
28+
1829
#### 4.0.0
1930

20-
* The external `account_Ecrecover`-method was removed.
31+
* The external `account_Ecrecover`-method was removed.
2132
* The external `account_Import`-method was removed.
2233

2334
#### 3.0.0
2435

25-
* The external `account_List`-method was changed to not expose `url`, which contained info about the local filesystem. It now returns only a list of addresses.
36+
* The external `account_List`-method was changed to not expose `url`, which contained info about the local filesystem. It now returns only a list of addresses.
2637

2738
#### 2.0.0
2839

@@ -33,15 +44,3 @@ makes the `accounts_signTransaction` identical to the old `eth_signTransaction`.
3344
#### 1.0.0
3445

3546
Initial release.
36-
37-
### Versioning
38-
39-
The API uses [semantic versioning](https://semver.org/).
40-
41-
TLDR; Given a version number MAJOR.MINOR.PATCH, increment the:
42-
43-
* MAJOR version when you make incompatible API changes,
44-
* MINOR version when you add functionality in a backwards-compatible manner, and
45-
* PATCH version when you make backwards-compatible bug fixes.
46-
47-
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

‎cmd/clef/intapi_changelog.md‎

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,39 @@
1-
### Changelog for internal API (ui-api)
1+
## Changelog for internal API (ui-api)
22

3-
### 6.0.0
3+
The API uses [semantic versioning](https://semver.org/).
4+
5+
TL;DR: Given a version number MAJOR.MINOR.PATCH, increment the:
6+
7+
* MAJOR version when you make incompatible API changes,
8+
* MINOR version when you add functionality in a backwards-compatible manner, and
9+
* PATCH version when you make backwards-compatible bug fixes.
10+
11+
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
12+
13+
### 7.0.0
14+
15+
- The `message` field was renamed to `messages` in all data signing request methods to better reflect that it's a list, not a value.
16+
- The `storage.Put` and `storage.Get` methods in the rule execution engine were lower-cased to `storage.put` and `storage.get` to be consistent with JavaScript call conventions.
17+
18+
### 6.0.0
419

5-
Removed `password` from responses to operations which require them. This is for two reasons,
20+
Removed `password` from responses to operations which require them. This is for two reasons,
621

7-
- Consistency between how rulesets operate and how manual processing works. A rule can `Approve` but require the actual password to be stored in the clef storage.
8-
With this change, the same stored password can be used even if rulesets are not enabled, but storage is.
9-
- It also removes the usability-shortcut that a UI might otherwise want to implement; remembering passwords. Since we now will not require the
10-
password on every `Approve`, there's no need for the UI to cache it locally.
11-
- In a future update, we'll likely add `clef_storePassword` to the internal API, so the user can store it via his UI (currently only CLI works).
22+
- Consistency between how rulesets operate and how manual processing works. A rule can `Approve` but require the actual password to be stored in the clef storage.
23+
With this change, the same stored password can be used even if rulesets are not enabled, but storage is.
24+
- It also removes the usability-shortcut that a UI might otherwise want to implement; remembering passwords. Since we now will not require the
25+
password on every `Approve`, there's no need for the UI to cache it locally.
26+
- In a future update, we'll likely add `clef_storePassword` to the internal API, so the user can store it via his UI (currently only CLI works).
1227

1328
Affected datatypes:
1429
- `SignTxResponse`
1530
- `SignDataResponse`
1631
- `NewAccountResponse`
1732

18-
If `clef` requires a password, the `OnInputRequired` will be used to collect it.
33+
If `clef` requires a password, the `OnInputRequired` will be used to collect it.
1934

2035

21-
### 5.0.0
36+
### 5.0.0
2237

2338
Changed the namespace format to adhere to the legacy ethereum format: `name_methodName`. Changes:
2439

@@ -38,7 +53,7 @@ Changed the namespace format to adhere to the legacy ethereum format: `name_meth
3853
### 4.0.0
3954

4055
* Bidirectional communication implemented, so the UI can query `clef` via the stdin/stdout RPC channel. Methods implemented are:
41-
- `clef_listWallets`
56+
- `clef_listWallets`
4257
- `clef_listAccounts`
4358
- `clef_listWallets`
4459
- `clef_deriveAccount`
@@ -48,10 +63,10 @@ Changed the namespace format to adhere to the legacy ethereum format: `name_meth
4863
- `clef_setChainId`
4964
- `clef_export`
5065
- `clef_import`
51-
52-
* The type `Account` was modified (the json-field `type` was removed), to consist of
5366

54-
```golang
67+
* The type `Account` was modified (the json-field `type` was removed), to consist of
68+
69+
```go
5570
type Account struct {
5671
Address common.Address `json:"address"` // Ethereum account address derived from the key
5772
URL URL `json:"url"` // Optional resource locator within a backend
@@ -64,7 +79,7 @@ type Account struct {
6479
* Make `ShowError`, `OnApprovedTx`, `OnSignerStartup` be json-rpc [notifications](https://www.jsonrpc.org/specification#notification):
6580

6681
> A Notification is a Request object without an "id" member. A Request object that is a Notification signifies the Client's lack of interest in the corresponding Response object, and as such no Response object needs to be returned to the client. The Server MUST NOT reply to a Notification, including those that are within a batch request.
67-
>
82+
>
6883
> Notifications are not confirmable by definition, since they do not have a Response object to be returned. As such, the Client would not be aware of any errors (like e.g. "Invalid params","Internal error"
6984
### 3.1.0
7085

@@ -79,15 +94,17 @@ type Account struct {
7994
* Add `OnInputRequired(info UserInputRequest)` to internal API. This method is used when Clef needs user input, e.g. passwords.
8095

8196
The following structures are used:
82-
```golang
83-
UserInputRequest struct {
84-
Prompt string `json:"prompt"`
85-
Title string `json:"title"`
86-
IsPassword bool `json:"isPassword"`
87-
}
88-
UserInputResponse struct {
89-
Text string `json:"text"`
90-
}
97+
98+
```go
99+
UserInputRequest struct {
100+
Prompt string `json:"prompt"`
101+
Title string `json:"title"`
102+
IsPassword bool `json:"isPassword"`
103+
}
104+
UserInputResponse struct {
105+
Text string `json:"text"`
106+
}
107+
```
91108

92109
### 2.0.0
93110

@@ -161,15 +178,3 @@ Example call:
161178
#### 1.0.0
162179

163180
Initial release.
164-
165-
### Versioning
166-
167-
The API uses [semantic versioning](https://semver.org/).
168-
169-
TLDR; Given a version number MAJOR.MINOR.PATCH, increment the:
170-
171-
* MAJOR version when you make incompatible API changes,
172-
* MINOR version when you add functionality in a backwards-compatible manner, and
173-
* PATCH version when you make backwards-compatible bug fixes.
174-
175-
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

0 commit comments

Comments
 (0)