@@ -19,15 +19,13 @@ export class UtilsSecret {
1919 public setEncryptSecret ( passphrase : string ) : void {
2020 try {
2121 let oldpassphrase = this . getPassphrase ( ) ;
22- console . log ( `>>>> setEncryptSecret oldpassphrase: ${ oldpassphrase } ` )
2322 if ( oldpassphrase . length > 0 ) {
2423 throw new Error ( `setEncryptSecret: passphrase already stored` ) ;
2524 } else {
2625 oldpassphrase = this . globalUtil != null ? this . globalUtil . secret : "" ;
2726 if ( oldpassphrase . length <= 0 ) {
2827 throw new Error ( `setEncryptSecret: globalUtil is null` ) ;
2928 }
30- console . log ( `>>>> setEncryptSecret oldpassphrase: ${ oldpassphrase } , passphrase ${ passphrase } ` )
3129 // check if some databases were encrypted with the initial secret 'sqlite secret'
3230 this . changeDatabaseSecret ( oldpassphrase , passphrase ) . then ( ( ) => {
3331
@@ -82,20 +80,13 @@ export class UtilsSecret {
8280 }
8381 private async changeDatabaseSecret ( oldpassphrase : string , newpassphrase : string ) : Promise < void > {
8482 try {
85- console . log ( `>>> changeDatabaseSecret oldpassphrase: ${ oldpassphrase } ` ) ;
86- console . log ( `>>> changeDatabaseSecret newpassphrase: ${ newpassphrase } ` ) ;
8783 // get the database folder
8884 const pathDatabase = this . fileUtil . getDatabasesPath ( ) ;
89- console . log ( `>>> changeDatabaseSecret pathDatabase: ${ pathDatabase } ` ) ;
9085 // get the list of databases
9186 const files : string [ ] = await this . fileUtil . getFileList ( pathDatabase ) ;
92- console . log ( `>>> changeDatabaseSecret files: ${ files } ` ) ;
93- files . forEach ( dbName => {
94- console . log ( `>>> changeDatabaseSecret dbName: ${ dbName } ` ) ;
87+ files . forEach ( async dbName => {
9588 const filePath = this . fileUtil . getFilePath ( dbName ) ;
96- console . log ( `>>> changeDatabaseSecret filePath: ${ filePath } ` ) ;
97- const isEncrypt : boolean = this . sqliteUtil . isDBEncrypted ( filePath ) ;
98- console . log ( `>>> changeDatabaseSecret isEncrypt: ${ isEncrypt } ` ) ;
89+ const isEncrypt : boolean = await this . sqliteUtil . isDBEncrypted ( filePath ) ;
9990 if ( isEncrypt ) {
10091
10192 this . sqliteUtil . changePassword ( filePath , oldpassphrase , newpassphrase ) ;
@@ -108,7 +99,6 @@ export class UtilsSecret {
10899 }
109100 public getPassphrase ( ) : string {
110101 const data = this . storage . getSync ( 'userData' ) ;
111- console . log ( `>>>>>> data: ` , data )
112102 const keys = Object . keys ( data ) ;
113103 if ( data == null || keys . length <= 0 ) return "" ;
114104 if ( Object . keys ( data ) . includes ( 'passphrase' ) ) {
@@ -120,15 +110,13 @@ export class UtilsSecret {
120110 public setPassphrase ( passphrase : string ) : void {
121111 const data = this . storage . getSync ( 'userData' ) ;
122112 data . passphrase = passphrase ;
123- console . log ( `>>>>>> set data: ` , data )
124113 this . storage . set ( 'userData' , data , function ( error :any ) {
125114 if ( error ) throw new Error ( `setPassphrase: ${ error . message } ` ) ;
126115 } ) ;
127116 }
128117 public removePassphrase ( ) : void {
129118 const data = this . storage . getSync ( 'userData' ) ;
130119 delete data . passphrase ;
131- console . log ( `>>>>>> set data: ` , data )
132120 this . storage . set ( 'userData' , data , function ( error :any ) {
133121 if ( error ) throw new Error ( `removePassphrase: ${ error . message } ` ) ;
134122 } ) ;
0 commit comments