1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-26 22:33:44 +00:00

add decryption errors from sdk

This commit is contained in:
Nick Krantz
2026-01-22 11:30:00 -06:00
parent 6f463e5fbc
commit 9563ca745c
4 changed files with 24 additions and 14 deletions

View File

@@ -85,7 +85,10 @@ export class AttachmentView implements View {
/**
* Converts the SDK AttachmentView to a AttachmentView.
*/
static fromSdkAttachmentView(obj: SdkAttachmentView): AttachmentView | undefined {
static fromSdkAttachmentView(
obj: SdkAttachmentView,
failure = false,
): AttachmentView | undefined {
if (!obj) {
return undefined;
}
@@ -99,7 +102,7 @@ export class AttachmentView implements View {
// TODO: PM-23005 - Temporary field, should be removed when encrypted migration is complete
view.key = obj.decryptedKey ? SymmetricCryptoKey.fromString(obj.decryptedKey) : undefined;
view.encryptedKey = obj.key ? new EncString(obj.key) : undefined;
view._hasDecryptionError = obj.decryptionFailure;
view._hasDecryptionError = failure;
return view;
}

View File

@@ -275,6 +275,14 @@ export class CipherView implements View, InitializerMetadata {
return undefined;
}
const attachments = obj.attachments?.map((a) => AttachmentView.fromSdkAttachmentView(a)) ?? [];
if (obj.attachmentDecryptionFailures?.length) {
obj.attachmentDecryptionFailures.forEach((attachment) => {
attachments.push(AttachmentView.fromSdkAttachmentView(attachment, true)!);
});
}
const cipherView = new CipherView();
cipherView.id = uuidAsString(obj.id);
cipherView.organizationId = uuidAsString(obj.organizationId);
@@ -290,8 +298,7 @@ export class CipherView implements View, InitializerMetadata {
cipherView.edit = obj.edit;
cipherView.viewPassword = obj.viewPassword;
cipherView.localData = fromSdkLocalData(obj.localData);
cipherView.attachments =
obj.attachments?.map((a) => AttachmentView.fromSdkAttachmentView(a)!) ?? [];
cipherView.attachments = attachments;
cipherView.fields = obj.fields?.map((f) => FieldView.fromSdkFieldView(f)!) ?? [];
cipherView.passwordHistory =
obj.passwordHistory?.map((ph) => PasswordHistoryView.fromSdkPasswordHistoryView(ph)!) ?? [];

16
package-lock.json generated
View File

@@ -23,8 +23,8 @@
"@angular/platform-browser": "20.3.15",
"@angular/platform-browser-dynamic": "20.3.15",
"@angular/router": "20.3.15",
"@bitwarden/commercial-sdk-internal": "0.2.0-main.470",
"@bitwarden/sdk-internal": "0.2.0-main.470",
"@bitwarden/commercial-sdk-internal": "0.2.0-main.492",
"@bitwarden/sdk-internal": "0.2.0-main.492",
"@electron/fuses": "1.8.0",
"@emotion/css": "11.13.5",
"@koa/multer": "4.0.0",
@@ -4982,9 +4982,9 @@
"link": true
},
"node_modules/@bitwarden/commercial-sdk-internal": {
"version": "0.2.0-main.470",
"resolved": "https://registry.npmjs.org/@bitwarden/commercial-sdk-internal/-/commercial-sdk-internal-0.2.0-main.470.tgz",
"integrity": "sha512-QYhxv5eX6ouFJv94gMtBW7MjuK6t2KAN9FLz+/w1wnq8dScnA9Iky25phNPw+iHMgWwhq/dzZq45asKUFF//oA==",
"version": "0.2.0-main.492",
"resolved": "https://registry.npmjs.org/@bitwarden/commercial-sdk-internal/-/commercial-sdk-internal-0.2.0-main.492.tgz",
"integrity": "sha512-Uyi49LzHuBBm4ZmILjGlfMHjXrTHYuHoUpu1cN0/W12NQMveL5oI8sZZnZQuo/VEWqdpJ9qNWsDSgMH+wMf+FQ==",
"license": "BITWARDEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT",
"dependencies": {
"type-fest": "^4.41.0"
@@ -5087,9 +5087,9 @@
"link": true
},
"node_modules/@bitwarden/sdk-internal": {
"version": "0.2.0-main.470",
"resolved": "https://registry.npmjs.org/@bitwarden/sdk-internal/-/sdk-internal-0.2.0-main.470.tgz",
"integrity": "sha512-XKvcUtoU6NnxeEzl3WK7bATiCh2RNxRmuX6JYNgcQHUtHUH+x3ckToR6II1qM3nha0VH0u1ijy3+07UdNQM+JQ==",
"version": "0.2.0-main.492",
"resolved": "https://registry.npmjs.org/@bitwarden/sdk-internal/-/sdk-internal-0.2.0-main.492.tgz",
"integrity": "sha512-DnaaurPhS8zxwCeYKJ0qxHMGOqRHCzSCibT4a9Su5H+OLCAiC2mKHwVUf/i4tmwZVEBI3YER/i0oVtYY/sczBQ==",
"license": "GPL-3.0",
"dependencies": {
"type-fest": "^4.41.0"

View File

@@ -162,8 +162,8 @@
"@angular/platform-browser": "20.3.15",
"@angular/platform-browser-dynamic": "20.3.15",
"@angular/router": "20.3.15",
"@bitwarden/sdk-internal": "0.2.0-main.470",
"@bitwarden/commercial-sdk-internal": "0.2.0-main.470",
"@bitwarden/sdk-internal": "0.2.0-main.492",
"@bitwarden/commercial-sdk-internal": "0.2.0-main.492",
"@electron/fuses": "1.8.0",
"@emotion/css": "11.13.5",
"@koa/multer": "4.0.0",