diff options
-rw-r--r-- | Changelog | 1 | ||||
-rwxr-xr-x | bin/raps2 | 2 | ||||
-rw-r--r-- | lib/App/Raps2.pm | 55 |
3 files changed, 29 insertions, 29 deletions
@@ -8,6 +8,7 @@ git HEAD * file_to_hash now returns a hashref instead of a hash * Allow password to be passed as argument to get_master_password * Add pw_load_info method + * The 'salt' argument to pw_add is now optional App::Raps2 0.4 - Sun Jul 03 2011 @@ -27,7 +27,6 @@ sub cmd_add { $raps2->get_master_password(); - my $salt = $raps2->pw->create_salt(); my $url = $raps2->ui->read_line('URL'); my $login = $raps2->ui->read_line('Login'); my $pass = $raps2->ui->read_pw( 'Password', 1 ); @@ -35,7 +34,6 @@ sub cmd_add { $raps2->pw_save( file => $pwfile, - salt => $salt, url => $url, login => $login, password => $pass, diff --git a/lib/App/Raps2.pm b/lib/App/Raps2.pm index 96f37d7..8971dd0 100644 --- a/lib/App/Raps2.pm +++ b/lib/App/Raps2.pm @@ -137,6 +137,7 @@ sub pw_save { my ( $self, %data ) = @_; $data{file} //= $self->{xdg_data} . "/$data{name}"; + $data{salt} //= $self->pw->create_salt(); my $pass_hash = $self->pw->encrypt( $data{password}, $data{salt} ); my $extra_hash = ( @@ -236,6 +237,22 @@ B<cost> of key setup, passed on to App::Raps2::Password(3pm). 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_load( B<file> => I<file> | B<name> => I<name> ) + +Load a password from I<file> (or account I<name>), requires +B<get_master_password> to have been called before. + +Returns a hashref containing its url, login, salt and decrypted password and +extra. + +=item $raps2->pw_load_info( B<file> => I<file> | B<name> => I<name> ) + +Load all unencrypted data from I<file> (or account I<name>). Unlike +B<pw_load>, this method does not require a prior call to +B<get_master_password>. + +Returns a hashref with url, login and salt. + =item $raps2->pw_save( I<%data> ) Write an account as specified by I<data> to the store. Requires @@ -247,7 +264,7 @@ The following I<data> keys are supported: =item B<password> => I<password to encrypt> (mandatory) -=item B<salt> => I<salt> (mandatory) +=item B<salt> => I<salt> =item B<file> => I<file> | B<name> => I<name> (one must be set) @@ -259,21 +276,9 @@ The following I<data> keys are supported: =back -=item $raps2->pw_load( B<file> => I<file> | B<name> => I<name> ) - -Load a password from I<file> (or account I<name>), requires -B<get_master_password> to have been called before. - -Returns a hashref containing its url, login, salt and decrypted password and -extra. - -=item $raps2->pw_load_info( B<file> => I<file> | B<name> => I<name> ) - -Load all unencrypted data from I<file> (or account I<name>). Unlike -B<pw_load>, this method does not require a prior call to -B<get_master_password>. +=item $raps2->ui() -Returns a hashref with url, login and salt. +Returns the App::Raps2::UI(3pm) object. =back @@ -283,14 +288,6 @@ You usually don't need to call these methods by yourself. =over -=item $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 B<new>. - -Calls B<create_config> if no raps2 config was found. - =item $raps2->create_config() Creates a default config and asks the user to set a master password. @@ -303,15 +300,19 @@ Load config. Automatically called by B<new>. Returns the App::Raps2::Password(3pm) object. -=item $raps2->ui() - -Returns the App::Raps2::UI(3pm) object. - =item $raps2->file_to_hash( I<$file> ) Reads $file (lines with key/value separated by whitespace) and returns a hashref with its key/value pairs. +=item $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 B<new>. + +Calls B<create_config> if no raps2 config was found. + =back =head1 DIAGNOSTICS |