Skip to content

Commit 4b31172

Browse files
committed
Merge branch 'andrew/decryption' of https://github.com/LIT-Protocol/developer-guides-code into andrew/decryption
2 parents 0bc465a + 3f15769 commit 4b31172

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

encryption-decryption/browser/README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,19 @@ Before you click the buttons, open up the JavaScript console in your browser so
3333
After typing in the text you want to encrypt, clicking the `Encrypt String` button will:
3434

3535
1. You will be prompted by your wallet (i.e. MetaMask) to connect an account to the site
36-
2. After connecting an account, the console should display a successful connection to the Lit network and the encrypted `ciphertext` and `dataToEncryptHash` that will later be used to decrypt the string.
36+
2. After connecting an account, the console should display a successful connection to the Lit network and the encrypted `ciphertext` and `dataToEncryptHash` that will later be used to decrypt the string
3737

3838
After encrypting the string, clicking the `Decrypt String` button will:
3939

4040
1. Connect you to the Lit network and LitContracts client
4141
2. If you did not provide a Capacity Credit token ID, you will be prompted by your wallet to mint a new one
42-
3. You will then be prompted by your wallet to sign a message. This message will create a `capacityDelegationAuthSig`, which is used to pay for decrypting data ([and other functionality](https://developer.litprotocol.com/paying-for-lit/capacity-credits)) on the Lit
42+
3. You will then be prompted by your wallet to sign a message. This message will create a `capacityDelegationAuthSig`, which is used to pay for decrypting data ([and other functionality](https://developer.litprotocol.com/paying-for-lit/capacity-credits)) on the Lit network
4343
4. You will then be prompted by your wallet to sign another one final message. This message is the SIWE message that will derive your address from to use for the conditional check of whether or not you are permitted to decrypt the data
4444

4545
The full example should look something like:
4646

47-
***video***
47+
48+
https://github.com/user-attachments/assets/64bcc6a9-e35e-48b2-969f-e05b6c22907f
49+
50+
51+

encryption-decryption/nodejs/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,31 @@ In this directory, `encryption-decryption/nodejs`, run `yarn test:encrypt` to te
3636

3737
`encryptFile.ts`:
3838

39-
1. Will take a blob created from a file and contract conditions to encrypt the file.
39+
1. Requires a blob created from a file and contract conditions to encrypt the file
4040
2. Connects to the Lit network
4141
3. Encrypts the file and returns the `ciphertext` and `dataToEncryptHash`
4242

4343
`decryptFile.ts`:
4444

4545
1. Connects to the Lit network and LitContracts client
46-
2. Mints a new CapacityCredit if a CapacityCredit tokenId is not provided in the `.env` file and creates a capacityDelegationAuthSig to pay for use of the Lit network, decrypting data in this case
46+
2. Mints a new CapacityCredit if a CapacityCredit tokenId is not provided in the `.env` file and creates a capacityDelegationAuthSig to pay for use of the Lit network, which is decrypting data in this case
4747
3. Generates session signatures with the ability to decrypt the file
4848
4. Decrypts the file and returns a decrypted file buffer
4949

50-
However the tests created in the `test` directory are more complicated.
50+
The tests created in the `test` directory are slightly more complex.
5151

52-
`encryptFileWithContractConditions.spec.ts`
52+
`encryptFileWithContractConditions.spec.ts`:
5353

5454
```
5555
yarn test:encrypt
5656
```
5757

58-
Encrypt the file with specific `EVMContractConditions`. These conditions check the [deployedAllowList](./test/fixtures/deployed.json) contract address on the Chronicle Yellowstone network and calls the `isOnAllowList` function, expecting to return true if the address of the Ethereum account is on the allow list.
58+
Encrypt the file with specific `EVMContractConditions`. These conditions check the [deployedAllowList](./test/fixtures/deployed.json) contract address on the Chronicle Yellowstone network and calls the `isOnAllowList` function, expecting to return true if the address of the Ethereum account is on the allow list. This means that the encrypted file can only be decrypted if the same contract conditions are able to return true while decrypting.
5959

60-
`decryptFileWithContractConditions.spec.ts`
60+
`decryptFileWithContractConditions.spec.ts`:
6161

6262
```
6363
yarn test:decrypt
6464
```
6565

66-
Decrypts the file, first checking if the address is on the allow list, and if not, adding it to the allow list. Once the address is on the allow list, the file can be successfully decrypted.
66+
Decrypts the file, first checking if the address is on the allow list, and if not, adding it to the allow list. Once the address is on the allow list, the file can be successfully decrypted.

0 commit comments

Comments
 (0)