-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: copy/modify kotlin wrapper from Kalium (#284)
- Loading branch information
Showing
16 changed files
with
1,154 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
60 changes: 60 additions & 0 deletions
60
crypto-ffi/bindings/kt/main/com/wire/crypto/client/CoreCryptoCentral.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.wire.crypto.client | ||
|
||
import com.wire.crypto.ClientId | ||
import com.wire.crypto.ConversationId | ||
import com.wire.crypto.CoreCrypto | ||
import com.wire.crypto.CoreCryptoCallbacks | ||
import java.io.File | ||
|
||
private class Callbacks: CoreCryptoCallbacks { | ||
|
||
override fun authorize( | ||
conversationId: List<UByte>, | ||
clientId: List<UByte>): Boolean { | ||
return true | ||
} | ||
|
||
override fun userAuthorize( | ||
conversationId: ConversationId, | ||
externalClientId: ClientId, | ||
existingClients: List<ClientId> | ||
): Boolean { | ||
return true | ||
} | ||
|
||
override fun clientIsExistingGroupUser( | ||
conversationId: ConversationId, | ||
clientId: ClientId, | ||
existingClients: List<ClientId>, | ||
parentConversationClients: List<ClientId>? | ||
): Boolean { | ||
return true | ||
} | ||
} | ||
|
||
@Suppress("TooManyFunctions") | ||
class CoreCryptoCentral constructor( | ||
private val rootDir: String, | ||
databaseKey: String | ||
) { | ||
private val path: String = "$rootDir/$KEYSTORE_NAME" | ||
private val coreCrypto: CoreCrypto | ||
init { | ||
File(rootDir).mkdirs() | ||
coreCrypto = CoreCrypto.deferredInit(path, databaseKey, null) | ||
coreCrypto.setCallbacks(Callbacks()) | ||
} | ||
|
||
fun proteusClient(): ProteusClient { | ||
return ProteusClientImpl(coreCrypto, rootDir) | ||
} | ||
|
||
fun mlsClient(clientId: String): MLSClient { | ||
return MLSClientImpl(coreCrypto, clientId) | ||
} | ||
|
||
companion object { | ||
const val KEYSTORE_NAME = "keystore" | ||
} | ||
} | ||
|
Oops, something went wrong.