Refactor code into api from internal
This commit is contained in:
parent
5abb786b6b
commit
c18439f99b
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous
|
package org.matrix.android.sdk.api.rendezvous
|
||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
@ -29,10 +29,10 @@ import org.matrix.android.sdk.api.session.crypto.crosssigning.MASTER_KEY_SSSS_NA
|
|||||||
import org.matrix.android.sdk.api.session.crypto.crosssigning.SELF_SIGNING_KEY_SSSS_NAME
|
import org.matrix.android.sdk.api.session.crypto.crosssigning.SELF_SIGNING_KEY_SSSS_NAME
|
||||||
import org.matrix.android.sdk.api.session.crypto.crosssigning.USER_SIGNING_KEY_SSSS_NAME
|
import org.matrix.android.sdk.api.session.crypto.crosssigning.USER_SIGNING_KEY_SSSS_NAME
|
||||||
import org.matrix.android.sdk.api.util.MatrixJsonParser
|
import org.matrix.android.sdk.api.util.MatrixJsonParser
|
||||||
import org.matrix.android.sdk.internal.rendezvous.channels.ECDHRendezvousChannel
|
import org.matrix.android.sdk.api.rendezvous.channels.ECDHRendezvousChannel
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.ECDHRendezvousCode
|
import org.matrix.android.sdk.api.rendezvous.model.ECDHRendezvousCode
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.RendezvousIntent
|
import org.matrix.android.sdk.api.rendezvous.model.RendezvousIntent
|
||||||
import org.matrix.android.sdk.internal.rendezvous.transports.SimpleHttpRendezvousTransport
|
import org.matrix.android.sdk.api.rendezvous.transports.SimpleHttpRendezvousTransport
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
internal enum class PayloadType(val value: String) {
|
internal enum class PayloadType(val value: String) {
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous
|
package org.matrix.android.sdk.api.rendezvous
|
||||||
|
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.ECDHRendezvousCode
|
import org.matrix.android.sdk.api.rendezvous.model.ECDHRendezvousCode
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.RendezvousIntent
|
import org.matrix.android.sdk.api.rendezvous.model.RendezvousIntent
|
||||||
|
|
||||||
interface RendezvousChannel {
|
interface RendezvousChannel {
|
||||||
var transport: RendezvousTransport;
|
var transport: RendezvousTransport;
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous
|
package org.matrix.android.sdk.api.rendezvous
|
||||||
|
|
||||||
enum class RendezvousFailureReason(val value: String, val canRetry: Boolean = true) {
|
enum class RendezvousFailureReason(val value: String, val canRetry: Boolean = true) {
|
||||||
UserDeclined("user_declined"),
|
UserDeclined("user_declined"),
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous
|
package org.matrix.android.sdk.api.rendezvous
|
||||||
|
|
||||||
import okhttp3.MediaType
|
import okhttp3.MediaType
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.RendezvousTransportDetails
|
import org.matrix.android.sdk.api.rendezvous.model.RendezvousTransportDetails
|
||||||
|
|
||||||
interface RendezvousTransport {
|
interface RendezvousTransport {
|
||||||
var ready: Boolean;
|
var ready: Boolean;
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous.channels
|
package org.matrix.android.sdk.api.rendezvous.channels
|
||||||
|
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
@ -23,15 +23,15 @@ import okhttp3.MediaType.Companion.toMediaType
|
|||||||
import org.matrix.android.sdk.api.logger.LoggerTag
|
import org.matrix.android.sdk.api.logger.LoggerTag
|
||||||
import org.matrix.android.sdk.api.util.MatrixJsonParser
|
import org.matrix.android.sdk.api.util.MatrixJsonParser
|
||||||
import org.matrix.android.sdk.internal.extensions.toUnsignedInt
|
import org.matrix.android.sdk.internal.extensions.toUnsignedInt
|
||||||
import org.matrix.android.sdk.internal.rendezvous.RendezvousFailureReason
|
import org.matrix.android.sdk.api.rendezvous.RendezvousFailureReason
|
||||||
import org.matrix.android.sdk.internal.rendezvous.RendezvousChannel
|
import org.matrix.android.sdk.api.rendezvous.RendezvousChannel
|
||||||
import org.matrix.android.sdk.internal.rendezvous.RendezvousTransport
|
import org.matrix.android.sdk.api.rendezvous.RendezvousTransport
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.ECDHRendezvous
|
import org.matrix.android.sdk.api.rendezvous.model.ECDHRendezvous
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.ECDHRendezvousCode
|
import org.matrix.android.sdk.api.rendezvous.model.ECDHRendezvousCode
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.RendezvousError
|
import org.matrix.android.sdk.api.rendezvous.model.RendezvousError
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.RendezvousIntent
|
import org.matrix.android.sdk.api.rendezvous.model.RendezvousIntent
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.SecureRendezvousChannelAlgorithm
|
import org.matrix.android.sdk.api.rendezvous.model.SecureRendezvousChannelAlgorithm
|
||||||
import org.matrix.android.sdk.internal.rendezvous.transports.SimpleHttpRendezvousTransportDetails
|
import org.matrix.android.sdk.api.rendezvous.transports.SimpleHttpRendezvousTransportDetails
|
||||||
import org.matrix.olm.OlmSAS
|
import org.matrix.olm.OlmSAS
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.security.SecureRandom
|
import java.security.SecureRandom
|
||||||
@ -107,10 +107,12 @@ class ECDHRendezvousChannel(override var transport: RendezvousTransport, theirPu
|
|||||||
} else {
|
} else {
|
||||||
// send our public key unencrypted
|
// send our public key unencrypted
|
||||||
// Timber.tag(TAG).i("Sending public key")
|
// Timber.tag(TAG).i("Sending public key")
|
||||||
send(ECDHPayload(
|
send(
|
||||||
|
ECDHPayload(
|
||||||
algorithm = SecureRendezvousChannelAlgorithm.ECDH_V1,
|
algorithm = SecureRendezvousChannelAlgorithm.ECDH_V1,
|
||||||
key = Base64.encodeToString(ourPublicKey, Base64.NO_WRAP)
|
key = Base64.encodeToString(ourPublicKey, Base64.NO_WRAP)
|
||||||
))
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
olmSAS!!.setTheirPublicKey(Base64.encodeToString(theirPublicKey, Base64.NO_WRAP))
|
olmSAS!!.setTheirPublicKey(Base64.encodeToString(theirPublicKey, Base64.NO_WRAP))
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,11 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous.model
|
package org.matrix.android.sdk.api.rendezvous.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
import org.matrix.android.sdk.internal.rendezvous.transports.SimpleHttpRendezvousTransportDetails
|
import org.matrix.android.sdk.api.rendezvous.transports.SimpleHttpRendezvousTransportDetails
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class ECDHRendezvous(
|
data class ECDHRendezvous(
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous.model
|
package org.matrix.android.sdk.api.rendezvous.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous.model
|
package org.matrix.android.sdk.api.rendezvous.model
|
||||||
|
|
||||||
import org.matrix.android.sdk.internal.rendezvous.RendezvousFailureReason
|
import org.matrix.android.sdk.api.rendezvous.RendezvousFailureReason
|
||||||
|
|
||||||
class RendezvousError(val description: String, val reason: RendezvousFailureReason): RuntimeException(description) {
|
class RendezvousError(val description: String, val reason: RendezvousFailureReason): RuntimeException(description) {
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous.model
|
package org.matrix.android.sdk.api.rendezvous.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous.model
|
package org.matrix.android.sdk.api.rendezvous.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous.model
|
package org.matrix.android.sdk.api.rendezvous.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous.model
|
package org.matrix.android.sdk.api.rendezvous.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.rendezvous.transports
|
package org.matrix.android.sdk.api.rendezvous.transports
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
@ -23,10 +23,10 @@ import okhttp3.MediaType
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.RequestBody.Companion.toRequestBody
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
import org.matrix.android.sdk.api.logger.LoggerTag
|
import org.matrix.android.sdk.api.logger.LoggerTag
|
||||||
import org.matrix.android.sdk.internal.rendezvous.RendezvousFailureReason
|
import org.matrix.android.sdk.api.rendezvous.RendezvousFailureReason
|
||||||
import org.matrix.android.sdk.internal.rendezvous.RendezvousTransport
|
import org.matrix.android.sdk.api.rendezvous.RendezvousTransport
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.RendezvousTransportDetails
|
import org.matrix.android.sdk.api.rendezvous.model.RendezvousTransportDetails
|
||||||
import org.matrix.android.sdk.internal.rendezvous.model.RendezvousTransportType
|
import org.matrix.android.sdk.api.rendezvous.model.RendezvousTransportType
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package im.vector.app.features.login.qr
|
package im.vector.app.features.login.qr
|
||||||
|
|
||||||
import org.matrix.android.sdk.internal.rendezvous.RendezvousFailureReason
|
import org.matrix.android.sdk.api.rendezvous.RendezvousFailureReason
|
||||||
|
|
||||||
sealed class QrCodeLoginConnectionStatus {
|
sealed class QrCodeLoginConnectionStatus {
|
||||||
object ConnectingToDevice : QrCodeLoginConnectionStatus()
|
object ConnectingToDevice : QrCodeLoginConnectionStatus()
|
||||||
|
@ -27,7 +27,7 @@ import im.vector.app.R
|
|||||||
import im.vector.app.core.platform.VectorBaseFragment
|
import im.vector.app.core.platform.VectorBaseFragment
|
||||||
import im.vector.app.databinding.FragmentQrCodeLoginStatusBinding
|
import im.vector.app.databinding.FragmentQrCodeLoginStatusBinding
|
||||||
import im.vector.app.features.themes.ThemeUtils
|
import im.vector.app.features.themes.ThemeUtils
|
||||||
import org.matrix.android.sdk.internal.rendezvous.RendezvousFailureReason
|
import org.matrix.android.sdk.api.rendezvous.RendezvousFailureReason
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class QrCodeLoginStatusFragment : VectorBaseFragment<FragmentQrCodeLoginStatusBinding>() {
|
class QrCodeLoginStatusFragment : VectorBaseFragment<FragmentQrCodeLoginStatusBinding>() {
|
||||||
|
@ -31,8 +31,8 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.matrix.android.sdk.api.auth.AuthenticationService
|
import org.matrix.android.sdk.api.auth.AuthenticationService
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
import org.matrix.android.sdk.internal.rendezvous.Rendezvous
|
import org.matrix.android.sdk.api.rendezvous.Rendezvous
|
||||||
import org.matrix.android.sdk.internal.rendezvous.RendezvousFailureReason
|
import org.matrix.android.sdk.api.rendezvous.RendezvousFailureReason
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
class QrCodeLoginViewModel @AssistedInject constructor(
|
class QrCodeLoginViewModel @AssistedInject constructor(
|
||||||
|
Loading…
Reference in New Issue
Block a user