Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add grpc client tls certificate #2715

Merged
merged 2 commits into from
Oct 16, 2020
Merged

Conversation

vctt94
Copy link
Member

@vctt94 vctt94 commented Oct 13, 2020

This PR depends on https://github.com/jrick/dcrwallet/tree/clientauth.

It adds tls client certificate into grpc client.

@matheusd
Copy link
Member

FYI, here's the minimal diff to pass on the required client auth and cert from decrediton to dcrlnd. This requires decred/dcrlnd#110 and it also requires bringing in the most recent walletunlocker.proto and regenerating the dcrlnd gRPC bindings, however doing that will make this conflict with #2641 (so you won't be able to test it until 2641 is merged or by manually modifying the local rpc.proto file)

diff --git a/app/actions/LNActions.js b/app/actions/LNActions.js
index ee0ad36b..73e072f0 100644
--- a/app/actions/LNActions.js
+++ b/app/actions/LNActions.js
@@ -85,6 +85,7 @@ export const startDcrlnd = (
   }
 
   const rpcCreds = ipcRenderer.sendSync("get-dcrd-rpc-credentials");
+  const walletClientKeyCert = wallet.getDcrwalletGrpcKeyCert();
 
   let dcrlndCreds;
   let wuClient;
@@ -140,7 +141,7 @@ export const startDcrlnd = (
       stage: LNWALLET_STARTUPSTAGE_UNLOCK,
       type: LNWALLET_STARTUP_CHANGEDSTAGE
     });
-    await ln.unlockWallet(wuClient, passphrase);
+    await ln.unlockWallet(wuClient, passphrase, walletClientKeyCert);
   } catch (error) {
     // An unimplemented error here probably means dcrlnd was already running,
     // so just continue with the connection attempt.
diff --git a/app/wallet/ln/index.js b/app/wallet/ln/index.js
index 1311660b..180d495c 100644
--- a/app/wallet/ln/index.js
+++ b/app/wallet/ln/index.js
@@ -267,10 +267,11 @@ export const sendCoins = (client, address, amount) => {
   );
 };
 
-export const unlockWallet = (wuClient, passphrase) => {
+export const unlockWallet = (wuClient, passphrase, dcrwClientKeyCert) => {
   const request = new pb.UnlockWalletRequest();
   const bytesPassphrase = new Uint8Array(Buffer.from(passphrase));
   request.setWalletPassword(bytesPassphrase);
+  request.setDcrwClientKeyCert(dcrwClientKeyCert);
 
   return new Promise((resolve, reject) =>
     wuClient.unlockWallet(request, (err, resp) =>

@alexlyp alexlyp changed the title [wip] Add grpc client tls certificate Add grpc client tls certificate Oct 16, 2020
Copy link
Member

@alexlyp alexlyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@alexlyp alexlyp merged commit d60213a into decred:master Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants