Generate nonce before the message is created.
Add tests