decrypt

suspend fun decrypt(envelope: EncryptedEnvelope): ReceiveResult

Decrypts and processes envelope (docs/message-reliability.md, docs/application-delivery.md).

A logical ID that arrives again with another body fails with SecureMessageClientException.LogicalMessageConflict and changes nothing and is not acknowledged, also after a discard. For IDs committed before milestone 20 no digest is stored, so such a mismatch is not detected; they count as committed.

A failed acknowledgement does not fail this call: the result says ackSent = false and the sender's next retry triggers a new one.

Failures change nothing, except that a SecureMessageClientException.SessionCollision retires the losing initiation; its message is not acknowledged, so its sender keeps it pending and can send it again on the winning session. A decrypted plaintext that is not a reliability frame (for example from a peer before milestone 8) fails with ProtocolException.MalformedSecurePayload or ProtocolException.UnsupportedSecurePayloadVersion.

Envelopes from one sender must be decrypted one at a time, in the order the transport delivered them (docs/transport-ordering.md).