The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::ACME::Authorization::Pending - pending ACME authorization

SYNOPSIS

    use Net::ACME::Authorization::Pending ();

    my $authz_p = Net::ACME::Authorization::Pending->new(
        uri => 'http://url/to/poll/for/authz',
        challenges => \@challenge_objects,
        combinations => [
            [ 2 ],
            [ 1 ],
            [ 0 ],
        ],
    );

    for my $cmb ( $authz_p->combinations() ) {

        #An example of only doing “http-01”:
        next if @$cmb > 1;
        next if $cmb->[0]->type() ne 'http-01';

        #Prepare for the challenge …

        #Assume we instantiated Net::ACME above …
        $acme->do_challenge($cmb->[0]);

        while (1) {
            if ($authz_p->is_time_to_poll()) {
                my $poll = $authz_p->poll();

                last if $poll->status() eq 'valid';

                if ($poll->status() eq 'invalid') {
                    my $completed_challenge = ($poll->challenges())[0];
                    print $completed_challenge->error()->detail() . $/;
                    die "Failed authorization!$/";
                }

            }

            sleep 1;
        }

        last;
    }