Protocol-OTR

 view release on metacpan or  search on metacpan

lib/Protocol/OTR/Fingerprint.pm  view on Meta::CPAN

# ABSTRACT: Off-the-Record contact's Fingerprint
package Protocol::OTR::Fingerprint;
BEGIN {
  $Protocol::OTR::Fingerprint::AUTHORITY = 'cpan:AJGB';
}
$Protocol::OTR::Fingerprint::VERSION = '0.05';
use strict;
use warnings;

sub _new {
    my ($class, $cnt, $args) = @_;

    my $self = bless $args, $class;
    $self->{cnt} = $cnt;

    return $self;
}

sub contact {
    return $_[0]->{cnt};
}

sub status {
    return $_[0]->{status};
}

sub is_verified {
    return $_[0]->{is_verified};
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Protocol::OTR::Fingerprint - Off-the-Record contact's Fingerprint

=head1 VERSION

version 0.05

=head1 SYNOPSIS

    use Protocol::OTR qw( :constants );

    my $otr = Protocol::OTR->new(
        {
            privkeys_file => "otr.private_key",
            contacts_file => "otr.fingerprints",
            instance_tags_file => "otr.instance_tags",
        }
    );

    # find or create account
    my $alice = $otr->account('alice@domain', 'prpl-jabber');

    # find or create contact known by $alice
    my $bob = $alice->contact('bob@domain');

    # return all $bob's fingerprints
    for my $fingerprint ( $bob->fingerprints() ) {
        print "Fingerprint:\n";
        print " * hash: ",        $fingerprint->hash,        "\n";
        print " * status: ",      $fingerprint->status,      "\n";
        print " * is_verified: ", $fingerprint->is_verified, "\n";
    }

=head1 DESCRIPTION

L<Protocol::OTR::Fingerprint> represents the fingerprint for OTR contact.

=head1 METHODS

=head2 contact

    my $contact = $fingerprint->contact();

Returns fingerprint's L<Protocol::OTR::Contact> object.

=head2 hash

    my $hash = $fingerprint->hash();

Returns fingerprint's hash in human readable format
C<12345678 90ABCDEF 12345678 90ABCDEF 12345678>.

=head2 status

    my $status = $fingerprint->status;

Returns current status of fingerprint used in communication, which is one of:

=over 4

=item * Unused

=item * Not private

=item * Unverified

=item * Private

=item * Finished

=back

=head2 is_verified



( run in 1.656 second using v1.01-cache-2.11-cpan-39bf76dae61 )