2020-07-07 16:36:32 -05:00
|
|
|
#!/bin/sh
|
2020-09-04 22:07:23 -05:00
|
|
|
# we need to generate a 256 byte random key
|
|
|
|
# for using the aes-256-cbc cipher
|
2020-07-07 16:36:32 -05:00
|
|
|
key="$(openssl rand -hex 32)"
|
2020-09-04 22:07:23 -05:00
|
|
|
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)"
|
|
|
|
printf '%s\n' "${url%\/*}/paste.html#${url##*\/}_${key}_${iv}"
|
|
|
|
[ "$WAYLAND_DISPLAY" ] && printf '%s' "${url%\/*}/paste.html#${url##*\/}_${key}_${iv}" | wl-copy
|