mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
OpenPGP (#53) UNSTABLE
This commit is contained in:
parent
67b5a72a71
commit
b330f77bc0
14 changed files with 526 additions and 260 deletions
|
|
@ -1716,3 +1716,48 @@ Utils.selectElement = function (element)
|
|||
}
|
||||
/* jshint onevar: true */
|
||||
};
|
||||
|
||||
Utils.openPgpImportPublicKeys = function (sPublicKeysArmored)
|
||||
{
|
||||
if (window.openpgp && RL)
|
||||
{
|
||||
var
|
||||
oOpenpgpKeyring = RL.data().openpgpKeyring,
|
||||
oImported = window.openpgp.key.readArmored(sPublicKeysArmored)
|
||||
;
|
||||
|
||||
if (oOpenpgpKeyring && oImported && !oImported.err && Utils.isArray(oImported.keys) &&
|
||||
0 < oImported.keys.length)
|
||||
{
|
||||
_.each(oImported.keys, function (oPrivKey) {
|
||||
if (oPrivKey)
|
||||
{
|
||||
window.console.log(oPrivKey);
|
||||
// var oKey = oOpenpgpKeyring.getKeysForKeyId(oPrivKey.primaryKey.getFingerprint());
|
||||
// if (oKey && oKey[0])
|
||||
// {
|
||||
// if (oKey[0].isPublic())
|
||||
// {
|
||||
// oPrivKey.update(oKey[0]);
|
||||
// oOpenpgpKeyring.publicKeys.removeForId(oPrivKey.primaryKey.getFingerprint());
|
||||
// oOpenpgpKeyring.privateKeys.push(oPrivKey);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// oKey[0].update(oPrivKey);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// oOpenpgpKeyring.importKey(oPrivKey.armored);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
oOpenpgpKeyring.store();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue