Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: requesting to update E2EI certificate unnecessarily [WPB-7083] #2625

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ data class WireIdentity(
val status: CryptoCertificateStatus,
val thumbprint: String,
val serialNumber: String,
val endTimestamp: Long
val endTimestampSeconds: Long
) {
val handleWithoutSchemeAtSignAndDomain: String
get() = handle.substringAfter("://%40").removeSuffix("@$domain")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ data class E2eiCertificate(
status = certificateStatusMapper.toCertificateStatus(identity.status),
serialNumber = identity.serialNumber,
certificateDetail = identity.certificate,
endAt = Instant.fromEpochMilliseconds(identity.endTimestamp)
endAt = Instant.fromEpochSeconds(identity.endTimestampSeconds)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1699,12 +1699,14 @@ class MLSConversationRepositoryTest {
.whenInvokedWith(anything())
.then { Either.Right(mlsClient) }
}

fun withGetExternalSenderKeySuccessful() = apply {
given(mlsClient)
.suspendFunction(mlsClient::getExternalSenders)
.whenInvokedWith(anything())
.thenReturn(EXTERNAL_SENDER_KEY)
}

fun withRotateAllSuccessful(rotateBundle: RotateBundle = ROTATE_BUNDLE) = apply {
given(mlsClient)
.suspendFunction(mlsClient::e2eiRotateAll)
Expand Down Expand Up @@ -1915,7 +1917,7 @@ class MLSConversationRepositoryTest {
CryptoCertificateStatus.VALID,
thumbprint = "thumbprint",
serialNumber = "serialNumber",
endTimestamp = 1899105093
endTimestampSeconds = 1899105093
)
val E2EI_CONVERSATION_CLIENT_INFO_ENTITY =
E2EIConversationClientInfoEntity(UserIDEntity(uuid4().toString(), "domain.com"), "clientId", "groupId")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class MLSConversationsVerificationStatusesHandlerTest {
serialNumber = "serial1",
status = CryptoCertificateStatus.VALID,
thumbprint = "thumbprint1",
endTimestamp = 1899105093
endTimestampSeconds = 1899105093
)
),
user2.first.toModel() to listOf(
Expand All @@ -200,7 +200,7 @@ class MLSConversationsVerificationStatusesHandlerTest {
serialNumber = "serial2",
status = CryptoCertificateStatus.VALID,
thumbprint = "thumbprint2",
endTimestamp = 1899105093
endTimestampSeconds = 1899105093
)
)
)
Expand Down Expand Up @@ -256,7 +256,7 @@ class MLSConversationsVerificationStatusesHandlerTest {
serialNumber = "serial1",
status = CryptoCertificateStatus.VALID,
thumbprint = "thumbprint1",
endTimestamp = 1899105093
endTimestampSeconds = 1899105093
)
),
user2.first.toModel() to listOf(
Expand All @@ -272,7 +272,7 @@ class MLSConversationsVerificationStatusesHandlerTest {
serialNumber = "serial2",
status = CryptoCertificateStatus.VALID,
thumbprint = "thumbprint2",
endTimestamp = 1899105093
endTimestampSeconds = 1899105093
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import io.mockative.mock
import io.mockative.once
import io.mockative.verify
import kotlinx.coroutines.test.runTest
import kotlinx.datetime.Instant
import kotlin.test.Test
import kotlin.test.assertEquals

Expand Down Expand Up @@ -161,6 +162,8 @@ class GetE2eiCertificateUseCaseTest {
private val CRYPTO_QUALIFIED_CLIENT_ID =
CryptoQualifiedClientId("clientId", USER_ID.toCrypto())

val e2eiCertificate =
E2eiCertificate(CertificateStatus.EXPIRED, "serialNumber", "certificateDetail", Instant.DISTANT_FUTURE)
val IDENTITY = WireIdentity(
CRYPTO_QUALIFIED_CLIENT_ID,
handle = "alic_test",
Expand All @@ -170,7 +173,7 @@ class GetE2eiCertificateUseCaseTest {
status = CryptoCertificateStatus.EXPIRED,
thumbprint = "thumbprint",
serialNumber = "serialNumber",
endTimestamp = 1899105093
endTimestampSeconds = 1899105093
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class GetMembersE2EICertificateStatusesUseCaseTest {
CryptoCertificateStatus.VALID,
"thumbprint",
"serialNumber",
endTimestamp = 1899105093
endTimestampSeconds = 1899105093
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,5 @@ class GetUserE2eiAllCertificateStatusesUseCaseTest {
"serialNumber",
1899105093
)
private val E2EI_CERTIFICATE =
E2eiCertificate(
status = CertificateStatus.VALID,
certificateDetail = "details",
serialNumber = "serialNumber",
endAt = Instant.DISTANT_FUTURE
)
}
}
Loading