commit f8a8a89
Emilia Smólska
·
2026-06-22 21:08:51 +0000 UTC
parent 395af62
BREAKING CHANGE: Use RNP instead of GPG thanks shrub for the suggestion everyone needs less GNU software in their lives
4 files changed,
+18,
-37
M
README
+1,
-1
1@@ -3,7 +3,7 @@ Haslo is a simple password manager.
2 Dependencies:
3 - Perl,
4 - The Perl modules MIME::Base32, MIME::Base64 and Term::ReadKey (some may already be included in your system's Perl distribution),
5-- GnuPG.
6+- RNP.
7
8 Installation:
9 Run make install.
M
haslo
+14,
-14
1@@ -17,7 +17,7 @@ my $home = $ENV{'HOME'} or die "\$HOME not set\n";
2 my $hasloemail = $ENV{'HASLOEMAIL'} or die "\$HASLOEMAIL not set\n";
3 my $haslodir = $ENV{'HASLODIR'} || "$home/.haslo";
4
5-sub writegpgpassword
6+sub writernppassword
7 {
8 unless(-d $haslodir){
9 print STDERR "creating directory $haslodir\n";
10@@ -26,18 +26,18 @@ sub writegpgpassword
11 }
12 my $target = shift;
13 my $password = shift;
14- open GPG, '|-', 'gpg', '-qer', $hasloemail, '-o',
15- "$haslodir/$target.gpg"
16- or die "couldn't open pipe to gpg: $!\n";
17- print GPG $password;
18- close GPG or die "gpg failed with exit code $?\n";
19+ open RNP, '|-', 'rnp', '--encrypt', '--recipient', $hasloemail,
20+ '--output', "$haslodir/$target.rnp"
21+ or die "couldn't open pipe to rnp: $!\n";
22+ print RNP $password;
23+ close RNP or die "rnp failed with exit code $?\n";
24 }
25
26 sub dodel
27 {
28 my $target = $ARGV[1] or usage;
29 $target = encode_base32 $target;
30- system 'rm', '-i', "$haslodir/$target.gpg"
31+ system 'rm', '-i', "$haslodir/$target.rnp"
32 and die "rm failed with exit code $?\n";
33 }
34
35@@ -51,17 +51,17 @@ sub dogen
36 or die "couldn't read from /dev/urandom: $!\n";
37 close URANDOM;
38 $buf = encode_base64 $buf;
39- writegpgpassword $target, $buf;
40+ writernppassword $target, $buf;
41 }
42
43 sub doget
44 {
45 my $target = $ARGV[1] or usage;
46 $target = encode_base32 $target;
47- open GPG, '-|', 'gpg', '-qd', "$haslodir/$target.gpg"
48- or die "couldn't open pipe to gpg: $!\n";
49- my $password = <GPG>;
50- close GPG or die "gpg failed with exit code $?\n";
51+ open RNP, '-|', 'rnp', '--decrypt', "$haslodir/$target.rnp"
52+ or die "couldn't open pipe to rnp: $!\n";
53+ my $password = <RNP>;
54+ close RNP or die "rnp failed with exit code $?\n";
55 print $password;
56 }
57
58@@ -69,7 +69,7 @@ sub dolist
59 {
60 opendir DIR, $haslodir or die "couldn't open $haslodir: $!\n";
61 for(readdir DIR){
62- next unless s/.gpg$//;
63+ next unless s/.rnp$//;
64 my $decoded = decode_base32 $_;
65 print "$decoded\n";
66 }
67@@ -91,7 +91,7 @@ sub doput
68 print STDERR "\n";
69 ReadMode 'restore';
70 }while($password ne $confirm);
71- writegpgpassword $target, $password;
72+ writernppassword $target, $password;
73 }
74
75 my %commands = (
M
haslo.1
+3,
-3
1@@ -39,8 +39,8 @@ List all stored passwords.
2 .Bl -tag -width Ds
3 .It Ev HASLOEMAIL
4 The email address used by
5-.Xr gpg 1
6-to encrypt and decrypt the passwords.
7+.Xr rnp 1
8+to encrypt the passwords.
9 .It Ev HASLODIR
10 The directory used to store passwords. Defaults to
11 .Pa ~/.haslo .
12@@ -48,7 +48,7 @@ The directory used to store passwords. Defaults to
13 .Sh EXIT STATUS
14 .Ex -std
15 .Sh SEE ALSO
16-.Xr gpg 1 ,
17+.Xr rnp 1 ,
18 .Xr xclip 1 ,
19 .Xr urandom 4
20 .Sh AUTHORS
+0,
-19
1@@ -1,19 +0,0 @@
2-#!/usr/bin/env perl
3-
4-use strict;
5-use warnings;
6-use MIME::Base32 qw(encode_base32);
7-
8-my $home = $ENV{'HOME'} or die "\$HOME not set\n";
9-my $haslodir = $ENV{'HASLODIR'} || "$home/.haslo";
10-
11-chdir $haslodir or die "couldn't chdir to $haslodir: $!\n";
12-opendir DIR, '.' or die "couldn't open $haslodir: $!\n";
13-for(readdir DIR){
14- next if -d;
15- next unless s/\.gpg$//;
16- my $encoded = encode_base32 $_;
17- print "renaming $_ to $encoded\n";
18- rename "$_.gpg", "$encoded.gpg" or die "couldn't rename $_ to $encoded: $!\n";
19-}
20-close DIR;