NAME
Noise::Pattern - Handshake pattern definitions and modifiers
SYNOPSIS
use Noise::Pattern;
my $p = Noise::Pattern->new( name => 'XXpsk3' );
say 'Base pattern: ' . $p->name;
# Inspect pre-messages and message sequences
my $seq = $p->msg_seq;
DESCRIPTION
Noise::Pattern defines the fundamental handshake patterns of the Noise Protocol Framework. It also handles pattern modifiers like pre-shared keys (PSKs).
SUPPORTED PATTERNS
- NN: No static keys for either party.
- XX: Both parties exchange static keys during the handshake.
- IK: Initiator already knows responder's static key.
- NK: Responder's static key is known, initiator is anonymous.
- KK: Both parties already know each other's static keys.
- NX: Initiator is anonymous, responder exchanges static key.
MODIFIERS
This module supports PSK modifiers by appending psk0, psk1, etc., to the base pattern name. This will automatically inject psk tokens into the message sequence at the specified positions.
METHODS
new( %params )
Constructor.
Expected parameters:
name( )
Returns the base name of the pattern.
pre_msg( )
Returns an array reference of pre-message tokens for both parties.
msg_seq( )
Returns an array reference of message sequences, each containing a list of tokens (e, s, ee, es, etc.).
SEE ALSO
AUTHOR
Sanko Robinson <sanko@cpan.org>
COPYRIGHT
Copyright (C) 2026 by Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.