wasup
I made a new command line tool called wasup
.
i.e. 'WAS UPloader' for Wallet Attached Storage (see my intent to implement).
# wasup
A tool that uploads to Wallet Attached Storage
Usage:
wasup <path/to/file> <space-url> [--identity ~/.ssh/space-controller-key]
wasup -h | --help
Options:
-h --help Show this screen.
-i --identity Path to the Ed25519 SSH key to use for authentication.
Generate an identity with `ssh-keygen -t ed25519`.
The order of the positional arguments is meant to be like mv <to> <from>
but <from>
is a path on your file system and <to>
is URL of a WAS Resource e.g. a Space.
I pushed the source code to https://github.com/gobengo/wasup.
As shown in the example above, install with npm:
npm i -g https://github.com/gobengo/wasup
⚡ wasup --help
You can use wasup
without installing it first via npx
⚡ npx https://github.com/gobengo/wasup
This is a nontrivial use case that involves:
⚡ npm i -g https://github.com/gobengo/wasup
added 25 packages, and changed 39 packages in 4s
4 packages are looking for funding
run `npm fund` for details
⚡
IDENTITY="$HOME/.ssh/id_ed25519_wasup_examples"
SPACE_UUID="$(uuidgen | tr "[:upper:]" "[:lower:]")" # generate a random UUID
WAS=https://storage.bengo.is
SPACE_PATH=/space/$SPACE_UUID
SPACE="$WAS$SPACE_PATH"
# Space
wasup --content-type application/json /dev/stdin "$SPACE" -i "$IDENTITY" <<EOF
{
"controller": "did:key:z6MkmoJbuoR9TSY4evRTLAtw6nN44RtCtqFhxdv72PhEa91X",
"link": "$SPACE_PATH/links/"
}
EOF
# /links/ - Links including link to ACL
wasup --content-type application/linkset+json /dev/stdin "$SPACE"/links/ -i "$IDENTITY" <<EOF
{
"linkset": [
{
"anchor": "$SPACE_PATH/",
"acl": [
{
"href": "$SPACE_PATH/acl"
}
]
}
]
}
EOF
# /acl - ACL
wasup --content-type application/json /dev/stdin "$SPACE"/acl -i "$IDENTITY" <<EOF
{
"type": "PublicCanRead"
}
EOF
# / - HTML Homepage
wasup --content-type text/html /dev/stdin "$SPACE"/ -i "$IDENTITY" <<EOF
<!doctype html>
<h1>wasup/examples/acl-simple.sh</h1>
<p>This is a simple example of something uploaded from wasup</p>
EOF
https://storage.bengo.is/space/e7f0af82-3f5e-415b-94d8-9330e17d8c3c
https://storage.bengo.is/space/e7f0af82-3f5e-415b-94d8-9330e17d8c3c/links/
https://storage.bengo.is/space/e7f0af82-3f5e-415b-94d8-9330e17d8c3c/acl
https://storage.bengo.is/space/e7f0af82-3f5e-415b-94d8-9330e17d8c3c/