summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/App/Raps2.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/App/Raps2.pm b/lib/App/Raps2.pm
index 6b40cc2..cf5a404 100644
--- a/lib/App/Raps2.pm
+++ b/lib/App/Raps2.pm
@@ -133,6 +133,8 @@ sub ui {
sub pw_add {
my ( $self, %data ) = @_;
+ $data{file} //= $self->{xdg_data} . "/$data{name}";
+
my $pass_hash = $self->pw->encrypt( $data{password}, $data{salt} );
my $extra_hash = (
$data{extra}
@@ -184,6 +186,8 @@ sub cmd_add {
sub pw_get {
my ( $self, %data ) = @_;
+ $data{file} //= $self->{xdg_data} . "/$data{name}";
+
my %key = $self->file_to_hash( $data{file} );
return {
@@ -414,6 +418,19 @@ Returns the App::Raps2::Password(3pm) object.
Returns the App::Raps2::UI(3pm) object.
+=item $raps2->pw_add(I<%data>)
+
+Write an account as specified by I<data> to the store. Requires
+B<get_master_password> to have been called before. Requires I<data> keys are
+password, salt and either file or name, plus the optional url, login and
+extra.
+
+=item $raps2->pw_get(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.
+
=item $raps2->cmd_add(I<$name>)
Adds a new password file called $name.