MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / minifyKey

Function minifyKey

src/modules/key.js:299–326  ·  view source on GitHub ↗
(key, userId)

Source from the content-addressed store, hash-verified

297 * @return {openpgp.key.Key}
298 */
299export async function minifyKey(key, userId) {
300 let user;
301 try {
302 ({user} = await key.getPrimaryUser(undefined, userId));
303 } catch (e) {}
304 if (!user) {
305 return null;
306 }
307 let p = new PacketList();
308 p.push(key.keyPacket);
309 p.push(user.userID || user.userAttribute);
310 p = p.concat(user.selfCertifications);
311 let signSubkey;
312 try {
313 signSubkey = await key.getSigningKey();
314 if (key !== signSubkey) {
315 p = p.concat(signSubkey.toPacketList());
316 }
317 } catch (e) {}
318 try {
319 const encSubkey = await key.getEncryptionKey();
320 if (key !== encSubkey && signSubkey !== encSubkey) {
321 p = p.concat(encSubkey.toPacketList());
322 }
323 } catch (e) {}
324 const binaryKey = p.write();
325 return readKey({binaryKey});
326}
327
328export async function verifyUserCertificate(user, certificate, key) {
329 try {

Callers 2

key-test.jsFile · 0.90

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected