Skip to content

Commit

Permalink
The default password length and IPFS gateway can be overidden by sett…
Browse files Browse the repository at this point in the history
…ing environment variables, IWPASSWORDLENGTH and IWIPFSGATEWAY, respectively.
  • Loading branch information
Zi1mo5zo committed Nov 22, 2018
1 parent d76ef60 commit 937097c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ gateway](https://cloudflare-ipfs.com), decrypt it and save it locally.

`ipfs-wormhole.sh update`

## Parameters

The default password length and IPFS gateway can be overidden by setting the
environment variables IWPASSWORDLENGTH and IWIPFSGATEWAY, respectively.

E.g.:

- `IWPASSWORDLENGTH=50 ipfs-wormhole.sh send FILE` will use a longer password to
encrypt FILE (default length is 40).
- `IWIPFSGATEWAY=https://gateway.ipfs.io/ipfs ipfs-wormhole.sh receive tag` will
use the official IPFS gateway (instead of Cloudflare's gateway) if `ipfs daemon` is not running.

# How it works

Your data is encrypted on the sender's machine, using `gpg` and its default
Expand Down
12 changes: 8 additions & 4 deletions ipfs-wormhole.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ IFS=$'\n\t'

# See <https://raw.githubusercontent.com/aurelg/ipfs-wormhole/master/README.md>

PASSWORDLENGTH=40
IPFSGATEWAY=https://cloudflare-ipfs.com/ipfs
if [ -z "${IWPASSWORDLENGTH-}" ]; then
IWPASSWORDLENGTH=40
fi
if [ -z "${IWIPFSGATEWAY-}" ]; then
IWIPFSGATEWAY=https://cloudflare-ipfs.com/ipfs
fi

# Check deps

Expand All @@ -26,7 +30,7 @@ send)
TARCMD="$(checkdep tar)"
GPGCMD="$(checkdep gpg)"
IPFSCMD="$(checkdep ipfs)"
PASSWORD=$($PWGENCMD -1 $PASSWORDLENGTH)
PASSWORD=$($PWGENCMD -1 $IWPASSWORDLENGTH)
USERINPUT=${2:-}
FILE=${USERINPUT%/}
if ! pgrep ipfs 1>/dev/null 2>&1; then
Expand Down Expand Up @@ -83,7 +87,7 @@ receive)
else
echo "Receiving $DSTFILENAME over HTTPS..."
WGETCMD="$(checkdep wget)"
$WGETCMD -qO - "$IPFSGATEWAY"/"$IPFSHASH" |
$WGETCMD -qO - "$IWIPFSGATEWAY"/"$IPFSHASH" |
$GPGCMD --batch --passphrase="$PASSWORD" -d \
>"$DSTFILENAME" \
2>/dev/null
Expand Down

0 comments on commit 937097c

Please sign in to comment.