Zap-iOS can open URLs with the scheme lndconnect:
to directly connect to remote nodes.
[foo] means optional, <bar> are placeholders
lndconnect://<host>:<port>?[cert=<base64url DER certifcate>&]macaroon=<base64url macaroon>
// open tls.cert file
var certFile = fs.readFileSync(os.homedir() + '/.lnd/tls.cert', 'utf8');
// remove '-----BEGIN CERTIFICATE-----', '-----END CERTIFICATE-----' and line breaks
var lines = certFile.split(/\n/);
lines = lines.filter(line => line != "");
lines.pop();
lines.shift();
var cert = base64url.fromBase64(lines.join(''));
// open macaroon file in base64 encoding
var macaroonPath = os.homedir() + '/.lnd/data/chain/bitcoin/testnet/admin.macaroon'
var macaroonData = fs.readFileSync(macaroonPath);
var macaroon = base64url(new Buffer(macaroonData));
var url = 'lndconnect://' + ip.address() + ':10009?cert=' + cert + '&macaroon=' + macaroon
This is useful when one doesn't want to bring dependencies.
echo 'lndconnect://example.com?cert='"`grep -v 'CERTIFICATE' tls.cert | tr -d '=' | tr '/+' '_-'`"'&macaroon='"`base64 admin.macaroon | tr -d '=' | tr '/+' '_-'`" | tr -d '\n' | qrencode -o /tmp/out.png
-----BEGIN CERTIFICATE-----
MIICiDCCAi+gAwIBAgIQdo5v0QBXHnji4hRaeeMjNDAKBggqhkjOPQQDAjBHMR8w
HQYDVQQKExZsbmQgYXV0b2dlbmVyYXRlZCBjZXJ0MSQwIgYDVQQDExtKdXN0dXNz
LU1hY0Jvb2stUHJvLTMubG9jYWwwHhcNMTgwODIzMDU1ODEwWhcNMTkxMDE4MDU1
ODEwWjBHMR8wHQYDVQQKExZsbmQgYXV0b2dlbmVyYXRlZCBjZXJ0MSQwIgYDVQQD
ExtKdXN0dXNzLU1hY0Jvb2stUHJvLTMubG9jYWwwWTATBgcqhkjOPQIBBggqhkiO
PQMBBwNCAASFhRm+w/T10PoKtg4lm9hBNJjJD473fkzHwPUFwy91vTrQSf7543j2
JrgFo8mbTV0VtpgqkfK1IMVKMLrF21xio4H8MIH5MA4GA1UdDwEB/wQEAwICpDAP
BgNVHRMBA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