holochain_integrity_types/x_salsa20_poly1305/
nonce.rs

1use holochain_secure_primitive::secure_primitive;
2use holochain_serialized_bytes::prelude::*;
3
4pub const NONCE_BYTES: usize = 24;
5
6#[derive(Clone, Copy, SerializedBytes)]
7pub struct XSalsa20Poly1305Nonce([u8; NONCE_BYTES]);
8pub type SecretBoxNonce = XSalsa20Poly1305Nonce;
9
10// A nonce is public but it does need to inherit all the fixed array serialization and in the
11// future it will be useful to have generation from random bytes as it MUST be UNIQUE.
12// Currently lair does the nonce generation for us.
13secure_primitive!(XSalsa20Poly1305Nonce, NONCE_BYTES);