Skip to content

Commit

Permalink
[PM-3438] Vault exports (#561)
Browse files Browse the repository at this point in the history
Vault export implementation.

New crate `bitwarden-exporters` which defines it's own data structure,
isolating it from the other code areas. It primarily focuses on
converting a data model to csv and json. Currently all data has to be
decrypted independently of what is required for the export which is an
area of improvement for the future.
  • Loading branch information
Hinton authored Feb 6, 2024
1 parent b98a019 commit 714c2d4
Show file tree
Hide file tree
Showing 19 changed files with 1,685 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ schemas
/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts
about.hbs
support/docs/template.hbs

# Test fixtures
crates/bitwarden-exporters/resources/*
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
"Pbkdf",
"PKCS8",
"repr",
"reprompt",
"reqwest",
"schemars",
"totp",
"uniffi",
"wordlist",
"zxcvbn"
Expand Down
34 changes: 34 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions crates/bitwarden-exporters/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "bitwarden-exporters"
version = "0.1.0"
authors = ["Bitwarden Inc"]
license-file = "LICENSE"
repository = "https://github.com/bitwarden/sdk"
homepage = "https://bitwarden.com"
description = """
Internal crate for the bitwarden crate. Do not use.
"""
keywords = ["bitwarden"]
edition = "2021"
rust-version = "1.57"
exclude = ["/resources"]

[dependencies]
chrono = { version = ">=0.4.26, <0.5", features = [
"clock",
"serde",
"std",
], default-features = false }
csv = "1.3.0"
serde = { version = ">=1.0, <2.0", features = ["derive"] }
serde_json = ">=1.0.96, <2.0"
thiserror = ">=1.0.40, <2.0"
uuid = { version = ">=1.3.3, <2.0", features = ["serde"] }
6 changes: 6 additions & 0 deletions crates/bitwarden-exporters/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Bitwarden Exporters

This is an internal crate for the Bitwarden SDK do not depend on this directly and use the
[`bitwarden`](https://crates.io/crates/bitwarden) crate instead.

This crate does not follow semantic versioning and the public interface may change at any time.
146 changes: 146 additions & 0 deletions crates/bitwarden-exporters/resources/json_export.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"encrypted": false,
"folders": [
{
"id": "942e2984-1b9a-453b-b039-b107012713b9",
"name": "Important"
}
],
"items": [
{
"id": "25c8c414-b446-48e9-a1bd-b10700bbd740",
"folderId": "942e2984-1b9a-453b-b039-b107012713b9",
"organizationId": null,
"collectionIds": null,
"name": "Bitwarden",
"notes": "My note",
"type": 1,
"login": {
"username": "[email protected]",
"password": "asdfasdfasdf",
"uris": [
{
"uri": "https://vault.bitwarden.com",
"match": null
}
],
"totp": "ABC",
"fido2Credentials": []
},
"favorite": true,
"reprompt": 0,
"fields": [
{
"name": "Text",
"value": "A",
"type": 0,
"linkedId": null
},
{
"name": "Hidden",
"value": "B",
"type": 1,
"linkedId": null
},
{
"name": "Boolean (true)",
"value": "true",
"type": 2,
"linkedId": null
},
{
"name": "Boolean (false)",
"value": "false",
"type": 2,
"linkedId": null
},
{
"name": "Linked",
"value": null,
"type": 3,
"linkedId": 101
}
],
"passwordHistory": null,
"revisionDate": "2024-01-30T14:09:33.753Z",
"creationDate": "2024-01-30T11:23:54.416Z",
"deletedDate": null
},
{
"id": "23f0f877-42b1-4820-a850-b10700bc41eb",
"folderId": null,
"organizationId": null,
"collectionIds": null,
"name": "My secure note",
"notes": "Very secure!",
"type": 2,
"secureNote": {
"type": 0
},
"favorite": false,
"reprompt": 0,
"passwordHistory": null,
"revisionDate": "2024-01-30T11:25:25.466Z",
"creationDate": "2024-01-30T11:25:25.466Z",
"deletedDate": null
},
{
"id": "3ed8de45-48ee-4e26-a2dc-b10701276c53",
"folderId": null,
"organizationId": null,
"collectionIds": null,
"name": "My card",
"notes": null,
"type": 3,
"card": {
"cardholderName": "John Doe",
"expMonth": "1",
"expYear": "2032",
"code": "123",
"brand": "Visa",
"number": "4111111111111111"
},
"favorite": false,
"reprompt": 0,
"passwordHistory": null,
"revisionDate": "2024-01-30T17:55:36.150Z",
"creationDate": "2024-01-30T17:55:36.150Z",
"deletedDate": null
},
{
"id": "41cc3bc1-c3d9-4637-876c-b10701273712",
"folderId": "942e2984-1b9a-453b-b039-b107012713b9",
"organizationId": null,
"collectionIds": null,
"name": "My identity",
"notes": null,
"type": 4,
"identity": {
"title": "Mr",
"firstName": "John",
"middleName": null,
"lastName": "Doe",
"address1": null,
"address2": null,
"address3": null,
"city": null,
"state": null,
"postalCode": null,
"country": null,
"company": "Bitwarden",
"email": null,
"phone": null,
"ssn": null,
"username": "JDoe",
"passportNumber": null,
"licenseNumber": null
},
"favorite": false,
"reprompt": 0,
"passwordHistory": null,
"revisionDate": "2024-01-30T17:54:50.706Z",
"creationDate": "2024-01-30T17:54:50.706Z",
"deletedDate": null
}
]
}
Loading

0 comments on commit 714c2d4

Please sign in to comment.