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

Encryption/Decryption Feature #928

Closed
LaurentTrk opened this issue Dec 13, 2021 · 10 comments
Closed

Encryption/Decryption Feature #928

LaurentTrk opened this issue Dec 13, 2021 · 10 comments
Labels

Comments

@LaurentTrk
Copy link

Hi !
Now that the encryption/decryption feature has been added to Polkadot Common JS library, it could be great to add this feature to the extension :)

This feature has already been requested (#691) but rejected as the underlying feature was not available.

I started to work on this for my personal needs, and got something working for the decryption part :
image

You can have a look at this fork (Disclaimer: quick and dirty hackathon code ;) )

It seems that @RoyTimes planned to work on this but I don't know where he is.

It would be my pleasure to work on this feature if you think it's worth it.
Feel free to share your thoughts, thanks !

@LaurentTrk LaurentTrk changed the title Asymmetric Encryption Feature Encryption/Decryption Feature Dec 13, 2021
@LaurentTrk
Copy link
Author

At this time, I cannot get things work with sr22519 keypair.

Another solution (and easiest) could be to do symmetric encryption (let say AES) using a derived key from the account secret key.

Does it make sense ?

@jacogr
Copy link
Member

jacogr commented Dec 14, 2021

I like the functionality, it is a nice addition.

However, as mentioned if it doesn't work at the base, it is a no-go area. Fixes welcome at that level.

@LaurentTrk
Copy link
Author

LaurentTrk commented Dec 14, 2021

I like the functionality, it is a nice addition.

Glad to hear ! 🙏

At this time, I see 3 options:

  • Fix the encrypt/decrypt feature the way it has been done
  • Implement it another way, using ECIES to keep the asymmetric flavor
  • Switch to a symmetric encryption, using a derived key managed by the extension (I didn't find yet a well documented implementation using this approach)

I will do some experiments with the second option...

Any thoughts on this is welcome !

Edit: Work in progress at polkadot-js/common#1331

@defliction
Copy link

defliction commented Jan 7, 2022

Thanks for working on this. I'm trudging my way through implementation on this and ran into the same issue which it looks like @RoyTimes has workaround out to fix.

When thinking about this decrypt UI dialogue - can this UI dialog be optional? and/or can the decrypt ui be enabled once for multiple decrypts?

@LaurentTrk
Copy link
Author

Thanks for your comment.

When thinking about this decrypt UI dialogue - can this UI dialog be optional? and/or can the decrypt ui be enabled once for multiple decrypts?

I think it's possible, but is it desirable ? I don't have a strong opinion, but we could make it possible through an option, like Don't ask me for the next xxx minutes as it's done for the password.

@jacogr
Copy link
Member

jacogr commented Jan 13, 2022

Since the unlocking in the backend is the same, the "remember for 15 minutes" would apply here as well. Can't really and shouldn't really make it different, but agree that it could add value.

(The next 15 is from the last operation, so if you decrypt at least 1 message every 15 minutes, it is basically indefinitely)

@LaurentTrk
Copy link
Author

Thanks for your reply @jacogr !
I think the @revick suggestion is to remove completely the user confirmation for decryption, which is a little bit different that not asking for password each time (but keep asking for transaction confirmation). But maybe I'm wrong...

@polkadot-js-bot
Copy link

This issue has been open for 21 days with no activity and is not labelled as an enhancement. It will be closed in 7 days.

@LaurentTrk
Copy link
Author

Hi !
I'm still waiting for some feedbacks here : polkadot-js/common#1331
before moving forward on this one.

@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Feb 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants