mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-11 10:10:25 +01:00
[PM-10791] Set favorite on import from ProtonPass (#10480)
* Update import test data with new fields Add new fields to the types file * Set favorites when importing from ProtonPass --------- Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
parent
a3d2bb60d1
commit
3ef1080754
@ -116,4 +116,14 @@ describe("Protonpass Json Importer", () => {
|
||||
|
||||
expect(ciphers.length).toBe(4);
|
||||
});
|
||||
|
||||
it("should set favorites", async () => {
|
||||
const testDataJson = JSON.stringify(testData);
|
||||
const result = await importer.parse(testDataJson);
|
||||
|
||||
const ciphers = result.ciphers;
|
||||
expect(ciphers[0].favorite).toBe(true);
|
||||
expect(ciphers[1].favorite).toBe(false);
|
||||
expect(ciphers[2].favorite).toBe(true);
|
||||
});
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { ProtonPassJsonFile } from "../../../src/importers/protonpass/types/protonpass-json-type";
|
||||
|
||||
export const testData: ProtonPassJsonFile = {
|
||||
version: "1.3.1",
|
||||
version: "1.21.2",
|
||||
userId: "REDACTED_USER_ID",
|
||||
encrypted: false,
|
||||
vaults: {
|
||||
@ -54,6 +54,7 @@ export const testData: ProtonPassJsonFile = {
|
||||
urls: ["https://example.com/", "https://example2.com/"],
|
||||
totpUri:
|
||||
"otpauth://totp/Test%20Login%20-%20Personal%20Vault:Username?issuer=Test%20Login%20-%20Personal%20Vault&secret=TOTPCODE&algorithm=SHA1&digits=6&period=30",
|
||||
passkeys: [],
|
||||
itemUsername: "Username",
|
||||
},
|
||||
},
|
||||
@ -62,6 +63,7 @@ export const testData: ProtonPassJsonFile = {
|
||||
contentFormatVersion: 1,
|
||||
createTime: 1689182868,
|
||||
modifyTime: 1689182868,
|
||||
pinned: true,
|
||||
},
|
||||
{
|
||||
itemId:
|
||||
@ -83,6 +85,7 @@ export const testData: ProtonPassJsonFile = {
|
||||
contentFormatVersion: 1,
|
||||
createTime: 1689182908,
|
||||
modifyTime: 1689182908,
|
||||
pinned: false,
|
||||
},
|
||||
{
|
||||
itemId:
|
||||
@ -111,6 +114,7 @@ export const testData: ProtonPassJsonFile = {
|
||||
contentFormatVersion: 1,
|
||||
createTime: 1691001643,
|
||||
modifyTime: 1691001643,
|
||||
pinned: true,
|
||||
},
|
||||
{
|
||||
itemId:
|
||||
@ -132,6 +136,7 @@ export const testData: ProtonPassJsonFile = {
|
||||
contentFormatVersion: 1,
|
||||
createTime: 1689182908,
|
||||
modifyTime: 1689182908,
|
||||
pinned: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -161,6 +166,7 @@ export const testData: ProtonPassJsonFile = {
|
||||
password: "other vault password",
|
||||
urls: [],
|
||||
totpUri: "JBSWY3DPEHPK3PXP",
|
||||
passkeys: [],
|
||||
itemUsername: "",
|
||||
},
|
||||
},
|
||||
@ -169,6 +175,7 @@ export const testData: ProtonPassJsonFile = {
|
||||
contentFormatVersion: 1,
|
||||
createTime: 1689182949,
|
||||
modifyTime: 1689182949,
|
||||
pinned: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -43,6 +43,7 @@ export class ProtonPassJsonImporter extends BaseImporter implements Importer {
|
||||
const cipher = this.initLoginCipher();
|
||||
cipher.name = this.getValueOrDefault(item.data.metadata.name, "--");
|
||||
cipher.notes = this.getValueOrDefault(item.data.metadata.note);
|
||||
cipher.favorite = item.pinned;
|
||||
|
||||
switch (item.data.type) {
|
||||
case "login": {
|
||||
|
@ -24,6 +24,7 @@ export type ProtonPassItem = {
|
||||
contentFormatVersion: number;
|
||||
createTime: number;
|
||||
modifyTime: number;
|
||||
pinned: boolean;
|
||||
};
|
||||
|
||||
export enum ProtonPassItemState {
|
||||
@ -34,6 +35,7 @@ export enum ProtonPassItemState {
|
||||
export type ProtonPassItemData = {
|
||||
metadata: ProtonPassItemMetadata;
|
||||
extraFields: ProtonPassItemExtraField[];
|
||||
platformSpecific?: any;
|
||||
type: "login" | "alias" | "creditCard" | "note";
|
||||
content: ProtonPassLoginItemContent | ProtonPassCreditCardItemContent;
|
||||
};
|
||||
@ -60,6 +62,7 @@ export type ProtonPassLoginItemContent = {
|
||||
password?: string;
|
||||
urls?: string[];
|
||||
totpUri?: string;
|
||||
passkeys: [];
|
||||
itemUsername?: string;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user