show QR codes to connect CLN to Zeus and Spark

Showing the Tor address and Acces Key / Macaroon individually
to be scanned and pasted into the wallets
Discussed in: https://github.com/ZeusLN/zeus/issues/515
and #2295
This commit is contained in:
openoms 2021-08-24 13:17:41 +01:00
parent 40f0711dcc
commit e0c374f81a
No known key found for this signature in database
GPG key ID: 5BFB77609B081B65
3 changed files with 146 additions and 33 deletions

View file

@ -4,9 +4,19 @@
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ "$1" = "-h" ] || [ "$1" = "-help" ];then
echo "Usage:"
echo "97addMobileWallet.sh <lnd|cln> <mainnet|testnet|signet>"
echo "defaults from the configs are:"
echo "ligthning=${lightning}"
echo "chain=${chain}"
fi
justLocal=1
aks4IP2TOR=0
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
# if TOR is activated then outside reach is possible (no notice)
if [ "${runBehindTor}" = "on" ]; then
echo "# runBehindTor ON"
@ -131,23 +141,33 @@ checkIP2TOR()
fi
}
# Also Zap-Android deactivated for now - see: https://github.com/rootzoll/raspiblitz/issues/2198#issuecomment-822808428
#OPTIONS=(ZAP_ANDROID "Zap Wallet (Android)" \
# ZAP_IOS "Zap Wallet (iOS)" \
OPTIONS=(ZEUS_IOS "Zeus Wallet (iOS)" \
ZEUS_ANDROID "Zeus Wallet (Android)" \
SPHINX "Sphinx Chat (Android or iOS)"
)
if [ $lightning = "lnd" ]; then
# Also Zap-Android deactivated for now - see: https://github.com/rootzoll/raspiblitz/issues/2198#issuecomment-822808428
#OPTIONS=(ZAP_ANDROID "Zap Wallet (Android)" \
# ZAP_IOS "Zap Wallet (iOS)" \
OPTIONS=(ZEUS_IOS "Zeus Wallet (iOS)" \
ZEUS_ANDROID "Zeus Wallet (Android)" \
SPHINX "Sphinx Chat (Android or iOS)"
)
# add SEND MANY APP
OPTIONS+=(SENDMANY_ANDROID "SendMany (Android)")
# add SEND MANY APP
OPTIONS+=(SENDMANY_ANDROID "SendMany (Android)")
elif [ $lightning = "cln" ]; then
# Additinal Options with TOR
OPTIONS=(ZEUS_CLNREST "Zeus to C-lightningREST (Android or iOS)" \
ZEUS_SPARK "Zeus to Sparko (Android or iOS)" \
SPARK "Spark Wallet to Sparko (Android - EXPERIMENTAL)"
)
fi
# Additional Options with Tor
if [ "${runBehindTor}" = "on" ]; then
OPTIONS+=(FULLY_NODED "Fully Noded (iOS+Tor)")
fi
CHOICE=$(whiptail --clear --title "Choose Mobile Wallet" --menu "" 14 50 8 "${OPTIONS[@]}" 2>&1 >/dev/tty)
CHOICE=$(whiptail --clear --title "Choose Mobile Wallet" --menu "" 14 55 8 "${OPTIONS[@]}" 2>&1 >/dev/tty)
/home/admin/config.scripts/blitz.display.sh hide
@ -179,10 +199,10 @@ case $CHOICE in
appstoreLink="https://apps.apple.com/us/app/zap-bitcoin-lightning-wallet/id1406311960"
#/home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
#whiptail --title "Install Testflight and Zap on your iOS device" \
# --yes-button "continue" \
# --no-button "link as QR code" \
# --yesno "Search for 'Zap Bitcoin' in Apple Appstore for basic version\nOr join public beta test for latest features:\n${appstoreLink}\n\nJoin testing and follow ALL instructions.\n\nWhen installed and started -> continue" 11 65
# if [ $? -eq 1 ]; then
# --yes-button "continue" \
# --no-button "link as QR code" \
# --yesno "Search for 'Zap Bitcoin' in Apple Appstore for basic version\nOr join public beta test for latest features:\n${appstoreLink}\n\nJoin testing and follow ALL instructions.\n\nWhen installed and started -> continue" 11 65
# if [ $? -eq 1 ]; then
# /home/admin/config.scripts/blitz.display.sh qr-console ${appstoreLink}
#fi
@ -279,7 +299,7 @@ Please go to MAINMENU > SERVICES and activate KEYSEND first.
whiptail --title "Install Zeus on your Android Phone" \
--yes-button "Continue" \
--no-button "StoreLink" \
--yesno "Open the Android Play Store on your mobile phone.\n\nSearch for --> 'zeus bitcoin app'\n\nCheck that logo is like on LCD and author is: Evan Kaloudis\nWhen app is installed and started --> Continue." 12 65
--yesno "Open the Android Play Store on your mobile phone.\n\nSearch for --> 'zeus ln'\n\nCheck that logo is like on LCD and author is: Evan Kaloudis\nWhen app is installed and started --> Continue." 12 65
if [ $? -eq 1 ]; then
/home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
whiptail --title " App Store Link " --msgbox "\
@ -311,4 +331,51 @@ Or scan the qr code on the LCD with your mobile phone.
/home/admin/config.scripts/bonus.fullynoded.sh
exit 0;
;;
ZEUS_CLNREST)
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_zeus.png
whiptail --title "Install Zeus on your Android or iOS Phone" \
--yes-button "Continue" \
--no-button "Cancel" \
--yesno "Open the https://zeusln.app/ on your mobile phone to find the App Store link or binary for your phone.\n\nWhen the app is installed and started --> Continue." 12 65
if [ $? -eq 1 ]; then
exit 0
fi
/home/admin/config.scripts/blitz.display.sh hide
/home/admin/config.scripts/cln.rest.sh connect
exit 0;
;;
ZEUS_SPARK)
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_zeus.png
whiptail --title "Install Zeus on your Android or iOS Phone" \
--yes-button "Continue" \
--no-button "Cancel" \
--yesno "Open the https://zeusln.app/ on your mobile phone to find the App Store link or binary for your phone.\n\nWhen the app is installed and started --> Continue." 12 65
if [ $? -eq 1 ]; then
exit 0
fi
/home/admin/config.scripts/blitz.display.sh hide
/home/admin/config.scripts/cln-plugin.sparko.sh connect
exit 0;
;;
SPARK)
appstoreLink="https://github.com/shesek/spark-wallet#mobile-app"
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_zeus.png
whiptail --title "Install Zeus on your Android Phone" \
--yes-button "Continue" \
--no-button "GitHub link" \
--yesno "Open the ${appstoreLink} on Android to find the App Store link or binary for your phone.\n\nWhen the app is installed and started --> Continue." 12 65
if [ $? -eq 1 ]; then
/home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
whiptail --title " GitHub link " --msgbox "\
To install app open the following link:\n
${appstoreLink}\n
Or scan the QR code on the LCD with your mobile phone.
" 11 70
fi
/home/admin/config.scripts/blitz.display.sh hide
/home/admin/config.scripts/cln-plugin.sparko.sh connect
exit 0;
;;
esac

View file

@ -7,7 +7,7 @@
SPARKOVERSION="v2.7"
# command info
if [ $# -lt 2 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
echo
echo "Install, remove, connect or get info about the Sparko plugin for C-lightning"
echo "version: $SPARKOVERSION"
@ -65,21 +65,43 @@ if [ $1 = connect ];then
toraddress=$(sudo cat /mnt/hdd/tor/${netprefix}sparko/hostname)
accesskey=$(sudo cat ${CLNCONF} | grep "^sparko-keys=" | cut -d= -f2 | cut -d';' -f1)
url="https://${localip}:${portprefix}9000/"
string="${url}?access-key=${accesskey}"
/home/admin/config.scripts/blitz.display.sh qr "$string"
#string="${url}?access-key=${accesskey}"
#/home/admin/config.scripts/blitz.display.sh qr "$string"
#clear
#echo "connection string (shown as a QRcode on the top and on the LCD):"
#echo "$string"
#qrencode -t ANSIUTF8 "${string}"
clear
echo "connection string (shown as a QRcode on the top and on the LCD):"
echo "$string"
qrencode -t ANSIUTF8 "${string}"
echo
echo "Tor address (shown as a QRcode below):"
echo "${toraddress}"
/home/admin/config.scripts/blitz.display.sh qr "${toraddress}"
echo "The Tor address is shown as a QRcode below and on the LCD"
echo "Scan it to your phone with a QR scanner app and paste it to: 'Host'"
echo
echo "Host: ${toraddress}"
echo
qrencode -t ANSIUTF8 "${toraddress}"
echo
echo
echo "Alternatively to connect through the LAN the address is:"
echo "${url}"
echo
echo "# Press enter to continue to show the access key"
read key
/home/admin/config.scripts/blitz.display.sh hide
/home/admin/config.scripts/blitz.display.sh qr "${accesskey}"
clear
echo
echo "The Access Key is shown as a QRcode below and on the LCD"
echo "Scan it to your phone with a QR scanner app and paste it to: 'Access Key'"
echo
echo "Acces Key: ${accesskey}"
echo
qrencode -t ANSIUTF8 "${accesskey}"
echo
echo "# Press enter to hide the QRcode from the LCD"
read key
/home/admin/config.scripts/blitz.display.sh hide
exit 0
fi
if [ $1 = on ];then

View file

@ -31,21 +31,45 @@ if [ $1 = connect ];then
toraddress=$(sudo cat /mnt/hdd/tor/${netprefix}clnrest/hostname)
hex_macaroon=$(xxd -plain /home/bitcoin/c-lightning-REST/certs/access.macaroon | tr -d '\n')
url="https://${localip}:${portprefix}6100/"
string="${url}?${hex_macaroon}"
/home/admin/config.scripts/blitz.display.sh qr "$string"
#string="${url}?${hex_macaroon}"
#/home/admin/config.scripts/blitz.display.sh qr "$string"
#clear
#echo "connection string (shown as a QRcode on the top and on the LCD):"
#echo "$string"
#qrencode -t ANSIUTF8 "${string}"
clear
echo "connection string (shown as a QRcode on the top and on the LCD):"
echo "$string"
qrencode -t ANSIUTF8 "${string}"
echo
echo "Tor address (shown as a QRcode below):"
echo "${toraddress}"
/home/admin/config.scripts/blitz.display.sh qr "${toraddress}"
echo "The Tor address is shown as a QRcode below and on the LCD"
echo "Scan it to your phone with a QR scanner app and paste it to: 'Host'"
echo
echo "Host: ${toraddress}"
echo "REST Port: 443"
echo
qrencode -t ANSIUTF8 "${toraddress}"
echo
echo
echo "Alternatively to connect through the LAN the address is:"
echo "https://${localip}"
echo "REST Port: ${portprefix}6100"
echo
echo "# Press enter to continue to show the Macaroon"
read key
/home/admin/config.scripts/blitz.display.sh hide
/home/admin/config.scripts/blitz.display.sh qr "${hex_macaroon}"
clear
echo
echo "The Macaroon is shown as a QRcode below and on the LCD"
echo "Scan it to your phone with a QR scanner app and paste it to: 'Macaroon (Hex format)'"
echo
echo "Macaroon: ${hex_macaroon}"
echo
qrencode -t ANSIUTF8 "${hex_macaroon}"
echo
echo "# Press enter to hide the QRcode from the LCD"
read key
/home/admin/config.scripts/blitz.display.sh hide
exit 0
fi
if [ $1 = on ];then