package Crypt::LE::Challenge::Simple;
use strict;
use warnings;

=head1 NAME

Crypt::LE::Challenge::Simple - A boilerplate for extending Crypt::LE with challenge handlers.

=head1 SYNOPSIS

 use Crypt::LE;
 use Crypt::LE::Challenge::Simple;
 ...
 my $le = Crypt::LE->new();
 my $simple_challenge = Crypt::LE::Challenge::Simple->new();
 ..
 $le->accept_challenge($simple_challenge);

=head1 DESCRIPTION

Crypt::LE provides the functionality necessary to use Let's Encrypt API and generate free SSL certificates for your domains.
This Crypt::LE plugin is an example of how challenge handling can be done by an external module.

=cut

sub new { bless {}, shift }
 
sub handle_challenge_http {
    my $self = shift;
    my $challenge = shift;
    print "Domain: $challenge->{domain} expects '$challenge->{token}.$challenge->{fingerprint}' text in '$challenge->{token}' file\n";
    print "Press <Enter>";
    <STDIN>;
    return 1;
};

sub handle_challenge_tls {
    # Return 0 to indicate an error
    return 0;
}

sub handle_challenge_dns {
    # Critical error will be treated as a failure too
    die "Oh, this challenge is not supported!\n";
}

=head1 AUTHOR

Alexander Yezhov, C<< <leader at cpan.org> >>
Domain Knowledge Ltd.
L<https://do-know.com/>

=cut

1;
