-
Notifications
You must be signed in to change notification settings - Fork 4
Usage
All the features of MaskWalletCore are provided through the request
function. Request
function receives Protobuf encoded messages and returns Protobuf encoded responses.
All .proto files are located in chain-common/proto
directory.
The blockchain type
- Ethereum
- Polkadot, still under development
The type of StoredKey, indicates the StoredKey is created with which kind of data.
- PrivateKey
- Mnemonic
Indicate the import type of creating a StoredKey
- PrivateKeyImportType
- MnemonicImportType
- KeyStoreJSONImportType
Indicate the export type of creating a StoredKey
- PrivateKeyExportType
- MnemonicExportType
- KeyStoreJSONExportType
StoredKeyInfo contains the "public" information of a StoredKey and the encoded data of the whole StoredKey. Refer to StoredKey
Name | Type | Description |
---|---|---|
id | string | UUID of the created StoredKey |
hash | string | The unique hash of the StoredKey, users could check whether two StoredKeys are same by comparing the hash |
type | StoredKeyType | Type of the StoredKey |
data | Bytes | Raw data of the StoredKey, used in requests required an existing StoredKey. Need to be updated after mutating the StoredKey |
StoredKeyAccountInfo contains all the account information. Refer to Account
Name | Type | Description |
---|---|---|
address | string | Blockchain specific address |
name | string | Alias name set by users |
derivationPath | string | The derivation path used to derived this account. Would be an empty string for an account generated by the imported private key. |
coin | string | Coin id of the address, is the same as the raw value of enum Coin |
extendedPublicKey | string | Not used on Ethereum. Always be an empty string for now |
Struct used to check whether a password is valid for a StoredKey
Name | Type | Description |
---|---|---|
storedKeyData | bytes | Raw bytes of the StoredKey |
password | string | The password to be checked |
Struct used to check whether an address is valid for a blockchain type
Name | Type | Description |
---|---|---|
address | string | The address to be checked |
coin | Coin | Blockchain type |
Since almost all requests and responses are used in pairs, the following section will list the structure of each request and its corresponding response.
No Parameters
Use this request to get the version of MaskWalletCore.
Name | Type | Description |
---|---|---|
version | string | The version of MaskWalletCore |
Name | Type | Description |
---|---|---|
coin | Coin | Blockchain type |
Use this request to get the supported import type of a specific blockchain.
Name | Type | Description |
---|---|---|
type | repeated StoredKeyImportType | List of supported StoredKeyImportTypes |
Name | Type | Description |
---|---|---|
coin | Coin | Blockchain type |
Use this request to get the supported export type of a specific blockchain.
Name | Type | Description |
---|---|---|
type | repeated StoredKeyExportType | List of supported StoredKeyExportTypes |
Name | Type | Description |
---|---|---|
data | repeated bytes | List of encoded raw bytes of StoredKey |
Use this request to get the information of the StoredKey raw bytes.
Name | Type | Description |
---|---|---|
StoredKeys | repeated StoredKeyInfo | List of supported StoredKeyExportTypes |
Name | Type | Description |
---|---|---|
password | string | Password to create a new StoredKey |
Use this request to create a new mnemonic type StoredKey with randomly generated mnemonic phrases.
This request does NOT create an account.
Name | Type | Description |
---|---|---|
StoredKey | StoredKeyInfo | Created StoredKeyInfo |
mnemonic | string | The random mnemonic phrases of the created StoredKey |
Name | Type | Description |
---|---|---|
privateKey | string | Hex encoded private key string |
password | string | Password to create a new StoredKey |
name | string | The name of created account |
Use this request to create a new private key type StoredKey with an existing private key.
This request DO create an account.
Name | Type | Description |
---|---|---|
StoredKey | StoredKeyInfo | Created StoredKeyInfo |
Name | Type | Description |
---|---|---|
mnemonic | string | Hex encoded private key string |
password | string | Password to create a new StoredKey |
name | string | The name of created account |
Use this request to create a new mnemonic key type StoredKey with an existing mnemonic.
This request does NOT create an account.
Name | Type | Description |
---|---|---|
StoredKey | StoredKeyInfo | Created StoredKeyInfo |
Name | Type | Description |
---|---|---|
json | string | KeyStoreJson string |
password | string | Password to create a new StoredKey |
name | string | The name of created account |
coin | Coin | Blockchain type |
Use this request to create a new private key type StoredKey with an existing KeyStoreJson.
This request DO create an account.
Name | Type | Description |
---|---|---|
StoredKey | StoredKeyInfo | Created StoredKeyInfo |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey to be updated |
oldPassword | string | Current password of the StoredKey |
newPassword | string | New password of the StoredKey |
Use this request to update the password of the StoredKey.
Name | Type | Description |
---|---|---|
StoredKey | StoredKeyInfo | The updated StoredKeyInfo |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey to be exported |
password | string | Password of the StoredKey |
coin | Coin | Blockchain type |
Use this request to export the private key of the StoredKey on the coin's base derivation path.
Name | Type | Description |
---|---|---|
privateKey | string | The exported private key |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey to be exported |
password | string | Password of the StoredKey |
coin | Coin | Blockchain type |
derivationPath | string | The derivation path of the exported private key |
Use this request to export the private key of the StoredKey on the specified derivation path.
Fail if the StoredKey is not a mnemonic type StoredKey
Name | Type | Description |
---|---|---|
privateKey | string | The exported private key |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey to be exported |
password | string | Password of the StoredKey |
Use this request to export the mnemonic of the StoredKey.
Fail if the StoredKey is not a mnemonic type StoredKey
Name | Type | Description |
---|---|---|
mnemonic | string | The exported mnemonic |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey to be exported |
password | string | Password of the StoredKey |
newPassword | string | The password used to encrypt the exported KeyStoreJson |
coin | Coin | Blockchain type |
address | string | The address of the account of which the private key to be exported as KeyStoreJson |
Use this request to export the KeyStoreJson of the private key with the specified address in the StoredKey.
Name | Type | Description |
---|---|---|
json | string | The exported KeyStoreJson |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey to be exported |
password | string | Password of the StoredKey |
newPassword | string | The password used to encrypt the exported KeyStoreJson |
coin | Coin | Blockchain type |
derivationPath | string | The derivation path of the account of which the private key to be exported as KeyStoreJson |
Use this request to export the KeyStoreJson of the private key with the specified derivation path in the StoredKey.
Name | Type | Description |
---|---|---|
json | string | The exported KeyStoreJson |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey |
name | string | Name of the created account |
password | string | The password of the stored key |
coin | Coin | Blockchain type |
derivationPath | string | The derivation path to create the account |
Use this request to create a new account to the StoredKey at the specific derivation path.
Fail if the StoredKey is not a mnemonic type StoredKey
Name | Type | Description |
---|---|---|
account | StoredKeyAccountInfo | The created StoredKeyAccountInfo |
storedKey | StoredKeyInfo | The updated StoredKeyInfo |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey |
Use this request to get the count of accounts of a StoredKey.
Name | Type | Description |
---|---|---|
count | uint32 | The count of accounts |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey |
index | uint32 | Index of the requested account, begin from 0 |
Use this request to get the account at the specified index of a StoredKey.
Fail if the requested index is larger than the count of the existing accounts
Name | Type | Description |
---|---|---|
account | StoredKeyAccountInfo | The requested StoredKeyAccountInfo |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey |
Use this request to get all accounts of a StoredKey.
Name | Type | Description |
---|---|---|
account | repeated StoredKeyAccountInfo | The list of StoredKeyAccountInfo |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey |
coin | Coin | Blockchain type |
Use this request to get all accounts of the specific blockchain type of a StoredKey.
Name | Type | Description |
---|---|---|
account | repeated StoredKeyAccountInfo | The list of StoredKeyAccountInfo |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey |
address | string | The address of the account to be updated |
name | string | The new name of the account |
Use this request to update the name of an account of the specific address of a StoredKey.
Name | Type | Description |
---|---|---|
storedKey | StoredKeyInfo | The updated StoredKeyInfo |
account | StoredKeyAccountInfo | The updated StoredKeyAccountInfo |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey |
coin | Coin | Blockchain type |
Use this request to remove all accounts of the specific blockchain of a StoredKey.
Name | Type | Description |
---|---|---|
storedKey | StoredKeyInfo | The updated StoredKeyInfo |
Name | Type | Description |
---|---|---|
StoredKeyData | bytes | Raw bytes of the StoredKey |
coin | Coin | Blockchain type |
address | string | The address to the account to be removed |
Use this request to remove the account of the specific address of a StoredKey.
Name | Type | Description |
---|---|---|
storedKey | StoredKeyInfo | The updated StoredKeyInfo |
Name | Type | Description |
---|---|---|
privateKey | string | The private key to be checked |
mnemonic | string | The mnemonic to be checked |
keyStoreJSON | string | The KeyStoreJson to be checked |
storedKeyPassword | PasswordValidationParam | The password and StoredKey to be checked |
addressValidationParam | AddressValidationParam | The address to be checked |
Use this request to check whether a type of data is valid.
Since the parameter of this request is oneof
, users could choose only 1 validation type at a time.
Name | Type | Description |
---|---|---|
valid | bool | Whether the data to be checked is valid |
Name | Type | Description |
---|---|---|
storedKeyData | bytes | Raw bytes of the StoredKey used to sign |
address | string | Address of the account used to sign |
password | string | Password of the StoredKey |
coin | Coin | Blockchain type |
input | oneof input | The input parameter specified by each blockchain |
Use this request to sign a transaction.
Please note that the actual input
parameter type should be the same as the coin
blockchain, e.g. to sign an Ethereum transaction, users should set coin
to Ethereum
, and the input
should be the type of ethereum.SignInput
.
Currently, only Ethereum is supported.
Name | Type | Description |
---|---|---|
output | oneof output | The signed output, type varies on different blockchain |