Skip to content

Commit 3e90191

Browse files
hightoweoalders
authored andcommitted
Add authority() to URI::otpauth (GH#152)
1 parent 835e708 commit 3e90191

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Revision history for URI
22

33
{{$NEXT}}
44
- Add smb scheme (buralien)
5+
- Add authority() to URI::otpauth (GH#152) (hightowe)
56

67
5.31 2024-11-06 03:38:29Z
78
- Re-releasing with corrected module permissions. No changes since 5.31

lib/URI/otpauth.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ sub type {
128128
return $self->_field('type', @parameters);
129129
}
130130

131+
sub authority { return shift->type(@_); }
132+
131133
sub label {
132134
my ($self, @parameters) = @_;
133135
return $self->_field('label', @parameters);

t/otpauth.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use strict;
44
use warnings;
55

66
use URI;
7-
use Test::More tests => 86;
7+
use Test::More tests => 90;
88

99
{
1010
my $uri = URI->new( 'otpauth://totp/Example:[email protected]?secret=JBSWY3DPEHPK3PXP&issuer=Example' );
@@ -121,6 +121,7 @@ for my $case ( @case ) {
121121
ok $uri, "created $uri";
122122
is $uri->scheme(), 'otpauth', "$name: scheme";
123123
is $uri->type(), $type, "$name: type";
124+
is $uri->authority(), $type, "$name: authority";
124125
is $uri->secret(), $secret, "$name: secret";
125126
is $uri->issuer(), $issuer, "$name: issuer";
126127
if (defined $issuer) {
@@ -141,5 +142,7 @@ diag "doc1_uri is $doc1_uri";
141142
diag "doc2_uri is $doc2_uri";
142143
is "$doc1_uri", "$doc2_uri", "$doc1_uri: matches";
143144

145+
is $doc1_uri->type(), $doc2_uri->authority(), "type and authority match";
146+
144147
# vim:ts=2:sw=2:et:ft=perl
145148

0 commit comments

Comments
 (0)