mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-27 17:18:24 +08:00
Update openpgpjs 0.3.0 -> 0.5.1 (#142)
This commit is contained in:
parent
1ed1efbe6c
commit
61a7a9c078
23 changed files with 160 additions and 228 deletions
|
@ -115,9 +115,9 @@ module.exports = function (grunt) {
|
|||
js_openpgp: {
|
||||
nonull: true,
|
||||
src: [
|
||||
"vendors/openpgp.min.js",
|
||||
"vendors/openpgp/openpgp-0.5.1.min.js",
|
||||
],
|
||||
dest: 'rainloop/v/<%= cfg.devVersion %>/static/js/openpgp.js'
|
||||
dest: 'rainloop/v/<%= cfg.devVersion %>/static/js/openpgp.min.js'
|
||||
},
|
||||
js_libs: {
|
||||
nonull: true,
|
||||
|
@ -254,7 +254,6 @@ module.exports = function (grunt) {
|
|||
|
||||
"dev/Storages/LocalStorages/CookieDriver.js",
|
||||
"dev/Storages/LocalStorages/LocalStorageDriver.js",
|
||||
"dev/Storages/LocalStorages/OpenPgpLocalStorageDriver.js",
|
||||
"dev/Storages/LocalStorage.js",
|
||||
|
||||
"dev/Knoin/AbstractBoot.js",
|
||||
|
|
|
@ -385,7 +385,7 @@ RainLoopApp.prototype.reloadOpenPgpKeys = function ()
|
|||
aKeys = [],
|
||||
oEmail = new EmailModel(),
|
||||
oOpenpgpKeyring = RL.data().openpgpKeyring,
|
||||
oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.keys : []
|
||||
oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.getAllKeys() : []
|
||||
;
|
||||
|
||||
_.each(oOpenpgpKeys, function (oItem, iIndex) {
|
||||
|
@ -1035,7 +1035,7 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
'success': function () {
|
||||
if (window.openpgp)
|
||||
{
|
||||
RL.data().openpgpKeyring = new window.openpgp.Keyring(new OpenPgpLocalStorageDriver());
|
||||
RL.data().openpgpKeyring = new window.openpgp.Keyring();
|
||||
RL.data().allowOpenPGP(true);
|
||||
|
||||
RL.pub('openpgp.init');
|
||||
|
|
|
@ -271,7 +271,7 @@ LinkBuilder.prototype.notificationMailIcon = function ()
|
|||
LinkBuilder.prototype.openPgpJs = function ()
|
||||
{
|
||||
return ('' === this.sCdnStaticDomain ? 'rainloop/v/' : this.sCdnStaticDomain) +
|
||||
this.sVersion + '/static/js/openpgp.js';
|
||||
this.sVersion + '/static/js/openpgp.min.js';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,33 +53,16 @@ SettingsOpenPGP.prototype.deleteOpenPgpKey = function (oOpenPgpKeyToRemove)
|
|||
{
|
||||
this.openPgpKeyForDeletion(null);
|
||||
|
||||
var
|
||||
iFindIndex = -1,
|
||||
oOpenpgpKeyring = RL.data().openpgpKeyring,
|
||||
fRemoveAccount = function (oOpenPgpKey) {
|
||||
return oOpenPgpKeyToRemove === oOpenPgpKey;
|
||||
}
|
||||
;
|
||||
|
||||
if (oOpenPgpKeyToRemove && oOpenpgpKeyring)
|
||||
if (oOpenPgpKeyToRemove && RL.data().openpgpKeyring)
|
||||
{
|
||||
this.openpgpkeys.remove(fRemoveAccount);
|
||||
|
||||
_.each(oOpenpgpKeyring.keys, function (oKey, iIndex) {
|
||||
if (-1 === iFindIndex && oKey && oKey.primaryKey &&
|
||||
oOpenPgpKeyToRemove.guid === oKey.primaryKey.getFingerprint() &&
|
||||
oOpenPgpKeyToRemove.isPrivate === oKey.isPrivate())
|
||||
{
|
||||
iFindIndex = iIndex;
|
||||
}
|
||||
this.openpgpkeys.remove(function (oOpenPgpKey) {
|
||||
return oOpenPgpKeyToRemove === oOpenPgpKey;
|
||||
});
|
||||
|
||||
if (0 <= iFindIndex)
|
||||
{
|
||||
oOpenpgpKeyring.removeKey(iFindIndex);
|
||||
}
|
||||
RL.data().openpgpKeyring[oOpenPgpKeyToRemove.isPrivate ? 'privateKeys' : 'publicKeys']
|
||||
.removeForId(oOpenPgpKeyToRemove.guid);
|
||||
|
||||
oOpenpgpKeyring.store();
|
||||
RL.data().openpgpKeyring.store();
|
||||
|
||||
RL.reloadOpenPgpKeys();
|
||||
}
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function OpenPgpLocalStorageDriver()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Declare the localstore itemname
|
||||
*/
|
||||
OpenPgpLocalStorageDriver.prototype.item = 'armoredRainLoopKeys';
|
||||
|
||||
/**
|
||||
* Load the keyring from HTML5 local storage and initializes this instance.
|
||||
* @return {Array<module:key~Key>} array of keys retrieved from localstore
|
||||
*/
|
||||
OpenPgpLocalStorageDriver.prototype.load = function ()
|
||||
{
|
||||
var
|
||||
iIndex = 0,
|
||||
iLen = 0,
|
||||
aKeys = [],
|
||||
aArmoredKeys = JSON.parse(window.localStorage.getItem(this.item))
|
||||
;
|
||||
|
||||
if (aArmoredKeys && 0 < aArmoredKeys.length)
|
||||
{
|
||||
for (iLen = aArmoredKeys.length; iIndex < iLen; iIndex++)
|
||||
{
|
||||
aKeys.push(
|
||||
window.openpgp.key.readArmored(aArmoredKeys[iIndex]).keys[0]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return aKeys;
|
||||
};
|
||||
|
||||
/**
|
||||
* Saves the current state of the keyring to HTML5 local storage.
|
||||
* The privateKeys array and publicKeys array gets Stringified using JSON
|
||||
* @param {Array<module:key~Key>} aKeys array of keys to save in localstore
|
||||
*/
|
||||
OpenPgpLocalStorageDriver.prototype.store = function (aKeys)
|
||||
{
|
||||
var
|
||||
iIndex = 0,
|
||||
iLen = aKeys.length,
|
||||
aArmoredKeys = []
|
||||
;
|
||||
|
||||
for (; iIndex < iLen; iIndex++)
|
||||
{
|
||||
aArmoredKeys.push(aKeys[iIndex].armor());
|
||||
}
|
||||
|
||||
window.localStorage.setItem(this.item, JSON.stringify(aArmoredKeys));
|
||||
};
|
|
@ -106,7 +106,11 @@ html.rl-started-trigger.no-mobile #rl-content {
|
|||
animation: animate-stripes 2s linear infinite;
|
||||
}
|
||||
|
||||
&.csstransitions .b-settings-folders {
|
||||
&.csstransitions .button-delete-transitions {
|
||||
.transition(all 0.2s linear);
|
||||
}
|
||||
|
||||
/* &.csstransitions .b-settings-folders {
|
||||
.folder-item {
|
||||
.button-delete {
|
||||
.transition(all 0.2s linear);
|
||||
|
@ -142,7 +146,7 @@ html.rl-started-trigger.no-mobile #rl-content {
|
|||
.button-delete {
|
||||
.transition(margin-left 0.2s linear);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
&.cssanimations .b-folders .e-item .anim-action-class {
|
||||
-webkit-animation: highlight-folder-row 0.5s linear;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -49,10 +49,10 @@ function PopupsGenerateNewOpenPgpKeyViewModel()
|
|||
mKeyPair = window.openpgp.generateKeyPair(1, Utils.pInt(self.keyBitLength()), sUserID, Utils.trim(self.password()));
|
||||
if (mKeyPair && mKeyPair.privateKeyArmored)
|
||||
{
|
||||
oOpenpgpKeyring.importKey(mKeyPair.privateKeyArmored);
|
||||
oOpenpgpKeyring.importKey(mKeyPair.publicKeyArmored);
|
||||
oOpenpgpKeyring.privateKeys.importKey(mKeyPair.privateKeyArmored);
|
||||
oOpenpgpKeyring.publicKeys.importKey(mKeyPair.publicKeyArmored);
|
||||
oOpenpgpKeyring.store();
|
||||
|
||||
|
||||
RL.reloadOpenPgpKeys();
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<span class="domain-name" data-bind="text: name"></span>
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete" data-bind="css: {'delete-access': deleteAccess()}, click: function(oDomain) { $root.deleteDomain(oDomain); }">
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: function(oDomain) { $root.deleteDomain(oDomain); }">
|
||||
<span>Are you sure?</span>
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<span class="i18n" data-i18n-text="COMPOSE/BUTTON_SAVE"></span>
|
||||
</a>
|
||||
<a class="btn btn-danger button-delete" data-bind="command: deleteCommand">
|
||||
<a class="btn btn-danger button-delete button-delete-transitions" data-bind="command: deleteCommand">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
</a>
|
||||
<span class="saved-text" data-bind="text: savedOrSendingText, css: { 'errorDesc': savedError }"></span>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<td>
|
||||
<span class="account-img icon-user"></span>
|
||||
<span class="account-name" data-bind="text: email"></span>
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete" data-bind="css: {'delete-access': deleteAccess()}, click: function(oAccount) { $root.deleteAccount(oAccount); }">
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: function(oAccount) { $root.deleteAccount(oAccount); }">
|
||||
<span class="i18n" data-i18n-text="SETTINGS_ACCOUNTS/DELETING_ASK"></span>
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<span class="folder-system-name" data-bind="text: manageFolderSystemName, visible: isSystemFolder"></span>
|
||||
<input type="text" class="folder-name-input" data-bind="value: nameForEdit, visible: edited, hasfocus: edited, onEnter: function () { $root.folderEditOnEnter($data); }, onEsc: function () { $root.folderEditOnEsc($data); }" />
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete" data-bind="css: {'delete-access': deleteAccess()}, click: function() { $root.deleteFolder($data); }">
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: function() { $root.deleteFolder($data); }">
|
||||
<span class="i18n" data-i18n-text="SETTINGS_FOLDERS/DELETING_ASK"></span>
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<span class="identity-name" data-bind="text: formattedName()"></span>
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete" data-bind="css: {'delete-access': deleteAccess()}, click: function(oIdentity) { $root.deleteIdentity(oIdentity); }">
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: function(oIdentity) { $root.deleteIdentity(oIdentity); }">
|
||||
<span class="i18n" data-i18n-text="SETTINGS_IDENTITIES/DELETING_ASK"></span>
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<td>
|
||||
<i class="open-pgp-key-img icon-lock i18n" data-i18n-title="SETTINGS_OPEN_PGP/TITLE_PRIVATE"></i>
|
||||
<span class="open-pgp-key-user" data-bind="text: user"></span>
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete" data-bind="css: {'delete-access': deleteAccess()}, click: function(oOpenPGP) { $root.deleteOpenPgpKey(oOpenPGP); }">
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: function(oOpenPGP) { $root.deleteOpenPgpKey(oOpenPGP); }">
|
||||
<span class="i18n" data-i18n-text="SETTINGS_OPEN_PGP/DELETING_ASK"></span>
|
||||
</a>
|
||||
</td>
|
||||
|
@ -52,7 +52,7 @@
|
|||
<span class="open-pgp-key-img icon-key i18n" data-i18n-title="SETTINGS_OPEN_PGP/TITLE_PUBLIC"></span>
|
||||
<span class="open-pgp-key-user" data-bind="text: user"></span>
|
||||
(<span class="open-pgp-key-id" data-bind="text: id"></span>)
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete" data-bind="css: {'delete-access': deleteAccess()}, click: function(oOpenPGP) { $root.deleteOpenPgpKey(oOpenPGP); }">
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: function(oOpenPGP) { $root.deleteOpenPgpKey(oOpenPGP); }">
|
||||
<span class="i18n" data-i18n-text="SETTINGS_OPEN_PGP/DELETING_ASK"></span>
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -9521,6 +9521,46 @@ html.rl-started-trigger.no-mobile #rl-content {
|
|||
-o-transition: opacity 0.5s linear;
|
||||
transition: opacity 0.5s linear;
|
||||
}
|
||||
.rl-anim {
|
||||
/* &.csstransitions .b-settings-folders {
|
||||
.folder-item {
|
||||
.button-delete {
|
||||
.transition(all 0.2s linear);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.csstransitions .b-settings-accounts {
|
||||
.account-item {
|
||||
.button-delete {
|
||||
.transition(all 0.2s linear);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.csstransitions .b-settings-identities {
|
||||
.identity-item {
|
||||
.button-delete {
|
||||
.transition(all 0.2s linear);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.csstransitions .b-admin-domains {
|
||||
.e-item {
|
||||
.button-delete {
|
||||
.transition(all 0.2s linear);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.csstransitions .b-compose {
|
||||
.button-delete {
|
||||
.transition(margin-left 0.2s linear);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
.rl-anim.csstransitions.no-mobile #rl-left {
|
||||
-webkit-transition: width 0.3s ease-out;
|
||||
-moz-transition: width 0.3s ease-out;
|
||||
|
@ -9571,36 +9611,12 @@ html.rl-started-trigger.no-mobile #rl-content {
|
|||
-moz-animation: animate-stripes 2s linear infinite;
|
||||
animation: animate-stripes 2s linear infinite;
|
||||
}
|
||||
.rl-anim.csstransitions .b-settings-folders .folder-item .button-delete {
|
||||
.rl-anim.csstransitions .button-delete-transitions {
|
||||
-webkit-transition: all 0.2s linear;
|
||||
-moz-transition: all 0.2s linear;
|
||||
-o-transition: all 0.2s linear;
|
||||
transition: all 0.2s linear;
|
||||
}
|
||||
.rl-anim.csstransitions .b-settings-accounts .account-item .button-delete {
|
||||
-webkit-transition: all 0.2s linear;
|
||||
-moz-transition: all 0.2s linear;
|
||||
-o-transition: all 0.2s linear;
|
||||
transition: all 0.2s linear;
|
||||
}
|
||||
.rl-anim.csstransitions .b-settings-identities .identity-item .button-delete {
|
||||
-webkit-transition: all 0.2s linear;
|
||||
-moz-transition: all 0.2s linear;
|
||||
-o-transition: all 0.2s linear;
|
||||
transition: all 0.2s linear;
|
||||
}
|
||||
.rl-anim.csstransitions .b-admin-domains .e-item .button-delete {
|
||||
-webkit-transition: all 0.2s linear;
|
||||
-moz-transition: all 0.2s linear;
|
||||
-o-transition: all 0.2s linear;
|
||||
transition: all 0.2s linear;
|
||||
}
|
||||
.rl-anim.csstransitions .b-compose .button-delete {
|
||||
-webkit-transition: margin-left 0.2s linear;
|
||||
-moz-transition: margin-left 0.2s linear;
|
||||
-o-transition: margin-left 0.2s linear;
|
||||
transition: margin-left 0.2s linear;
|
||||
}
|
||||
.rl-anim.cssanimations .b-folders .e-item .anim-action-class {
|
||||
-webkit-animation: highlight-folder-row 0.5s linear;
|
||||
-moz-animation: highlight-folder-row 0.5s linear;
|
||||
|
|
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -3657,7 +3657,7 @@ LinkBuilder.prototype.notificationMailIcon = function ()
|
|||
LinkBuilder.prototype.openPgpJs = function ()
|
||||
{
|
||||
return ('' === this.sCdnStaticDomain ? 'rainloop/v/' : this.sCdnStaticDomain) +
|
||||
this.sVersion + '/static/js/openpgp.js';
|
||||
this.sVersion + '/static/js/openpgp.min.js';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
2
rainloop/v/0.0.0/static/js/admin.min.js
vendored
2
rainloop/v/0.0.0/static/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -3661,7 +3661,7 @@ LinkBuilder.prototype.notificationMailIcon = function ()
|
|||
LinkBuilder.prototype.openPgpJs = function ()
|
||||
{
|
||||
return ('' === this.sCdnStaticDomain ? 'rainloop/v/' : this.sCdnStaticDomain) +
|
||||
this.sVersion + '/static/js/openpgp.js';
|
||||
this.sVersion + '/static/js/openpgp.min.js';
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -4832,65 +4832,6 @@ LocalStorageDriver.prototype.get = function (sKey)
|
|||
return mResult;
|
||||
};
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function OpenPgpLocalStorageDriver()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Declare the localstore itemname
|
||||
*/
|
||||
OpenPgpLocalStorageDriver.prototype.item = 'armoredRainLoopKeys';
|
||||
|
||||
/**
|
||||
* Load the keyring from HTML5 local storage and initializes this instance.
|
||||
* @return {Array<module:key~Key>} array of keys retrieved from localstore
|
||||
*/
|
||||
OpenPgpLocalStorageDriver.prototype.load = function ()
|
||||
{
|
||||
var
|
||||
iIndex = 0,
|
||||
iLen = 0,
|
||||
aKeys = [],
|
||||
aArmoredKeys = JSON.parse(window.localStorage.getItem(this.item))
|
||||
;
|
||||
|
||||
if (aArmoredKeys && 0 < aArmoredKeys.length)
|
||||
{
|
||||
for (iLen = aArmoredKeys.length; iIndex < iLen; iIndex++)
|
||||
{
|
||||
aKeys.push(
|
||||
window.openpgp.key.readArmored(aArmoredKeys[iIndex]).keys[0]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return aKeys;
|
||||
};
|
||||
|
||||
/**
|
||||
* Saves the current state of the keyring to HTML5 local storage.
|
||||
* The privateKeys array and publicKeys array gets Stringified using JSON
|
||||
* @param {Array<module:key~Key>} aKeys array of keys to save in localstore
|
||||
*/
|
||||
OpenPgpLocalStorageDriver.prototype.store = function (aKeys)
|
||||
{
|
||||
var
|
||||
iIndex = 0,
|
||||
iLen = aKeys.length,
|
||||
aArmoredKeys = []
|
||||
;
|
||||
|
||||
for (; iIndex < iLen; iIndex++)
|
||||
{
|
||||
aArmoredKeys.push(aKeys[iIndex].armor());
|
||||
}
|
||||
|
||||
window.localStorage.setItem(this.item, JSON.stringify(aArmoredKeys));
|
||||
};
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
@ -10609,7 +10550,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
|
||||
;
|
||||
|
||||
|
@ -10620,7 +10564,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();
|
||||
|
@ -10739,10 +10706,10 @@ function PopupsGenerateNewOpenPgpKeyViewModel()
|
|||
mKeyPair = window.openpgp.generateKeyPair(1, Utils.pInt(self.keyBitLength()), sUserID, Utils.trim(self.password()));
|
||||
if (mKeyPair && mKeyPair.privateKeyArmored)
|
||||
{
|
||||
oOpenpgpKeyring.importKey(mKeyPair.privateKeyArmored);
|
||||
oOpenpgpKeyring.importKey(mKeyPair.publicKeyArmored);
|
||||
oOpenpgpKeyring.privateKeys.importKey(mKeyPair.privateKeyArmored);
|
||||
oOpenpgpKeyring.publicKeys.importKey(mKeyPair.publicKeyArmored);
|
||||
oOpenpgpKeyring.store();
|
||||
|
||||
|
||||
RL.reloadOpenPgpKeys();
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
}
|
||||
|
@ -14983,33 +14950,16 @@ SettingsOpenPGP.prototype.deleteOpenPgpKey = function (oOpenPgpKeyToRemove)
|
|||
{
|
||||
this.openPgpKeyForDeletion(null);
|
||||
|
||||
var
|
||||
iFindIndex = -1,
|
||||
oOpenpgpKeyring = RL.data().openpgpKeyring,
|
||||
fRemoveAccount = function (oOpenPgpKey) {
|
||||
return oOpenPgpKeyToRemove === oOpenPgpKey;
|
||||
}
|
||||
;
|
||||
|
||||
if (oOpenPgpKeyToRemove && oOpenpgpKeyring)
|
||||
if (oOpenPgpKeyToRemove && RL.data().openpgpKeyring)
|
||||
{
|
||||
this.openpgpkeys.remove(fRemoveAccount);
|
||||
|
||||
_.each(oOpenpgpKeyring.keys, function (oKey, iIndex) {
|
||||
if (-1 === iFindIndex && oKey && oKey.primaryKey &&
|
||||
oOpenPgpKeyToRemove.guid === oKey.primaryKey.getFingerprint() &&
|
||||
oOpenPgpKeyToRemove.isPrivate === oKey.isPrivate())
|
||||
{
|
||||
iFindIndex = iIndex;
|
||||
}
|
||||
this.openpgpkeys.remove(function (oOpenPgpKey) {
|
||||
return oOpenPgpKeyToRemove === oOpenPgpKey;
|
||||
});
|
||||
|
||||
if (0 <= iFindIndex)
|
||||
{
|
||||
oOpenpgpKeyring.removeKey(iFindIndex);
|
||||
}
|
||||
RL.data().openpgpKeyring[oOpenPgpKeyToRemove.isPrivate ? 'privateKeys' : 'publicKeys']
|
||||
.removeForId(oOpenPgpKeyToRemove.guid);
|
||||
|
||||
oOpenpgpKeyring.store();
|
||||
RL.data().openpgpKeyring.store();
|
||||
|
||||
RL.reloadOpenPgpKeys();
|
||||
}
|
||||
|
@ -18947,7 +18897,7 @@ RainLoopApp.prototype.reloadOpenPgpKeys = function ()
|
|||
aKeys = [],
|
||||
oEmail = new EmailModel(),
|
||||
oOpenpgpKeyring = RL.data().openpgpKeyring,
|
||||
oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.keys : []
|
||||
oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.getAllKeys() : []
|
||||
;
|
||||
|
||||
_.each(oOpenpgpKeys, function (oItem, iIndex) {
|
||||
|
@ -19597,7 +19547,7 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
'success': function () {
|
||||
if (window.openpgp)
|
||||
{
|
||||
RL.data().openpgpKeyring = new window.openpgp.Keyring(new OpenPgpLocalStorageDriver());
|
||||
RL.data().openpgpKeyring = new window.openpgp.Keyring();
|
||||
RL.data().allowOpenPGP(true);
|
||||
|
||||
RL.pub('openpgp.init');
|
||||
|
|
18
rainloop/v/0.0.0/static/js/app.min.js
vendored
18
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
7
rainloop/v/0.0.0/static/js/openpgp.min.js
vendored
Normal file
7
rainloop/v/0.0.0/static/js/openpgp.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
vendors/openpgp/openpgp-0.5.1.min.js
vendored
Normal file
7
vendors/openpgp/openpgp-0.5.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue