Skip to content
Snippets Groups Projects
Commit 8ff81de9 authored by Taras's avatar Taras
Browse files

Generate random key outside sdk

parent 80c476ec
No related branches found
No related tags found
No related merge requests found
......@@ -128,8 +128,11 @@ interface KeysBackupService {
callback: MatrixCallback<MegolmBackupCreationInfo>
)
fun prepareKeysBackupVersion(
key: ByteArray,
callback: MatrixCallback<MegolmBackupCreationInfo>
)
fun prepareRandomKeyBackupVersion(callback: MatrixCallback<MegolmBackupCreationInfo>)
/**
* Delete a keys backup version. It will delete all backed up keys on the server, and the backup itself.
* If we are backing up to this version. Backup will be stopped.
......
......@@ -237,14 +237,12 @@ internal class DefaultKeysBackupService @Inject constructor(
}
}
override fun prepareRandomKeyBackupVersion(callback: MatrixCallback<MegolmBackupCreationInfo>) {
override fun prepareKeysBackupVersion(key: ByteArray, callback: MatrixCallback<MegolmBackupCreationInfo>) {
cryptoCoroutineScope.launch(coroutineDispatchers.io) {
try {
val privateKey = ByteArray(32)
SecureRandom().nextBytes(privateKey)
val olmPkDecryption = OlmPkDecryption()
val signalableBackupAuthData = SignalableMegolmBackupAuthData(
publicKey = olmPkDecryption.setPrivateKey(privateKey),
publicKey = olmPkDecryption.setPrivateKey(key),
privateKeySalt = null,
privateKeyIterations = null
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment