Trait ring::aead::NonceSequence

source ·
pub trait NonceSequence {
    // Required method
    fn advance(&mut self) -> Result<Nonce, Unspecified>;
}
Expand description

A sequences of unique nonces.

A given NonceSequence must never return the same Nonce twice from advance().

A simple counter is a reasonable (but probably not ideal) NonceSequence.

Intentionally not Clone or Copy since cloning would allow duplication of the sequence.

Required Methods§

source

fn advance(&mut self) -> Result<Nonce, Unspecified>

Returns the next nonce in the sequence.

This may fail if “too many” nonces have been requested, where how many is too many is up to the implementation of NonceSequence. An implementation may that enforce a maximum number of records are sent/received under a key this way. Once advance() fails, it must fail for all subsequent calls.

Implementors§