diff --git a/libs/importer/spec/onepassword-1pux-importer.spec.ts b/libs/importer/spec/onepassword-1pux-importer.spec.ts index fe1b2801bdf..93de4be606b 100644 --- a/libs/importer/spec/onepassword-1pux-importer.spec.ts +++ b/libs/importer/spec/onepassword-1pux-importer.spec.ts @@ -56,6 +56,16 @@ describe("1Password 1Pux Importer", () => { const SecureNoteDataJson = JSON.stringify(SecureNoteData); const SanitizedExportJson = JSON.stringify(SanitizedExport); + it("should not import items with state 'archived'", async () => { + const importer = new OnePassword1PuxImporter(); + const archivedLoginData = LoginData; + archivedLoginData["accounts"][0]["vaults"][0]["items"][0]["state"] = "archived"; + const archivedDataJson = JSON.stringify(archivedLoginData); + const result = await importer.parse(archivedDataJson); + expect(result != null).toBe(true); + expect(result.ciphers.length).toBe(0); + }); + it("should parse login data", async () => { const importer = new OnePassword1PuxImporter(); const result = await importer.parse(LoginDataJson); diff --git a/libs/importer/spec/test-data/onepassword-1pux/api-credentials.ts b/libs/importer/spec/test-data/onepassword-1pux/api-credentials.ts index 49269e72fa0..7a830194b8c 100644 --- a/libs/importer/spec/test-data/onepassword-1pux/api-credentials.ts +++ b/libs/importer/spec/test-data/onepassword-1pux/api-credentials.ts @@ -26,7 +26,7 @@ export const APICredentialsData: ExportData = { favIndex: 0, createdAt: 1619465969, updatedAt: 1619466052, - trashed: false, + state: "active", categoryUuid: "112", details: { loginFields: [], @@ -41,7 +41,6 @@ export const APICredentialsData: ExportData = { value: { string: "apiuser@nullvalue.test", }, - indexAtSource: 0, guarded: true, multiline: false, dontGenerate: false, @@ -57,7 +56,6 @@ export const APICredentialsData: ExportData = { value: { concealed: "apiapiapiapiapiapiappy", }, - indexAtSource: 1, guarded: true, multiline: false, dontGenerate: true, @@ -73,7 +71,6 @@ export const APICredentialsData: ExportData = { value: { menu: "jwt", }, - indexAtSource: 2, guarded: false, multiline: false, dontGenerate: false, @@ -89,7 +86,6 @@ export const APICredentialsData: ExportData = { value: { string: "filename.jwt", }, - indexAtSource: 3, guarded: false, multiline: false, dontGenerate: false, @@ -105,7 +101,6 @@ export const APICredentialsData: ExportData = { value: { date: 1301918460, }, - indexAtSource: 4, guarded: false, multiline: false, dontGenerate: false, @@ -121,7 +116,6 @@ export const APICredentialsData: ExportData = { value: { date: 1932811260, }, - indexAtSource: 5, guarded: false, multiline: false, dontGenerate: false, @@ -137,7 +131,6 @@ export const APICredentialsData: ExportData = { value: { string: "not.your.everyday.hostname", }, - indexAtSource: 6, guarded: false, multiline: false, dontGenerate: false, diff --git a/libs/importer/spec/test-data/onepassword-1pux/bank-account.ts b/libs/importer/spec/test-data/onepassword-1pux/bank-account.ts index 7f3d8c080cd..6ffccafe514 100644 --- a/libs/importer/spec/test-data/onepassword-1pux/bank-account.ts +++ b/libs/importer/spec/test-data/onepassword-1pux/bank-account.ts @@ -26,7 +26,7 @@ export const BankAccountData: ExportData = { favIndex: 0, createdAt: 1619466056, updatedAt: 1619466187, - trashed: false, + state: "active", categoryUuid: "101", details: { loginFields: [], @@ -41,7 +41,6 @@ export const BankAccountData: ExportData = { value: { string: "Super Credit Union", }, - indexAtSource: 0, guarded: false, multiline: false, dontGenerate: false, @@ -57,7 +56,6 @@ export const BankAccountData: ExportData = { value: { string: "Cool Guy", }, - indexAtSource: 1, guarded: false, multiline: false, dontGenerate: false, @@ -73,7 +71,6 @@ export const BankAccountData: ExportData = { value: { menu: "checking", }, - indexAtSource: 2, guarded: false, multiline: false, dontGenerate: false, @@ -89,7 +86,6 @@ export const BankAccountData: ExportData = { value: { string: "111000999", }, - indexAtSource: 3, guarded: false, multiline: false, dontGenerate: false, @@ -105,7 +101,6 @@ export const BankAccountData: ExportData = { value: { string: "192837465918273645", }, - indexAtSource: 4, guarded: false, multiline: false, dontGenerate: false, @@ -121,7 +116,6 @@ export const BankAccountData: ExportData = { value: { string: "123456", }, - indexAtSource: 5, guarded: false, multiline: false, dontGenerate: false, @@ -137,7 +131,6 @@ export const BankAccountData: ExportData = { value: { string: "DE12 123456", }, - indexAtSource: 6, guarded: false, multiline: false, dontGenerate: false, @@ -153,7 +146,6 @@ export const BankAccountData: ExportData = { value: { concealed: "5555", }, - indexAtSource: 7, guarded: false, multiline: false, dontGenerate: true, @@ -175,7 +167,6 @@ export const BankAccountData: ExportData = { value: { phone: "9399399933", }, - indexAtSource: 0, guarded: false, multiline: false, dontGenerate: false, @@ -191,7 +182,6 @@ export const BankAccountData: ExportData = { value: { string: "1 Fifth Avenue", }, - indexAtSource: 1, guarded: false, multiline: false, dontGenerate: false, diff --git a/libs/importer/spec/test-data/onepassword-1pux/credit-card.ts b/libs/importer/spec/test-data/onepassword-1pux/credit-card.ts index 80258f13f05..74af97a4c2b 100644 --- a/libs/importer/spec/test-data/onepassword-1pux/credit-card.ts +++ b/libs/importer/spec/test-data/onepassword-1pux/credit-card.ts @@ -26,7 +26,7 @@ export const CreditCardData: ExportData = { favIndex: 0, createdAt: 1619465282, updatedAt: 1619465447, - trashed: false, + state: "active", categoryUuid: "002", details: { loginFields: [], @@ -41,7 +41,6 @@ export const CreditCardData: ExportData = { value: { string: "Fred Engels", }, - indexAtSource: 0, guarded: true, multiline: false, dontGenerate: false, @@ -57,7 +56,6 @@ export const CreditCardData: ExportData = { value: { creditCardType: "discover", }, - indexAtSource: 1, guarded: true, multiline: false, dontGenerate: false, @@ -73,7 +71,6 @@ export const CreditCardData: ExportData = { value: { creditCardNumber: "6011111111111117", }, - indexAtSource: 2, guarded: true, clipboardFilter: "0123456789", multiline: false, @@ -90,7 +87,6 @@ export const CreditCardData: ExportData = { value: { concealed: "1312", }, - indexAtSource: 3, guarded: true, multiline: false, dontGenerate: true, @@ -106,7 +102,6 @@ export const CreditCardData: ExportData = { value: { monthYear: 209912, }, - indexAtSource: 4, guarded: true, multiline: false, dontGenerate: false, @@ -122,7 +117,6 @@ export const CreditCardData: ExportData = { value: { monthYear: 200101, }, - indexAtSource: 5, guarded: true, multiline: false, dontGenerate: false, @@ -138,7 +132,6 @@ export const CreditCardData: ExportData = { value: { string: "card", }, - indexAtSource: 6, guarded: false, multiline: false, dontGenerate: false, @@ -160,7 +153,6 @@ export const CreditCardData: ExportData = { value: { string: "Some bank", }, - indexAtSource: 0, guarded: false, multiline: false, dontGenerate: false, @@ -176,7 +168,6 @@ export const CreditCardData: ExportData = { value: { phone: "123456", }, - indexAtSource: 1, guarded: false, multiline: false, dontGenerate: false, @@ -192,7 +183,6 @@ export const CreditCardData: ExportData = { value: { phone: "0800123456", }, - indexAtSource: 2, guarded: false, multiline: false, dontGenerate: false, @@ -208,7 +198,6 @@ export const CreditCardData: ExportData = { value: { phone: "+49123456", }, - indexAtSource: 3, guarded: false, multiline: false, dontGenerate: false, @@ -224,7 +213,6 @@ export const CreditCardData: ExportData = { value: { url: "somebank.com", }, - indexAtSource: 4, guarded: false, multiline: false, dontGenerate: false, @@ -246,7 +234,6 @@ export const CreditCardData: ExportData = { value: { concealed: "1234", }, - indexAtSource: 0, guarded: false, multiline: false, dontGenerate: true, @@ -262,7 +249,6 @@ export const CreditCardData: ExportData = { value: { string: "$1312", }, - indexAtSource: 1, guarded: false, multiline: false, dontGenerate: false, @@ -278,7 +264,6 @@ export const CreditCardData: ExportData = { value: { string: "$500", }, - indexAtSource: 2, guarded: false, multiline: false, dontGenerate: false, @@ -294,7 +279,6 @@ export const CreditCardData: ExportData = { value: { string: "1%", }, - indexAtSource: 3, guarded: false, multiline: false, dontGenerate: false, @@ -310,7 +294,6 @@ export const CreditCardData: ExportData = { value: { string: "123456", }, - indexAtSource: 4, guarded: false, multiline: false, dontGenerate: false, diff --git a/libs/importer/spec/test-data/onepassword-1pux/database.ts b/libs/importer/spec/test-data/onepassword-1pux/database.ts index 17b6700bf6d..58631a2f98b 100644 --- a/libs/importer/spec/test-data/onepassword-1pux/database.ts +++ b/libs/importer/spec/test-data/onepassword-1pux/database.ts @@ -26,7 +26,7 @@ export const DatabaseData: ExportData = { favIndex: 0, createdAt: 1619466193, updatedAt: 1619466276, - trashed: false, + state: "active", categoryUuid: "102", details: { loginFields: [], @@ -41,7 +41,6 @@ export const DatabaseData: ExportData = { value: { menu: "postgresql", }, - indexAtSource: 0, guarded: false, multiline: false, dontGenerate: false, @@ -57,7 +56,6 @@ export const DatabaseData: ExportData = { value: { string: "my.secret.db.server", }, - indexAtSource: 1, guarded: false, multiline: false, dontGenerate: false, @@ -73,7 +71,6 @@ export const DatabaseData: ExportData = { value: { string: "1337", }, - indexAtSource: 2, guarded: false, multiline: false, dontGenerate: false, @@ -89,7 +86,6 @@ export const DatabaseData: ExportData = { value: { string: "user_database", }, - indexAtSource: 3, guarded: false, multiline: false, dontGenerate: false, @@ -105,7 +101,6 @@ export const DatabaseData: ExportData = { value: { string: "cooldbuser", }, - indexAtSource: 4, guarded: false, multiline: false, dontGenerate: false, @@ -121,7 +116,6 @@ export const DatabaseData: ExportData = { value: { concealed: "^+kTjhLaN7wVPAhGU)*J", }, - indexAtSource: 5, guarded: false, multiline: false, dontGenerate: false, @@ -137,7 +131,6 @@ export const DatabaseData: ExportData = { value: { string: "ASDIUFU-283234", }, - indexAtSource: 6, guarded: false, multiline: false, dontGenerate: false, @@ -153,7 +146,6 @@ export const DatabaseData: ExportData = { value: { string: "cdbu", }, - indexAtSource: 7, guarded: false, multiline: false, dontGenerate: false, @@ -169,7 +161,6 @@ export const DatabaseData: ExportData = { value: { string: "ssh", }, - indexAtSource: 8, guarded: false, multiline: false, dontGenerate: false, diff --git a/libs/importer/spec/test-data/onepassword-1pux/drivers-license.ts b/libs/importer/spec/test-data/onepassword-1pux/drivers-license.ts index 9f7260d63d3..54a52f36999 100644 --- a/libs/importer/spec/test-data/onepassword-1pux/drivers-license.ts +++ b/libs/importer/spec/test-data/onepassword-1pux/drivers-license.ts @@ -26,7 +26,7 @@ export const DriversLicenseData: ExportData = { favIndex: 0, createdAt: 1619466279, updatedAt: 1619466425, - trashed: false, + state: "active", categoryUuid: "103", details: { loginFields: [], @@ -41,7 +41,6 @@ export const DriversLicenseData: ExportData = { value: { string: "Michael Scarn", }, - indexAtSource: 0, guarded: false, multiline: false, dontGenerate: false, @@ -57,7 +56,6 @@ export const DriversLicenseData: ExportData = { value: { string: "2120 Mifflin Rd.", }, - indexAtSource: 1, guarded: false, multiline: false, dontGenerate: false, @@ -73,7 +71,6 @@ export const DriversLicenseData: ExportData = { value: { date: 252504060, }, - indexAtSource: 2, guarded: false, multiline: false, dontGenerate: false, @@ -89,7 +86,6 @@ export const DriversLicenseData: ExportData = { value: { gender: "male", }, - indexAtSource: 3, guarded: false, multiline: false, dontGenerate: false, @@ -105,7 +101,6 @@ export const DriversLicenseData: ExportData = { value: { string: "5'11\"", }, - indexAtSource: 4, guarded: false, multiline: false, dontGenerate: false, @@ -121,7 +116,6 @@ export const DriversLicenseData: ExportData = { value: { string: "12345678901", }, - indexAtSource: 5, guarded: false, multiline: false, dontGenerate: false, @@ -137,7 +131,6 @@ export const DriversLicenseData: ExportData = { value: { string: "C", }, - indexAtSource: 6, guarded: false, multiline: false, dontGenerate: false, @@ -153,7 +146,6 @@ export const DriversLicenseData: ExportData = { value: { string: "B", }, - indexAtSource: 7, guarded: false, multiline: false, dontGenerate: false, @@ -169,7 +161,6 @@ export const DriversLicenseData: ExportData = { value: { string: "Pennsylvania", }, - indexAtSource: 8, guarded: false, multiline: false, dontGenerate: false, @@ -185,7 +176,6 @@ export const DriversLicenseData: ExportData = { value: { string: "United States", }, - indexAtSource: 9, guarded: false, multiline: false, dontGenerate: false, @@ -201,7 +191,6 @@ export const DriversLicenseData: ExportData = { value: { monthYear: 203012, }, - indexAtSource: 10, guarded: false, multiline: false, dontGenerate: false, diff --git a/libs/importer/spec/test-data/onepassword-1pux/email-account.ts b/libs/importer/spec/test-data/onepassword-1pux/email-account.ts index a6de6b55b22..0d94973ec29 100644 --- a/libs/importer/spec/test-data/onepassword-1pux/email-account.ts +++ b/libs/importer/spec/test-data/onepassword-1pux/email-account.ts @@ -26,7 +26,7 @@ export const EmailAccountData: ExportData = { favIndex: 0, createdAt: 1619466428, updatedAt: 1619466585, - trashed: false, + state: "active", categoryUuid: "111", details: { loginFields: [], @@ -41,7 +41,6 @@ export const EmailAccountData: ExportData = { value: { menu: "either", }, - indexAtSource: 0, guarded: false, multiline: false, dontGenerate: false, @@ -57,7 +56,6 @@ export const EmailAccountData: ExportData = { value: { string: "someuser@nullvalue.test", }, - indexAtSource: 1, guarded: false, multiline: false, dontGenerate: false, @@ -73,7 +71,6 @@ export const EmailAccountData: ExportData = { value: { string: "mailserver.nullvalue.test", }, - indexAtSource: 2, guarded: false, multiline: false, dontGenerate: false, @@ -89,7 +86,6 @@ export const EmailAccountData: ExportData = { value: { string: "587", }, - indexAtSource: 3, guarded: false, multiline: false, dontGenerate: false, @@ -105,7 +101,6 @@ export const EmailAccountData: ExportData = { value: { concealed: "u1jsf v.attrs.type === VaultAttributeTypeEnum.Personal); account.vaults.forEach((vault: VaultsEntity) => { vault.items.forEach((item: Item) => { - if (item.trashed === true) { + if (item.state === "archived") { return; } diff --git a/libs/importer/src/importers/onepassword/types/onepassword-1pux-importer-types.ts b/libs/importer/src/importers/onepassword/types/onepassword-1pux-importer-types.ts index ebb52386545..353fcf1337e 100644 --- a/libs/importer/src/importers/onepassword/types/onepassword-1pux-importer-types.ts +++ b/libs/importer/src/importers/onepassword/types/onepassword-1pux-importer-types.ts @@ -53,7 +53,7 @@ export interface Item { favIndex: number; createdAt: number; updatedAt: number; - trashed?: boolean; + state: "active" | "archived"; categoryUuid: string; details: Details; overview: Overview; @@ -88,12 +88,12 @@ export interface SectionsEntity { title: string; name?: string | null; fields?: FieldsEntity[] | null; + hideAddAnotherField?: boolean | null; } export interface FieldsEntity { title: string; id: string; value: Value; - indexAtSource: number; guarded: boolean; multiline: boolean; dontGenerate: boolean; @@ -153,6 +153,8 @@ export interface Overview { pbe?: number | null; pgrng?: boolean | null; tags?: string[] | null; + icons?: string | null; + watchtowerExclusions?: string | null; } export interface UrlsEntity { label: string;