File Coverage

blib/lib/Net/OAuth/SignatureMethod/HMAC_SHA1.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 25 27 92.5


line stmt bran cond sub pod time code
1             package Net::OAuth::SignatureMethod::HMAC_SHA1;
2 7     7   41 use warnings;
  7         14  
  7         476  
3 7     7   38 use strict;
  7         29  
  7         199  
4 7     7   3678 use Digest::SHA ();
  7         24751  
  7         271  
5 7     7   3472 use MIME::Base64;
  7         5143  
  7         1417  
6              
7             sub sign {
8 21     21 0 179 my $self = shift;
9 21         36 my $request = shift;
10 21         124 my $hmac_digest = Digest::SHA::hmac_sha1(
11             $request->signature_base_string, $request->signature_key
12             );
13 21         201 return encode_base64($hmac_digest, '');
14             }
15              
16             sub verify {
17 12     12 0 28 my $self = shift;
18 12         25 my $request = shift;
19 12         45 return $request->signature eq $self->sign($request);
20             }
21              
22             =head1 NAME
23              
24             Net::OAuth::SignatureMethod::HMAC_SHA1 - HMAC_SHA1 Signature Method for OAuth protocol
25              
26             =head1 SEE ALSO
27              
28             L<Net::OAuth>, L<http://oauth.net>
29              
30             =head1 AUTHOR
31              
32             Originally by Keith Grennan <kgrennan@cpan.org>
33              
34             Currently maintained by Robert Rothenberg <rrwo@cpan.org>
35              
36             =head1 COPYRIGHT & LICENSE
37              
38             Copyright 2007-2012, 2024-2025 Keith Grennan
39              
40             This program is free software; you can redistribute it and/or modify it
41             under the same terms as Perl itself.
42              
43             =cut
44              
45             1;