forked from hyperledger/indy-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_indy_keys
executable file
·37 lines (27 loc) · 1.17 KB
/
init_indy_keys
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /usr/bin/env python3
import argparse
import os.path
from plenum.common.keygen_utils import initNodeKeysForBothStacks
from plenum.common.constants import CLIENT_STACK_SUFFIX
from indy_common.config_util import getConfig
from indy_common.config_helper import NodeConfigHelper
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Generate keys for a node's stacks "
"by taking the node's name and 2 "
"seed values")
parser.add_argument('--name', required=True, help='node name')
parser.add_argument('--seed', required=False, type=str,
help='seed for keypair')
parser.add_argument('--force', help='overrides keys', action='store_true')
args = parser.parse_args()
print("Node-stack name is", args.name)
print("Client-stack name is", args.name + CLIENT_STACK_SUFFIX)
config = getConfig()
config_helper = NodeConfigHelper(args.name, config)
os.makedirs(config_helper.keys_dir, exist_ok=True)
try:
initNodeKeysForBothStacks(args.name, config_helper.keys_dir, args.seed, override=args.force)
except Exception as ex:
print(ex)
exit()