Passphrase file in wallet key file
This commit is contained in:
		
							parent
							
								
									d3f6d1138d
								
							
						
					
					
						commit
						d24fea2d4f
					
				| @ -1,3 +1,7 @@ | ||||
| - 0.0.19 | ||||
| 	* Passphrase file option to unlock keyfile for CLI tooling | ||||
| - 0.0.18 | ||||
| 	* Upgrade hexathon skipping buggy compact hex method | ||||
| - 0.0.17 | ||||
| 	* Add loglevel environment variable | ||||
| - 0.0.16 | ||||
|  | ||||
| @ -166,6 +166,7 @@ class ArgumentParser(argparse.ArgumentParser): | ||||
|             self.add_argument('--seq', action='store_true', help='Use sequential rpc ids') | ||||
|         if arg_flags & Flag.KEY_FILE: | ||||
|             self.add_argument('-y', '--key-file', dest='y', type=str, help='Keystore file to use for signing or address') | ||||
|             self.add_argument('--passphrase-file', dest='passphrase_file', type=str, help='File containing passphrase for keystore') | ||||
|         if arg_flags & Flag.SEND: | ||||
|             self.add_argument('-s', '--send', dest='s', action='store_true', help='Send to network') | ||||
|         if arg_flags & Flag.RAW: | ||||
|  | ||||
| @ -3,6 +3,7 @@ import logging | ||||
| import os | ||||
| import sys | ||||
| import re | ||||
| import stat | ||||
| 
 | ||||
| # external imports | ||||
| import confini | ||||
| @ -213,7 +214,14 @@ class Config(confini.Config): | ||||
|             args_override['CHAIN_SPEC'] = getattr(args, 'i') | ||||
|         if arg_flags & Flag.KEY_FILE: | ||||
|             args_override['WALLET_KEY_FILE'] = getattr(args, 'y') | ||||
|         | ||||
|             fp = getattr(args, 'passphrase_file') | ||||
|             if fp != None: | ||||
|                 st = os.stat(fp) | ||||
|                 if stat.S_IMODE(st.st_mode) & (stat.S_IRWXO | stat.S_IRWXG) > 0: | ||||
|                     logg.warning('others than owner have access on password file') | ||||
|                 f = open(fp, 'r') | ||||
|                 args_override['WALLET_PASSPHRASE'] = f.read() | ||||
|                 f.close() | ||||
|         config.dict_override(args_override, 'cli args') | ||||
| 
 | ||||
|         if arg_flags & Flag.PROVIDER: | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user