()
| 275 | * @return {Promise<Boolean>} |
| 276 | */ |
| 277 | export 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 |
no test coverage detected