Use unauth WebSocket after quick restore for transfer mode decision.

This commit is contained in:
Cody Henthorne
2025-04-09 15:13:20 -04:00
committed by Michelle Tang
parent 143b2b5bd5
commit ac36eeb84d
6 changed files with 15 additions and 12 deletions

View File

@@ -21,7 +21,7 @@ import kotlin.time.Duration.Companion.seconds
/**
* Linked and new device provisioning endpoints.
*/
class ProvisioningApi(private val authWebSocket: SignalWebSocket.AuthenticatedWebSocket) {
class ProvisioningApi(private val authWebSocket: SignalWebSocket.AuthenticatedWebSocket, private val unauthWebSocket: SignalWebSocket.UnauthenticatedWebSocket) {
/**
* Encrypts and sends the [registrationProvisionMessage] from the current primary (old device) to the new device over
@@ -56,7 +56,7 @@ class ProvisioningApi(private val authWebSocket: SignalWebSocket.AuthenticatedWe
val request = WebSocketRequestMessage.get("/v1/devices/restore_account/${token.urlEncode()}?timeout=$timeout")
return NetworkResult.fromWebSocket(NetworkResult.LongPollingWebSocketConverter(RestoreMethodBody::class)) {
authWebSocket.request(request, timeout.seconds)
unauthWebSocket.request(request, timeout.seconds)
}.map {
it.method ?: RestoreMethod.DECLINE
}