1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-05 03:41:07 +01:00

Add OpenPGPKey.isFullyDecrypted/isFullyEncrypted extension methods

This commit is contained in:
Paul Schaub 2025-10-21 17:39:45 +02:00
parent fc056edd93
commit cd99330a97
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -27,3 +27,11 @@ fun OpenPGPKey.getSecretKeyFor(pkesk: PGPPublicKeyEncryptedData): OpenPGPSecretK
*/
fun OpenPGPSecretKey.unlock(passphrase: Passphrase): OpenPGPPrivateKey =
this.unlock(passphrase.getChars())
fun OpenPGPKey.isFullyDecrypted(): Boolean {
return secretKeys.values.none { it.isLocked }
}
fun OpenPGPKey.isFullyEncrypted(): Boolean {
return secretKeys.values.all { it.isLocked }
}