How would you send data from one place to another place without leaking information, using FIFO ordering, and without using any database?
Implement an in-memory sender and receiver. Encrypt each message, authenticate its ciphertext, preserve FIFO order, and reject reordered or replayed packets.
Use secure_fifo_transfer(messages, key, arrival_order, nonce). Return a result object containing received messages and an error value, without persisting data externally.
def secure_fifo_transfer(messages, key, arrival_order, nonce):