File Coverage

blib/lib/GnuPG/UserAttribute.pm
Criterion Covered Total %
statement 6 12 50.0
branch n/a
path n/a
condition n/a
subroutine 2 4 50.0
pod 0 2 0.0
total 8 18 44.4


line stmt bran path cond sub pod time code
1               # UserAttribute.pm
2               # - providing an object-oriented approach to GnuPG user attributes
3               #
4               # Copyright (C) 2010 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
5               # (derived from UserId.pm, Copyright (C) 2000 Frank J. Tobin <ftobin@cpan.org>)
6               #
7               # This module is free software; you can redistribute it and/or modify it
8               # under the same terms as Perl itself.
9               #
10               # This program is distributed in the hope that it will be useful,
11               # but WITHOUT ANY WARRANTY; without even the implied warranty of
12               # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13               #
14               # $Id: UserId.pm,v 1.7 2001/08/21 13:31:50 ftobin Exp $
15               #
16                
17               package GnuPG::UserAttribute;
18 5       5   60 use Moo;
  5           16  
  5           42  
19 5       5   1703 use MooX::late;
  5           11  
  5           40  
20                
21               has [qw( validity subpacket_count subpacket_total_size )] => (
22               isa => 'Any',
23               is => 'rw',
24               );
25                
26               has signatures => (
27               isa => 'ArrayRef',
28               is => 'rw',
29               default => sub { [] },
30               );
31               has revocations => (
32               isa => 'ArrayRef',
33               is => 'rw',
34               default => sub { [] },
35               );
36                
37               sub push_signatures {
38 0       0 0   my $self = shift;
39 0             push @{ $self->signatures }, @_;
  0              
40               }
41               sub push_revocations {
42 0       0 0   my $self = shift;
43 0             push @{ $self->revocations }, @_;
  0              
44               }
45                
46               1;
47                
48               __END__
49                
50               =head1 NAME
51                
52               GnuPG::UserAttribute - GnuPG User Attribute Objects
53                
54               =head1 SYNOPSIS
55                
56               # assumes a GnuPG::PublicKey object in $publickey
57               my $jpgs_size = $publickey->user_attributes->[0]->subpacket_total_size();
58                
59               =head1 DESCRIPTION
60                
61               GnuPG::UserAttribute objects are generally not instantiated on their
62               own, but rather as part of GnuPG::PublicKey or GnuPG::SecretKey
63               objects.
64                
65               =head1 OBJECT METHODS
66                
67               =over 4
68                
69               =item new( I<%initialization_args> )
70                
71               This methods creates a new object. The optional arguments are
72               initialization of data members;
73                
74               =back
75                
76               =head1 OBJECT DATA MEMBERS
77                
78               =over 4
79                
80               =item validity
81                
82               A scalar holding the value GnuPG reports for the calculated validity
83               of the binding between this User Attribute packet and its associated
84               primary key. See GnuPG's DETAILS file for details.
85                
86               =item subpacket_count
87                
88               A scalar holding the number of attribute subpackets. This is usually
89               1, as most UATs seen in the wild contain a single image in JPEG
90               format.
91                
92               =item subpacket_total_size
93                
94               A scalar holding the total byte count of all attribute subpackets.
95                
96               =item signatures
97                
98               A list of GnuPG::Signature objects embodying the signatures
99               on this user attribute.
100                
101               =item revocations
102                
103               A list of revocations associated with this User Attribute, stored as
104               GnuPG::Signature objects (since revocations are a type of
105               certification as well).
106                
107               =back
108                
109               =head1 BUGS
110                
111               No useful information about the embedded attributes is provided yet.
112               It would be nice to be able to get ahold of the raw JPEG material.
113                
114               =head1 SEE ALSO
115                
116               L<GnuPG::Signature>,
117                
118               =cut