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

refactor: remove unused asymmetric encode/decode functions #1183

Merged
merged 1 commit into from
Dec 7, 2021

Conversation

davidyuk
Copy link
Member

@davidyuk davidyuk requested a review from mradkov May 15, 2021 14:49
@davidyuk davidyuk force-pushed the feature/remove-asymmentric-enc branch from b38c350 to ab982da Compare May 15, 2021 14:49
@davidyuk davidyuk changed the title refactoring: remove unused asymmetric encode/decode functions refactor: remove unused asymmetric encode/decode functions May 15, 2021
@codecov
Copy link

codecov bot commented May 15, 2021

Codecov Report

Merging #1183 (51def34) into develop (55334b2) will increase coverage by 0.25%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1183      +/-   ##
===========================================
+ Coverage    65.84%   66.09%   +0.25%     
===========================================
  Files           55       55              
  Lines         2755     2743      -12     
  Branches        36       36              
===========================================
- Hits          1814     1813       -1     
+ Misses         933      922      -11     
  Partials         8        8              
Impacted Files Coverage Δ
src/utils/crypto.js 71.83% <ø> (+9.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55334b2...51def34. Read the comment docs.

Copy link
Contributor

@mradkov mradkov left a comment

Choose a reason for hiding this comment

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

I think this is helpful to have in the SDK. Not sure if anyone is and how much they are using it but it gives a useful wrapper for asymmetric encryption.

example case: https://github.com/mradkov/secure-data-exchange

@mradkov
Copy link
Contributor

mradkov commented Jun 9, 2021

I propose to keep it here. Its obvious that anyone can use it with the underlying nacl library directly, but people relying on the sdk to make aeternity related asymmetric crypto operations will expect it to be here.

@davidyuk
Copy link
Member Author

Were these functions requested to implement by you? Do you know according to what it is implemented?

tweetnacl have a reference to https://github.com/whs/tweetnacl-sealed-box that does the same, but a bit more size-efficient, why don't use this instead of our implementation?

I'm not sure what our implementation is audited/well-written, at least the package ed2curve (we are using it) says "there's currently no proof that this is safe to do".

I don't like to have this also because other parts of SDK are not compatible with it. It can't be used in aepp, because aepp-wallet connection support only signing.

https://github.com/mradkov/secure-data-exchange

In your case would be more secure to use exactly nacl.box because both Alice and Bob have keypairs (no need to generate ephemeral key pair, sender would be verified despite blockchain).

I'm not sure why are you using Crypto.decryptData (based on nacl.box) with Crypto.decryptPrivateKey (AES). Is it for performance reasons? As I understand nacl.box is already using a symmetric cipher underhood (xsalsa20-poly1305) that is accessible separately in nacl.secretbox.

Simple wrappers won't help to implement crypto-stuff with confidence, better to use crypto libraries directly. The best that we can propose now is a function converting address to byte array.

@davidyuk davidyuk force-pushed the feature/remove-asymmentric-enc branch from ab982da to 12e4855 Compare June 16, 2021 22:15
@marc0olo marc0olo added this to the Cleanup / Finish old PRs milestone Oct 11, 2021
@davidyuk davidyuk force-pushed the feature/remove-asymmentric-enc branch from 12e4855 to a807607 Compare November 19, 2021 07:35
@mradkov
Copy link
Contributor

mradkov commented Dec 3, 2021

@davidyuk can you rebase this PR so we can merge it?

@davidyuk davidyuk force-pushed the feature/remove-asymmentric-enc branch from a807607 to 51def34 Compare December 7, 2021 07:51
@davidyuk davidyuk mentioned this pull request Dec 7, 2021
@mradkov mradkov merged commit 667c664 into develop Dec 7, 2021
@davidyuk davidyuk deleted the feature/remove-asymmentric-enc branch December 7, 2021 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants