mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-18 20:54:20 +01:00
[client] Add command to dump private key (#101)
* adds dumpPrivKey command * Update client/dump.go Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com> Signed-off-by: João Bordalo <bordalix@users.noreply.github.com> --------- Signed-off-by: João Bordalo <bordalix@users.noreply.github.com> Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
This commit is contained in:
24
client/dump.go
Normal file
24
client/dump.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/hex"
|
||||||
|
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var dumpCommand = cli.Command{
|
||||||
|
Name: "dump-privkey",
|
||||||
|
Usage: "Dump private key of the Ark wallet",
|
||||||
|
Action: dumpAction,
|
||||||
|
}
|
||||||
|
|
||||||
|
func dumpAction(ctx *cli.Context) error {
|
||||||
|
privateKey, err := privateKeyFromPassword()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return printJSON(map[string]interface{}{
|
||||||
|
"privateKey": hex.EncodeToString(privateKey.Serialize()),
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -61,6 +61,7 @@ func main() {
|
|||||||
app.Commands,
|
app.Commands,
|
||||||
&balanceCommand,
|
&balanceCommand,
|
||||||
&configCommand,
|
&configCommand,
|
||||||
|
&dumpCommand,
|
||||||
&faucetCommand,
|
&faucetCommand,
|
||||||
&initCommand,
|
&initCommand,
|
||||||
&receiveCommand,
|
&receiveCommand,
|
||||||
|
|||||||
Reference in New Issue
Block a user