diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-07-04 12:22:22 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-07-04 12:22:22 +0200 |
commit | 581559e3d6dcac68e7ae297f9b1247b63b143582 (patch) | |
tree | e200f920e81302bc2c8204f327ec349ce4ca26c2 /lib | |
parent | 2a03eac098be689fa11c371b926d3f2d8ae4c96d (diff) |
Raps2.pm: pw_save: Make salt argument optional, restructure documentation while at it
Diffstat (limited to 'lib')
-rw-r--r-- | lib/App/Raps2.pm | 55 |
1 files changed, 28 insertions, 27 deletions
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 |