diff --git a/app/main.dev.js b/app/main.dev.js index 7316dd92..4cc25080 100644 --- a/app/main.dev.js +++ b/app/main.dev.js @@ -112,7 +112,7 @@ app.on('ready', async () => { if (!results.length) { // Run a bash script that checks for the LND folder and generates Node.js compatible certs console.log('CHECKING/GENERATING CERTS') - exec('sh generate_certs.sh') + exec(`sh ${platform()}_generate_certs.sh`) // After the certs are generated, it's time to start LND console.log('STARTING LND') diff --git a/generate_certs.sh b/darwin_generate_certs.sh similarity index 70% rename from generate_certs.sh rename to darwin_generate_certs.sh index 0efbb154..d48762fd 100755 --- a/generate_certs.sh +++ b/darwin_generate_certs.sh @@ -9,9 +9,3 @@ openssl ecparam -genkey -name prime256v1 -out ~/Library/Application\ Support/Lnd openssl req -new -sha256 -key ~/Library/Application\ Support/Lnd/tls.key -out ~/Library/Application\ Support/Lnd/csr.csr -subj '/CN=localhost/O=lnd' openssl req -x509 -sha256 -days 3650 -key ~/Library/Application\ Support/Lnd/tls.key -in ~/Library/Application\ Support/Lnd/csr.csr -out ~/Library/Application\ Support/Lnd/tls.cert rm ~/Library/Application\ Support/Lnd/csr.csr - -# Linux -# openssl ecparam -genkey -name prime256v1 -out ~/.lnd/tls.key -# openssl req -new -sha256 -key ~/.lnd/tls.key -out ~/.lnd/csr.csr -subj '/CN=localhost/O=lnd' -# openssl req -x509 -sha256 -days 3650 -key ~/.lnd/tls.key -in ~/.lnd/csr.csr -out ~/.lnd/tls.cert -# rm ~/.lnd/csr.csr \ No newline at end of file diff --git a/linux_generate_certs.sh b/linux_generate_certs.sh new file mode 100644 index 00000000..3e786b78 --- /dev/null +++ b/linux_generate_certs.sh @@ -0,0 +1,11 @@ +# Generate Node.js compatible certs +# If Lnd folder doesn't exist we have to create it +if [ ! -d ~/Library/Application\ Support/Lnd ]; then + mkdir -p ~/.lnd; +fi + +# Generate compatible certs +openssl ecparam -genkey -name prime256v1 -out ~/Library/Application\ Support/Lnd/tls.key +openssl req -new -sha256 -key ~/Library/Application\ Support/Lnd/tls.key -out ~/Library/Application\ Support/Lnd/csr.csr -subj '/CN=localhost/O=lnd' +openssl req -x509 -sha256 -days 3650 -key ~/Library/Application\ Support/Lnd/tls.key -in ~/Library/Application\ Support/Lnd/csr.csr -out ~/Library/Application\ Support/Lnd/tls.cert +rm ~/Library/Application\ Support/Lnd/csr.csr diff --git a/win32_generate_certs.sh b/win32_generate_certs.sh new file mode 100644 index 00000000..c04bfc25 --- /dev/null +++ b/win32_generate_certs.sh @@ -0,0 +1,11 @@ +# Generate Node.js compatible certs +# If Lnd folder doesn't exist we have to create it +if [ ! -d ~/Library/Application\ Support/Lnd ]; then + mkdir -p ~/AppData/Local/Lnd; +fi + +# Generate compatible certs +openssl ecparam -genkey -name prime256v1 -out ~/Library/Application\ Support/Lnd/tls.key +openssl req -new -sha256 -key ~/Library/Application\ Support/Lnd/tls.key -out ~/Library/Application\ Support/Lnd/csr.csr -subj '/CN=localhost/O=lnd' +openssl req -x509 -sha256 -days 3650 -key ~/Library/Application\ Support/Lnd/tls.key -in ~/Library/Application\ Support/Lnd/csr.csr -out ~/Library/Application\ Support/Lnd/tls.cert +rm ~/Library/Application\ Support/Lnd/csr.csr