NAME

Crypt::Passphrase::Fallback - a fallback validator for Crypt::Passphrase

VERSION

version 0.020

SYNOPSIS

sub plaintext {
    my ($password, $hash) = @_;
    return $password eq $hash;
}

my $passphrase = Crypt::Passphrase->new(
    encoder    => 'Argon2',
    validators => [ \&plaintext ],
);

DESCRIPTION

This is a helper class to write ad-hoc validators. If passing a subref as a validator Crypt::Passphrase will automatically wrap it in a fallback object, but it can also passed explicitly.

CONFIGURATION

This takes two named arguments:

  • callback

    The verify_password method will call this with the password and the hash, and return its return value. This is mandatory.

  • acceptor

    This callback will decide if this object will try to match a hash. By default it always return true (so always accepts

AUTHOR

Leon Timmermans <fawaka@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.