20 [[nodiscard]]
bool has_key() const noexcept {
23 [[nodiscard]] std::uint64_t
nonce() const noexcept {
37 std::uint64_t nonce_ = 0;
38 bool has_key_ =
false;
Byte buffer / view aliases and protobuf base-128 varint codec.
Non-owning view over a contiguous run of bytes (a C++17 stand-in for std::span<const std::uint8_t>).
Definition bytes.hpp:17
Wraps a symmetric key plus a monotonically increasing nonce, per the Noise CipherState object.
Definition cipher_state.hpp:15
ByteBuffer decrypt_with_ad(ByteView ad, ByteView ciphertext)
AEAD-decrypt ciphertext, advancing the nonce.
void initialize_key(const SymmetricKey &key)
Set the key and reset the nonce to zero.
std::uint64_t nonce() const noexcept
Definition cipher_state.hpp:23
bool has_key() const noexcept
Definition cipher_state.hpp:20
ByteBuffer encrypt_with_ad(ByteView ad, ByteView plaintext)
AEAD-encrypt plaintext with associated data ad, advancing the nonce.
Definition cipher_state.hpp:11
std::array< std::uint8_t, key_len > SymmetricKey
Definition primitives.hpp:21
std::vector< std::uint8_t > ByteBuffer
Owning, growable byte buffer.
Definition bytes.hpp:13
Noise cryptographic primitives (SHA-256, HMAC, HKDF, X25519, ChaCha20- Poly1305, base64).