PGP-Finger

 view release on metacpan or  search on metacpan

lib/PGP/Finger.pm  view on Meta::CPAN


use Moose;

# ABSTRACT: retrieve PGP keys from different sources
our $VERSION = '1.1'; # VERSION

use PGP::Finger::DNS;
use PGP::Finger::Keyserver;
use PGP::Finger::ResultSet;

has 'sources' => ( is => 'ro', isa => 'ArrayRef[PGP::Finger::Source]', lazy => 1,
	default => sub { [
		PGP::Finger::DNS->new,
		PGP::Finger::Keyserver->new,
	] },
);

sub fetch {
	my ( $self, $addr ) = @_;
	my $resultset = PGP::Finger::ResultSet->new;

lib/PGP/Finger/App.pm  view on Meta::CPAN

	cmd_aliases => 'i',
	documentation => 'path or - for stdin',
);

has 'query' => ( is => 'ro', isa => 'Str', default => 'dns,keyserver',
	traits => ['Getopt'],
	cmd_aliases => 'q',
	documentation => 'sources to query (default: dns,keyserver)',
);

has '_query' => ( is => 'ro', isa => 'ArrayRef[Str]', lazy => 1,
	default => sub {
		my $self = shift;
		return [ split(/\s*,\s*/, $self->query) ];
	},
);

has 'output' => ( is => 'ro', isa => 'Str', default => 'armored',
	traits => ['Getopt'],
	cmd_aliases => 'o',
	documentation => 'output format: armored,rfc or generic (default: armored)',

lib/PGP/Finger/GPG.pm  view on Meta::CPAN

extends 'PGP::Finger::Source';

# ABSTRACT: gpgfinger source to query local gnupg
our $VERSION = '1.1'; # VERSION

use PGP::Finger::Result;
use PGP::Finger::Key;

use IPC::Run qw(run);

has 'cmd' => ( is => 'ro', isa => 'ArrayRef', lazy => 1,
	default => sub { [ '/usr/bin/gpg', '--export' ] },
);

sub fetch {
	my ( $self, $addr ) = @_;
	my @cmd = ( @{$self->cmd}, $addr );
	my ( $in, $out, $err );
	run( \@cmd, \$in, \$out, \$err )
		or die('error running gpg: '.$err.' ('.$!.')');

lib/PGP/Finger/Key.pm  view on Meta::CPAN

use Digest::CRC qw(crcopenpgparmor_base64);
use MIME::Base64;

use overload
    q{""}    => sub { $_[0]->armored },
    fallback => 1;


has 'data' => ( is => 'ro' );

has 'attributes' => ( is => 'ro', isa => 'HashRef[Str]', lazy => 1,
	traits => [ 'Hash' ],
	default => sub { {} },
	handles => {
		set_attr => 'set',
		get_attr => 'get',
		has_attr => 'exists',
		has_attrs => 'count',
	},
);

lib/PGP/Finger/Result.pm  view on Meta::CPAN

package PGP::Finger::Result;

use Moose;

# ABSTRACT: a gpgfinger result object
our $VERSION = '1.1'; # VERSION

has 'keys' => (
	is => 'ro', isa => 'ArrayRef[PGP::Finger::Key]', lazy => 1,
	traits => [ 'Array' ],
	default => sub { [] },
	handles => {
		add_key => 'push',
		count => 'count',
	},
);

1;

lib/PGP/Finger/ResultSet.pm  view on Meta::CPAN

package PGP::Finger::ResultSet;

use Moose;

# ABSTRACT: object to hold and merge Result objects
our $VERSION = '1.1'; # VERSION

has 'results' => (
	is => 'ro', isa => 'ArrayRef[PGP::Finger::Result]', lazy => 1,
	traits => [ 'Array' ],
	default => sub { [] },
	handles => {
		add_result => 'push',
		count => 'count',
	},
);

sub merged_keys {
	my $self = shift;



( run in 0.763 second using v1.01-cache-2.11-cpan-5f2e87ce722 )