NAME

Protocol::OTR::Contact - Off-the-Record Contact

VERSION

version 0.05

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
my @fingerprints = $bob->fingerprints();

# current active fingerprint
my $active_fingerprint = $bob->active_fingerprint();

# create secure channel to Bob
my $channel = $bob->channel(
    {
        policy => ...,
        max_message_size => ...,
        on_write => sub { ... },
        on_read => sub { ... },
        on_gone_secure => sub { ... },
        on_gone_insecure => sub { ... },
        on_still_secure => sub { ... },
        on_unverified_fingerprint => sub { ... },
        on_symkey => sub { ... },
        on_timer => sub { ... },
        on_smp => sub { ... },
        on_error => sub { ... },
        on_event => sub { ... },
        on_smp_event => sub { ... },
        on_before_encrypt => sub { ... },
        on_after_decrypt => sub { ... },
        on_is_contact_logged_in => sub { ... },
    }
);

DESCRIPTION

Protocol::OTR::Contact represents the OTR contact.

METHODS

account

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

Returns contact's Protocol::OTR::Account object.

name

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

Returns contact's name.

fingerprints

my @fingerprints = $contact->fingerprints();

Returns a list of fingerprint objects Protocol::OTR::Fingerprint for given contact.

active_fingerprint

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

Returns currently used fingerprint objects Protocol::OTR::Fingerprint for that contact.

channel

my $channel = $contact->channel(
    {
        policy => ...,
        max_message_size => ...,
        on_write => sub { ... },
        on_read => sub { ... },
        on_gone_secure => sub { ... },
        on_gone_insecure => sub { ... },
        on_still_secure => sub { ... },
        on_unverified_fingerprint => sub { ... },
        on_symkey => sub { ... },
        on_timer => sub { ... },
        on_smp => sub { ... },
        on_error => sub { ... },
        on_event => sub { ... },
        on_smp_event => sub { ... },
        on_before_encrypt => sub { ... },
        on_after_decrypt => sub { ... },
        on_is_contact_logged_in => sub { ... },
    }
);

Create secure channel with that contact.

Please see Protocol::OTR::Channel for callbacks description.

SEE ALSO

AUTHOR

Alex J. G. Burzyński <ajgb@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Alex J. G. Burzyński <ajgb@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.