class Create_New_Key(Resource):
def post(self):
- return create_new_key()
+ args = parser.parse_args()
+ entropy = args.get('entropy_str')
+ mnemonic = args.get('mnemonic_str')
+ response = create_new_key(entropy, mnemonic)
+ return response
class Create_New_Address(Resource):
class Get_Gm_New_Key(Resource):
def post(self):
- return get_gm_new_key()
+ args = parser.parse_args()
+ entropy = args.get('entropy_str')
+ mnemonic = args.get('mnemonic_str')
+ response = get_gm_new_key(entropy, mnemonic)
+ return response
class Get_Gm_New_Address(Resource):
}
-def create_new_key():
- entropy_str = create_entropy()['entropy']
- mnemonic_str = entropy_to_mnemonic(entropy_str)['mnemonic']
+def create_new_key(entropy_str, mnemonic_str):
+ if (entropy_str == "") and (mnemonic_str == ""):
+ entropy_str = create_entropy()['entropy']
+ mnemonic_str = entropy_to_mnemonic(entropy_str)['mnemonic']
+ if (entropy_str == "") and (mnemonic_str != ""):
+ pass
+ if entropy_str != "":
+ mnemonic_str = entropy_to_mnemonic(entropy_str)['mnemonic']
seed_str = mnemonic_to_seed(mnemonic_str)['seed']
root_xprv_str = seed_to_root_xprv(seed_str)['root_xprv']
xpub_str = xprv_to_xpub(root_xprv_str)['xpub']
}
-def get_gm_new_key():
- entropy_str = key.create_entropy()['entropy']
- mnemonic_str = key.entropy_to_mnemonic(entropy_str)['mnemonic']
+def get_gm_new_key(entropy_str, mnemonic_str):
+ if (entropy_str == "") and (mnemonic_str == ""):
+ entropy_str = key.create_entropy()['entropy']
+ mnemonic_str = key.entropy_to_mnemonic(entropy_str)['mnemonic']
+ if (entropy_str == "") and (mnemonic_str != ""):
+ pass
+ if entropy_str != "":
+ mnemonic_str = key.entropy_to_mnemonic(entropy_str)['mnemonic']
seed_str = key.mnemonic_to_seed(mnemonic_str)['seed']
root_xprv_str = get_gm_root_xprv(seed_str)['root_xprv']
xpub_str = get_gm_xpub(root_xprv_str)['xpub']