line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bitcoin::Crypto::Role::BasicKey; |
2
|
|
|
|
|
|
|
$Bitcoin::Crypto::Role::BasicKey::VERSION = '2.000_01'; # TRIAL |
3
|
|
|
|
|
|
|
$Bitcoin::Crypto::Role::BasicKey::VERSION = '2.00001'; |
4
|
16
|
|
|
16
|
|
8943
|
use v5.10; |
|
16
|
|
|
|
|
66
|
|
5
|
16
|
|
|
16
|
|
123
|
use strict; |
|
16
|
|
|
|
|
55
|
|
|
16
|
|
|
|
|
368
|
|
6
|
16
|
|
|
16
|
|
86
|
use warnings; |
|
16
|
|
|
|
|
53
|
|
|
16
|
|
|
|
|
560
|
|
7
|
16
|
|
|
16
|
|
107
|
use Type::Params -sigs; |
|
16
|
|
|
|
|
73
|
|
|
16
|
|
|
|
|
136
|
|
8
|
|
|
|
|
|
|
|
9
|
16
|
|
|
16
|
|
8993
|
use Bitcoin::Crypto::Exception; |
|
16
|
|
|
|
|
38
|
|
|
16
|
|
|
|
|
459
|
|
10
|
16
|
|
|
16
|
|
105
|
use Bitcoin::Crypto::Types qw(Object Str ByteStr FormatStr); |
|
16
|
|
|
|
|
48
|
|
|
16
|
|
|
|
|
125
|
|
11
|
16
|
|
|
16
|
|
62155
|
use Bitcoin::Crypto::Util qw(to_format); |
|
16
|
|
|
|
|
40
|
|
|
16
|
|
|
|
|
799
|
|
12
|
16
|
|
|
16
|
|
121
|
use Bitcoin::Crypto::Helpers qw(carp_once); |
|
16
|
|
|
|
|
36
|
|
|
16
|
|
|
|
|
739
|
|
13
|
16
|
|
|
16
|
|
98
|
use Moo::Role; |
|
16
|
|
|
|
|
46
|
|
|
16
|
|
|
|
|
201
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with qw( |
16
|
|
|
|
|
|
|
Bitcoin::Crypto::Role::Key |
17
|
|
|
|
|
|
|
Bitcoin::Crypto::Role::Compressed |
18
|
|
|
|
|
|
|
Bitcoin::Crypto::Role::SignVerify |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
around BUILDARGS => sub { |
22
|
|
|
|
|
|
|
my ($orig, $class, @params) = @_; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
if (@params == 1) { |
25
|
|
|
|
|
|
|
carp_once "$class->new(\$bytes) is now deprecated. Use $class->from_serialized(\$bytes) instead"; |
26
|
|
|
|
|
|
|
unshift @params, 'key_instance'; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return $class->$orig(@params); |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
signature_for from_serialized => ( |
33
|
|
|
|
|
|
|
method => Str, |
34
|
|
|
|
|
|
|
positional => [ByteStr], |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub from_serialized |
38
|
|
|
|
|
|
|
{ |
39
|
|
|
|
|
|
|
my ($class, $bytes) = @_; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return $class->new(key_instance => $bytes); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
signature_for to_serialized => ( |
45
|
|
|
|
|
|
|
method => Object, |
46
|
|
|
|
|
|
|
positional => [], |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub to_serialized |
50
|
|
|
|
|
|
|
{ |
51
|
|
|
|
|
|
|
my ($self) = @_; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
return $self->raw_key; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
### DEPRECATED |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub from_hex |
59
|
|
|
|
|
|
|
{ |
60
|
0
|
|
|
0
|
0
|
|
my ($class, $val) = @_; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
carp_once "$class->from_hex(\$str) is now deprecated. Use $class->from_serialized([hex => \$str]) instead"; |
63
|
0
|
|
|
|
|
|
return $class->from_serialized([hex => $val]); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub to_hex |
67
|
|
|
|
|
|
|
{ |
68
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $class = ref $self; |
71
|
0
|
|
|
|
|
|
carp_once |
72
|
|
|
|
|
|
|
"$class->to_hex() is now deprecated. Use Bitcoin::Crypto::Util::to_format [hex => $class->to_serialized()] instead"; |
73
|
0
|
|
|
|
|
|
return to_format [hex => $self->to_serialized]; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub from_bytes |
77
|
|
|
|
|
|
|
{ |
78
|
0
|
|
|
0
|
0
|
|
my ($class, $bytes) = @_; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
carp_once "$class->from_bytes() is now deprecated. Use $class->from_serialized() instead"; |
81
|
0
|
|
|
|
|
|
return $class->from_serialized($bytes); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub to_bytes |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my $class = ref $self; |
89
|
0
|
|
|
|
|
|
carp_once "$class->to_bytes() is now deprecated. Use $class->to_serialized() instead"; |
90
|
0
|
|
|
|
|
|
return $self->to_serialized; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|