=pod

=encoding utf-8

=head1 NAME

Noise::Pattern - Handshake pattern definitions and modifiers

=head1 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;

=head1 DESCRIPTION

Noise::Pattern defines the fundamental handshake patterns of the Noise Protocol Framework. It also handles pattern
modifiers like pre-shared keys (PSKs).

=head1 SUPPORTED PATTERNS

=over

=item NN: No static keys for either party.

=item XX: Both parties exchange static keys during the handshake.

=item IK: Initiator already knows responder's static key.

=item NK: Responder's static key is known, initiator is anonymous.

=item KK: Both parties already know each other's static keys.

=item NX: Initiator is anonymous, responder exchanges static key.

=back

=head1 MODIFIERS

This module supports PSK modifiers by appending C<psk0>, C<psk1>, etc., to the base pattern name. This will
automatically inject C<psk> tokens into the message sequence at the specified positions.

=head1 METHODS

=head2 C<new( %params )>

Constructor.

Expected parameters:

=over

=item C<name>: String name of the pattern ('XX' or 'IKpsk2').

=back

=head2 C<name( )>

Returns the base name of the pattern.

=head2 C<pre_msg( )>

Returns an array reference of pre-message tokens for both parties.

=head2 C<msg_seq( )>

Returns an array reference of message sequences, each containing a list of tokens (e, s, ee, es, etc.).

=head1 SEE ALSO

L<Noise::HandshakeState>

=head1 AUTHOR

Sanko Robinson E<lt>sanko@cpan.orgE<gt>

=head1 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.

=cut
