env/bin/sekrit.1

154 lines
3.1 KiB
Groff

.\"
.\" sekrit.1
.\" Written in 2018,2020 by Lucas
.\" CC0 1.0 Universal/Public domain - No rights reserved
.\"
.\" To the extent possible under law, the author(s) have dedicated all
.\" copyright and related and neighboring rights to this software to the
.\" public domain worldwide. This software is distributed without any
.\" warranty. You should have received a copy of the CC0 Public Domain
.\" Dedication along with this software. If not, see
.\" <http://creativecommons.org/publicdomain/zero/1.0/>.
.\"
.Dd May 25, 2020
.Dt SEKRIT 1
.Os
.Sh NAME
.Nm sekrit
.Nd Secret files manager
.Sh SYNOPSIS
.Nm
.Cm add
.Ar key
.Op Ar value ...
.Nm
.Cm cp
.Op Fl k
.Op key
.Nm
.Cm gen
.Op Fl l Ar length
.Op Ar chars
.Nm
.Cm get
.Ar key
.Nm
.Cm has
.Ar key
.Nm
.Cm ls
.Op Ar keys ...
.Sh DESCRIPTION
.Nm
is a small shell script for managing encrypted files.
It leverages
.Xr gpg2 1
to create and read encrypted files,
and can generate random data to populate them.
.Pp
Because of this,
.Nm
can be used as an account credentials manager,
or as a general-purpose key-value store of encrypted information.
.Bl -tag -width Ds
.It Nm Cm add Ar key Op Ar value ...
Adds a value to
.Ar key .
.Ar value
is inserted as is, without any extra modifications.
If no
.Ar value
is specified on command line,
.Cm add
will read the value from standard input.
.Cm add
will fail if
.Ar key
already has a value.
.It Nm Cm cp Oo Fl k Oc Ar key
Decrypts the value associated with
.Ar key
and copies it to the clipboard with
.Xr xclip 1 .
It removes the last newline unless
.Fl k
is given.
.It Nm Cm gen Oo Fl l Ar length Oc Op Ar chars
Outputs a randomly generated sequence.
The generated sequence consist of characters
.Ar chars .
Defaults to
.Ar +/0-9A-Za-z .
If
.Fl l Ar length
is provided, the randomly generated sequence will be
.Ar length
characters long.
Defaults to 43.
.It Nm Cm get Ar key
Decrypts the value associated with
.Ar key
and prints it to standard output.
Fails if
.Ar key
doesn't have a value associated with it.
.It Nm Cm has Ar key
Returns success if
.Ar key
has a value associated with it.
Fails otherwise.
.It Nm Cm ls Op Ar keys ...
For each
.Ar key
given as argument,
list all the registered keys under that hierarchy.
If no
.Ar key
is given, list all the registeres keys.
.El
.Sh ENVIRONMENT
.Bl -tag -width SEKRIT_GPG_ID
.It Ev SEKRIT_DIR
Secret files base directory.
Defaults to
.Pa ~/keep/sekrit .
.It Ev SEKRIT_GPG_ID
The recipient to whom encrypt the files.
Defaults to
.Ar myself .
.El
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
To use
.Nm
as an account credentials manager, you can run
.Bd -literal -offset indent
sekrit add accounts/example.com/user myuser
sekrit gen accounts/example.com/pass
.Ed
.Pp
Then, to retrieve credentials to login as
.Ar myuser
in
.Ar example.com
you can run
.Bd -literal -offset indent
sekrit cp accounts/example.com/user
sekrit cp accounts/example.com/pass
.Ed
.Sh SEE ALSO
.Xr gpg2 1 ,
.Xr xclip 1
.Sh AUTHORS
.An Lucas
.Sh LICENSE
.Nm
is in the public domain.
.Pp
To the extent possible under law, the author(s) have dedicated all
copyright and related and neighboring rights to this software to the
public domain worldwide.
.Pp
.Lk http://creativecommons.org/publicdomain/zero/1.0/