The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Protocol::OTR::Account - Off-the-Record Account (private key)

VERSION

version 0.04

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";
    print " * protocol: ",    $alice->protocol,    "\n";
    print " * fingerprint: ", $alice->fingerprint, "\n";

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

    # return all known by $alice contacts
    my @contacts = $alice->contacts();

DESCRIPTION

Protocol::OTR::Account represents the OTR account (private key).

METHODS

ctx

    my $otr = $account->ctx();

Returns account's context.

name

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

Returns account's name.

protocol

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

Returns account's protocol.

fingerprint

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

Returns account's fingerprint in human readable format 12345678 90ABCDEF 12345678 90ABCDEF 12345678.

contact

    my $contact = $account->contact( $name, [ $fingerprint, [ $is_verified ]]);

Returns existing or creates new Protocol::OTR::Contact object.

If $fingeprint is set for contact, it will be set as verified if $is_verified is true.

Note: it is allowed to use a string of 40 chars or human readable format (44 chars).

contacts

    my @contacts = $account->contacts();

Returns a list of known contact objects Protocol::OTR::Contact.

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.