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:
37
src/models/domainModels.js
Normal file
37
src/models/domainModels.js
Normal 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);
|
||||
};
|
||||
Reference in New Issue
Block a user