MCPcopy
hub / github.com/mailvelope/mailvelope / hasAnyPrivateKey

Function hasAnyPrivateKey

src/modules/keyring.js:277–290  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

275 * @return {Promise<Boolean>}
276 */
277export async function hasAnyPrivateKey() {
278 const attributes = await mvelo.storage.get('mvelo.keyring.attributes') || {};
279 for (const keyringId of Object.keys(attributes)) {
280 if (keyringId === GNUPG_KEYRING_ID) {
281 // a registered GnuPG keyring is assumed to hold a private key
282 return true;
283 }
284 const privArmored = await mvelo.storage.get(`mvelo.keyring.${keyringId}.privateKeys`);
285 if (privArmored?.length) {
286 return true;
287 }
288 }
289 return false;
290}
291
292/**
293 * Get all keyrings

Callers 2

getIsSetupDoneMethod · 0.90
keyring.test.jsFile · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected