Skip to content

Commit

Permalink
feat: read randomness from /dev/urandom
Browse files Browse the repository at this point in the history
  • Loading branch information
QEDK committed Nov 30, 2023
1 parent 3fbec62 commit 6c44fe9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
identity.toml
7 changes: 6 additions & 1 deletion availup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ if [ -z "$config" ]; then
echo "ℹ️ No config file selected. Defaulting to $HOME/.avail/$NETWORK/config.yml."
CONFIG="$HOME/.avail/$NETWORK/config.yml"
touch $CONFIG
SEED=$(hexdump -vn32 -e'8/8 "%0X"' /dev/urandom)
if command -v hexdump >/dev/null 2>&1; then
echo "🔐 Generating random seed..."
SEED=$(hexdump -vn32 -e'8/8 "%0X"' /dev/urandom)
else
SEED="$RANDOM$RANDOM-avail-$RANDOM$RANDOM"
fi
if [ "$NETWORK" = "goldberg" ]; then
echo "log_level = \"info\"\nhttp_server_host = \"0.0.0.0\"\nhttp_server_port = 7001\n\nsecret_key = { seed = \"$SEED\" }\nlibp2p_port = \"37000\"\nfull_node_ws = [\"wss://goldberg.avail.tools:443/ws\"]\napp_id = $APPID\nconfidence = 99.0\navail_path = \"$HOME/.avail-light/$NETWORK\"\nbootstraps = [[\"12D3KooWBkLsNGaD3SpMaRWtAmWVuiZg1afdNSPbtJ8M8r9ArGRT\",\"/dns/bootnode.1.lightclient.goldberg.avail.tools/udp/37000/quic-v1\"]]" >~/.avail/$NETWORK/config.yml
elif [ "$NETWORK" = "kate" ]; then
Expand Down

0 comments on commit 6c44fe9

Please sign in to comment.