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

Implement missing exchangeKey cryptography for react-native #119

Open
pedrouid opened this issue May 9, 2019 · 8 comments

Comments

Projects
None yet
4 participants
@pedrouid
Copy link
Member

commented May 9, 2019

Context

As part of the WCIP-2 (WalletConnect/WCIPs#2) the exchangeKey flow will be refactored to include a 2-stage procedure that includes a signing challenge and a key update to complete the exchangeKey successfully.

The proposal has been implemented on the exchange-key-refactor branch in this repo and it already includes the cryptography library interface required to perform this procedure.

From PR #118, you can see the file changes to the core, browser, react-native packages are completed but the react-native package is still missing the cryptographic methods.

The browser library was able to use an existing library called eth-crypto but this library is not supported in the react-native library.

Goal

Implement the missing cryptographic methods present in the nativeCrypto.ts file required for the new exchangeKey flow on the exchange-key-refactor branch.

The methods are generateKeyPair, encryptWithPublicKey, decryptWithPrivateKey, sign, and recoverPublicKey.

Refer to lines 157 to 196 here.

Potential Solution 1

Fork eth-crypto library and make it react-native compatible. Check the issue is described on their repo here.

Potential Solution 2

Use a different library (eg. crypto node module polyfill from tradle/react-native-crypto) that matches the same cryptographic methods as the ones used from eth-crypto. These methods involve key pair generation, encrypt, decrypt, sign and recover with Secp256k1. For more details, please consult the source code for eth-crypto library here

Notes

When forking this repository to submit a PR, please use exchange-key-refactor branch as base and submit a PR agaisnt it.

To test the react-native enviroment, you can use walletconnect-developer-app library found here. Run the app from debug branch and you will find a folder called walletconnect under src which is copy of the source code from walletconnect-monorepo on the exchange-key-refactor branch.

For any other questions, please reach out directly to me @pedrouid on Github / Telegram / Discord.

@gitcoinbot

This comment has been minimized.

Copy link

commented May 9, 2019

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 400.0 DAI (400.0 USD @ $1.0/DAI) attached to it as part of the WalletConnect fund.

@ligi

This comment has been minimized.

Copy link
Member

commented May 9, 2019

please wait with accepting anyone for this issue. I really think WCIP-2 is the wrong approach - will try to write down my thoughts about it over the weekend

@pedrouid

This comment has been minimized.

Copy link
Member Author

commented May 9, 2019

please wait with accepting anyone for this issue. I really think WCIP-2 is the wrong approach - will try to write down my thoughts about it over the weekend

Ok, but comment either on the WCIP or the PR #118. This issue is only about react-native cryptography methods

@gitcoinbot

This comment has been minimized.

Copy link

commented May 9, 2019

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 3 weeks, 5 days from now.
Please review their action plans below:

1) georgiemathews has started work.

I'll be implementing the mentioned methods after researching and thinking about tradeoffs between the proposed approaches as well as any others I come up with.

Learn more on the Gitcoin Issue Details page.

2) georgiemathews has started work.

I'll be implementing the mentioned methods after researching and thinking about tradeoffs between the proposed approaches as well as any others I come up with.

Learn more on the Gitcoin Issue Details page.

@georgiemathews

This comment has been minimized.

Copy link

commented May 10, 2019

Finished, tested on the debug branch of the developer app and was able to use all methods and successfully encrypt and decrypt: #121

Current documentation covers necessary install steps for react-native-crypto, link react-native-randombytes with react-native link

@pedrouid

This comment has been minimized.

Copy link
Member Author

commented May 10, 2019

Awesome @georgiemathews! 👍I'm about to push an update for walletconnect-monorepo to v1.0.0-beta.22. Let's get the debug branch and your PR up-to-date with the latest changes and then I will test your implementation to review your bounty submission

@pedrouid

This comment has been minimized.

Copy link
Member Author

commented May 10, 2019

Hey @georgiemathews, beta.22 is published on NPM and available on master branch

@gitcoinbot

This comment has been minimized.

Copy link

commented May 11, 2019

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 400.0 DAI (400.0 USD @ $1.0/DAI) has been submitted by:

  1. @georgiemathews

@pedrouid please take a look at the submitted work:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.