* Improve performance of initial keyring operations by pre-verifying keys in large keyrings * @param {String} keyringId
(keyringId)
| 216 | * @param {String} keyringId |
| 217 | */ |
| 218 | async 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) |