Protocol-OTR

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    Protocol::OTR - Off-the-Record secure messaging protocol

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');

README  view on Meta::CPAN


DESCRIPTION
    Protocol::OTR provides bindings to Off-the-Record C library
    <https://otr.cypherpunks.ca/> allowing to manage OTR setup and to
    communicate in secure way.

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

    Returns an context object using optionally specified files. If files do
    not exist, they will be created when needed.

    The example above shows the default filenames used.

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

=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');

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


L<Protocol::OTR> provides bindings to L<Off-the-Record C library|https://otr.cypherpunks.ca/>
allowing to manage OTR setup and to communicate in secure way.

=head1 METHODS

=head2 new

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

Returns an context object using optionally specified files. If files do not exist, they
will be created when needed.

The example above shows the default filenames used.

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

=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');

    print "Account:\n";
    print " * name: ",        $alice->name,        "\n";

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

=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');

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

=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');

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

=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');

t/channel.t  view on Meta::CPAN

    my $result = $action->();
    while (my $e = shift @Q) {
        $e->();
    }

    return $result;
}

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

    }
);

my $otr2 = Protocol::OTR->new(
    {
        privkeys_file => "$tmpdir2/otr.private_key",
        contacts_file => "$tmpdir2/otr.fingerprints",
        instance_tags_file => "$tmpdir2/otr.instance_tags",

    }
);

my ($msg_a2b, $msg_b2a);

my $alice = $otr->account('alice', "protocol");
my $bob = $otr2->account('bob', "protocol");

t/prototypes.t  view on Meta::CPAN


my $tmpdir = tempdir( 'XXXXXXXX', DIR => "t/", CLEANUP => 1 );

eval {
    my $otr = Protocol::OTR->new( [ 123 ]);
};
ok($@, '->new() args are passed as hashref');

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

eval {
    my $act = $otr->account('user@domain');
};
ok($@, 'otr->account() requires protocol');

t/setup.t  view on Meta::CPAN


BEGIN { $ENV{PROTOCOL_OTR_ENABLE_QUICK_RANDOM} = 1 }

use Protocol::OTR qw( :constants );
use File::Temp qw( tempdir );

my $tmpdir = tempdir( 'XXXXXXXX', DIR => "t/", CLEANUP => 1 );

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

my $act = $otr->account('user@domain', 'protocol');

isa_ok($act, 'Protocol::OTR::Account');



( run in 0.322 second using v1.01-cache-2.11-cpan-4d50c553e7e )