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

Method exportOwnPubKey

src/controller/api.controller.js:72–84  ·  view source on GitHub ↗
({keyringId, emailAddr})

Source from the content-addressed store, hash-verified

70 }
71
72 async exportOwnPubKey({keyringId, emailAddr}) {
73 const keyring = await keyringById(keyringId);
74 const keyMap = await keyring.getKeyByAddress(emailAddr, {pub: false, priv: true, sort: true});
75 const keyFprMap = mapAddressKeyMapToFpr(keyMap);
76 const pubKeyFprs = keyFprMap[emailAddr];
77 if (!pubKeyFprs) {
78 throw new MvError('No key pair found for this email address.', 'NO_KEY_FOR_ADDRESS');
79 }
80 // only take first valid key
81 const pubKeyFpr = pubKeyFprs[0];
82 const armored = keyring.getArmoredKeys(pubKeyFpr, {pub: true});
83 return armored[0].armoredPublic;
84 }
85
86 async additionalHeadersForOutgoing({headers, keyringId}) {
87 const emailAddr = headers.from;

Callers

nothing calls this directly

Calls 3

mapAddressKeyMapToFprFunction · 0.90
getKeyByAddressMethod · 0.80
getArmoredKeysMethod · 0.45

Tested by

no test coverage detected