MCPcopy
hub / github.com/mailvelope/mailvelope / getPreferredKeyringQueue

Function getPreferredKeyringQueue

src/modules/keyring.js:480–498  ·  view source on GitHub ↗

* Return list of keyrings in the preferred priority order * @param {String} keyringId - requested keyring, the leading keyring of a scenario * @return {Array }

(keyringId)

Source from the content-addressed store, hash-verified

478 * @return {Array<KeyringBase>}
479 */
480function getPreferredKeyringQueue(keyringId) {
481 const keyrings = [];
482 const hasGpgKeyring = keyringMap.has(GNUPG_KEYRING_ID);
483 // use gnupg keyring if available and preferred
484 if (hasGpgKeyring && prefs.general.prefer_gnupg) {
485 keyrings.push(keyringMap.get(GNUPG_KEYRING_ID));
486 }
487 // next, if requested keyring is API keyring then use that
488 if (isApiKeyring(keyringId)) {
489 keyrings.push(keyringMap.get(keyringId));
490 }
491 // always use the main keyring
492 keyrings.push(keyringMap.get(MAIN_KEYRING_ID));
493 // if gnupg keyring is available but not preferred, we put at the end of the queue
494 if (hasGpgKeyring && !prefs.general.prefer_gnupg) {
495 keyrings.push(keyringMap.get(GNUPG_KEYRING_ID));
496 }
497 return keyrings;
498}
499
500/**
501 * Get keyring that includes at least one private key of the specified key Ids.

Callers 6

getDefaultKeyFprFunction · 0.85
getKeyDataFunction · 0.85
getKeyByAddressFunction · 0.85
getKeyringWithPrivKeyFunction · 0.85
hasUsablePrivateKeyFunction · 0.85
syncPublicKeysFunction · 0.85

Calls 4

isApiKeyringFunction · 0.85
hasMethod · 0.45
pushMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected