Security5 min read

Every UIMessage session starts with a post-quantum key agreement

Every UIMessage session pairs X25519 with ML-KEM-768, which NIST standardized in 2024, and its key needs both, so breaking X25519 later, even with a quantum computer, doesn’t open messages recorded today.

  • The UIMessage team
ShareXLinkedIn
On this page
  1. Two key agreements, one session key
  2. No fallback to a weaker handshake
  3. What it costs
  4. Where the math comes from
  5. What it covers
  6. How other apps compare

Someone who records encrypted traffic today can keep it for years. NIST’s standard for ML-KEM says that if large-scale quantum computers are realized, the security of key agreements built on elliptic curves “will be at risk”1. X25519 is one of them.

A UIMessage session links two devices, such as your phone and a friend’s Mac. It starts with a key agreement that produces a session key, and every key the session uses after that builds on it. No UIMessage session starts on X25519 alone. Each also uses ML-KEM-768, a post-quantum algorithm NIST standardized in 2024, and the session key needs both.

Recorded today, opened laterA hypothetical

Two sessions are recorded today: one set up with X25519 alone and one set up the way UIMessage sets up every session. Choose Later to see which one a large quantum computer could open.

When

Both recordings stay closed

A session set up with X25519 alone
Closed. It can’t be read without its session key.
UIMessage: X25519 and ML-KEM-768
Closed. It can’t be read without its session key.

Source1
Every case (2)
  1. Both recordings stay closed

    A session set up with X25519 alone
    Closed. It can’t be read without its session key.
    UIMessage: X25519 and ML-KEM-768
    Closed. It can’t be read without its session key.
  2. One recording opens

    A session set up with X25519 alone
    Open. Breaking X25519 gives the session key.
    UIMessage: X25519 and ML-KEM-768
    Closed. The session key also needs the ML-KEM-768 secret.

Two key agreements, one session key

Each session starts with PQXDH, a key agreement Signal published in 20232. Our version pairs X25519, an elliptic-curve key agreement, with ML-KEM-768. NIST published ML-KEM as FIPS 203 on August 13, 20241.

ML-KEM-768 is a key encapsulation mechanism: one device seals a fresh secret with the other’s public key, and only the matching private key can open it. NIST describes ML-KEM as “presently believed to be secure” even against a large-scale quantum computer1.

Every device publishes prekeys on our server in advance. These are public keys that let other devices start a session with it. To start one, your device runs up to four X25519 agreements and one ML-KEM-768 encapsulation.

The X25519 agreements combine your device’s long-term key and a fresh key made for the session with the other device’s long-term key and prekeys. For the encapsulation, your device uses a post-quantum prekey that the other device signed. When your message arrives, the other device runs the same agreements from its side and opens the encapsulated secret with its private key.

HKDF-SHA256, a standard key-derivation function, turns every result into the session key, the same on both devices. It also takes in a transcript of both accounts, both devices and every key used, which binds the session key to them. Because the key needs both kinds of result, someone who recorded the session would have to break X25519 and ML-KEM-768 to get it.

Where the session key comes from

Where the session key comes fromUp to four X25519 results and one ML-KEM-768 shared secret go into HKDF-SHA256, together with a transcript of both accounts, both devices and every key used. The session key comes out.What goes inKey derivationWhat comes outX25519 resultsUp to fourML-KEM-768 shared secretFrom one encapsulationTranscriptBoth accountsBoth devicesEvery key usedHKDF-SHA256Session key
Where the session key comes fromUp to four X25519 results and one ML-KEM-768 shared secret go into HKDF-SHA256, together with a transcript of both accounts, both devices and every key used. The session key comes out.What goes inKey derivationWhat comes outX25519 resultsUp to fourML-KEM-768 sharedsecretFrom one encapsulationTranscriptBoth accountsBoth devicesEvery key usedHKDF-SHA256Session key

Up to four X25519 results and one ML-KEM-768 shared secret go into HKDF-SHA256, together with a transcript of both accounts, both devices and every key used. The session key comes out.

Breaking X25519 alone doesn’t give the session key.

No fallback to a weaker handshake

The post-quantum half is mandatory. A UIMessage session never falls back to a handshake on X25519 alone, and no setting turns ML-KEM-768 off.

Every UIMessage app, on iPhone, iPad, Mac, Android and the web, speaks one version of our protocol and refuses anything else. That rule is built into each app, so no answer from our server can switch it off.

An X25519 public key is 32 bytes. ML-KEM-768’s public key is 1,184 bytes, and the ciphertext that carries its secret to the other device is 1,088 bytes1.

An ML-KEM-768 public key
1,184bytes
An ML-KEM-768 ciphertext
1,088bytes
X25519 agreements in a new session, beside one ML-KEM-768 encapsulation
up to4
A first message with 160 bytes of padded content
1,350bytes

ML-KEM-768’s key and ciphertext sizes are set by FIPS 2031.

On a new session, the ciphertext travels at the front of your messages, in a 1,133-byte prefix. The prefix also holds your device’s fresh X25519 key, a byte for the message type and three numbers that tell the other device which of its prekeys were used.

Your device adds the prefix to every message until the other device first replies, then leaves it off. Padding brings message content up to a multiple of 160 bytes. With a type byte, a 40-byte header and a 16-byte authentication tag, a message with 160 bytes of padded content is 217 bytes, or 1,350 bytes with the prefix.

What’s in a first message

bytes
What’s in a first messageA short first message on a new session is 1,350 bytes: the ML-KEM-768 ciphertext (1,088), the sender’s fresh X25519 key (32), a type byte and three prekey numbers (13), the message type and ratchet header (41), the message padded to 160, and a 16-byte authentication tag. A later short message is 217 bytes.05001,0001,500A short first message1,0881,350A later short message217
What’s in a first messageA short first message on a new session is 1,350 bytes: the ML-KEM-768 ciphertext (1,088), the sender’s fresh X25519 key (32), a type byte and three prekey numbers (13), the message type and ratchet header (41), the message padded to 160, and a 16-byte authentication tag. A later short message is 217 bytes.05001,0001,500A short first message1,0881601,350A later short message160217
A short first message
ML-KEM-768 ciphertext1,088The sender’s fresh X25519 key32First-message type and prekey numbers13Message type and ratchet header41Your message, padded160Authentication tag16
A later short message
Message type and ratchet header41Your message, padded160Authentication tag16

The post-quantum part travels with your messages only until the other device first replies.

Show the numbers
A short first message on a new session is 1,350 bytes: the ML-KEM-768 ciphertext (1,088), the sender’s fresh X25519 key (32), a type byte and three prekey numbers (13), the message type and ratchet header (41), the message padded to 160, and a 16-byte authentication tag. A later short message is 217 bytes.
CategoryML-KEM-768 ciphertextThe sender’s fresh X25519 keyFirst-message type and prekey numbersMessage type and ratchet headerYour message, paddedAuthentication tagTotal
A short first message1,088321341160161,350
A later short message4116016217
Source1

Every device uploads 100 one-time post-quantum prekeys to our server and refills them to 100 when fewer than 25 remain. Our server hands out each one-time prekey only once.

Where the math comes from

Apple devices get ML-KEM-768 from CryptoKit, Apple’s cryptography framework. On Android and the web, it comes from our own FIPS 203 code, written in Kotlin and TypeScript. Known-answer tests check that code: they run fixed inputs and compare the outputs with values known in advance.

Our apps don’t use a messaging-protocol library. PQXDH and the rest of our protocol are our own code on each platform, built on standard cryptographic building blocks. We test every implementation against the same shared test vectors.

Our server takes no part in the key agreement. It stores the public prekeys and hands them out, and it checks that every post-quantum key a device uploads is a valid ML-KEM-768 public key before storing it. Private keys never leave the device that made them.

What it covers

ML-KEM-768 is part of how a session is set up. After that, each pair of devices runs the Double Ratchet. Every message gets its own key, and each reply adds a fresh X25519 step, so a key stolen today can’t open earlier messages. Those steps add no post-quantum keys.

How other apps compare

Like UIMessage, Signal and iMessage set up sessions with a post-quantum key agreement. Signal announced PQXDH on September 19, 20232. Since version 0.75.0, released in June 2025, its libsignal library refuses to set up a session without it67. Apple’s PQ3 for iMessage, announced on February 21, 2024, began rolling out with iOS 17.43.

WhatsApp’s Encryption Overview (version 10, October 30, 2026) describes session setup with Curve25519, the curve behind X25519, and doesn’t mention post-quantum cryptography8. Meta described moving its own internal infrastructure to post-quantum cryptography in April 2026, in an article that doesn’t cover WhatsApp chats9. Telegram’s FAQ doesn’t mention post-quantum cryptography10.

Post-quantum keys, app by app
FeatureUIMessageWhatsAppSignaliMessageTelegram
Post-quantum session setupYesPQXDH with ML-KEM-768 on every session, with no fallbackOur article

UIMessage: Post-quantum session setup

Yes

PQXDH with ML-KEM-768 on every session, with no fallback

Not describedits overview (v10, Oct 30, 2026) describes Curve25519 setup and doesn't mention post-quantum cryptography

WhatsApp: Post-quantum session setup

Not described

its overview (v10, Oct 30, 2026) describes Curve25519 setup and doesn't mention post-quantum cryptography

  1. WhatsApp Encryption Overview, version 10 (opens in a new tab), WhatsApp, Oct 30, 2026. Checked Nov 2026 Source 8
YesPQXDH since Sep 2023, required since libsignal v0.75.0 (2025)

Signal: Post-quantum session setup

Yes

PQXDH since Sep 2023, required since libsignal v0.75.0 (2025)

  1. Quantum resistance and the Signal Protocol (opens in a new tab), Signal, Sep 19, 2023. Checked Nov 2026 Source 2
  2. libsignal commit requiring PQXDH (opens in a new tab), Signal on GitHub, Jun 13, 2025. Checked Nov 2026 Source 6
  3. libsignal v0.75.0 (opens in a new tab), Signal on GitHub, 2025. Checked Nov 2026 Source 7
YesPQ3, since iOS 17.4 (2024)

iMessage: Post-quantum session setup

Yes

PQ3, since iOS 17.4 (2024)

  1. iMessage with PQ3: the new state of the art in quantum-secure messaging at scale (opens in a new tab), Apple Security Research, Feb 21, 2024. Checked Nov 2026 Source 3
Not describedits FAQ doesn't mention post-quantum cryptography

Telegram: Post-quantum session setup

Not described

its FAQ doesn't mention post-quantum cryptography

  1. Telegram FAQ (opens in a new tab), Telegram. Checked Nov 2026 Source 10
Post-quantum keys added during a conversationNonew keys during a conversation come from X25519Our article

UIMessage: Post-quantum keys added during a conversation

No

new keys during a conversation come from X25519

Not described

WhatsApp: Post-quantum keys added during a conversation

Not described

  1. WhatsApp Encryption Overview, version 10 (opens in a new tab), WhatsApp, Oct 30, 2026. Checked Nov 2026 Source 8
YesSPQR, since Oct 2025; libsignal has required it in every new session since v0.92.0 (Apr 2026) and in every session since v0.100.0 (Aug 2026)

Signal: Post-quantum keys added during a conversation

Yes

SPQR, since Oct 2025; libsignal has required it in every new session since v0.92.0 (Apr 2026) and in every session since v0.100.0 (Aug 2026)

  1. Signal Protocol and post-quantum ratchets (opens in a new tab), Signal, Oct 2, 2025. Checked Nov 2026 Source 4
  2. libsignal v0.92.0 (opens in a new tab), Signal on GitHub, Apr 8, 2026. Checked Nov 2026 Source 11
  3. libsignal v0.100.0 (opens in a new tab), Signal on GitHub, Aug 7, 2026. Checked Nov 2026 Source 5
Yesrekeying about every 50 messages, and at least every 7 days

iMessage: Post-quantum keys added during a conversation

Yes

rekeying about every 50 messages, and at least every 7 days

  1. iMessage with PQ3: the new state of the art in quantum-secure messaging at scale (opens in a new tab), Apple Security Research, Feb 21, 2024. Checked Nov 2026 Source 3
Not described

Telegram: Post-quantum keys added during a conversation

Not described

  1. Telegram FAQ (opens in a new tab), Telegram. Checked Nov 2026 Source 10

Checked Nov 2026

“Not described” means we read the document named in the cell and it doesn’t describe this.

Post-quantum session setup in messaging

  1. Sep 19, 2023

    Signal announces PQXDH2

  2. Feb 21, 2024

    Apple announces PQ3 for iMessage3

    Arriving with iOS 17.4.

  3. Aug 13, 2024

    NIST publishes ML-KEM as FIPS 2031

  4. Jun 13, 2025

    libsignal starts refusing session setup without PQXDH67

    Shipped in libsignal v0.75.0 on Jun 16, 2025.

  5. Oct 2, 2025

    Signal announces SPQR and starts rolling it out4

    SPQR adds post-quantum keys as a conversation goes on.

  6. Apr 16, 2026

    Meta describes moving its internal infrastructure to post-quantum cryptography9

    The article doesn’t cover WhatsApp chats.

  7. Today

    Every UIMessage session starts with PQXDH

Sources

  1. 1.NIST, FIPS 203, Module-Lattice-Based Key-Encapsulation Mechanism Standard (opens in a new tab), Aug 13, 2024. Checked Nov 2026. 1 2 3 4 5 6 7 8
  2. 2.Signal, Quantum resistance and the Signal Protocol (opens in a new tab), Sep 19, 2023. Checked Nov 2026. 1 2 3 4
  3. 3.Apple Security Research, iMessage with PQ3: the new state of the art in quantum-secure messaging at scale (opens in a new tab), Feb 21, 2024. Checked Nov 2026. 1 2 3 4 5
  4. 4.Signal, Signal Protocol and post-quantum ratchets (opens in a new tab), Oct 2, 2025. Checked Nov 2026. 1 2 3
  5. 5.Signal on GitHub, libsignal v0.100.0 (opens in a new tab), Aug 7, 2026. Checked Nov 2026. 1 2
  6. 6.Signal on GitHub, libsignal commit requiring PQXDH (opens in a new tab), Jun 13, 2025. Checked Nov 2026. 1 2 3
  7. 7.Signal on GitHub, libsignal v0.75.0 (opens in a new tab), 2025. Checked Nov 2026. 1 2 3
  8. 8.WhatsApp, WhatsApp Encryption Overview, version 10 (opens in a new tab), Oct 30, 2026. Checked Nov 2026. 1 2 3
  9. 9.Meta Engineering, Post-quantum cryptography migration at Meta: framework, lessons, and takeaways (opens in a new tab), Apr 16, 2026. Checked Nov 2026. 1 2
  10. 10.Telegram, Telegram FAQ (opens in a new tab). Checked Nov 2026. 1 2 3
  11. 11.Signal on GitHub, libsignal v0.92.0 (opens in a new tab), Apr 8, 2026. Checked Nov 2026. 1
ShareXLinkedIn

More from the newsroom

Security

What our servers keep, and for how long

Our servers delete each encrypted message once the devices it was sent to have saved it. This is what else they keep, for how long, and which three companies handle some of your information for us.

Security

How we protect your calls

Every audio and video frame is encrypted on your device before it leaves. Our relays carry calls they can’t decode, and when you call someone outside your contacts, they never see your IP address.