Revision control

Copy as Markdown

namespace autofill {
// We expose the crypto primitives on the namespace
// Create a new, random, encryption key.
[Throws=AutofillApiError]
string create_autofill_key();
// Encrypt an arbitrary string - `key` must have come from `create_key()`
[Throws=AutofillApiError]
string encrypt_string(string key, string cleartext);
// Decrypt an arbitrary string - `key` must have come from `create_key()`
// and `ciphertext` must have come from `encrypt_string()`
[Throws=AutofillApiError]
string decrypt_string(string key, string ciphertext);
};
// What you pass to create or update a credit-card.
dictionary UpdatableCreditCardFields {
string cc_name;
string cc_number_enc;
string cc_number_last_4;
i64 cc_exp_month;
i64 cc_exp_year;
string cc_type;
};
// What you get back as a credit-card.
dictionary CreditCard {
string guid;
string cc_name;
string cc_number_enc;
string cc_number_last_4;
i64 cc_exp_month;
i64 cc_exp_year;
string cc_type;
i64 time_created;
i64? time_last_used;
i64 time_last_modified;
i64 times_used;
};
// What you pass to create or update an address.
dictionary UpdatableAddressFields {
string name;
string organization;
string street_address;
string address_level3;
string address_level2;
string address_level1;
string postal_code;
string country;
string tel;
string email;
};
// What you get back as an address.
dictionary Address {
string guid;
string name;
string organization;
string street_address;
string address_level3;
string address_level2;
string address_level1;
string postal_code;
string country;
string tel;
string email;
i64 time_created;
i64? time_last_used;
i64 time_last_modified;
i64 times_used;
};
[Error]
interface AutofillApiError {
SqlError(string reason);
InterruptedError();
CryptoError(string reason);
NoSuchRecord(string guid);
UnexpectedAutofillApiError(string reason);
};
interface Store {
[Throws=AutofillApiError]
constructor(string dbpath);
[Throws=AutofillApiError]
CreditCard add_credit_card(UpdatableCreditCardFields cc);
[Throws=AutofillApiError]
CreditCard get_credit_card(string guid);
[Throws=AutofillApiError]
sequence<CreditCard> get_all_credit_cards();
[Throws=AutofillApiError]
void update_credit_card(string guid, UpdatableCreditCardFields cc);
[Throws=AutofillApiError]
boolean delete_credit_card(string guid);
[Throws=AutofillApiError]
void touch_credit_card(string guid);
[Throws=AutofillApiError]
Address add_address(UpdatableAddressFields a);
[Throws=AutofillApiError]
Address get_address(string guid);
[Throws=AutofillApiError]
sequence<Address> get_all_addresses();
[Throws=AutofillApiError]
void update_address(string guid, UpdatableAddressFields a);
[Throws=AutofillApiError]
boolean delete_address(string guid);
[Throws=AutofillApiError]
void touch_address(string guid);
[Throws=AutofillApiError, Self=ByArc]
void scrub_encrypted_data();
[Self=ByArc]
void register_with_sync_manager();
};