OpenPGP Key Storage (Settings) (#53)

Import, Delete, Generate, View
This commit is contained in:
RainLoop Team 2014-03-13 02:29:33 +04:00
parent 5a5c6af2c6
commit 5ece4cc0ec
47 changed files with 1333 additions and 539 deletions

View file

@ -190,6 +190,36 @@ RainLoopApp.prototype.folders = function (fCallback)
}, this));
};
RainLoopApp.prototype.reloadOpenPgpKeys = function ()
{
if (Globals.bAllowOpenPGP)
{
var
aKeys = [],
oOpenpgpKeyring = RL.data().openpgpKeyring,
oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.keys : []
;
_.each(oOpenpgpKeys, function (oItem, iIndex) {
if (oItem)
{
var
aIDs = _.map(oItem.getKeyIds(), function (oID) {
return oID ? oID.toHex() : '';
})
;
aKeys.push(
new OpenPgpKeyModel(iIndex, aIDs.join(', '), oItem.getUserIds().join(', '),
oItem.isPrivate(), oItem.armor())
);
}
});
RL.data().openpgpkeys(aKeys);
}
};
RainLoopApp.prototype.accountsAndIdentities = function ()
{
var oRainLoopData = RL.data();
@ -739,6 +769,11 @@ RainLoopApp.prototype.bootstart = function ()
{
Utils.removeSettingsViewModel(SettingsIdentities);
}
if (!RL.settingsGet('OpenPGP'))
{
Utils.removeSettingsViewModel(SettingsOpenPGP);
}
if (!bGoogle && !bFacebook && !bTwitter)
{
@ -795,9 +830,12 @@ RainLoopApp.prototype.bootstart = function ()
'success': function () {
if (window.openpgp)
{
// window.console.log(window.openpgp);
RL.data().openpgpKeyring = new window.openpgp.Keyring(new OpenPgpLocalStorageDriver());
Globals.bAllowOpenPGP = true;
RL.pub('openpgp.init');
RL.reloadOpenPgpKeys();
}
}
});