dotfiles/utils/.local/bin/meow-old

10 lines
447 B
Bash
Executable File

#!/bin/sh
# we need to generate a 256 byte random key
# for using the aes-256-cbc cipher
key="$(openssl rand -hex 32)"
iv="$(openssl rand -hex 12)"
# calculate its encryption and upload it
url="$(openssl enc -aes-256-cbc -K ${key} -iv ${iv} -e -base64 -A < ${1:-/dev/stdin} | purr-old)"
printf '%s\n' "${url%\/*}/paste.html#${url##*\/}_${key}_${iv}"
[ "$WAYLAND_DISPLAY" ] && printf '%s' "${url%\/*}/paste.html#${url##*\/}_${key}_${iv}" | wl-copy