Remove primaryEmail parameter from public-key service.
This commit is contained in:
@@ -62,11 +62,10 @@ class PublicKey {
|
||||
/**
|
||||
* Persist a new public key
|
||||
* @param {String} publicKeyArmored The ascii armored pgp key block
|
||||
* @param {String} primaryEmail (optional) The key's primary email address
|
||||
* @param {Object} origin Required for links to the keyserver e.g. { protocol:'https', host:'openpgpkeys@example.com' }
|
||||
* @yield {undefined}
|
||||
*/
|
||||
async put({publicKeyArmored, primaryEmail, origin}) {
|
||||
async put({publicKeyArmored, origin}) {
|
||||
// lazily purge old/unverified keys on every key upload
|
||||
await this._purgeOldUnverified();
|
||||
// parse key block
|
||||
@@ -79,7 +78,7 @@ class PublicKey {
|
||||
// store key in database
|
||||
await this._persisKey(key);
|
||||
// send mails to verify user ids (send only one if primary email is provided)
|
||||
await this._sendVerifyEmail(key, primaryEmail, origin);
|
||||
await this._sendVerifyEmail(key, origin);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,17 +120,10 @@ class PublicKey {
|
||||
* Send verification emails to the public keys user ids for verification.
|
||||
* If a primary email address is provided only one email will be sent.
|
||||
* @param {Array} userIds user id documents containg the verification nonces
|
||||
* @param {string} primaryEmail the public key's primary email address
|
||||
* @param {Object} origin the server's origin (required for email links)
|
||||
* @yield {undefined}
|
||||
*/
|
||||
async _sendVerifyEmail({userIds, keyId, publicKeyArmored}, primaryEmail, origin) {
|
||||
// check for primary email (send only one email)
|
||||
const primaryUserId = userIds.find(uid => uid.email === primaryEmail);
|
||||
if (primaryUserId) {
|
||||
userIds = [primaryUserId];
|
||||
}
|
||||
// send emails
|
||||
async _sendVerifyEmail({userIds, keyId, publicKeyArmored}, origin) {
|
||||
for (const userId of userIds) {
|
||||
userId.publicKeyArmored = publicKeyArmored; // set key for encryption
|
||||
await this._email.send({template: tpl.verifyKey, userId, keyId, origin});
|
||||
|
||||
Reference in New Issue
Block a user