Skip to content

Commit

Permalink
chore: upgrade to CC 1.0.0.rc14 and disable MLS and E2EI impl
Browse files Browse the repository at this point in the history
  • Loading branch information
typfel committed Oct 10, 2023
1 parent 7237f74 commit e12a775
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 382 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ProteusClientCryptoBoxImpl constructor(

override fun getIdentity(): ByteArray = wrapException { box.copyIdentity() }

override fun getLocalFingerprint(): ByteArray = wrapException { box.localFingerprint }
override suspend fun getLocalFingerprint(): ByteArray = wrapException { box.localFingerprint }

override suspend fun newPreKeys(from: Int, count: Int): ArrayList<PreKeyCrypto> = lock.withLock {
withContext(defaultContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class ProteusClientCoreCryptoImpl constructor(private val rootDir: String, priva
return ByteArray(0)
}

override fun getLocalFingerprint(): ByteArray {
override suspend fun getLocalFingerprint(): ByteArray {
return wrapException { coreCrypto.proteusFingerprint().toByteArray() }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ actual class ProteusClientImpl actual constructor(
return client.getIdentity()
}

override fun getLocalFingerprint(): ByteArray {
override suspend fun getLocalFingerprint(): ByteArray {
return client.getLocalFingerprint()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,84 +17,70 @@
*/
package com.wire.kalium.cryptography

import com.wire.crypto.WireE2eIdentity
import com.wire.kalium.cryptography.MLSClientImpl.Companion.toByteArray
import com.wire.kalium.cryptography.MLSClientImpl.Companion.toUByteList

@Suppress("TooManyFunctions")
@OptIn(ExperimentalUnsignedTypes::class)
class E2EIClientImpl(
val wireE2eIdentity: WireE2eIdentity
) : E2EIClient {

private val defaultDPoPTokenExpiry: UInt = 30U

override fun directoryResponse(directory: JsonRawData) =
toAcmeDirectory(wireE2eIdentity.directoryResponse(toUByteList(directory)))

override fun getNewAccountRequest(previousNonce: String) =
toByteArray(wireE2eIdentity.newAccountRequest(previousNonce))

override fun setAccountResponse(account: JsonRawData) =
wireE2eIdentity.newAccountResponse(toUByteList(account))

override fun getNewOrderRequest(previousNonce: String) =
toByteArray(wireE2eIdentity.newOrderRequest(previousNonce))

override fun setOrderResponse(order: JsonRawData) =
toNewAcmeOrder(wireE2eIdentity.newOrderResponse(toUByteList(order)))
class E2EIClientImpl : E2EIClient {
override fun directoryResponse(directory: JsonRawData): AcmeDirectory {
TODO("Not yet implemented")
}

override fun getNewAuthzRequest(url: String, previousNonce: String) =
toByteArray(wireE2eIdentity.newAuthzRequest(url, previousNonce))
override fun getNewAccountRequest(previousNonce: String): JsonRawData {
TODO("Not yet implemented")
}

override fun setAuthzResponse(authz: JsonRawData) =
toNewAcmeAuthz(wireE2eIdentity.newAuthzResponse(toUByteList(authz)))
override fun setAccountResponse(account: JsonRawData) {
TODO("Not yet implemented")
}

override fun createDpopToken(backendNonce: String) =
wireE2eIdentity.createDpopToken(expirySecs = defaultDPoPTokenExpiry, backendNonce)
override fun getNewOrderRequest(previousNonce: String): JsonRawData {
TODO("Not yet implemented")
}

override fun getNewDpopChallengeRequest(accessToken: String, previousNonce: String) =
toByteArray(wireE2eIdentity.newDpopChallengeRequest(accessToken, previousNonce))
override fun setOrderResponse(order: JsonRawData): NewAcmeOrder {
TODO("Not yet implemented")
}

override fun getNewOidcChallengeRequest(idToken: String, previousNonce: String) =
toByteArray(wireE2eIdentity.newOidcChallengeRequest(idToken, previousNonce))
override fun getNewAuthzRequest(url: String, previousNonce: String): JsonRawData {
TODO("Not yet implemented")
}

override fun setChallengeResponse(challenge: JsonRawData) =
wireE2eIdentity.newChallengeResponse(toUByteList(challenge))
override fun setAuthzResponse(authz: JsonRawData): NewAcmeAuthz {
TODO("Not yet implemented")
}

override fun checkOrderRequest(orderUrl: String, previousNonce: String) =
toByteArray(wireE2eIdentity.checkOrderRequest(orderUrl, previousNonce))
override fun createDpopToken(backendNonce: String): DpopToken {
TODO("Not yet implemented")
}

override fun checkOrderResponse(order: JsonRawData) =
wireE2eIdentity.checkOrderResponse(toUByteList(order))
override fun getNewDpopChallengeRequest(accessToken: String, previousNonce: String): JsonRawData {
TODO("Not yet implemented")
}

override fun finalizeRequest(previousNonce: String) =
toByteArray(wireE2eIdentity.finalizeRequest(previousNonce))
override fun getNewOidcChallengeRequest(idToken: String, previousNonce: String): JsonRawData {
TODO("Not yet implemented")
}

override fun finalizeResponse(finalize: JsonRawData) =
wireE2eIdentity.finalizeResponse(toUByteList(finalize))
override fun setChallengeResponse(challenge: JsonRawData) {
TODO("Not yet implemented")
}

override fun certificateRequest(previousNonce: String) =
toByteArray(wireE2eIdentity.certificateRequest(previousNonce))
override fun checkOrderRequest(orderUrl: String, previousNonce: String): JsonRawData {
TODO("Not yet implemented")
}

companion object {
fun toAcmeDirectory(value: com.wire.crypto.AcmeDirectory) = AcmeDirectory(
value.newNonce, value.newAccount, value.newOrder
)
override fun checkOrderResponse(order: JsonRawData): String {
TODO("Not yet implemented")
}

fun toNewAcmeOrder(value: com.wire.crypto.NewAcmeOrder) = NewAcmeOrder(
value.delegate.toUByteArray().asByteArray(),
value.authorizations
)
override fun finalizeRequest(previousNonce: String): JsonRawData {
TODO("Not yet implemented")
}

private fun toAcmeChallenge(value: com.wire.crypto.AcmeChallenge) = AcmeChallenge(
value.delegate.toUByteArray().asByteArray(), value.url
)
override fun finalizeResponse(finalize: JsonRawData): String {
TODO("Not yet implemented")
}

fun toNewAcmeAuthz(value: com.wire.crypto.NewAcmeAuthz) = NewAcmeAuthz(
value.identifier,
value.wireOidcChallenge?.let { toAcmeChallenge(it) },
value.wireDpopChallenge?.let { toAcmeChallenge(it) },
)
override fun certificateRequest(previousNonce: String): JsonRawData {
TODO("Not yet implemented")
}

}
Loading

0 comments on commit e12a775

Please sign in to comment.