PairingSession.kt

721 B · raw

1package com.peachpasswords.sync23import kotlinx.coroutines.CompletableDeferred45/**6 * The user's SAS decision, handed to the UI and awaited by the live pairing7 * session.8 *9 * The handler blocks inside the connection while the two screens are compared,10 * so the decision has to reach it out of band rather than as a return value.11 *12 * Lived in the retired LAN `CodePairingServer` until relay-only pairing13 * (docs/sync-lan-retirement.md); it was never LAN-specific.14 */15class PairingSession internal constructor() {16    private val decision = CompletableDeferred<Boolean>()1718    fun confirm(matches: Boolean) {19        decision.complete(matches)20    }2122    internal suspend fun await(): Boolean = decision.await()23}