1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-01 08:03:20 +00:00

[PS-2096] BEEEEP: Add Psono importer (#4286)

* Add psono json importer

Create types for psono export format
Add test files
Write tests for psono-json-importer
Write importer for psono export
Register 'psonojson' with `importOptions`
Import/register psono-json-importer with import.service
Add instructions on how to export from Psono

* Retain all imported data

Ensure all data is retained by adding unmapped properties into custom fields
Each item type has a set of mapped properties, anything not matching will be created as a custom field
Write extensive tests to ensure data is present

* Skipping GPG

We currently cannot import GPG Keys into notes or custom fields

* Add organizational test

Verify that folders get converted to collections when imported by an org

* Remove combined test-file (whole export)

* Remove redundant null type
This commit is contained in:
Daniel James Smith
2023-01-30 13:56:49 +01:00
committed by GitHub
parent 651968ca9c
commit b1a1068906
15 changed files with 840 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import { PsonoJsonExport } from "@bitwarden/common/importers/psono/psono-json-types";
export const ApplicationPasswordsData: PsonoJsonExport = {
folders: [],
items: [
{
type: "application_password",
name: "My App Password",
application_password_title: "My App Password",
application_password_username: "someUser",
application_password_password: "somePassword",
application_password_notes: "some notes for the APP",
create_date: "2022-12-13T19:42:05.784077Z",
write_date: "2022-12-13T19:42:05.784103Z",
callback_url: "",
callback_user: "",
callback_pass: "",
},
],
};

View File

@@ -0,0 +1,21 @@
import { PsonoJsonExport } from "@bitwarden/common/importers/psono/psono-json-types";
export const BookmarkData: PsonoJsonExport = {
folders: [],
items: [
{
type: "bookmark",
name: "MyBookmark",
urlfilter: "bitwarden.com",
bookmark_title: "MyBookmark",
bookmark_url: "https://bitwarden.com",
bookmark_notes: "my notes for bitwarden.com",
bookmark_url_filter: "bitwarden.com",
create_date: "2022-12-13T19:39:26.631530Z",
write_date: "2022-12-13T19:39:26.631553Z",
callback_url: "",
callback_user: "",
callback_pass: "",
},
],
};

View File

@@ -0,0 +1,10 @@
import { PsonoJsonExport } from "@bitwarden/common/importers/psono/psono-json-types";
export const EmptyTestFolderData: PsonoJsonExport = {
folders: [
{
name: "EmptyFolder",
items: [],
},
],
};

View File

@@ -0,0 +1,22 @@
import { PsonoJsonExport } from "@bitwarden/common/importers/psono/psono-json-types";
export const EnvVariablesData: PsonoJsonExport = {
folders: [],
items: [
{
type: "environment_variables",
name: "My Environment Variables",
environment_variables_title: "My Environment Variables",
environment_variables_variables: [
{ key: "Key1", value: "Value1" },
{ key: "Key2", value: "Value2" },
],
environment_variables_notes: "Notes for environment variables",
create_date: "2022-12-13T19:41:02.028884Z",
write_date: "2022-12-13T19:41:02.028909Z",
callback_url: "",
callback_user: "",
callback_pass: "",
},
],
};

View File

@@ -0,0 +1,53 @@
import { PsonoJsonExport } from "@bitwarden/common/importers/psono/psono-json-types";
export const FoldersTestData: PsonoJsonExport = {
folders: [
{
name: "TestFolder",
items: [
{
type: "website_password",
name: "TestEntry",
autosubmit: true,
urlfilter: "filter",
website_password_title: "TestEntry",
website_password_url: "bitwarden.com",
website_password_username: "testUser",
website_password_password: "testPassword",
website_password_notes: "some notes",
website_password_auto_submit: true,
website_password_url_filter: "filter",
create_date: "2022-12-13T19:24:09.810266Z",
write_date: "2022-12-13T19:24:09.810292Z",
callback_url: "callback",
callback_user: "callbackUser",
callback_pass: "callbackPassword",
},
],
},
{
name: "TestFolder2",
items: [
{
type: "website_password",
name: "TestEntry2",
autosubmit: true,
urlfilter: "filter",
website_password_title: "TestEntry2",
website_password_url: "bitwarden.com",
website_password_username: "testUser",
website_password_password: "testPassword",
website_password_notes: "some notes",
website_password_auto_submit: true,
website_password_url_filter: "filter",
create_date: "2022-12-13T19:24:09.810266Z",
write_date: "2022-12-13T19:24:09.810292Z",
callback_url: "callback",
callback_user: "callbackUser",
callback_pass: "callbackPassword",
},
],
},
],
items: [],
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
import { PsonoJsonExport } from "@bitwarden/common/importers/psono/psono-json-types";
export const NotesData: PsonoJsonExport = {
folders: [],
items: [
{
type: "note",
name: "My Note",
note_title: "My Note",
note_notes: "Notes for my Note",
create_date: "2022-12-13T19:41:18.770714Z",
write_date: "2022-12-13T19:41:18.770738Z",
callback_url: "",
callback_user: "",
callback_pass: "",
},
],
};

View File

@@ -0,0 +1,22 @@
import { PsonoJsonExport } from "@bitwarden/common/importers/psono/psono-json-types";
export const TOTPData: PsonoJsonExport = {
folders: [],
items: [
{
type: "totp",
name: "My TOTP",
totp_title: "My TOTP",
totp_period: 30,
totp_algorithm: "SHA1",
totp_digits: 6,
totp_code: "someSecretOfMine",
totp_notes: "Notes for TOTP",
create_date: "2022-12-13T19:41:42.972586Z",
write_date: "2022-12-13T19:41:42.972609Z",
callback_url: "",
callback_user: "",
callback_pass: "",
},
],
};

View File

@@ -0,0 +1,25 @@
import { PsonoJsonExport } from "@bitwarden/common/importers/psono/psono-json-types";
export const WebsiteLoginsData: PsonoJsonExport = {
folders: [],
items: [
{
type: "website_password",
name: "TestEntry",
autosubmit: true,
urlfilter: "filter",
website_password_title: "TestEntry",
website_password_url: "bitwarden.com",
website_password_username: "testUser",
website_password_password: "testPassword",
website_password_notes: "some notes",
website_password_auto_submit: true,
website_password_url_filter: "filter",
create_date: "2022-12-13T19:24:09.810266Z",
write_date: "2022-12-13T19:24:09.810292Z",
callback_url: "callback",
callback_user: "callbackUser",
callback_pass: "callbackPassword",
},
],
};