#!/bin/bash set -euo pipefail if [[ "$#" -gt 0 && ("$1" == "-h" || "$1" == "--help") ]]; then cat < echo "secret-value" | put put -h|--help Arguments: secret-name Name to store the secret under The command will: 1. Read data from stdin 2. Encrypt the data using age with the public key 3. Store the encrypted data in the store as .age Note: Will overwrite existing secrets with the same name. EOF exit 0 fi this_dir="$(cd "$(dirname "$0")" && pwd)" source "${this_dir}/common.sh" if [[ "$#" -lt 1 ]]; then >&2 echo "ERROR: Need secret name" exit 1 fi name="$1" ensure_age age_encrypt "${public_key}" "$(file_for "${name}")"