summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-07-04 10:00:53 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-07-04 10:00:53 +0200
commit2a03eac098be689fa11c371b926d3f2d8ae4c96d (patch)
tree8ae1e9e3a779ff8ea722c68885aad70f31ade3bf /lib
parent1bc1cec23206cf212573fd283d81f8e030155261 (diff)
Raps2.pm: Add pw_load_info method (pw_load for unencrypted data)
Diffstat (limited to 'lib')
-rw-r--r--lib/App/Raps2.pm48
1 files changed, 36 insertions, 12 deletions
diff --git a/lib/App/Raps2.pm b/lib/App/Raps2.pm
index 720e942..96f37d7 100644
--- a/lib/App/Raps2.pm
+++ b/lib/App/Raps2.pm
@@ -177,6 +177,20 @@ sub pw_load {
};
}
+sub pw_load_info {
+ my ( $self, %data ) = @_;
+
+ $data{file} //= $self->{xdg_data} . "/$data{name}";
+
+ my $key = $self->file_to_hash( $data{file} );
+
+ return {
+ url => $key->{url},
+ login => $key->{login},
+ salt => $key->{salt},
+ };
+}
+
1;
__END__
@@ -203,7 +217,7 @@ This manual documents App::Raps2 version 0.4
=over
-=item $raps2 = App::Raps2->new(I<%conf>)
+=item $raps2 = App::Raps2->new( I<%conf> )
Returns a new B<App::Raps2> object.
@@ -217,17 +231,12 @@ B<cost> of key setup, passed on to App::Raps2::Password(3pm).
=back
-=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->get_master_password([I<$password>])
+=item $raps2->get_master_password( [I<$password>] )
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>)
+=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.
@@ -250,11 +259,21 @@ The following I<data> keys are supported:
=back
-=item $raps2->pw_load(B<file> => I<file> | B<name> => I<name>)
+=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> )
-Loads 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 and decrypted password and extra.
+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.
=back
@@ -288,6 +307,11 @@ Returns the App::Raps2::Password(3pm) object.
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.
+
=back
=head1 DIAGNOSTICS