jupyterlab / extension-examples

JupyterLab Extensions by Examples
BSD 3-Clause "New" or "Revised" License
439 stars 167 forks source link

Add simple encryption extension #165

Closed ghost closed 2 years ago

ghost commented 3 years ago

Hi all, I'm trying to create an encryption extension using Crypto-ts. The idea is create two new button at toolbar that will encrypt and decrypt selected cell with password access. However, I'm having trouble accessing the content of the cell.

Here a snippet of the encryption code Untitled1

I need to change the string, 'some message', to what is in the content of the cell and preferably replace it with the encrypted text. Then, the encrypted text will decrypt when button decrypt is clicked. I researched a bit found a slightly different approach to select the content of the cell by highlighting it before encrypt it by using getInitialQuery. (I think that what it does?)(I apologize if it not)

Also, the issue to prompt a password every time encrypt and decrypt is clicked. Is there a similar doc that I can refer related to prompting a password and where to save it?

I find the VSCode encryption related to what I'm trying to do. It just that VSCode encrypt the whole file while I just want to encrypt only selected cell.

I'm not sure am I doing it correctly or my method are way off so any suggestion and advice is appreciated.

Thanks, Adry

fcollonval commented 2 years ago

The purpose of this repository is to describe how to use JupyterLab API. As this request is about adding not existing feature, it will be closed. But you can definitely ask on the Gitter chat or on the Jupyter forum for pointers.