KtorSecureMessageTransport

class KtorSecureMessageTransport(baseUrl: String, client: HttpClient = HttpClient { install(ContentNegotiation) { json() } }) : SecureMessageTransport

SecureMessageTransport over the KSecureMessage HTTP API v1. client must have ContentNegotiation with JSON installed. Routes and bodies are described in docs/prekey-publication.md, authentication in docs/server-authentication.md.

Authenticated requests are built from their exact body bytes: the JSON is encoded here, signed together with the method and canonical path, and sent unchanged, so the server hashes what was signed. Each attempt is signed anew (fresh timestamp and nonce).

Constructors

Link copied to clipboard
constructor(baseUrl: String, client: HttpClient = HttpClient { install(ContentNegotiation) { json() } })

Functions

Link copied to clipboard
open suspend override fun cancelLastDeviceRecoveryKeyReset(address: DeviceAddress, resetId: RecoveryKeyResetId, signer: ServerRequestSigner)
Link copied to clipboard
open suspend override fun fetchPreKeyBundle(address: DeviceAddress): PreKeyBundle

The returned bundle's address is always address; the server's response carries none. The bundle is not trusted here: the protocol engine verifies it before X3DH.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open suspend override fun publishPreKeys(publication: PreKeyPublication, signer: ServerRequestSigner)
Link copied to clipboard
open suspend override fun receive(address: DeviceAddress, signer: ServerRequestSigner): List<EncryptedEnvelope>
Link copied to clipboard
open suspend override fun recoverDevice(authorization: DeviceRecoveryAuthorization)
Link copied to clipboard
open suspend override fun recoverLastDevice(authorization: LastDeviceRecoveryAuthorization)
Link copied to clipboard
open suspend override fun registerDevice(registration: DeviceRegistration, signer: ServerRequestSigner)
Link copied to clipboard
open suspend override fun registerLastDeviceRecoveryKey(address: DeviceAddress, registration: LastDeviceRecoveryKeyRegistration, signer: ServerRequestSigner)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open suspend override fun rotateLastDeviceRecoveryKey(authorization: RecoveryKeyRotationAuthorization, signer: ServerRequestSigner)
Link copied to clipboard
open suspend override fun send(envelope: EncryptedEnvelope, signer: ServerRequestSigner)

POST /v1/messages, ServerAuth-signed as the envelope's sender, which the device header names (S1, docs/server-authentication.md).