Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix(lndconnect): support old style lndconnect links
Browse files Browse the repository at this point in the history
Convert old style lndconnect links to the new format before storing as
part of a wallet config.

fix #1997
  • Loading branch information
mrfelton committed Apr 11, 2019
1 parent 4b706d9 commit b4c5d04
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
"javascript-state-machine": "3.1.0",
"jstimezonedetect": "1.0.6",
"lnd-grpc": "0.1.21",
"lndconnect": "0.2.3",
"lndconnect": "0.2.4",
"lodash.debounce": "4.0.8",
"lodash.get": "4.4.2",
"lodash.matches": "4.6.0",
Expand Down
14 changes: 13 additions & 1 deletion renderer/components/Onboarding/Steps/ConnectionConfirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,22 @@ class ConnectionConfirm extends React.Component {

// If its already an lndconnect uri, use it as is.
if (connectionString.startsWith('lndconnect:')) {
// In order to support legacy style lndconnect links we first pass the connection string through
// lndconnect.decode (which supports legacy style links where the host is provided as a querystring). Then encode
// the result. This ensures that we always store the link the current lndconnect format (with the host part in the
// origin position).
//
// eg. legacy lndconnect format:
// lndconnect:?cert=~/.lnd/tls.cert&macaroon=~/.lnd/admin.macaroon&host=example.com:10009
//
// eg. current lndconnect format:
// lndconnect://example.com:10009?cert=~/.lnd/tls.cert&macaroon=~/.lnd/admin.macaroon
const lndconnectUri = encode(decode(connectionString))

return startLnd({
type: 'custom',
decoder: 'lnd.lndconnect.v1',
lndconnectUri: connectionString,
lndconnectUri,
})
}

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10949,10 +10949,10 @@ lnd-grpc@0.1.21:
debug "^4.1.1"
semver "^5.7.0"

lndconnect@0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/lndconnect/-/lndconnect-0.2.3.tgz#73cdaa0533aebccce72a64830867b047f4a9523c"
integrity sha512-hpct0HRTfAxbmUUfYQoHTiIsIbARs2NxGP19iFfxqzU/DoDuyX+tpnAOxfSA1sD0TGITXl3aNXYJD9Mp1xIqvw==
lndconnect@0.2.4:
version "0.2.4"
resolved "https://registry.yarnpkg.com/lndconnect/-/lndconnect-0.2.4.tgz#26be0bbc5c13f730ac377bb768708356fa72c4d2"
integrity sha512-TrDSPJysUhfZ+Zjh3K8Prs3ARhUO+jdaxFdRNpZQQowyU3fty0L5fgU1flBb6WseICmQZoWel9ORBLrkFwzKwQ==
dependencies:
base64url "^3.0.1"
decode-uri-component "^0.2.0"
Expand Down

0 comments on commit b4c5d04

Please sign in to comment.