Skip to content
Permalink
Browse files

fix(wallet): enable custom certs with btcpayserver

  • Loading branch information...
mrfelton committed Apr 20, 2019
1 parent 48555fc commit ba4f9a6af4d5e1e3a541bd828c9c84214171116a
@@ -81,14 +81,17 @@ class ConnectionConfirm extends React.Component {
}

// Otherwise, process it as a BtcPayServer connection string.
const { host, port, macaroon } = parseConnectionString(connectionString)
const { host, port, macaroon, cert } = parseConnectionString(connectionString)
const lndconnectUri = encode({
host: `${host}:${port}`,
macaroon,
cert,
})

return startLnd({
type: 'custom',
decoder: 'lnd.lndconnect.v1',
lndconnectUri: encode({
host: `${host}:${port}`,
macaroon,
}),
lndconnectUri,
})
}

@@ -38,14 +38,16 @@ test('should connect to an external wallet (btcpay)', async t => {
.click(onboarding.connectionDetailsTabs.string.button)
.typeText(
onboarding.connectionStringInput,
/* eslint-disable max-len */
`{
"configurations": [
{
"type": "grpc",
"cryptoCode": "BTC",
"host": "example.com",
"port": "19000",
"macaroon": "macaroon"
"host": "testnet1-lnd.zaphq.io:",
"port": "10009",
"macaroon": "0201036c6e64028a01030a1091304f2d271c450ef775f3bbca0f64101201301a0f0a07616464726573731204726561641a0c0a04696e666f1204726561641a100a08696e766f696365731204726561641a0f0a076d6573736167651204726561641a100a086f6666636861696e1204726561641a0f0a076f6e636861696e1204726561641a0d0a05706565727312047265616400000620bbda8514cda095f98fbfc946efc0b83423e9e48e2cf410e9f27df45feec7a3cb",
"cert": "MIICLDCCAdGgAwIBAgIRAKYFvCWmEHf0pLfq2cjcLVowCgYIKoZIzj0EAwIwPjEfMB0GA1UEChMWbG5kIGF1dG9nZW5lcmF0ZWQgY2VydDEbMBkGA1UEAxMSemFwLXRlc3RuZXQxLWxuZC0wMB4XDTE4MDkwMzA4MzI1OFoXDTE5MTAyOTA4MzI1OFowPjEfMB0GA1UEChMWbG5kIGF1dG9nZW5lcmF0ZWQgY2VydDEbMBkGA1UEAxMSemFwLXRlc3RuZXQxLWxuZC0wMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEh4X-3IFky-tnbyR7blabLYLLvuK4UXWqsh48_zuy2CaRZ96Ot-oaeMDjYkR4dEzxhAKIFMoBFvgkW0bL_qDRzKOBrzCBrDAOBgNVHQ8BAf8EBAMCAqQwDwYDVR0TAQH_BAUwAwEB_zCBiAYDVR0RBIGAMH6CEnphcC10ZXN0bmV0MS1sbmQtMIIJbG9jYWxob3N0ghV0ZXN0bmV0MS1sbmQuemFwaHEuaW-CBHVuaXiCCnVuaXhwYWNrZXSHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAGHBAo0C3mHEP6AAAAAAAAACBSL__7XNwaHBCPEVWswCgYIKoZIzj0EAwIDSQAwRgIhAPfhInyLkbnxYtqa3YTZPnvMWeg9Sp-Pzc_7SHG2TV2jAiEArflwta6DpWRdVm_-dsFiOudmKAYesrhPOy-FqGhv80g"
}
]
}`
@@ -9,11 +9,11 @@ const parseConnectionString = (value, network = 'BTC') => {
}
const allConfigs = get(config, 'configurations', [])
const params = allConfigs.find(c => c.type === 'grpc' && c.cryptoCode === network) || {}
const { host, port, macaroon } = params
const { host, port, macaroon, cert } = params
if (!host || !port || !macaroon) {
throw new Error('Invalid connection string')
}
return { host, port, macaroon }
return { host, port, macaroon, cert }
}

export default parseConnectionString

0 comments on commit ba4f9a6

Please sign in to comment.
You can’t perform that action at this time.