Skip to content

Commit

Permalink
fix(MemberIdBundle): Expose expiry date (#75)
Browse files Browse the repository at this point in the history
As `MemberIdBundle.expiryDate`.
  • Loading branch information
gnarea authored Dec 21, 2023
1 parent e580f9c commit 922113f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/kotlin/tech/relaycorp/veraid/pki/MemberIdBundle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
*/
Expand Down
10 changes: 10 additions & 0 deletions src/test/kotlin/tech/relaycorp/veraid/pki/MemberIdBundleTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 922113f

Please sign in to comment.