You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.9 KiB

6 years ago
#!/usr/bin/python
6 years ago
import codecs, grpc, os, sys
import rpc_pb2 as ln, rpc_pb2_grpc as lnrpc
# display config script info
if len(sys.argv) <= 1 or sys.argv[1] == "-h" or sys.argv[1] == "help":
6 years ago
print("# creating or recovering the LND wallet")
print("# lnd.winitwallet.py new [walletpassword] [?seedpassword]")
print("# lnd.winitwallet.py seed [walletpassword] [seedstring] [?seedpassword]")
print("# lnd.winitwallet.py scb [walletpassword] [seedstring] [filepathSCB] [?seedpassword]")
print("err='missing parameters'")
6 years ago
sys.exit(1)
walletpassword=""
seedwords=""
seedpassword=""
filepathSCB=""
mode=sys.argv[1]
if mode=="new":
6 years ago
print("# *** CREATING NEW LND WALLET ***")
if len(sys.argv)>2:
6 years ago
walletpassword=sys.argv[2]
if len(walletpassword)<8:
print("err='wallet password is too short'")
sys.exit(1)
else:
print("err='wallet password is too short'")
sys.exit(1)
if len(sys.argv)>3:
6 years ago
seedpassword=sys.argv[3]
6 years ago
elif mode=="seed":
6 years ago
print("err='TODO: implement creating from seed'")
sys.exit(1)
6 years ago
elif mode=="scb":
6 years ago
print("err='TODO: implement creating from seed/scb'")
sys.exit(1)
6 years ago
else:
6 years ago
print("err='unkown mode parameter - run without any parameters to see options'")
6 years ago
sys.exit(1)
6 years ago
os.environ['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA'
cert = open('/mnt/hdd/lnd/tls.cert', 'rb').read()
ssl_creds = grpc.ssl_channel_credentials(cert)
channel = grpc.secure_channel('localhost:10009', ssl_creds)
stub = lnrpc.WalletUnlockerStub(channel)
print("TODO: mode "+mode)
6 years ago
sys.exit(1)
#request = ln.InitWalletRequest(
# wallet_password=base64.b64encode(sys.argv[1]).decode(),
# cipher_seed_mnemonic=<array string>,
# aezeed_passphrase=<bytes>,
# recovery_window=<int32>,
# channel_backups=<ChanBackupSnapshot>,
# )
#response = stub.InitWallet(request)
#print(response)