Replace addressparser with openpgp.util.parseUserId
This commit is contained in:
parent
b83f13cde2
commit
f88f4d5d2e
5
package-lock.json
generated
5
package-lock.json
generated
@ -94,11 +94,6 @@
|
|||||||
"email-addresses": "^3.0.0"
|
"email-addresses": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"addressparser": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/addressparser/-/addressparser-1.0.1.tgz",
|
|
||||||
"integrity": "sha1-R6++GiqSYhkdtoOOT9HTm0CCF0Y="
|
|
||||||
},
|
|
||||||
"ajv": {
|
"ajv": {
|
||||||
"version": "6.9.2",
|
"version": "6.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.2.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.2.tgz",
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
"release:archive": "zip -rq release.zip package.json package-lock.json node_modules/ *.js src/ config/"
|
"release:archive": "zip -rq release.zip package.json package-lock.json node_modules/ *.js src/ config/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"addressparser": "1.0.1",
|
|
||||||
"co-body": "6.0.0",
|
"co-body": "6.0.0",
|
||||||
"config": "3.0.1",
|
"config": "3.0.1",
|
||||||
"koa": "2.7.0",
|
"koa": "2.7.0",
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
const log = require('winston');
|
const log = require('winston');
|
||||||
const util = require('./util');
|
const util = require('./util');
|
||||||
const openpgp = require('openpgp');
|
const openpgp = require('openpgp');
|
||||||
const addressparser = require('addressparser');
|
|
||||||
|
|
||||||
const KEY_BEGIN = '-----BEGIN PGP PUBLIC KEY BLOCK-----';
|
const KEY_BEGIN = '-----BEGIN PGP PUBLIC KEY BLOCK-----';
|
||||||
const KEY_END = '-----END PGP PUBLIC KEY BLOCK-----';
|
const KEY_END = '-----END PGP PUBLIC KEY BLOCK-----';
|
||||||
@ -131,16 +130,18 @@ class PGP {
|
|||||||
for (const user of users) {
|
for (const user of users) {
|
||||||
const userStatus = await user.verify(primaryKey, verifyDate);
|
const userStatus = await user.verify(primaryKey, verifyDate);
|
||||||
if (userStatus !== openpgp.enums.keyStatus.invalid && user.userId && user.userId.userid) {
|
if (userStatus !== openpgp.enums.keyStatus.invalid && user.userId && user.userId.userid) {
|
||||||
const uid = addressparser(user.userId.userid)[0];
|
try {
|
||||||
if (util.isEmail(uid.address)) {
|
const uid = openpgp.util.parseUserId(user.userId.userid);
|
||||||
// map to local user id object format
|
if (util.isEmail(uid.email)) {
|
||||||
result.push({
|
// map to local user id object format
|
||||||
status: userStatus,
|
result.push({
|
||||||
name: uid.name,
|
status: userStatus,
|
||||||
email: util.normalizeEmail(uid.address),
|
name: uid.name,
|
||||||
verified: false
|
email: util.normalizeEmail(uid.email),
|
||||||
});
|
verified: false
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user