Crates.io | dead-man-switch-tui |
lib.rs | dead-man-switch-tui |
version | 0.4.1 |
source | src |
created_at | 2024-09-08 11:31:16.837726 |
updated_at | 2024-10-02 08:31:56.033116 |
description | A simple no-BS Dead Man's Switch Tui Interface |
homepage | |
repository | |
max_upload_size | |
id | 1368008 |
size | 73,104 |
This is a simple implementation of a Dead Man's Switch.
Use at your own risk. Check the f****(as in friendly) code.
Dead man's switches are designed to require positive action or they will automatically deploy. They are ideal for situations where you are worried about unforeseen death, kidnapping, or memory loss. If you don’t engage the trigger for a certain amount of time, the switch automatically sends the desired message.
If you want a very simple explanation and the motivation behind the project, check my blog post here.
Upon starting the program it will create a config.toml
file in an OS-agnostic config file location:
$XDG_CONFIG_HOME
, i.e. $HOME/.config|/home/alice/.config
$HOME/Library/Application Support
, i.e. /Users/Alice/Library/Application Support
{FOLDERID_RoamingAppData}
, i.e. C:\Users\Alice\AppData\Roaming
Edit the config.toml
file to your liking.
Some default values are provided for inspiration.
Dead Man's Switch comprises of two timers:
timer_warning
(seconds) value
in the config.toml
file.
If the user do not check-in before timer reaches 0,
it will send a warning email to the users' own specified email address,
the from
in the config.toml
.timer_dead_man
(seconds).
If the user do not check-in before timer reaches 0,
it will send the final email to the specified email address in the config.toml
,
i.e. the to
in the config.toml
.If you want to send attachments with the Dead Man's email,
you can specify the attachments
option config in the config.toml
and provide the absolute path to the file you want to attach.
To check-in, you just need to press the c
key as in check-in.
There are several ways to install Dead Man's Switch:
Crates.io: cargo install dead-man-switch-tui
.
GitHub: cargo install --git https://github.com/storopoli/dead-man-switch -p dead-man-switch-tui
.
From source: Clone the repository and run cargo install --path .
.
Using Nix: nix run github:storopoli/dead-man-switch
.
Using Nix Flakes: add this to your flake.nix
:
{
# ...
inputs.dead-man-switch = {
url = "github:storopoli/dead-man-switch";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-parts.follows = "flake-parts";
};
};
outputs = inputs @ { self, ... }:
{
imports = [
{
nixpkgs.overlays = [
# ...
inputs.dead-man-switch.overlays.default
];
}
];
};
}
Then dead-man-switch
will be available as pkgs.dead-man-switch
;
Dead Man's Switch can be used as a library. This includes all the functions necessary to configure and send emails; along with the timers.
To do so you can add the following to your Cargo.toml
:
[dependencies]
dead-man-switch = "0.4"
The Dead Man's Switch is also available as a web interface.
To use the web interface, please follow the instructions below:
Change the configuration template file with your own values:
cp config.example.toml config.toml
Copy the Docker Compose example file:
cp docker-compose.example.yml docker-compose.yml
Run the Docker Compose:
docker-compose up --detach
Make sure to reverse proxy the web interface with proper security measures such as HTTPS.
The source code is licensed under an AGPL v3 License