[API BREAK] Use a nonce-generation function instead of a nonce

> Maybe there should be an explicit mention that if attempt is non-zero it
implies a different nonce is required.

Done.