You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: SIPS/sip-30.md
+42-6Lines changed: 42 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ This SIP proposes additions to entropy retrieval APIs that allows snaps to reque
14
14
15
15
Interoperability snaps and account management snaps use the methods `snap_getEntropy`, `snap_getBip44Entropy`, `snap_getBip32Entropy`, and `snap_getBip32PublicKey` to generate addresses and other key material.
16
16
17
-
These methods assume the client contains a single entropy source (the user's primary keyring mnemonic). The proposed API will allow snaps to request entropy from a specific source such as a secondary mnemonic.
17
+
These methods assume the client contains a single entropy source (the user's primary keyring mnemonic). The proposed API changes will allow snaps to request entropy from a specific source such as a secondary mnemonic. A new method `snap_listAvailableEntropySources` will be added to allow snaps to request a list of available entropy sources.
18
18
19
19
## Specification
20
20
@@ -26,6 +26,18 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S
26
26
"NOT RECOMMENDED", "MAY", and "OPTIONAL" written in uppercase in this document are to be interpreted as described in
27
27
[RFC 2119](https://www.ietf.org/rfc/rfc2119.txt)
28
28
29
+
### Snap Manifest
30
+
31
+
A new set permission is added to the snap manifest:
32
+
33
+
```json
34
+
{
35
+
"initialPermissions": {
36
+
"snap_listAvailableEntropySources": {}
37
+
}
38
+
}
39
+
```
40
+
29
41
30
42
### Common Types
31
43
```typescript
@@ -38,9 +50,7 @@ type Slip10Node = {
38
50
chainCode:string;
39
51
curve:"ed25519"|"secp256k1";
40
52
};
41
-
```
42
53
43
-
```typescript
44
54
exporttypeBIP44Node= {
45
55
coin_type:number;
46
56
depth:number;
@@ -49,6 +59,12 @@ export type BIP44Node = {
49
59
chainCode:string;
50
60
path:string[];
51
61
};
62
+
63
+
interfaceEntropySource {
64
+
name:string;
65
+
id:string;
66
+
type:"mnemonic";
67
+
}
52
68
```
53
69
54
70
### Scope
@@ -61,8 +77,12 @@ No changes are required to the snap manifest.
61
77
62
78
### Client wallet implementation
63
79
64
-
If a snap requests entropy and includes the `source` parameter, the wallet MUST return entropy corresponding to that source, if it exists.
65
-
If it does not exist, the wallet MUST respond with an error.
80
+
If a snap requests a list of available entropy sources, and it has the permission to do so, the wallet MUST return a list of `EntropySource` objects.
81
+
82
+
If a snap requests entropy and includes the `source` parameter for an entropy source of type `mnemonic`, the wallet MUST return entropy corresponding to that source, if it exists.
83
+
84
+
If the source does not exist, the wallet MUST respond with an error.
85
+
66
86
If the request does not include the `source` parameter, the wallet MUST return entropy from the default source.
67
87
68
88
A client wallet MAY invoke the `keyring.createAccount` method with an `entropySource` parameter in the `options` object.
@@ -73,7 +93,23 @@ The `entropySource` parameter MUST be a string which uniquely identifies the ent
73
93
74
94
If a snap is asked to create an account via `keyring.createAccount`, and the `entropySource` parameter is provided, and the snap requires entropy to create an account,the snap SHOULD request the entropy from the specified source.
75
95
76
-
### RPC Methods
96
+
### New RPC Methods
97
+
98
+
#### `snap_listAvailableEntropySources`
99
+
100
+
The method returns an array of `EntropySource` objects, each representing an available entropy source. It is intended that the snap will display this list to the user.
0 commit comments