Browse Questions
  • FlowLayout uses the Layout protocol (iOS 16+) — SwiftUI's official first-party layout system.
  • Secure Session is Themis's stateful encrypted channel: peers perform a handshake, derive ephemeral session keys, and then exchange messages with forward secrecy over any transport you supply.
  • CI/CD automates building, testing, and distributing your app on every code push.
  • Classic OOP centers on classes and inheritance hierarchies — behavior is shared by subclassing a base class.

Answer: Secure Session is Themis's stateful encrypted channel: peers perform a handshake, derive ephemeral session keys, and then exchange messages with forward secrecy over any transport you supply. Unlike TLS it authenticates peers by pinned public key rather than a certificate authority, so there is no CA to trust and no certificate chain to spoof.

That distinction is why it appears underneath TLS in high-assurance apps. A device with a user-installed root certificate, or an intercepting proxy, can terminate TLS and read the traffic — but Secure Session's keys were never negotiated with that proxy, so the payload stays opaque. You supply the transport via a TSSessionTransportInterface subclass that maps a peer ID to its known public key.

Code Example:

final class Transport: TSSessionTransportInterface {
    override func publicKey(for binaryId: Data!) throws -> Data {
        // Look up a *pinned* key. Returning an unknown key defeats the point.
        guard let key = KeyStore.publicKey(forPeer: binaryId) else {
            throw SessionError.unknownPeer
        }
        return key
    }
}

let session = TSSession(transportID: clientID,
                        privateKey: clientPrivateKey,
                        callbacks: Transport())!
let handshakeRequest = try session.connectRequest()   // send to server
// ...feed each server reply back in until session.isSessionEstablished()
let payload = try session.wrap(requestBody)

Key Points:

  • Forward secrecy — compromising a long-term key does not decrypt past sessions.
  • No certificate authority; trust comes from keys you pinned yourself.
  • Requires a persistent connection, so it suits sockets far better than stateless REST.