mirror of
https://github.com/element-hq/element-android
synced 2024-12-22 01:04:56 +03:00
crypto: Prepare the verification service to allow starting short SAS flows
This commit is contained in:
parent
304c89a56d
commit
bcfb121215
1 changed files with 18 additions and 11 deletions
|
@ -248,22 +248,29 @@ constructor(
|
||||||
otherDeviceId: String,
|
otherDeviceId: String,
|
||||||
transactionId: String?
|
transactionId: String?
|
||||||
): String? {
|
): String? {
|
||||||
val flowId = transactionId ?: return null
|
|
||||||
|
|
||||||
// should check if already one (and cancel it)
|
// should check if already one (and cancel it)
|
||||||
return if (method == VerificationMethod.SAS) {
|
return if (method == VerificationMethod.SAS) {
|
||||||
val request = this.getVerificationRequest(otherUserId, flowId)
|
val request = transactionId?.let { this.getVerificationRequest(otherUserId, it) }
|
||||||
|
|
||||||
runBlocking {
|
if (request != null) {
|
||||||
val sas = request?.startSasVerification()
|
runBlocking {
|
||||||
|
val sas = request.startSasVerification()
|
||||||
|
|
||||||
if (sas != null) {
|
if (sas != null) {
|
||||||
val sasTransaction = SasVerification(olmMachine.inner(), sas, requestSender, listeners)
|
val sasTransaction = SasVerification(olmMachine.inner(), sas, requestSender, listeners)
|
||||||
dispatchTxAdded(sasTransaction)
|
dispatchTxAdded(sasTransaction)
|
||||||
sasTransaction.transactionId
|
sasTransaction.transactionId
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// This should start the short SAS flow, the one that doesn't start with
|
||||||
|
// a `m.key.verification.request`, Element web stopped doing this, might
|
||||||
|
// be wise do do so as well
|
||||||
|
// DeviceListBottomSheetViewModel triggers this, interestingly the method that
|
||||||
|
// triggers this is called `manuallyVerify()`
|
||||||
|
TODO()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw IllegalArgumentException("Unknown verification method")
|
throw IllegalArgumentException("Unknown verification method")
|
||||||
|
|
Loading…
Reference in a new issue