+client.localIdentity
This commit is contained in:
parent
f2d8330ccc
commit
4098358233
1
.gitignore
vendored
1
.gitignore
vendored
@ -44,3 +44,4 @@ out/
|
|||||||
# More
|
# More
|
||||||
.kotlin
|
.kotlin
|
||||||
/.idea/workspace.xml
|
/.idea/workspace.xml
|
||||||
|
/.gigaide/gigaide.properties
|
||||||
|
@ -9,6 +9,7 @@ import kotlinx.coroutines.isActive
|
|||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
import kotlinx.coroutines.sync.withLock
|
import kotlinx.coroutines.sync.withLock
|
||||||
import net.sergeych.crypto2.SigningKey
|
import net.sergeych.crypto2.SigningKey
|
||||||
|
import net.sergeych.crypto2.VerifyingKey
|
||||||
import net.sergeych.crypto2.VerifyingPublicKey
|
import net.sergeych.crypto2.VerifyingPublicKey
|
||||||
import net.sergeych.mp_logger.LogTag
|
import net.sergeych.mp_logger.LogTag
|
||||||
import net.sergeych.mp_logger.Loggable
|
import net.sergeych.mp_logger.Loggable
|
||||||
@ -60,6 +61,14 @@ class KiloClient<S>(
|
|||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val connectedStateFlow = _state.asStateFlow()
|
val connectedStateFlow = _state.asStateFlow()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The verifying, or public, key identifying client sessions. It could be used to
|
||||||
|
* restore environment on reconnection. This is what remote side, e.g. server, sees as
|
||||||
|
* [KiloScope.remoteIdentity].
|
||||||
|
*/
|
||||||
|
@Suppress("unused")
|
||||||
|
val localIdentity: VerifyingKey? = secretKey?.verifyingKey
|
||||||
|
|
||||||
private var deferredClient = CompletableDeferred<KiloClientConnection<S>>()
|
private var deferredClient = CompletableDeferred<KiloClientConnection<S>>()
|
||||||
|
|
||||||
private val job =
|
private val job =
|
||||||
@ -141,7 +150,7 @@ class KiloClient<S>(
|
|||||||
* a key. Connection is established either with a properly authenticated key or no key at all.
|
* a key. Connection is established either with a properly authenticated key or no key at all.
|
||||||
*/
|
*/
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
suspend fun remoteId(): VerifyingPublicKey? = deferredClient.await().remoteId()
|
suspend fun remoteIdentity(): VerifyingPublicKey? = deferredClient.await().remoteId()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
class Builder<S>() {
|
class Builder<S>() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user