diff --git a/src/main/kotlin/tech/relaycorp/veraid/pki/MemberIdBundle.kt b/src/main/kotlin/tech/relaycorp/veraid/pki/MemberIdBundle.kt index bb0e7c1..0811a6f 100644 --- a/src/main/kotlin/tech/relaycorp/veraid/pki/MemberIdBundle.kt +++ b/src/main/kotlin/tech/relaycorp/veraid/pki/MemberIdBundle.kt @@ -12,6 +12,7 @@ import tech.relaycorp.veraid.utils.asn1.ASN1Utils import tech.relaycorp.veraid.utils.intersect import tech.relaycorp.veraid.utils.x509.CertificateException import java.security.PublicKey +import java.time.ZonedDateTime /** * Member Id bundle. @@ -30,6 +31,12 @@ public class MemberIdBundle( public val memberPublicKey: PublicKey get() = memberCertificate.subjectPublicKey + /** + * Expiry date of the bundle. + */ + public val expiryDate: ZonedDateTime + get() = memberCertificate.validityPeriod.endInclusive + /** * Serialise the bundle. */ diff --git a/src/test/kotlin/tech/relaycorp/veraid/pki/MemberIdBundleTest.kt b/src/test/kotlin/tech/relaycorp/veraid/pki/MemberIdBundleTest.kt index 132dcb1..30dc08d 100644 --- a/src/test/kotlin/tech/relaycorp/veraid/pki/MemberIdBundleTest.kt +++ b/src/test/kotlin/tech/relaycorp/veraid/pki/MemberIdBundleTest.kt @@ -51,6 +51,16 @@ class MemberIdBundleTest { } } + @Nested + inner class ExpiryDate { + @Test + fun `Should output member expiry date`() { + val bundle = MemberIdBundle(dnssecChain, ORG_CERT, MEMBER_CERT) + + bundle.expiryDate shouldBe MEMBER_CERT.validityPeriod.endInclusive + } + } + @Nested inner class Serialise { private val bundle = MemberIdBundle(dnssecChain, ORG_CERT, MEMBER_CERT)