| 1 | package Net::ACME2::Challenge::dns_01; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use parent qw( Net::ACME2::Challenge ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | =encoding utf-8 | ||||||||||
| 9 | |||||||||||
| 10 | =head1 NAME | ||||||||||
| 11 | |||||||||||
| 12 | Net::ACME2::Challenge::dns_01 | ||||||||||
| 13 | |||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||
| 15 | |||||||||||
| 16 | This module is instantiated by L<Net::ACME2::Authorization> and is a | ||||||||||
| 17 | subclass of L<Net::ACME2::Challenge>. | ||||||||||
| 18 | |||||||||||
| 19 | =head1 METHODS | ||||||||||
| 20 | |||||||||||
| 21 | =head2 I<OBJ>->get_record_name() | ||||||||||
| 22 | |||||||||||
| 23 | Returns the name (i.e., just the leftmost label) of the TXT record to create. | ||||||||||
| 24 | |||||||||||
| 25 | (NB: This is always the same name, as per the ACME specification.) | ||||||||||
| 26 | |||||||||||
| 27 | =cut | ||||||||||
| 28 | |||||||||||
| 29 | 2 | ▶ | use constant get_record_name => '_acme-challenge'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | |||||||||||
| 31 | #---------------------------------------------------------------------- | ||||||||||
| 32 | |||||||||||
| 33 | =head2 I<OBJ>->get_record_value( $ACME ) | ||||||||||
| 34 | |||||||||||
| 35 | Accepts a L<Net::ACME2> instance and returns the value of the TXT record | ||||||||||
| 36 | to create. | ||||||||||
| 37 | |||||||||||
| 38 | Example: | ||||||||||
| 39 | |||||||||||
| 40 | X_XMlEGlxkmqi3B8IFROXLXogCSMGo0JUC9-cJ3Y1NY | ||||||||||
| 41 | |||||||||||
| 42 | =cut | ||||||||||
| 43 | |||||||||||
| 44 | sub get_record_value { | ||||||||||
| 45 | 0 | ▶ | my ($self, $acme) = @_; | ||||||||
|
Subroutine
get_record_value: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 46 | |||||||||||
| 47 | # Errors for the programmer. | ||||||||||
| 48 | 0 | ▶ | if (!$acme) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 0 | die 'Need “Net::ACME2” instance to compute DNS record value!' | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | # NB: These are probably loaded anyway. | ||||||||||
| 53 | 0 | require Digest::SHA; | |||||||||
| 54 | 0 | require MIME::Base64; | |||||||||
| 55 | |||||||||||
| 56 | 0 | my $key_authz = $acme->make_key_authorization($self); | |||||||||
| 57 | |||||||||||
| 58 | 0 | my $sha = Digest::SHA::sha256($key_authz); | |||||||||
| 59 | |||||||||||
| 60 | 0 | return MIME::Base64::encode_base64url($sha); | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | 2 | 1; | |||||||||