Crypto/Key/NUMS.pm

filter: Statementstmt 100% 39 / 39 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 13 / 13 Podpod 100% 1 / 1 totaltotal 100% 53 / 53 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Crypto.pm ↑ Summary Crypto/Role/WithDerivationPath.pm »
1 package Bitcoin::Crypto::Key::NUMS;
2 1 $Bitcoin::Crypto::Key::NUMS::VERSION = '4.005';
3 1 ▶use v5.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Mooish::Base -standard;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Types::Common -sigs;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Crypt::PRNG qw(random_bytes);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Crypt::Digest::SHA256 qw(sha256);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Bitcoin::Crypto qw(btc_pub);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Bitcoin::Crypto::Types -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Bitcoin::Crypto::Util::Internal qw(lift_x);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Bitcoin::Crypto::Helpers qw(ecc);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Bitcoin::Crypto::Constants qw(:curve);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 # 32 random bytes can overflow ecc, but the changes of that are extremely low
18 has param 'tweak' => (
19 coerce => ByteStrLen [32],
20 1 ▶ lazy => sub { random_bytes(32) },
Subroutine __ANON__: called CC=1 SCAR=0.0
21 1 );
22  
23 sub get_public_key
24 3 ▶{
Subroutine get_public_key: called CC=1 SCAR=0.0
Pod documented
25 3 my ($self) = @_;
26  
27 3 state $nums_base = lift_x sha256 CURVE_GENERATOR;
28 3 return btc_pub->from_serialized(ecc->add_public_key($nums_base, $self->tweak));
29 }
30  
31 1 1;
32  
33 __END__
« Crypto.pm ↑ Summary Crypto/Role/WithDerivationPath.pm »