acceptAdd2 (41)

The acceptAdd2 message is the response to a requestAdd2 message, confirming that the user has accepted the contact request. It initiates the secure, quantum-resistant key exchange process.

The sender generates new key pairs for ECDH and ML-KEM, sending the public parts to the original requester. This allows both parties to derive a shared secret for end-to-end encryption.

Core Data Types

Payload Structure

FieldData TypeMinMaxDescription
versionIxiVarUInt1The S2 protocol version the sender has chosen for this session.
rsaPubKeyIxiBytes**The sender's primary public key, used for identity verification.
ecdhPubKeyIxiBytes**The public key part of a newly generated ephemeral ECDH key pair.
mlkemPubKeyIxiBytes**The public key part of a newly generated ephemeral ML-KEM (Kyber) key pair.
aesSaltIxiBytes3232A 32-byte random salt used for deriving the AES symmetric key.
capabilitiesIxiVarUInt**A bitfield of StreamCapabilities supported by the sender (e.g., Apps, IPN). See below for details.

StreamCapabilities Flags

The capabilities field is a bitfield indicating which features the sender supports. Multiple capabilities can be combined using bitwise OR.

Flag ValueNameDescription
1IncomingSupports incoming connections. If absent, contacts should not attempt to look for this peer's presence.
2OutgoingSupports outgoing connections. If absent, contacts should periodically query this peer instead of waiting for it to connect.
4IPNSupports Ixian Push Notifications. If absent, contacts should not send offline/pending messages via IPN.
8AppsSupports Mini-Apps. Required for app-related messages (appRequest, appData, etc.).
16AppProtocolsSupports App Protocols for advanced Mini-App features.

Example Capability Values

  • 15 (0x0F): Full client supporting Incoming (1) + Outgoing (2) + IPN (4) + Apps (8)
  • 31 (0x1F): Full client with App Protocols (adds 16 to above)
  • 6 (0x06): Gateway/bot supporting Outgoing (2) + IPN (4) but not accepting incoming connections
  • 10 (0x0A): Bot with Outgoing (2) + Apps (8) capabilities

Behavioral Notes

  • Key Generation: Before sending this message, the client generates new, single-use key pairs for both ECDH and ML-KEM to ensure forward secrecy.
  • Recipient Action: The recipient (the original requester) uses the public keys in this message along with its own private keys to derive a shared secret. It then uses this secret and the provided salts to generate the final AES and ChaCha symmetric keys for the session.
  • State Transition: Upon sending acceptAdd2, the sender's client marks the contact as "Approved" and transitions its handshake status to 2. It then waits for a keys2 message to complete the key exchange.