Daniel Friesel
and 1 contributors

NAME

App::Raps2 - A Password safe

SYNOPSIS

    use App::Raps2;

    my $raps2 = App::Raps2->new();

DESCRIPTION

App::Raps2 is the backend for raps2, a simple commandline password safe.

VERSION

This manual documents App::Raps2 version 0.54

METHODS

$raps2 = App::Raps2->new( %conf )

Returns a new App::Raps2 object.

Accepted configuration parameters are:

cost => int

cost of key setup, passed on to App::Raps2::Password(3pm).

Default: 12

no_cli => bool

If set to true, App::Raps2 assumes it will not be used as a CLI. It won't initialize its Term::ReadLine object and won't try to read anything from the terminal.

pwgen_cmd => comand

Command to use in generate_password.

Default: pwgen -s 23 1

Note that the cost and pwgen_cmd options specified here take precedence over those loaded from the config file.

$raps2->get_master_password( [$password] )

Sets the master password used to encrypt all accounts. Uses password if specified, otherwise it asks the user via App::Raps2::UI(3pm).

$raps2->pw_load( file => file | name => name )

Load a password from file (or account name), requires get_master_password to have been called before.

Returns a hashref containing its url, login, salt, cost and decrypted password and extra.

$raps2->pw_load_info( file => file | name => name )

Load all unencrypted data from file (or account name). Unlike pw_load, this method does not require a prior call to get_master_password.

Returns a hashref with url, login, salt and cost.

$raps2->pw_save( %data )

Write an account as specified by data to the store. Requires get_master_password to have been called before.

The following data keys are supported:

password => password to encrypt (mandatory)
salt => salt
cost => cost (optional, inferred from new / the config otherwise)
file => file | name => name (one must be set)
url => url (optional)
login => login (optional)
extra => extra (optiona)
$raps2->ui()

Returns the App::Raps2::UI(3pm) object.

$raps2->conf(key)

Returns the current config value of key, either set by new or loaded from the defaults config file.

$raps2->generate_password()

Runs pwgen_cmd (as specified in new or the config file) and returns its first word of output, without trailing newlines / whitespaces.

INTERNAL

You usually don't need to call these methods by yourself.

$raps2->create_config()

Creates a password file and asks the user to set a master password.

$raps2->load_config()

Load config. Automatically called by new.

$raps2->create_defaults()

Creates a defaults config file containing the default key setup cost and pwgen command.

$raps2->load_defaults()

Loads the defaults file. Automatically called by new.

$raps2->pw()

Returns the App::Raps2::Password(3pm) object.

$raps2->file_to_hash( $file )

Reads $file (lines with key/value separated by whitespace) and returns a hashref with its key/value pairs.

$raps2->sanity_check()

Create working directories (~/.config/raps2 and ~/.local/share/raps2, or the respective XDG environment variable contents), if they don't exist yet. Automatically called by new.

Calls create_config and create_defaults if no configs were found.

DIAGNOSTICS

If anything goes wrong, App::Raps2 will die with a backtrace (using confess from Carp(3pm)).

DEPENDENCIES

App::Raps2::Password(3pm), App::Raps2::UI(3pm), File::BaseDir(3pm), File::Slurp(3pm).

BUGS AND LIMITATIONS

Be aware that the password handling API is not yet stable. Also, so far the development concentrated on raps2, so this module / its documentation may not be completely up-to-date.

AUTHOR

Copyright (C) 2011-2015 by Daniel Friesel <derf@finalrewind.org>

LICENSE

  0. You just DO WHAT THE FUCK YOU WANT TO.