Encrypt/decrypt with multiple addresses in a single GPG key

This commit is contained in:
Carles Escrig Royo 2016-04-06 20:26:29 +02:00
parent d14375d022
commit a34da5de0d
No known key found for this signature in database
GPG key ID: 5E6F07C704111773
8 changed files with 141 additions and 62 deletions

View file

@ -426,25 +426,36 @@ class AppUser extends AbstractApp
if (oItem && oItem.primaryKey)
{
var
aEmails = [],
aUsers = [],
oPrimaryUser = oItem.getPrimaryUser(),
sUser = (oPrimaryUser && oPrimaryUser.user) ? oPrimaryUser.user.userId.userid
: (oItem.users && oItem.users[0] ? oItem.users[0].userId.userid : '')
;
oEmail.clear();
oEmail.mailsoParse(sUser);
if (oItem.users) {
_.each(oItem.users, (oItem) => {
oEmail.clear();
oEmail.mailsoParse(oItem.userId.userid);
if (oEmail.validate())
{
aEmails.push(oEmail.email);
aUsers.push(oItem.userId.userid);
}
});
}
if (oEmail.validate())
if (aEmails.length)
{
aKeys.push(new OpenPgpKeyModel(
iIndex,
oItem.primaryKey.getFingerprint(),
oItem.primaryKey.getKeyId().toHex().toLowerCase(),
sUser,
oEmail.email,
aUsers,
aEmails,
oItem.isPrivate(),
oItem.armor())
oItem.armor(),
sUser)
);
}
}