keystoreNewKey creates a new key in the keystore using raw JSON
(rpcURL, nickname, password string)
| 200 | |
| 201 | // keystoreNewKey creates a new key in the keystore using raw JSON |
| 202 | func keystoreNewKey(rpcURL, nickname, password string) (string, error) { |
| 203 | reqJSON := fmt.Sprintf(`{"nickname":"%s","password":"%s"}`, nickname, password) |
| 204 | |
| 205 | respBody, err := postRawJSON(rpcURL+"/v1/admin/keystore-new-key", reqJSON) |
| 206 | if err != nil { |
| 207 | return "", err |
| 208 | } |
| 209 | |
| 210 | var address string |
| 211 | if err := json.Unmarshal(respBody, &address); err != nil { |
| 212 | return "", fmt.Errorf("failed to parse response: %v, body: %s", err, string(respBody)) |
| 213 | } |
| 214 | |
| 215 | return address, nil |
| 216 | } |
| 217 | |
| 218 | // keystoreGetKey gets the key info from the keystore using raw JSON |
| 219 | func keystoreGetKey(rpcURL, address, password string) (*keyGroup, error) { |
no test coverage detected