| 1 | package Web::ID::SAN::Email; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 3 | our $WWW_Finger = 0; | |||||||||
| 7 | |||||||||||
| 8 | 3 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
| |||||||||||
| 9 | 3 | $Web::ID::SAN::Email::AUTHORITY = 'cpan:TOBYINK'; | |||||||||
| 10 | 3 | $Web::ID::SAN::Email::VERSION = '1.927'; | |||||||||
| 11 | |||||||||||
| 12 | 3 | eval { | |||||||||
| 13 | 3 | ▶ | no warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 3 | require WWW::Finger; | |||||||||
| 15 | 0 | WWW::Finger->VERSION('0.100'); | |||||||||
| 16 | 0 | $WWW_Finger++; | |||||||||
| 17 | } | ||||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 3 | ▶ | use Web::ID::Types -types; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 3 | ▶ | use Web::ID::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | |||||||||||
| 23 | 3 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 3 | ▶ | use namespace::sweep; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 3 | extends "Web::ID::SAN"; | |||||||||
| 26 | |||||||||||
| 27 | 3 | has '+type' => (default => 'rfc822Name'); | |||||||||
| 28 | |||||||||||
| 29 | 3 | has finger => ( | |||||||||
| 30 | is => read_only, | ||||||||||
| 31 | isa => Finger | Undef, | ||||||||||
| 32 | lazy => true, | ||||||||||
| 33 | builder => '_build_finger', | ||||||||||
| 34 | ); | ||||||||||
| 35 | |||||||||||
| 36 | sub _build_finger | ||||||||||
| 37 | 0 | ▶ | { | ||||||||
|
Subroutine
_build_finger: not called CC=1 SCAR=6.9
| |||||||||||
| 38 | 0 | my ($self) = @_; | |||||||||
| 39 | 0 | return WWW::Finger->new($self->value); | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | around _build_model => sub | ||||||||||
| 43 | 0 | ▶ | { | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 44 | 0 | my ($orig, $self) = @_; | |||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | if (my $finger = $self->finger) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | { | ||||||||||
| 48 | 0 | ▶ | if ($finger->endpoint) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | { | ||||||||||
| 50 | 0 | my $store = "RDF::Trine::Store::SPARQL"->new($finger->endpoint); | |||||||||
| 51 | 0 | return Model->new($store); | |||||||||
| 52 | } | ||||||||||
| 53 | 0 | return $finger->graph; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | $self->$orig(); | |||||||||
| 57 | 3 | }; | |||||||||
| 58 | |||||||||||
| 59 | around associated_keys => sub | ||||||||||
| 60 | 0 | ▶ | { | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 61 | 0 | my ($orig, $self) = @_; | |||||||||
| 62 | 0 | my @keys = $self->$orig; | |||||||||
| 63 | |||||||||||
| 64 | 0 | my $results = $self->_query->execute( $self->model ); | |||||||||
| 65 | 0 | ▶ | RESULT: while (my $result = $results->next) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | { | ||||||||||
| 67 | my $modulus = make_bigint_from_node( | ||||||||||
| 68 | $result->{modulus}, | ||||||||||
| 69 | fallback => $result->{hexModulus}, | ||||||||||
| 70 | 0 | fallback_type =>'hex', | |||||||||
| 71 | ); | ||||||||||
| 72 | my $exponent = make_bigint_from_node( | ||||||||||
| 73 | $result->{exponent}, | ||||||||||
| 74 | fallback => $result->{decExponent}, | ||||||||||
| 75 | 0 | fallback_type =>'dec', | |||||||||
| 76 | ); | ||||||||||
| 77 | |||||||||||
| 78 | 0 | my $key = $self->key_factory->( | |||||||||
| 79 | modulus => $modulus, | ||||||||||
| 80 | exponent => $exponent, | ||||||||||
| 81 | ); | ||||||||||
| 82 | 0 | ▶ | push @keys, $key if $key; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | 0 | return @keys; | |||||||||
| 86 | 3 | }; | |||||||||
| 87 | |||||||||||
| 88 | sub _query | ||||||||||
| 89 | 0 | ▶ | { | ||||||||
|
Subroutine
_query: not called CC=1 SCAR=6.9
| |||||||||||
| 90 | 0 | my ($self) = @_; | |||||||||
| 91 | 0 | my $email = 'mailto:' . $self->value; | |||||||||
| 92 | 0 | return "RDF::Query"->new( sprintf(<<'SPARQL', (($email)x4)) ); | |||||||||
| 93 | PREFIX cert: <http://www.w3.org/ns/auth/cert#> | ||||||||||
| 94 | PREFIX rsa: <http://www.w3.org/ns/auth/rsa#> | ||||||||||
| 95 | PREFIX foaf: <http://xmlns.com/foaf/0.1/> | ||||||||||
| 96 | SELECT | ||||||||||
| 97 | ?webid | ||||||||||
| 98 | ?modulus | ||||||||||
| 99 | ?exponent | ||||||||||
| 100 | ?decExponent | ||||||||||
| 101 | ?hexModulus | ||||||||||
| 102 | WHERE | ||||||||||
| 103 | { | ||||||||||
| 104 | { | ||||||||||
| 105 | ?webid foaf:mbox <%s> . | ||||||||||
| 106 | ?key | ||||||||||
| 107 | cert:identity ?webid ; | ||||||||||
| 108 | rsa:modulus ?modulus ; | ||||||||||
| 109 | rsa:public_exponent ?exponent . | ||||||||||
| 110 | } | ||||||||||
| 111 | UNION | ||||||||||
| 112 | { | ||||||||||
| 113 | ?webid | ||||||||||
| 114 | foaf:mbox <%s> ; | ||||||||||
| 115 | cert:key ?key . | ||||||||||
| 116 | ?key | ||||||||||
| 117 | rsa:modulus ?modulus ; | ||||||||||
| 118 | rsa:public_exponent ?exponent . | ||||||||||
| 119 | } | ||||||||||
| 120 | UNION | ||||||||||
| 121 | { | ||||||||||
| 122 | ?webid foaf:mbox <%s> . | ||||||||||
| 123 | ?key | ||||||||||
| 124 | cert:identity ?webid ; | ||||||||||
| 125 | cert:modulus ?modulus ; | ||||||||||
| 126 | cert:exponent ?exponent . | ||||||||||
| 127 | } | ||||||||||
| 128 | UNION | ||||||||||
| 129 | { | ||||||||||
| 130 | ?webid | ||||||||||
| 131 | foaf:mbox <%s> ; | ||||||||||
| 132 | cert:key ?key . | ||||||||||
| 133 | ?key | ||||||||||
| 134 | cert:modulus ?modulus ; | ||||||||||
| 135 | cert:exponent ?exponent . | ||||||||||
| 136 | } | ||||||||||
| 137 | OPTIONAL { ?modulus cert:hex ?hexModulus . } | ||||||||||
| 138 | OPTIONAL { ?exponent cert:decimal ?decExponent . } | ||||||||||
| 139 | } | ||||||||||
| 140 | SPARQL | ||||||||||
| 141 | } | ||||||||||
| 142 | |||||||||||
| 143 | 3 | __PACKAGE__ | |||||||||
| 144 | __END__ | ||||||||||