Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into observe_legal_hold…
Browse files Browse the repository at this point in the history
…_request

# Conflicts:
#	logic/src/commonMain/kotlin/com/wire/kalium/logic/configuration/UserConfigRepository.kt
#	logic/src/commonMain/kotlin/com/wire/kalium/logic/data/legalhold/LastPreKey.kt
#	logic/src/commonMain/kotlin/com/wire/kalium/logic/sync/receiver/handler/legalhold/LegalHoldRequestHandler.kt
#	persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/unread/UserConfigDAO.kt
  • Loading branch information
ohassine committed Nov 22, 2023
2 parents 66d02fb + d7d5a72 commit 1246174
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ internal class LegalHoldRequestHandlerImpl internal constructor(
) : LegalHoldRequestHandler {
override suspend fun handle(legalHoldRequest: Event.User.LegalHoldRequest): Either<CoreFailure, Unit> {
if (selfUserId == legalHoldRequest.userId) {
kaliumLogger.i("Legal hold request received, storing it locally..")
kaliumLogger.i(
"Legal hold request received for user ${legalHoldRequest.userId.toLogString()}," +
" storing it locally.."
)
userConfigRepository.setLegalHoldRequest(
legalHoldRequest.clientId.value,
legalHoldRequest.lastPreKey.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,39 @@ class HttpClientConnectionSpecsTest {
// This test conforms to the following testing standards:
// @SF.Channel @TSFI.RESTfulAPI @S0.2 @S0.3 @S3
fun givenTheHttpClientIsCreated_ThenEnsureOnlySupportedSpecsArePresent() {
// given
val validTlsVersions = listOf(TlsVersion.TLS_1_3, TlsVersion.TLS_1_2)
val notValidTlsVersions = listOf(TlsVersion.TLS_1_1, TlsVersion.TLS_1_0, TlsVersion.SSL_3_0)
val validCipherSuites = listOf(
CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
CipherSuite.TLS_AES_128_GCM_SHA256,
CipherSuite.TLS_AES_256_GCM_SHA384
)
val notValidCipherSuites = listOf(
CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
CipherSuite.TLS_RSA_WITH_AES_128_GCM_SHA256,
CipherSuite.TLS_RSA_WITH_AES_256_GCM_SHA384,
CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA,
CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA,
CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA
)

// when
val connectionSpecs = OkHttpSingleton.createNew {}.connectionSpecs

// then
with(connectionSpecs[0]) {
tlsVersions?.let {
assertTrue { validTlsVersions.containsAll(it) }
assertFalse { notValidTlsVersions.containsAll(it) }
assertTrue { it.containsAll(validTlsVersions) }
assertFalse { it.containsAll(notValidTlsVersions) }
}

cipherSuites?.let {
assertTrue { it.containsAll(validCipherSuites) }
assertFalse { it.containsAll(notValidCipherSuites) }
}
}

assertEquals(connectionSpecs[1], ConnectionSpec.CLEARTEXT)
}

private companion object {
val validTlsVersions = listOf(TlsVersion.TLS_1_3, TlsVersion.TLS_1_2)
val notValidTlsVersions = listOf(TlsVersion.TLS_1_1, TlsVersion.TLS_1_0, TlsVersion.SSL_3_0)

val validCipherSuites = listOf(
CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
CipherSuite.TLS_AES_128_GCM_SHA256,
CipherSuite.TLS_AES_256_GCM_SHA384
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ internal class UserConfigDAOImpl internal constructor(
metadataDAO.putSerializable(
LEGAL_HOLD_REQUEST,
LegalHoldRequestEntity(clientId, LastPreKey(lastPreKeyId, lastPreKey)),
LegalHoldRequestEntity.serializer(),
LegalHoldRequestEntity.serializer()
)
}

Expand Down

0 comments on commit 1246174

Please sign in to comment.