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
Make "crypto" module less dependent on 3rd party libraries (ease Android integration) #618
Conversation
Codecov Report
@@ Coverage Diff @@
## release/4.0 #618 +/- ##
=================================================
- Coverage 77.42% 77.26% -0.16%
+ Complexity 1853 1852 -1
=================================================
Files 241 241
Lines 6814 6819 +5
Branches 1012 1013 +1
=================================================
- Hits 5276 5269 -7
- Misses 1290 1300 +10
- Partials 248 250 +2
Continue to review full report at Codecov.
|
@conor10 how likely this change to hit the master? I can fix codecov checks if needed (though the changes are pretty simple) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm all for simplifying the crypto module - I really didn't like that I had to include those extra dependencies for the wallet file support.
However, is slf4j that significant a burden for Android devs? I spoke previously with some other Android devs about this - see #130
@@ -0,0 +1,19 @@ | |||
package org.web3j.crypto; | |||
|
|||
public interface Logger { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way we can use slf4j still? This is the one part of the PR I'm not keen on.
@serso any thoughts on the above? |
@conor10, I'm terribly sorry for the late response. I'm on vacation now and will return to the issue when I'm back (hopefully next week) |
6683e40
to
335e78a
Compare
Hi @conor10, I'm back. I have reverted the commit that removed slf4j dependency from |
Ping :) |
Up |
Hey @serso, apologies for the delay - I've been very snowed the last few months. The good news is that the ECF has given us funding, and @snazha-blkio is going to be helping maintain the project. My thinking is that this is a good candidate for the 4.0 milestone which will be going out before Devcon4. |
I'd also like us to get publishing snapshot builds so that people have something to work with prior to official releases. |
@conor10 👍 Let me know if you agree with this proposal. I can help implementing it. |
@serso we use SpongyCastle in the web3j-android branch (which is Java 1.6 compatible). Have you been working with the Android release or regular Java 8 web3j version? |
@conor10 I've been integrating the regular Java 8 version to an Android app. I saw the Also, I believe branching is not a viable way to support multiple platforms as it requires a lot of maintenance work (especially painful to merge conflicts in moved code). A better way would be to abstract the platform details (in this case it's a crypto-provider implementation) and let the platforms decide what to use. Regarding Java 1.6 and Android: Android has limited Java 8 support. Many common features work out of the box. I don't think Java 1.6 should be a requirement in web3j for Android. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome - we'll get this in 4.0. Thanks @serso.
@serso I'd love to stop having to maintain the Android branch, but previously it seemed that this would exclude a significant number of devices from being able to use the library (this was 18 months ago or so). Is this still the case? I want to ensure great Android support for the library's user base, but I don't have the Android platform expertise to know what the best strategy is here. @ligi may have some opinions here too. But it would be great to get your views specifically on ensuring maximum device support. Thanks! |
Hi @serso Could you please rebase from release/4.0? There have been some significant changes that have caused a break in this. Specifically, this will result in the introduction of a circular dependency between core and crypto. Thanks |
Move some core classes (Wallet, WalletFile, WalletUtils and Bip44WalletUtils) where they belong - to the core module. In order to keep old clients happy the package name was left intact - it's still `org.web3j.crypto`. This change is needed for using "crypto" on Android.
Can be useful for bip32 implementations outside of this project.
Or set null to use the default SecureRandom from KeyPairGenerator.
They can be useful e.g. for a recovery UI on Android.
@snazha-blkio done. I had to move |
@conor10 I'm not sure I'm following. If we talk about Java 8 language features supported on Android (lambdas, method references, etc.) then no devices are affected as these features are de-sugared (converted to Java 6). If we talk about Java 8 APIs that are not supported on older Android platforms ( Please check out this article about Java 8 and Android. |
Your comment is related to #769 . |
Thanks @serso for your contribution! |
This is primarily needed to ease its integration on Android.
Wallet and WalletFile were moved out of "crypto" to "core" as "core" seems to be a better place for them (this move was also needed to remove "fasterxml" dep).
The only one change that has to be done to the project now in order for "crypto" being compatible with Android is substituting the bouncycastle lib by the spongycastle, like this: serso@18bd32c