({key, password, message})
| 241 | * @return {Promise<openpgp.key.Key, Error>} return the unlocked key |
| 242 | */ |
| 243 | export async function unlock({key, password, message}) { |
| 244 | const unlockedKey = await unlockKey(key, password); |
| 245 | const options = {key: unlockedKey, password}; |
| 246 | if (message) { |
| 247 | options.reservedOperations = getReservedOperations({key: unlockedKey, message}); |
| 248 | } |
| 249 | if (active) { |
| 250 | // set unlocked key in cache |
| 251 | set(options); |
| 252 | } |
| 253 | return unlockedKey; |
| 254 | } |
| 255 | |
| 256 | async function unlockKey(privKey, passwd) { |
| 257 | try { |
no test coverage detected