Update openpgpjs 0.3.0 -> 0.5.1 (#142)

This commit is contained in:
RainLoop Team
2014-04-26 20:09:38 +04:00
parent 1ed1efbe6c
commit 61a7a9c078
23 changed files with 160 additions and 228 deletions

View File

@@ -19,7 +19,10 @@ function PopupsAddOpenPgpKeyViewModel()
this.addOpenPgpKeyCommand = Utils.createCommand(this, function () {
var
iCount = 30,
aMatch = null,
sKey = Utils.trim(this.key()),
oReg = /[\-]{3,6}BEGIN PGP (PRIVATE|PUBLIC) KEY BLOCK[\-]{3,6}[\s\S]+[\-]{3,6}END PGP (PRIVATE|PUBLIC) KEY BLOCK[\-]{3,6}/gi,
oOpenpgpKeyring = RL.data().openpgpKeyring
;
@@ -30,7 +33,30 @@ function PopupsAddOpenPgpKeyViewModel()
return false;
}
oOpenpgpKeyring.importKey(sKey);
do
{
aMatch = oReg.exec(sKey);
if (!aMatch || 0 > iCount)
{
break;
}
if (aMatch[0] && aMatch[1] && aMatch[2] && aMatch[1] === aMatch[2])
{
if ('PRIVATE' === aMatch[1])
{
oOpenpgpKeyring.privateKeys.importKey(aMatch[0]);
}
else if ('PUBLIC' === aMatch[1])
{
oOpenpgpKeyring.publicKeys.importKey(aMatch[0]);
}
}
iCount--;
}
while (true);
oOpenpgpKeyring.store();
RL.reloadOpenPgpKeys();