Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
- ### Commando Authentication
- This application utilizes [lnmessage](https://github.com/aaronbarnardsound/lnmessage) and [commando](https://docs.corelightning.org/reference/lightning-commando) for connecting with core lightning node. The connection is trustless and end-to-end encrypted. Commando manages authentication and authorization through runes, which can grant either full or fine-grained permissions.
- The backend server reads `LIGHTNING_PUBKEY` & `LIGHTNING_RUNE` from the `COMMANDO_CONFIG` file for this communication.
- Values can either be set manually or script `entrypoint.sh` can be used to call `getinfo` and `commando-rune` methods and save values in `COMMANDO_CONFIG`.
- Values can either be set manually or script `entrypoint.sh` can be used to call `getinfo` and `createrune` methods and save values in `COMMANDO_CONFIG`.
- `entrypoint.sh` can only run for the locally installed lightning. If `cln-application` is running remotely then pubkey and
rune can be set manually.
- Sample commando config should look like:
Expand Down
8 changes: 4 additions & 4 deletions entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ getinfo_request() {
EOF
}

commando_rune_request() {
createrune_request() {
cat <<EOF
{
"jsonrpc": "2.0",
"id": 2,
"method": "commando-rune",
"method": "createrune",
"params": [null, [["For Application#"]]]
}
EOF
Expand All @@ -40,11 +40,11 @@ generate_new_rune() {
COUNTER=0
RUNE=""
while { [ "$RUNE" = "" ] || [ "$RUNE" = "null" ]; } && [ $COUNTER -lt 10 ]; do
# Send 'commando-rune' request
# Send 'createrune' request
echo "Generating rune attempt: $COUNTER"
COUNTER=$((COUNTER+1))

RUNE_RESPONSE=$( (echo "$(commando_rune_request)"; sleep 2) | socat - UNIX-CONNECT:"$LIGHTNING_RPC")
RUNE_RESPONSE=$( (echo "$(createrune_request)"; sleep 2) | socat - UNIX-CONNECT:"$LIGHTNING_RPC")

RUNE=$(echo "$RUNE_RESPONSE" | jq -r '.result.rune')
UNIQUE_ID=$(echo "$RUNE_RESPONSE" | jq -r '.result.unique_id')
Expand Down