Lite/SignatureMethod/PLAINTEXT.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 23 / 23 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Lite/SignatureMethod/HMAC_SHA1.pm ↑ Summary Lite/SignatureMethod/RSA_SHA1.pm »
1 package OAuth::Lite::SignatureMethod::PLAINTEXT;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use base 'OAuth::Lite::SignatureMethod';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 __PACKAGE__->method_name('PLAINTEXT');
9  
10 3 ▶use OAuth::Lite::Util qw(encode_param);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 =head1 NAME
13  
14 OAuth::Lite::SignatureMethod::PLAINTEXT - PLAINTEXT signature method class;
15  
16 =head1 SYNOPSIS
17  
18 # Consumer side
19 my $method = OAuth::Lite::SignatureMethod::PLAINTEXT->new(
20 consumer_secret => 'foo',
21 token_secret => 'bar',
22 );
23  
24 my $signature = $method->sign($base_string);
25  
26 # Service Provider side
27 my $method = OAuth::Lite::SignatureMethod::PLAINTEXT->new(
28 consumer_secret => 'foo',
29 token_secret => 'bar',
30 );
31 unless ($method->verify($base_string, $signature)) {
32 say "Signature is invalid!";
33 }
34  
35 =head1 DESCRIPTION
36  
37 PLAINTEXT signature method class.
38  
39 =head1 METHODS
40  
41 =head2 method_name
42  
43 Class method. Returns this method's name.
44  
45 say OAuth::Lite::SignatureMethod::PLAINTEXT->method_name;
46 # PLAINTEXT
47  
48 =head2 new(%params)
49  
50 =head3 parameters
51  
52 =over 4
53  
54 =item consumer_secret
55  
56 =item token_secret
57  
58 =back
59  
60 my $method = OAuth::Lite::SignatureMethod::PLAINTEXT->new(
61 consumer_secret => $consumer_secret,
62 token_secret => $bar,
63 );
64  
65 =head2 sign($base_string)
66  
67 Generate signature from base string.
68  
69 my $signature = $method->sign($base_string);
70  
71 =head2 verify($base_string, $signature)
72  
73 Verify signature with base string.
74  
75 my $signature_is_valid = $method->verify($base_string, $signature);
76 unless ($signature_is_valid) {
77 say "Signature is invalid!";
78 }
79  
80 =cut
81  
82 sub sign {
83 6 ▶ my ($self, $base_string) = @_;
Subroutine sign: called CC=1 SCAR=0.0
Pod documented
84 6 my $key = $self->secrets_as_key();
85 6 $key;
86 }
87  
88 =head1 AUTHOR
89  
90 Lyo Kato, C<lyo.kato _at_ gmail.com>
91  
92 =head1 COPYRIGHT AND LICENSE
93  
94 This library is free software; you can redistribute it and/or modify
95 it under the same terms as Perl itself, either Perl version 5.8.6 or,
96 at your option, any later version of Perl 5 you may have available.
97  
98 =cut
99  
100 3 1;
« Lite/SignatureMethod/HMAC_SHA1.pm ↑ Summary Lite/SignatureMethod/RSA_SHA1.pm »