Add documentation

This commit is contained in:
Paul Schaub 2024-02-29 16:22:37 +01:00
parent f1aa910431
commit b049930824
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
1 changed files with 28 additions and 0 deletions

View File

@ -407,6 +407,10 @@ internal constructor(val policy: Policy, val creationTime: Date, val preferences
* Set a dedicated [Passphrase] for the primary key. This is useful, if each (sub-) key of
* this OpenPGP key is intended to use a different passphrase.
*
* If you want to use a single passphrase for the whole OpenPGP key (primary key + subkeys)
* it is advised to pass in the passphrase in the last builder step ([DefineSubkeys.build])
* instead.
*
* @param passphrase passphrase to protect the primary key with
*/
fun setPrimaryKeyPassphrase(passphrase: Passphrase) =
@ -416,6 +420,10 @@ internal constructor(val policy: Policy, val creationTime: Date, val preferences
* Set a dedicated [SecretKeyRingProtector] for the primary key. This is useful, if each
* (sub-) key of this OpenPGP key is intended to use a different passphrase.
*
* If you want to use the same protection for the whole OpenPGP key (primary key + subkeys)
* it is advised to pass in the protector in the last builder step ([DefineSubkeys.build])
* instead.
*
* @param protector protector to protect the primary key with
*/
fun setPrimaryKeyProtector(protector: SecretKeyRingProtector) {
@ -621,9 +629,29 @@ internal constructor(
bindingTime: Date
)
/**
* Set a dedicated [Passphrase] for the subkey. This is useful, if each (sub-) key of this
* OpenPGP key is intended to use a different passphrase.
*
* If you want to use a single passphrase for the whole OpenPGP key (primary key + subkeys)
* it is advised to pass in the passphrase in the last builder step ([DefineSubkeys.build])
* instead.
*
* @param passphrase passphrase to protect the subkey with
*/
fun setSubkeyPassphrase(passphrase: Passphrase) =
setSubkeyProtector(SecretKeyRingProtector.unlockAnyKeyWith(passphrase))
/**
* Set a dedicated [SecretKeyRingProtector] for the subkey. This is useful, if each (sub-)
* key of this OpenPGP key is intended to use a different protection method.
*
* If you want to use the same protection for the whole OpenPGP key (primary key + subkeys)
* it is advised to pass in the protector in the last builder step ([DefineSubkeys.build])
* instead.
*
* @param protector protector to protect the subkey with
*/
fun setSubkeyProtector(protector: SecretKeyRingProtector) {
builder.subkeyProtectors[OpenPgpFingerprint.of(subkey)] = protector
}