@@ -108,10 +108,10 @@ setVerificationCommand.addArgument(
108
108
109
109
const recoveryInfoCommand = subparsers . addParser ( 'recoveryInfo' , { addHelp : true } ) ;
110
110
recoveryInfoCommand . addArgument (
111
- [ 'pub ' ] ,
111
+ [ 'file ' ] ,
112
112
{
113
113
action : 'store' ,
114
- help : 'the backup pub (wallet key) to be recovered '
114
+ help : 'the path to the recovery file that bitgo provided '
115
115
}
116
116
) ;
117
117
@@ -376,14 +376,17 @@ const handleVerification = co(function *(args) {
376
376
} ) ;
377
377
378
378
const handleRecoveryInfo = co ( function * ( args ) {
379
- const walletkey = yield WalletKey . findOne ( { pub : args . pub } ) ;
379
+ const json = JSON . parse ( fs . readFileSync ( args . file ) ) ;
380
+ const pub = json . backupKey ;
381
+ const walletkey = yield WalletKey . findOne ( { pub } ) ;
380
382
const masterkey = yield MasterKey . findOne ( { pub : walletkey . masterKey } ) ;
381
-
382
- const outfile = { walletkey, masterkey } ;
383
- const filename = 'recovery-key-info.json' ;
384
- console . log ( 'Got info... writing file ' + filename ) ;
385
- fs . writeFileSync ( filename , JSON . stringify ( outfile , null , 2 ) ) ;
386
- console . log ( 'Done' ) ;
383
+ json . masterkey = masterkey . pub ;
384
+ json . masterkeypath = masterkey . path ;
385
+ json . walletkeypath = walletkey . path ;
386
+ const filename = args . file . substring ( 0 , args . file . length - 5 ) + '-prepared.json' ;
387
+ console . log ( 'got info... writing file ' + filename ) ;
388
+ fs . writeFileSync ( filename , JSON . stringify ( json , null , 2 ) ) ;
389
+ console . log ( 'done.' ) ;
387
390
} ) ;
388
391
389
392
const requireDB = function ( ) {
0 commit comments