@@ -26,7 +26,7 @@ class Transcrypt(ub.NiceRepr):
2626 >>> sandbox = DemoSandbox(verbose=1, dpath='special:cache').setup()
2727 >>> config = {'digest': 'sha256',
2828 >>> 'kdf': 'pbkdf2',
29- >>> 'salt_method ': '665896be121e1a0a4a7b18f01780061'}
29+ >>> 'base_salt ': '665896be121e1a0a4a7b18f01780061'}
3030 >>> self = Transcrypt(sandbox.repo_dpath,
3131 >>> config=config, env=sandbox.env, verbose=1)
3232 >>> print(self.version())
@@ -57,7 +57,7 @@ class Transcrypt(ub.NiceRepr):
5757 'password' : None ,
5858 'digest' : 'md5' ,
5959 'kdf' : 'none' ,
60- 'salt_method ' : 'password' ,
60+ 'base_salt ' : 'password' ,
6161 }
6262
6363 def __init__ (self , dpath , config = None , env = None , transcript_exe = None , verbose = 0 ):
@@ -89,7 +89,7 @@ def _config_args(self):
8989 "-p" , self .config ['password' ],
9090 "-md" , self .config ['digest' ],
9191 "--kdf" , self .config ['kdf' ],
92- "-sm " , self .config ['salt_method ' ],
92+ "-bs " , self .config ['base_salt ' ],
9393 ]
9494 args = [template .format (** self .config ) for template in arg_templates ]
9595 return args
@@ -111,7 +111,7 @@ def login(self):
111111 args = self ._config_args ()
112112 command = [str (self .transcript_exe ), * args , '-y' ]
113113 self ._cmd (command )
114- self .config ['salt_method ' ] = self ._load_unversioned_config ()['salt_method ' ]
114+ self .config ['base_salt ' ] = self ._load_unversioned_config ()['base_salt ' ]
115115
116116 def logout (self ):
117117 """
@@ -127,7 +127,7 @@ def rekey(self, new_config):
127127 args = self ._config_args ()
128128 command = [str (self .transcript_exe ), '--rekey' , * args , '-y' ]
129129 self ._cmd (command )
130- self .config ['salt_method ' ] = self ._load_unversioned_config ()['salt_method ' ]
130+ self .config ['base_salt ' ] = self ._load_unversioned_config ()['base_salt ' ]
131131
132132 def display (self ):
133133 """
@@ -202,7 +202,7 @@ def _load_unversioned_config(self):
202202 'cipher' : self ._cmd ('git config --get --local transcrypt.cipher' )['out' ].strip (),
203203 'digest' : self ._cmd ('git config --get --local transcrypt.digest' )['out' ].strip (),
204204 'kdf' : self ._cmd ('git config --get --local transcrypt.kdf' )['out' ].strip (),
205- 'salt_method ' : self ._cmd ('git config --get --local transcrypt.salt-method ' )['out' ].strip (),
205+ 'base_salt ' : self ._cmd ('git config --get --local transcrypt.base-salt ' )['out' ].strip (),
206206 'password' : self ._cmd ('git config --get --local transcrypt.password' )['out' ].strip (),
207207 'openssl_path' : self ._cmd ('git config --get --local transcrypt.openssl-path' )['out' ].strip (),
208208 }
@@ -237,6 +237,8 @@ def setup(self):
237237 self ._setup_gpghome ()
238238 self ._setup_gitrepo ()
239239 self ._setup_contents ()
240+ if self .verbose > 2 :
241+ self ._show_manual_env_setup ()
240242 return self
241243
242244 def _setup_gpghome (self ):
@@ -262,6 +264,8 @@ def _setup_gpghome(self):
262264 ub .cmd ('find ' + str (self .gpg_home ) + r' -type f -exec chmod 600 {} \;' , shell = True , cwd = self .gpg_home )
263265 ub .cmd ('find ' + str (self .gpg_home ) + r' -type d -exec chmod 700 {} \;' , shell = True , cwd = self .gpg_home )
264266 self .env ['GNUPGHOME' ] = str (self .gpg_home )
267+ if self .verbose :
268+ pass
265269
266270 def _setup_gitrepo (self ):
267271 if self .verbose :
@@ -298,7 +302,7 @@ def _setup_contents(self):
298302 self .secret_fpath = self .safe_dpath / 'secret.txt'
299303 self .secret_fpath .write_text ('secret content' )
300304
301- def _manual_hack_info (self ):
305+ def _show_manual_env_setup (self ):
302306 """
303307 Info on how to get an env to run a failing command manually
304308 """
@@ -393,7 +397,7 @@ def test_rekey(self):
393397 'password' : '12345' ,
394398 'digest' : 'sha256' ,
395399 'kdf' : 'pbkdf2' ,
396- 'salt_method ' : 'random' ,
400+ 'base_salt ' : 'random' ,
397401 }
398402 raw_before = self .tc .show_raw (self .sandbox .secret_fpath )
399403 self .tc .rekey (new_config )
@@ -408,7 +412,7 @@ def test_legacy_defaults():
408412 'password' : 'correct horse battery staple' ,
409413 'digest' : 'md5' ,
410414 'kdf' : 'none' ,
411- 'salt_method ' : 'password' ,
415+ 'base_salt ' : 'password' ,
412416 }
413417 verbose = 1
414418 self = TestCases (config = config , verbose = verbose )
@@ -423,7 +427,7 @@ def test_secure_defaults():
423427 'password' : 'correct horse battery staple' ,
424428 'digest' : 'sha512' ,
425429 'kdf' : 'pbkdf2' ,
426- 'salt_method ' : 'random' ,
430+ 'base_salt ' : 'random' ,
427431 }
428432 verbose = 1
429433 self = TestCases (config = config , verbose = verbose )
@@ -438,19 +442,19 @@ def test_configured_salt_changes_on_rekey():
438442 'password' : 'correct horse battery staple' ,
439443 'digest' : 'sha512' ,
440444 'kdf' : 'pbkdf2' ,
441- 'salt_method ' : 'random' ,
445+ 'base_salt ' : 'random' ,
442446 }
443447 verbose = 1
444448 self = TestCases (config = config , verbose = verbose )
445449 self .setup ()
446450 before_config = self .tc ._load_unversioned_config ()
447- self .tc .rekey ({'password' : '12345' , 'salt_method ' : '' })
451+ self .tc .rekey ({'password' : '12345' , 'base_salt ' : '' })
448452 self .sandbox .git .commit ('-am commit rekey' )
449453 after_config = self .tc ._load_unversioned_config ()
450454 assert before_config ['password' ] != after_config ['password' ]
451455 assert before_config ['cipher' ] == after_config ['cipher' ]
452456 assert before_config ['kdf' ] == after_config ['kdf' ]
453- assert before_config ['salt_method ' ] == after_config ['salt_method ' ]
457+ assert before_config ['base_salt ' ] == after_config ['base_salt ' ]
454458 assert before_config ['openssl_path' ] == after_config ['openssl_path' ]
455459
456460
@@ -463,7 +467,7 @@ def test_configuration_grid():
463467 >>> from test_transcrypt import * # NOQA
464468 >>> self = TestCases()
465469 >>> self.setup()
466- >>> self.sandbox._manual_hack_info ()
470+ >>> self.sandbox._show_manual_env_setup ()
467471 >>> self.test_round_trip()
468472 >>> self.test_export_gpg()
469473 """
@@ -473,10 +477,10 @@ def test_configuration_grid():
473477 'password' : ['correct horse battery staple' ],
474478 'digest' : ['md5' , 'sha256' ],
475479 'kdf' : ['none' , 'pbkdf2' ],
476- 'salt_method ' : ['password' , 'random' , 'mylittlecustomsalt' ],
480+ 'base_salt ' : ['password' , 'random' , 'mylittlecustomsalt' ],
477481 }
478482 test_grid = list (ub .named_product (basis ))
479- verbose = 0
483+ verbose = 3
480484 dpath = 'special:temp'
481485 dpath = 'special:cache'
482486 for params in ub .ProgIter (test_grid , desc = 'test configs' , freq = 1 ):
@@ -485,7 +489,7 @@ def test_configuration_grid():
485489 self .setup ()
486490 if 1 :
487491 # Manual debug
488- self .sandbox ._manual_hack_info ()
492+ self .sandbox ._show_manual_env_setup ()
489493
490494 self .test_round_trip ()
491495 self .test_export_gpg ()
0 commit comments