mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
Move MegolmBackupAuthData
to api package
This commit is contained in:
parent
851708c1b4
commit
cc1fc29e7c
6 changed files with 43 additions and 24 deletions
|
@ -44,7 +44,7 @@ import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
|||
import org.matrix.android.sdk.api.util.Optional
|
||||
import org.matrix.android.sdk.api.crypto.MXCRYPTO_ALGORITHM_MEGOLM
|
||||
import org.matrix.android.sdk.api.crypto.MXCRYPTO_ALGORITHM_MEGOLM_BACKUP
|
||||
import org.matrix.android.sdk.internal.crypto.keysbackup.model.MegolmBackupAuthData
|
||||
import org.matrix.android.sdk.api.session.crypto.keysbackup.MegolmBackupAuthData
|
||||
import org.matrix.android.sdk.api.session.crypto.keysbackup.MegolmBackupCreationInfo
|
||||
import java.util.UUID
|
||||
import kotlin.coroutines.Continuation
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.matrix.android.sdk.internal.crypto.keysbackup.model
|
||||
package org.matrix.android.sdk.api.session.crypto.keysbackup
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
import org.matrix.android.sdk.api.util.JsonDict
|
||||
import org.matrix.android.sdk.internal.crypto.keysbackup.model.SignalableMegolmBackupAuthData
|
||||
import org.matrix.android.sdk.internal.di.MoshiProvider
|
||||
|
||||
/**
|
||||
|
@ -54,7 +55,7 @@ data class MegolmBackupAuthData(
|
|||
val signatures: Map<String, Map<String, String>>? = null
|
||||
) {
|
||||
|
||||
fun toJsonDict(): JsonDict {
|
||||
internal fun toJsonDict(): JsonDict {
|
||||
val moshi = MoshiProvider.providesMoshi()
|
||||
val adapter = moshi.adapter(Map::class.java)
|
||||
|
||||
|
@ -67,7 +68,7 @@ data class MegolmBackupAuthData(
|
|||
}
|
||||
}
|
||||
|
||||
fun signalableJSONDictionary(): JsonDict {
|
||||
internal fun signalableJSONDictionary(): JsonDict {
|
||||
return SignalableMegolmBackupAuthData(
|
||||
publicKey = publicKey,
|
||||
privateKeySalt = privateKeySalt,
|
||||
|
@ -77,19 +78,3 @@ data class MegolmBackupAuthData(
|
|||
}
|
||||
}
|
||||
|
||||
internal data class SignalableMegolmBackupAuthData(
|
||||
val publicKey: String,
|
||||
val privateKeySalt: String? = null,
|
||||
val privateKeyIterations: Int? = null
|
||||
) {
|
||||
fun signalableJSONDictionary(): JsonDict = HashMap<String, Any>().apply {
|
||||
put("public_key", publicKey)
|
||||
|
||||
privateKeySalt?.let {
|
||||
put("private_key_salt", it)
|
||||
}
|
||||
privateKeyIterations?.let {
|
||||
put("private_key_iterations", it)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.matrix.android.sdk.api.session.crypto.keysbackup
|
||||
|
||||
import org.matrix.android.sdk.internal.crypto.keysbackup.model.MegolmBackupAuthData
|
||||
|
||||
/**
|
||||
* Data retrieved from Olm library. algorithm and authData will be send to the homeserver, and recoveryKey will be displayed to the user
|
||||
*/
|
||||
|
|
|
@ -49,11 +49,11 @@ import org.matrix.android.sdk.api.util.awaitCallback
|
|||
import org.matrix.android.sdk.api.util.fromBase64
|
||||
import org.matrix.android.sdk.api.crypto.MXCRYPTO_ALGORITHM_MEGOLM_BACKUP
|
||||
import org.matrix.android.sdk.api.session.crypto.keysbackup.KeysBackupVersionTrustSignature
|
||||
import org.matrix.android.sdk.api.session.crypto.keysbackup.MegolmBackupAuthData
|
||||
import org.matrix.android.sdk.internal.crypto.MXOlmDevice
|
||||
import org.matrix.android.sdk.internal.crypto.MegolmSessionData
|
||||
import org.matrix.android.sdk.internal.crypto.ObjectSigner
|
||||
import org.matrix.android.sdk.internal.crypto.actions.MegolmSessionDataImporter
|
||||
import org.matrix.android.sdk.internal.crypto.keysbackup.model.MegolmBackupAuthData
|
||||
import org.matrix.android.sdk.internal.crypto.keysbackup.model.SignalableMegolmBackupAuthData
|
||||
import org.matrix.android.sdk.internal.crypto.keysbackup.model.rest.BackupKeysResult
|
||||
import org.matrix.android.sdk.internal.crypto.keysbackup.model.rest.CreateKeysBackupVersionBody
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.matrix.android.sdk.internal.crypto.keysbackup.model
|
||||
|
||||
import org.matrix.android.sdk.api.util.JsonDict
|
||||
|
||||
internal data class SignalableMegolmBackupAuthData(
|
||||
val publicKey: String,
|
||||
val privateKeySalt: String? = null,
|
||||
val privateKeyIterations: Int? = null
|
||||
) {
|
||||
fun signalableJSONDictionary(): JsonDict = HashMap<String, Any>().apply {
|
||||
put("public_key", publicKey)
|
||||
|
||||
privateKeySalt?.let {
|
||||
put("private_key_salt", it)
|
||||
}
|
||||
privateKeyIterations?.let {
|
||||
put("private_key_iterations", it)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ package org.matrix.android.sdk.internal.crypto.keysbackup.model.rest
|
|||
|
||||
import org.matrix.android.sdk.api.util.JsonDict
|
||||
import org.matrix.android.sdk.api.crypto.MXCRYPTO_ALGORITHM_MEGOLM_BACKUP
|
||||
import org.matrix.android.sdk.internal.crypto.keysbackup.model.MegolmBackupAuthData
|
||||
import org.matrix.android.sdk.api.session.crypto.keysbackup.MegolmBackupAuthData
|
||||
import org.matrix.android.sdk.internal.di.MoshiProvider
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue