summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-07-04 09:49:24 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-07-04 09:49:24 +0200
commit1bc1cec23206cf212573fd283d81f8e030155261 (patch)
treec06957030900eecf2450c201d212cb6fc818abb2 /lib
parente496f621262e74133d9870cc197217552ad10185 (diff)
Raps2.pm: get_master_password: Accept password as optional argument
This way, it is possible to use App::Raps2 in non-CLI applications.
Diffstat (limited to 'lib')
-rw-r--r--lib/App/Raps2.pm14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/App/Raps2.pm b/lib/App/Raps2.pm
index faf74d9..720e942 100644
--- a/lib/App/Raps2.pm
+++ b/lib/App/Raps2.pm
@@ -63,8 +63,11 @@ sub sanity_check {
}
sub get_master_password {
- my ($self) = @_;
- my $pass = $self->ui->read_pw( 'Master Password', 0 );
+ my ( $self, $pass ) = @_;
+
+ if ( not defined $pass ) {
+ $pass = $self->ui->read_pw( 'Master Password', 0 );
+ }
$self->{pass} = App::Raps2::Password->new(
cost => $self->{default}->{cost},
@@ -219,16 +222,17 @@ B<cost> of key setup, passed on to App::Raps2::Password(3pm).
Reads $file (lines with key/value separated by whitespace) and returns a
hashref with its key/value pairs.
-=item $raps2->get_master_password()
+=item $raps2->get_master_password([I<$password>])
-Asks the user for the master passphrase.
+Sets the master password used to encrypt all accounts. Uses I<password> if
+specified, otherwise it asks the user via App::Raps2::UI(3pm).
=item $raps2->pw_save(I<%data>)
Write an account as specified by I<data> to the store. Requires
B<get_master_password> to have been called before.
-The following I<data> keys are possible:
+The following I<data> keys are supported:
=over