MCPcopy
hub / github.com/mailvelope/mailvelope / preVerifyKeys

Function preVerifyKeys

src/modules/keyring.js:218–231  ·  view source on GitHub ↗

* Improve performance of initial keyring operations by pre-verifying keys in large keyrings * @param {String} keyringId

(keyringId)

Source from the content-addressed store, hash-verified

216 * @param {String} keyringId
217 */
218async function preVerifyKeys(keyringId) {
219 for (const {keystore} of keyringId ? [await getById(keyringId)] : await getAll()) {
220 const keys = keystore.getAllKeys();
221 if (keys.length < 10) {
222 continue;
223 }
224 for (const key of keys) {
225 try {
226 await key.getEncryptionKey();
227 } catch (e) {}
228 await wait(20);
229 }
230 }
231}
232
233/**
234 * Sanitize all the keys in the keyring (discard invalid user IDs and sub keys)

Callers 2

initFunction · 0.85
initGPGFunction · 0.85

Calls 4

waitFunction · 0.90
getByIdFunction · 0.85
getAllKeysMethod · 0.80
getAllFunction · 0.70

Tested by

no test coverage detected