1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-09 18:29:39 +02:00

Add missing implementations of then() method

This commit is contained in:
Paul Schaub 2025-06-16 11:11:20 +02:00
parent 1ee77f1db7
commit 1106cb4228
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 39 additions and 2 deletions

View file

@ -6,7 +6,22 @@ package org.pgpainless.signature.subpackets
interface CertificationSubpackets : BaseSignatureSubpackets {
interface Callback : SignatureSubpacketCallback<CertificationSubpackets>
interface Callback : SignatureSubpacketCallback<CertificationSubpackets> {
fun then(nextCallback: SignatureSubpacketCallback<CertificationSubpackets>): Callback {
val currCallback = this
return object : Callback {
override fun modifyHashedSubpackets(hashedSubpackets: CertificationSubpackets) {
currCallback.modifyHashedSubpackets(hashedSubpackets)
nextCallback.modifyHashedSubpackets(hashedSubpackets)
}
override fun modifyUnhashedSubpackets(unhashedSubpackets: CertificationSubpackets) {
currCallback.modifyUnhashedSubpackets(unhashedSubpackets)
nextCallback.modifyUnhashedSubpackets(unhashedSubpackets)
}
}
}
}
companion object {

View file

@ -6,10 +6,32 @@ package org.pgpainless.signature.subpackets
import org.bouncycastle.bcpg.sig.RevocationReason
import org.pgpainless.key.util.RevocationAttributes
import org.pgpainless.signature.subpackets.SelfSignatureSubpackets.Callback
interface RevocationSignatureSubpackets : BaseSignatureSubpackets {
interface Callback : SignatureSubpacketCallback<RevocationSignatureSubpackets>
interface Callback : SignatureSubpacketCallback<RevocationSignatureSubpackets> {
fun then(
nextCallback: SignatureSubpacketCallback<RevocationSignatureSubpackets>
): Callback {
val currCallback = this
return object : Callback {
override fun modifyHashedSubpackets(
hashedSubpackets: RevocationSignatureSubpackets
) {
currCallback.modifyHashedSubpackets(hashedSubpackets)
nextCallback.modifyHashedSubpackets(hashedSubpackets)
}
override fun modifyUnhashedSubpackets(
unhashedSubpackets: RevocationSignatureSubpackets
) {
currCallback.modifyUnhashedSubpackets(unhashedSubpackets)
nextCallback.modifyUnhashedSubpackets(unhashedSubpackets)
}
}
}
}
fun setRevocationReason(
revocationAttributes: RevocationAttributes