| OpenHAP::Session(3p) | Perl Library Manual | OpenHAP::Session(3p) |
NAME
OpenHAP::Session - Encrypted session state for HAP connections
SYNOPSIS
use OpenHAP::Session;
my $session = OpenHAP::Session->new(socket => $socket);
# After pair-verify
$session->set_encryption($encrypt_key, $decrypt_key);
$session->set_verified($controller_id);
# Encrypt/decrypt data
my $encrypted = $session->encrypt($plaintext);
my $plaintext = $session->decrypt($encrypted);
DESCRIPTION
This module manages the encrypted session state for HAP connections, including ChaCha20-Poly1305 encryption/decryption with proper nonce management and frame handling. "decrypt" returns undef on a failed authentication tag, a truncated frame, or a frame claiming more than 1024 bytes of plaintext; the caller must close the connection.
SEE ALSO
OpenHAP::Crypto, spec/HAP-Encryption.md
| 2026-07-27 | OpenBSD |