mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-24 11:57:59 +01:00
Propagate referenceTime to the Network
This commit is contained in:
parent
b6cd1ff13c
commit
7ee8048c34
2 changed files with 12 additions and 1 deletions
|
@ -86,7 +86,7 @@ class WebOfTrust(private val certificateStore: PGPCertificateStore) {
|
|||
private class PGPNetworkFactory private constructor(validatedCertificates: List<KeyRingInfo>,
|
||||
private val policy: Policy,
|
||||
private val referenceTime: ReferenceTime) {
|
||||
private val networkBuilder: Network.Builder = Network.builder()
|
||||
private val networkBuilder: Network.Builder = Network.builder().setReferenceTime(referenceTime)
|
||||
|
||||
// certificates keyed by fingerprint
|
||||
private val byFingerprint: MutableMap<Fingerprint, KeyRingInfo> = HashMap()
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.pgpainless.key.OpenPgpFingerprint
|
|||
import org.pgpainless.wot.network.Edge
|
||||
import org.pgpainless.wot.network.Fingerprint
|
||||
import org.pgpainless.wot.network.Network
|
||||
import org.pgpainless.wot.network.ReferenceTime
|
||||
import org.pgpainless.wot.testfixtures.TestCertificateStores
|
||||
import org.pgpainless.wot.testfixtures.WotTestVectors
|
||||
import kotlin.test.assertEquals
|
||||
|
@ -92,6 +93,16 @@ class WebOfTrustTest {
|
|||
assertEquals(1, network.nodes.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `referenceTime is propagated properly`() {
|
||||
val referenceTime = ReferenceTime.now()
|
||||
|
||||
val network = WebOfTrust(KeyRingCertificateStore(listOf()))
|
||||
.buildNetwork(referenceTime = referenceTime)
|
||||
|
||||
assertEquals(referenceTime, network.referenceTime)
|
||||
}
|
||||
|
||||
|
||||
private fun assertHasIssuerAndTarget(
|
||||
certifications: Edge,
|
||||
|
|
Loading…
Reference in a new issue