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

Commit

Permalink
Merge pull request #2000 from mrfelton/fix/1997-support-oldstyle-lndc…
Browse files Browse the repository at this point in the history
…onnect

fix(lndconnect): support old style lndconnect links
  • Loading branch information
mrfelton authored Apr 11, 2019
2 parents 905c46f + b4c5d04 commit a678706
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 @@ [email protected]:
debug "^4.1.1"
semver "^5.7.0"

[email protected].3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/lndconnect/-/lndconnect-0.2.3.tgz#73cdaa0533aebccce72a64830867b047f4a9523c"
integrity sha512-hpct0HRTfAxbmUUfYQoHTiIsIbARs2NxGP19iFfxqzU/DoDuyX+tpnAOxfSA1sD0TGITXl3aNXYJD9Mp1xIqvw==
[email protected].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 a678706

Please sign in to comment.