Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement logic for sign in with QR #7369

Merged
merged 101 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
21ae4c6
Support for login by m.login.token during QR code sign in
hughns Oct 13, 2022
098c268
Changelog
hughns Oct 13, 2022
a71ecee
Linting
hughns Oct 13, 2022
0d24565
Retry scanning if not a QR code
hughns Oct 11, 2022
1c70d45
Implementations of MSC3886 and MSC3903
hughns Oct 11, 2022
b192fdb
Partial implementation of QR login logic
hughns Oct 11, 2022
6e09d90
Merge branch 'develop' into feature/ons/qr_code_login_ui
Oct 12, 2022
8609008
Only do completeOnNewDevice if we received a confirmation code
hughns Oct 12, 2022
ebb3d20
Make initialDeviceName optional
hughns Oct 13, 2022
5843c38
Use correct var name
hughns Oct 13, 2022
579df74
Add missing binding
hughns Oct 13, 2022
b5e81d2
Set default value for optional params
hughns Oct 13, 2022
22b344c
Another default value fix
hughns Oct 13, 2022
8dbb1b8
Map for soft logout
hughns Oct 13, 2022
0111b93
Support for navigation to home screen
hughns Oct 13, 2022
1ed082d
QR login + E2EE set up
hughns Oct 13, 2022
560fda5
Reduce logging
hughns Oct 13, 2022
88238c0
Support for login by m.login.token during QR code sign in
hughns Oct 13, 2022
282825d
Changelog
hughns Oct 13, 2022
d0898a2
Linting
hughns Oct 13, 2022
3b3e11e
Retry scanning if not a QR code
hughns Oct 11, 2022
de611ca
Implementations of MSC3886 and MSC3903
hughns Oct 11, 2022
bfab07d
Partial implementation of QR login logic
hughns Oct 11, 2022
ef574bd
Merge branch 'develop' into feature/ons/qr_code_login_ui
Oct 12, 2022
b032403
Only do completeOnNewDevice if we received a confirmation code
hughns Oct 12, 2022
1e60f3c
Make initialDeviceName optional
hughns Oct 13, 2022
e2f3dde
Use correct var name
hughns Oct 13, 2022
ca7a6ef
Add missing binding
hughns Oct 13, 2022
ac80ae5
Set default value for optional params
hughns Oct 13, 2022
bc0843e
Another default value fix
hughns Oct 13, 2022
991eeb1
Map for soft logout
hughns Oct 13, 2022
9a72d65
Support for navigation to home screen
hughns Oct 13, 2022
dd47297
QR login + E2EE set up
hughns Oct 13, 2022
7bc0bd3
Reduce logging
hughns Oct 13, 2022
6399032
Fix bad merge
hughns Oct 13, 2022
958ee2d
Revert "Revert "Retry scanning if not a QR code""
hughns Oct 13, 2022
370652c
Revert "Revert "Implementations of MSC3886 and MSC3903""
hughns Oct 13, 2022
f04f0e6
Revert "Revert "Partial implementation of QR login logic""
hughns Oct 13, 2022
385140a
Merge branch 'feature/hughns/qr_code_login' of https://github.com/vec…
hughns Oct 13, 2022
5abb786
Fix copyright on SDK
hughns Oct 13, 2022
c18439f
Refactor code into api from internal
hughns Oct 14, 2022
c00ce91
Linting
hughns Oct 14, 2022
efa70fa
Revert "Retry scanning if not a QR code"
hughns Oct 13, 2022
d723719
Add flag to allow QR login on all servers + split flag for showing in…
hughns Oct 14, 2022
de4232d
Fix logic for showing confirm button
hughns Oct 14, 2022
e439b72
Handle master key trust during E2EE set up
hughns Oct 14, 2022
4325600
Merge branch 'feature/ons/qr_code_login_ui' into feature/hughns/qr_co…
hughns Oct 14, 2022
f999e72
Changelog
hughns Oct 14, 2022
411b766
Refactor to camelcase
hughns Oct 14, 2022
6426ff4
Linting
hughns Oct 14, 2022
dc9b41d
Merge branch 'feature/ons/qr_code_login_ui' into feature/hughns/qr_co…
hughns Oct 14, 2022
fdc5596
Linting
hughns Oct 14, 2022
bfe3daa
Fix compile error from bad merge
hughns Oct 14, 2022
a3fc785
Fix missing param
hughns Oct 14, 2022
d979b50
Logging cleanup
hughns Oct 17, 2022
ed6bc01
Resolve TODO
hughns Oct 17, 2022
33be5c2
Refactor into dedicated files and companion objects
hughns Oct 17, 2022
3be4a0c
Remove unused val
hughns Oct 17, 2022
48de8f4
Fix bad merge
hughns Oct 17, 2022
506fa72
Cleanup
hughns Oct 17, 2022
4306c57
Thread safe use of OlmSAS
hughns Oct 17, 2022
fb86ab7
Comments and error mapping
hughns Oct 17, 2022
1976451
Lint
hughns Oct 17, 2022
eb30ef1
Improve 404 handling
hughns Oct 17, 2022
e89774e
Merge branch 'feature/ons/qr_code_login_ui' into feature/hughns/qr_co…
hughns Oct 17, 2022
7e24f6a
Merge branch 'feature/ons/qr_code_login_ui' into feature/hughns/qr_co…
hughns Oct 17, 2022
d616251
Fix merge
hughns Oct 17, 2022
e01ee61
Refactor error handling and report E2EE errors
hughns Oct 17, 2022
29065b8
Remove unused class
hughns Oct 17, 2022
e877fee
Add @JsonClass to all enums
hughns Oct 17, 2022
623277e
Lint
hughns Oct 17, 2022
3d37e0b
Fix enum JsonClass generateAdapter = false
hughns Oct 17, 2022
552fb9d
Improved comment around QR generation
hughns Oct 17, 2022
b2dc0b3
Implement try again button action.
Oct 17, 2022
1863e4c
Use unstable prefixes
hughns Oct 17, 2022
c366931
Merge branch 'feature/hughns/qr_code_login' of https://github.com/vec…
hughns Oct 17, 2022
d3e61a2
Fix generator
hughns Oct 17, 2022
41dbdbc
Lint
hughns Oct 17, 2022
8c81902
Better function name
hughns Oct 17, 2022
8f4d998
Lint
hughns Oct 17, 2022
6d17d51
remove nullability
hughns Oct 17, 2022
8cfe6b1
Wording updates
hughns Oct 17, 2022
cf1c751
Automatically try again on partial failed QR scan
hughns Oct 17, 2022
a3126b0
Progress to status screen on failure
hughns Oct 17, 2022
8a62dfb
Lint
hughns Oct 17, 2022
f297117
Use mutex
hughns Oct 18, 2022
a1d2944
Always check master key when provided by verifying device
hughns Oct 18, 2022
57a8dd4
Whitespce
hughns Oct 18, 2022
376cd1c
Missing throws
hughns Oct 18, 2022
9fb0db3
Update library/ui-strings/src/main/res/values/strings.xml
hughns Oct 18, 2022
0d1df3f
Update matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/re…
hughns Oct 18, 2022
8530f8f
Update matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/re…
hughns Oct 18, 2022
a83fb8b
Update matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/re…
hughns Oct 18, 2022
916ae65
Don't log whole QR code
hughns Oct 18, 2022
0acbd9c
Merge branch 'feature/hughns/qr_code_login' of https://github.com/vec…
hughns Oct 18, 2022
811d6d8
Reuse getDecimalCodeRepresentation from SAS instead of duplicating code
hughns Oct 18, 2022
f7e0a19
Remove redundant annotations
hughns Oct 18, 2022
67be8c3
The one that got away
hughns Oct 18, 2022
0c52a7e
Fix layout after try again button is clicked.
Oct 18, 2022
4f652f1
Request changes from review
hughns Oct 19, 2022
025a89f
Merge branch 'feature/hughns/qr_code_login' of https://github.com/vec…
hughns Oct 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7369.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add logic for sign in with QR code
13 changes: 10 additions & 3 deletions library/ui-strings/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3382,9 +3382,16 @@
<string name="qr_code_login_header_failed_device_is_not_supported_description">Linking with this device is not supported.</string>
<string name="qr_code_login_header_failed_timeout_description">The linking wasn’t completed in the required time.</string>
<string name="qr_code_login_header_failed_denied_description">The request was denied on the other device.</string>
<string name="qr_code_login_new_device_instruction_1">Open ${app_name} on your other device</string>
<string name="qr_code_login_new_device_instruction_2">Go to Settings -> Security &amp; Privacy -> Show All Sessions</string>
<string name="qr_code_login_new_device_instruction_3">Select \'Show QR code in this device\'</string>
<string name="qr_code_login_header_failed_other_description">The request failed.</string>
<string name="qr_code_login_header_failed_e2ee_security_issue_description">A security issue was encountered setting up secure messaging. One of the following may be compromised: Your homeserver; Your intent connection(s); Your device(s);</string>
<string name="qr_code_login_header_failed_other_device_already_signed_in_description">The other device is already signed in.</string>
<string name="qr_code_login_header_failed_other_device_not_signed_in_description">The other device must be signed in.</string>
<string name="qr_code_login_header_failed_invalid_qr_code_description">That QR code is invalid.</string>
<string name="qr_code_login_header_failed_user_cancelled_description">The sign in was cancelled on the other device.</string>
<string name="qr_code_login_header_failed_homeserver_is_not_supported_description">The homeserver doesn\'t support sign in with QR code.</string>
<string name="qr_code_login_new_device_instruction_1">Open the app on your other device</string>
<string name="qr_code_login_new_device_instruction_2">Go to Settings -> Security &amp; Privacy</string>
<string name="qr_code_login_new_device_instruction_3">Select \'Show QR code\'</string>
<string name="qr_code_login_link_a_device_scan_qr_code_instruction_1">Start at the sign in screen</string>
<string name="qr_code_login_link_a_device_scan_qr_code_instruction_2">Select \'Sign in with QR code\'</string>
<string name="qr_code_login_link_a_device_show_qr_code_instruction_1">Start at the sign in screen</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ open class LoggerTag(name: String, parentTag: LoggerTag? = null) {
object SYNC : LoggerTag("SYNC")
object VOIP : LoggerTag("VOIP")
object CRYPTO : LoggerTag("CRYPTO")
object RENDEZVOUS : LoggerTag("RZ")

val value: String = if (parentTag == null) {
name
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
/*
* Copyright 2022 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.api.rendezvous

import android.net.Uri
import org.matrix.android.sdk.api.auth.AuthenticationService
import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig
import org.matrix.android.sdk.api.logger.LoggerTag
import org.matrix.android.sdk.api.rendezvous.channels.ECDHRendezvousChannel
import org.matrix.android.sdk.api.rendezvous.model.ECDHRendezvousCode
import org.matrix.android.sdk.api.rendezvous.model.Outcome
import org.matrix.android.sdk.api.rendezvous.model.Payload
import org.matrix.android.sdk.api.rendezvous.model.PayloadType
import org.matrix.android.sdk.api.rendezvous.model.Protocol
import org.matrix.android.sdk.api.rendezvous.model.RendezvousError
import org.matrix.android.sdk.api.rendezvous.model.RendezvousIntent
import org.matrix.android.sdk.api.rendezvous.transports.SimpleHttpRendezvousTransport
import org.matrix.android.sdk.api.session.Session
import org.matrix.android.sdk.api.session.crypto.crosssigning.DeviceTrustLevel
import org.matrix.android.sdk.api.session.crypto.crosssigning.KEYBACKUP_SECRET_SSSS_NAME
import org.matrix.android.sdk.api.session.crypto.crosssigning.MASTER_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.util.MatrixJsonParser
import timber.log.Timber

/**
* Implementation of MSC3906 to sign in + E2EE set up using a QR code.
*/
class Rendezvous(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just define an interface here, and move the implementation to another internal class, for instance RendezvousImpl.

val channel: RendezvousChannel,
val theirIntent: RendezvousIntent,
) {
companion object {
private val TAG = LoggerTag(Rendezvous::class.java.simpleName, LoggerTag.RENDEZVOUS).value

@Throws(RendezvousError::class)
fun buildChannelFromCode(code: String): Rendezvous {
val parsed = try {
// we rely on moshi validating the code and throwing exception if invalid JSON or doesn't
MatrixJsonParser.getMoshi().adapter(ECDHRendezvousCode::class.java).fromJson(code)
} catch (a: Throwable) {
throw RendezvousError("Invalid code", RendezvousFailureReason.InvalidCode)
} ?: throw RendezvousError("Invalid code", RendezvousFailureReason.InvalidCode)

val transport = SimpleHttpRendezvousTransport(parsed.rendezvous.transport.uri)

return Rendezvous(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can return an instance of RendezvousImpl here.

ECDHRendezvousChannel(transport, parsed.rendezvous.key),
parsed.intent
)
}
}

private val adapter = MatrixJsonParser.getMoshi().adapter(Payload::class.java)

// not yet implemented: RendezvousIntent.RECIPROCATE_LOGIN_ON_EXISTING_DEVICE
val ourIntent: RendezvousIntent = RendezvousIntent.LOGIN_ON_NEW_DEVICE

@Throws(RendezvousError::class)
private suspend fun checkCompatibility() {
val incompatible = theirIntent == ourIntent

Timber.tag(TAG).d("ourIntent: $ourIntent, theirIntent: $theirIntent, incompatible: $incompatible")

if (incompatible) {
// inform the other side
send(Payload(PayloadType.FINISH, intent = ourIntent))
if (ourIntent == RendezvousIntent.LOGIN_ON_NEW_DEVICE) {
throw RendezvousError("The other device isn't signed in", RendezvousFailureReason.OtherDeviceNotSignedIn)
} else {
throw RendezvousError("The other device is already signed in", RendezvousFailureReason.OtherDeviceAlreadySignedIn)
}
}
}

@Throws(RendezvousError::class)
suspend fun startAfterScanningCode(): String {
val checksum = channel.connect()

Timber.tag(TAG).i("Connected to secure channel with checksum: $checksum")

checkCompatibility()

// get protocols
Timber.tag(TAG).i("Waiting for protocols")
val protocolsResponse = receive()

if (protocolsResponse?.protocols == null || !protocolsResponse.protocols.contains(Protocol.LOGIN_TOKEN)) {
send(Payload(PayloadType.FINISH, outcome = Outcome.UNSUPPORTED))
throw RendezvousError("Unsupported protocols", RendezvousFailureReason.UnsupportedHomeserver)
}

send(Payload(PayloadType.PROGRESS, protocol = Protocol.LOGIN_TOKEN))

return checksum
}

@Throws(RendezvousError::class)
suspend fun waitForLoginOnNewDevice(authenticationService: AuthenticationService): Session {
Timber.tag(TAG).i("Waiting for login_token")

val loginToken = receive()

if (loginToken?.type == PayloadType.FINISH) {
when (loginToken.outcome) {
Outcome.DECLINED -> {
throw RendezvousError("Login declined by other device", RendezvousFailureReason.UserDeclined)
}
Outcome.UNSUPPORTED -> {
throw RendezvousError("Homeserver lacks support", RendezvousFailureReason.UnsupportedHomeserver)
}
else -> {
throw RendezvousError("Unknown error", RendezvousFailureReason.Unknown)
}
}
}

val homeserver = loginToken?.homeserver ?: throw RendezvousError("No homeserver returned", RendezvousFailureReason.ProtocolError)
val token = loginToken.loginToken ?: throw RendezvousError("No login token returned", RendezvousFailureReason.ProtocolError)

Timber.tag(TAG).i("Got login_token now attempting to sign in with $homeserver")

val hsConfig = HomeServerConnectionConfig(homeServerUri = Uri.parse(homeserver))
return authenticationService.loginUsingQrLoginToken(hsConfig, token)
}

@Throws(RendezvousError::class)
suspend fun completeVerificationOnNewDevice(session: Session) {
val userId = session.myUserId
val crypto = session.cryptoService()
val deviceId = crypto.getMyDevice().deviceId
val deviceKey = crypto.getMyDevice().fingerprint()
send(Payload(PayloadType.PROGRESS, outcome = Outcome.SUCCESS, deviceId = deviceId, deviceKey = deviceKey))

// await confirmation of verification
val verificationResponse = receive()
if (verificationResponse?.outcome == Outcome.VERIFIED) {
val verifyingDeviceId = verificationResponse.verifyingDeviceId
?: throw RendezvousError("No verifying device id returned", RendezvousFailureReason.ProtocolError)
val verifyingDeviceFromServer = crypto.getCryptoDeviceInfo(userId, verifyingDeviceId)
if (verifyingDeviceFromServer?.fingerprint() != verificationResponse.verifyingDeviceKey) {
Timber.tag(TAG).w(
"Verifying device $verifyingDeviceId key doesn't match: ${
verifyingDeviceFromServer?.fingerprint()
} vs ${verificationResponse.verifyingDeviceKey})"
)
// inform the other side
send(Payload(PayloadType.FINISH, outcome = Outcome.E2EE_SECURITY_ERROR))
throw RendezvousError("Key from verifying device doesn't match", RendezvousFailureReason.E2EESecurityIssue)
}

verificationResponse.masterKey?.let { masterKeyFromVerifyingDevice ->
// verifying device provided us with a master key, so use it to check integrity

// see what the homeserver told us
val localMasterKey = crypto.crossSigningService().getMyCrossSigningKeys()?.masterKey()

// n.b. if no local master key this is a problem, as well as it not matching
if (localMasterKey?.unpaddedBase64PublicKey != masterKeyFromVerifyingDevice) {
Timber.tag(TAG).w("Master key from verifying device doesn't match: $masterKeyFromVerifyingDevice vs $localMasterKey")
// inform the other side
send(Payload(PayloadType.FINISH, outcome = Outcome.E2EE_SECURITY_ERROR))
throw RendezvousError("Master key from verifying device doesn't match", RendezvousFailureReason.E2EESecurityIssue)
}

// set other device as verified
Timber.tag(TAG).i("Setting device $verifyingDeviceId as verified")
crypto.setDeviceVerification(DeviceTrustLevel(locallyVerified = true, crossSigningVerified = false), userId, verifyingDeviceId)

Timber.tag(TAG).i("Setting master key as trusted")
crypto.crossSigningService().markMyMasterKeyAsTrusted()
} ?: run {
// set other device as verified anyway
Timber.tag(TAG).i("Setting device $verifyingDeviceId as verified")
crypto.setDeviceVerification(DeviceTrustLevel(locallyVerified = true, crossSigningVerified = false), userId, verifyingDeviceId)

Timber.tag(TAG).i("No master key given by verifying device")
}

// request secrets from the verifying device
Timber.tag(TAG).i("Requesting secrets from $verifyingDeviceId")

session.sharedSecretStorageService().let {
it.requestSecret(MASTER_KEY_SSSS_NAME, verifyingDeviceId)
it.requestSecret(SELF_SIGNING_KEY_SSSS_NAME, verifyingDeviceId)
it.requestSecret(USER_SIGNING_KEY_SSSS_NAME, verifyingDeviceId)
it.requestSecret(KEYBACKUP_SECRET_SSSS_NAME, verifyingDeviceId)
}
} else {
Timber.tag(TAG).i("Not doing verification")
}
}

@Throws(RendezvousError::class)
private suspend fun receive(): Payload? {
val data = channel.receive() ?: return null
val payload = try {
adapter.fromJson(data.toString(Charsets.UTF_8))
} catch (e: Exception) {
Timber.tag(TAG).w(e, "Failed to parse payload")
throw RendezvousError("Invalid payload received", RendezvousFailureReason.Unknown)
}

return payload
}

private suspend fun send(payload: Payload) {
channel.send(adapter.toJson(payload).toByteArray(Charsets.UTF_8))
}

suspend fun close() {
channel.close()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2022 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.api.rendezvous

import org.matrix.android.sdk.api.rendezvous.model.RendezvousError

/**
* Representation of a rendezvous channel such as that described by MSC3903.
*/
interface RendezvousChannel {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
interface RendezvousChannel {
internal interface RendezvousChannel {

var transport: RendezvousTransport

/**
* @returns the checksum/confirmation digits to be shown to the user
*/
@Throws(RendezvousError::class)
suspend fun connect(): String

/**
* Send a payload via the channel.
* @param data payload to send
*/
@Throws(RendezvousError::class)
suspend fun send(data: ByteArray)

/**
* Receive a payload from the channel.
* @returns the received payload
*/
@Throws(RendezvousError::class)
suspend fun receive(): ByteArray?

/**
* @returns closes the channel and cleans up
*/
suspend fun close()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2022 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.api.rendezvous

enum class RendezvousFailureReason(val canRetry: Boolean = true) {
UserDeclined,
OtherDeviceNotSignedIn,
OtherDeviceAlreadySignedIn,
Unknown,
Expired,
UserCancelled,
InvalidCode,
UnsupportedAlgorithm(false),
UnsupportedTransport(false),
UnsupportedHomeserver(false),
ProtocolError,
E2EESecurityIssue(false)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2022 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.api.rendezvous

import okhttp3.MediaType
import org.matrix.android.sdk.api.rendezvous.model.RendezvousError
import org.matrix.android.sdk.api.rendezvous.model.RendezvousTransportDetails

interface RendezvousTransport {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
interface RendezvousTransport {
internal interface RendezvousTransport {

and move to internal package.

var ready: Boolean

@Throws(RendezvousError::class)
suspend fun details(): RendezvousTransportDetails

@Throws(RendezvousError::class)
suspend fun send(contentType: MediaType, data: ByteArray)

@Throws(RendezvousError::class)
suspend fun receive(): ByteArray?

suspend fun close()
}
Loading