Exemplo n.º 1
0
 .then(db => {
     this.db = db;
     this.readModel();
     this.setOpenFile({ passwordLength: password ? password.textLength : 0 });
     if (keyFileData) {
         kdbxweb.ByteUtils.zeroBuffer(keyFileData);
     }
     logger.info('Opened file ' + this.get('name') + ': ' + logger.ts(ts) + ', ' +
         this.kdfArgsToString(db.header) + ', ' + Math.round(fileData.byteLength / 1024) + ' kB');
     callback();
 })
Exemplo n.º 2
0
 kdbxweb.Kdbx.load(fileData, credentials, (function(db, err) {
     if (err) {
         if (err.code === kdbxweb.Consts.ErrorCodes.InvalidKey && password && !password.byteLength) {
             logger.info('Error opening file with empty password, try to open with null password');
             return this.open(null, fileData, keyFileData, callback);
         }
         logger.error('Error opening file', err.code, err.message, err);
         callback(err);
     } else {
         this.db = db;
         this.readModel();
         this.setOpenFile({ passwordLength: password ? password.textLength : 0 });
         if (keyFileData) {
             kdbxweb.ByteUtils.zeroBuffer(keyFileData);
         }
         logger.info('Opened file ' + this.get('name') + ': ' + logger.ts(ts) + ', ' +
             db.header.keyEncryptionRounds + ' rounds, ' + Math.round(fileData.byteLength / 1024) + ' kB');
         callback();
     }
 }).bind(this));