refactor jwt secret

This commit is contained in:
2024-10-03 15:37:23 -05:00
parent 058429fff8
commit a95c0ed9b0
3 changed files with 33 additions and 7 deletions

View File

@@ -4,11 +4,11 @@
num_bytes=16
# Use dd to read cryptographically secure bytes from /dev/urandom
# and convert them to integers using od
secure_bytes=$(dd if=/dev/urandom bs=1 count=$num_bytes 2>/dev/null | od -An -tu1)
# and convert them to hexadecimal using od
secure_bytes=$(dd if=/dev/urandom bs=1 count=$num_bytes 2>/dev/null | od -An -tx1)
# Remove leading/trailing spaces and replace spaces with commas
secure_bytes=$(echo $secure_bytes | sed 's/ /,/g')
# Remove leading/trailing spaces and concatenate the hex bytes into a single string
secure_bytes=$(echo $secure_bytes | tr -d ' \n')
# Output the result as a comma-separated list of integers
echo "Cryptographically secure bytes (as integers): $secure_bytes"
# Output the result as a hexadecimal string
echo "Cryptographically secure bytes (as hex): $secure_bytes"