1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 07:13:32 +00:00

setting up more models and services

This commit is contained in:
Kyle Spearrin
2016-09-03 12:07:30 -04:00
parent c39aab4ee7
commit c3053ea3a7
7 changed files with 323 additions and 95 deletions

View File

@@ -0,0 +1,37 @@
var CipherString = function (encryptedString) {
this.encryptedString = encryptedString;
if (encryptedString) {
this.initializationVector = this.encryptedString.split('|')[0];
this.cipherText = this.encryptedString.split('|')[1];
}
};
!function () {
var _decryptedValue = null;
CipherString.prototype.decrypt = function (callback) {
if (!_decryptedValue) {
var cryptoService = chrome.extension.getBackgroundPage().cryptoService;
_decryptedValue = cryptoService.Decrypt(this);
}
return _decryptedValue;
};
}();
var Site = function (obj) {
this.id = obj.id;
this.folderId = obj.folderId;
this.name = new CipherString(obj.name);
this.uri = new CipherString(obj.uri);
this.username = new CipherString(obj.username);
this.password = new CipherString(obj.password);
this.notes = new CipherString(obj.notes);
this.favorite = new obj.favorite;
};
var Folder = function (obj) {
this.id = obj.id;
this.name = new CipherString(obj.name);
};