magiclabs / magic-js

Magic browser/React Native JavaScript SDK is your entry-point to integrating passwordless authentication inside your application.
https://magic.link/docs/api-reference/client-side-sdks/web
Apache License 2.0
455 stars 85 forks source link

Create shared secret by JsonRpcProvider #763

Closed StephanGerbeth closed 1 month ago

StephanGerbeth commented 1 month ago

✅ Prerequisites

❓ Question

Hi,

currently im searching for a solution to create a SharedSecret like this one https://docs.ethers.org/v6/api/crypto/#SigningKey-computeSharedSecret

I use magic link for authentication and to generate user wallets. The transactions take place via the JsonRpcProvider (ethers.BrowserProvider). However, what I am currently missing is a way to encrypt data between two users. This would actually be possible via ethers using the SharedSecret method. However, you need a PrivateKey for this. Do you have an alternative way of doing this?

Or are there plans to support something like this in the future?

Thanks

am-hernandez commented 1 month ago

Hi @StephanGerbeth ,

I reviewed the doc on computeSharedSecret and it does appear to require the user wallet's private key. If this is indeed the case then it may not be a method that you can implement with Magic wallets easily because applications do not have access to the user wallet's private key. A user can view their private key in a context inaccessible to the application implementing Magic. I do not know of any workarounds to implementing ethers computeSharedSecret, but if you find any please feel free to share it with the community.

We do not have plans to offer a similar function at the moment, so we will take note of this as a feature request. Should we implement the feature in the future we will make note of this in our newsletter and socials!