-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7762c4b
commit c4c12a7
Showing
16 changed files
with
1,340 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[package] | ||
name = "autofill" | ||
edition = "2018" | ||
version = "0.1.0" | ||
authors = ["application-services@mozilla.com"] | ||
license = "MPL-2.0" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
error-support = { path = "../support/error" } | ||
interrupt-support = { path = "../support/interrupt" } | ||
log = "0.4" | ||
serde = "1" | ||
serde_derive = "1" | ||
serde_json = "1" | ||
sql-support = { path = "../support/sql" } | ||
sync-guid = { path = "../support/guid", features = ["rusqlite_support", "random"] } | ||
sync15-traits = {path = "../support/sync15-traits"} | ||
thiserror = "1.0" | ||
types = { path = "../support/types" } | ||
url = { version = "2.1", features = ["serde"] } | ||
|
||
[dependencies.rusqlite] | ||
version = "0.23.1" | ||
features = ["functions", "bundled", "serde_json", "unlock_notify"] | ||
|
||
[dev-dependencies] | ||
env_logger = { version = "0.7", default-features = false } | ||
libsqlite3-sys = "0.18.0" | ||
|
||
[build-dependencies] | ||
nss_build_common = { path = "../support/rc_crypto/nss/nss_build_common" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
//! Work around the fact that `sqlcipher` might get enabled by a cargo feature | ||
//! another crate in the workspace needs, without setting up nss. (This is a | ||
//! gross hack). | ||
|
||
fn main() { | ||
println!("cargo:rerun-if-changed=build.rs"); | ||
// Ugh. This is really really dumb. We don't care about sqlcipher at all. really | ||
if nss_build_common::env_str("DEP_SQLITE3_LINK_TARGET") == Some("sqlcipher".into()) { | ||
// If NSS_DIR isn't set, we don't really care, ignore the Err case. | ||
let _ = nss_build_common::link_nss(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
-- This Source Code Form is subject to the terms of the Mozilla Public | ||
-- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
-- file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
CREATE TABLE IF NOT EXISTS addresses_data ( | ||
guid TEXT NOT NULL PRIMARY KEY, | ||
given_name TEXT NOT NULL, | ||
additional_name TEXT NOT NULL, | ||
family_name TEXT NOT NULL, | ||
organization TEXT NOT NULL, -- Company | ||
street_address TEXT NOT NULL, -- (Multiline) | ||
address_level3 TEXT NOT NULL, -- Suburb/Sublocality | ||
address_level2 TEXT NOT NULL, -- City/Town | ||
address_level1 TEXT NOT NULL, -- Province (Standardized code if possible) | ||
postal_code TEXT NOT NULL, | ||
country TEXT NOT NULL, -- ISO 3166 | ||
tel TEXT NOT NULL, -- Stored in E.164 format | ||
email TEXT NOT NULL, | ||
|
||
time_created INTEGER NOT NULL, | ||
time_last_used INTEGER, | ||
time_last_modified INTEGER NOT NULL, | ||
times_used INTEGER NOT NULL DEFAULT 0, | ||
|
||
sync_change_counter INTEGER NOT NULL DEFAULT 1 | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS addresses_mirror ( | ||
guid TEXT NOT NULL PRIMARY KEY, | ||
given_name TEXT NOT NULL, | ||
additional_name TEXT NOT NULL, | ||
family_name TEXT NOT NULL, | ||
organization TEXT NOT NULL, -- Company | ||
street_address TEXT NOT NULL, -- (Multiline) | ||
address_level3 TEXT NOT NULL, -- Suburb/Sublocality | ||
address_level2 TEXT NOT NULL, -- City/Town | ||
address_level1 TEXT NOT NULL, -- Province (Standardized code if possible) | ||
postal_code TEXT NOT NULL, | ||
country TEXT NOT NULL, -- ISO 3166 | ||
tel TEXT NOT NULL, -- Stored in E.164 format | ||
email TEXT NOT NULL, | ||
|
||
time_created INTEGER NOT NULL, | ||
time_last_used INTEGER, | ||
time_last_modified INTEGER NOT NULL, | ||
times_used INTEGER NOT NULL DEFAULT 0 | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS addresses_tombstones ( | ||
guid TEXT PRIMARY KEY, | ||
time_deleted INTEGER NOT NULL | ||
) WITHOUT ROWID; | ||
|
||
-- NOTE: The credit card tables below are not being implemented as there are still outstanding | ||
-- questions around how we address security model. | ||
|
||
-- CREATE TABLE IF NOT EXISTS credit_cards_data ( | ||
-- guid TEXT NOT NULL PRIMARY KEY, | ||
-- cc_name TEXT NOT NULL, -- full name | ||
-- cc_given_name TEXT NOT NULL, | ||
-- cc_additonal_name TEXT NOT NULL, | ||
-- cc_family_name TEXT NOT NULL, | ||
-- cc_number TEXT NOT NULL, | ||
-- cc_exp_month INTEGER, | ||
-- cc_exp_year INTEGER, | ||
-- cc_type TEXT NOT NULL, | ||
-- cc_exp TEXT NOT NULL, -- text format of the expiration date e.g. "[cc_exp_year]-[cc_exp_month]" | ||
|
||
-- time_created INTEGER NOT NULL, | ||
-- time_last_used INTEGER, | ||
-- time_last_modified INTEGER NOT NULL, | ||
-- times_used INTEGER NOT NULL DEFAULT 0, | ||
|
||
-- /* Same "sync change counter" strategy used by other components. */ | ||
-- sync_change_counter INTEGER NOT NULL DEFAULT 1 | ||
-- ); | ||
|
||
-- CREATE TABLE IF NOT EXISTS credit_cards_mirror ( | ||
-- guid TEXT NOT NULL PRIMARY KEY, | ||
-- cc_name TEXT NOT NULL, -- full name | ||
-- cc_given_name TEXT NOT NULL, | ||
-- cc_additonal_name TEXT NOT NULL, | ||
-- cc_family_name TEXT NOT NULL, | ||
-- cc_number TEXT NOT NULL, | ||
-- cc_exp_month INTEGER, | ||
-- cc_exp_year INTEGER, | ||
-- cc_type TEXT NOT NULL, | ||
-- cc_exp TEXT NOT NULL, -- text format of the expiration date e.g. "[cc_exp_year]-[cc_exp_month]" | ||
|
||
-- time_created INTEGER NOT NULL, | ||
-- time_last_used INTEGER, | ||
-- time_last_modified INTEGER NOT NULL, | ||
-- times_used INTEGER NOT NULL DEFAULT 0 | ||
-- ); | ||
|
||
-- CREATE TABLE IF NOT EXISTS credit_cards_tombstones ( | ||
-- guid TEXT PRIMARY KEY, | ||
-- time_deleted INTEGER NOT NULL | ||
-- ) WITHOUT ROWID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
-- This Source Code Form is subject to the terms of the Mozilla Public | ||
-- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
-- file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
-- This file defines triggers shared between the main and Sync connections. | ||
|
||
CREATE TEMP TRIGGER addresses_data_afterinsert_trigger | ||
AFTER INSERT ON addresses_data | ||
FOR EACH ROW WHEN NEW.guid IN (SELECT guid FROM addresses_tombstones) | ||
BEGIN | ||
SELECT RAISE(FAIL, 'guid exists in `addresses_tombstones`'); | ||
END; | ||
|
||
CREATE TEMP TRIGGER addresses_tombstones_afterinsert_trigger | ||
AFTER INSERT ON addresses_tombstones | ||
WHEN NEW.guid IN (SELECT guid FROM addresses_data) | ||
BEGIN | ||
SELECT RAISE(FAIL, 'guid exists in `addresses_data`'); | ||
END; |
Oops, something went wrong.