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

Method onKeyLookup

src/controller/editor.controller.js:272–280  ·  view source on GitHub ↗

* Lookup a recipient's public key with the key registry sources and * store it locally using a TOFU like (trust on first use) mechanic. * @param {Object} msg The event message object * @return {undefined}

(msg)

Source from the content-addressed store, hash-verified

270 * @return {undefined}
271 */
272 async onKeyLookup(msg) {
273 const result = await keyRegistry.lookup({query: {email: msg.recipient.email}, identity: this.state.keyringId});
274 if (result) {
275 const keyring = await getKeyringById(this.state.keyringId);
276 await keyring.importKeys([{type: 'public', armored: result.armored}]);
277 }
278 await this.sendKeyUpdate();
279 this.ports.editor.emit('key-lookup-result', {email: msg.recipient.email, found: Boolean(result)});
280 }
281
282 async sendKeyUpdate() {
283 // send updated key cache to editor

Callers

nothing calls this directly

Calls 3

sendKeyUpdateMethod · 0.95
importKeysMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected