Add info on the item failing the parse when importing from LastPass (#9068)
* Added more error log info into methods called on openVault from LastPass Direct importer
* Adding error messages to help identify errors on the ParseAccounts and ParseShar methods from the lastpass importer parser.ts
* removed unintended throw
* Revert "Added more error log info into methods called on openVault from LastPass Direct importer"
This reverts commit dc83722c2f
.
* Cleaned up error messages on LastPass's parser.ts
* throwing the error message if it exists on the Error object
* Using const on name instead let on parseShar
This commit is contained in:
parent
adf7a38f87
commit
4e1173d5cf
|
@ -32,12 +32,14 @@ export class Parser {
|
|||
folder: SharedFolder,
|
||||
options: ParserOptions,
|
||||
): Promise<Account> {
|
||||
let id: string;
|
||||
try {
|
||||
const placeholder = "decryption failed";
|
||||
const reader = new BinaryReader(chunk.payload);
|
||||
|
||||
// Read all items
|
||||
// 0: id
|
||||
const id = Utils.fromBufferToUtf8(this.readItem(reader));
|
||||
id = Utils.fromBufferToUtf8(this.readItem(reader));
|
||||
|
||||
// 1: name
|
||||
const name = await this.cryptoUtils.decryptAes256PlainWithDefault(
|
||||
|
@ -239,6 +241,11 @@ export class Parser {
|
|||
account.isFavorite = isFavorite;
|
||||
account.isShared = folder != null;
|
||||
return account;
|
||||
} catch (err) {
|
||||
throw new Error(
|
||||
"Error parsing accounts on item with ID:" + id + " errorMessage: " + err.message,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async parseShar(
|
||||
|
@ -246,10 +253,12 @@ export class Parser {
|
|||
encryptionKey: Uint8Array,
|
||||
rsaKey: Uint8Array,
|
||||
): Promise<SharedFolder> {
|
||||
let id: string;
|
||||
try {
|
||||
const reader = new BinaryReader(chunk.payload);
|
||||
|
||||
// Id
|
||||
const id = Utils.fromBufferToUtf8(this.readItem(reader));
|
||||
id = Utils.fromBufferToUtf8(this.readItem(reader));
|
||||
|
||||
// Key
|
||||
const folderKey = this.readItem(reader);
|
||||
|
@ -270,6 +279,11 @@ export class Parser {
|
|||
folder.name = name;
|
||||
folder.encryptionKey = key;
|
||||
return folder;
|
||||
} catch (err) {
|
||||
throw new Error(
|
||||
"Error parsing shared folder with ID:" + id + " errorMessage: " + err.message,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async parseEncryptedPrivateKey(encryptedPrivateKey: string, encryptionKey: Uint8Array) {
|
||||
|
|
Loading…
Reference in New Issue