diff --git a/docs/integrations/storage/irys.md b/docs/integrations/storage/irys.md index a4722f40..45f6a421 100644 --- a/docs/integrations/storage/irys.md +++ b/docs/integrations/storage/irys.md @@ -180,6 +180,8 @@ For more advanced examples, see [unified access control conditions](https://deve We provide multiple methods to encrypt data, including strings, files, zip files. - `encryptString():` Encrypts a string. +- `encryptFile()`: Encrypts a file. +- `encryptUint8Array()`: Encrypts a Uint8Array, which can be a compressed file. - `encryptToJson()`: Encrypts a string or file and serializes the result to JSON. We will use `encryptString()` to encrypt a simple string: @@ -426,8 +428,10 @@ For more advanced examples, see [unified access control conditions](https://deve We provide multiple methods to encrypt data, including strings, files, zip files. -- `encryptString()`: Encrypts a string. -- `encryptToJson()`: Encrypts a string or file and serializes the result to JSON. +- `encryptString():` Encrypts a string. +- `encryptFile()`: Encrypts a file. +- `encryptUint8Array()`: Encrypts a Uint8Array, which can be a compressed file. +- `encryptToJson()`: Encrypts a string or file and serializes the result to JSON. We will use `encryptString()` to encrypt a string: @@ -593,4 +597,4 @@ export const decryptData = async (encryptedText: string, dataToEncryptHash: stri Any questions? Reach out the Irys team in their [Discord](https://discord.gg/irys). - \ No newline at end of file + diff --git a/docs/sdk/access-control/encryption.md b/docs/sdk/access-control/encryption.md index 5b5217ab..1ee45e8a 100644 --- a/docs/sdk/access-control/encryption.md +++ b/docs/sdk/access-control/encryption.md @@ -198,7 +198,7 @@ const accessControlConditions = [ #### Encryption -To encrypt a string, use one of the following functions: +To encrypt a string, use: - [encryptString()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptString.html) - Used to encrypt the raw string. @@ -206,7 +206,11 @@ To encrypt a file, use: - [encryptFile()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptFile.html) - Used to encrypt a file without doing any zipping or packing. Because zipping larger files takes time, this function is useful when encrypting large files ( > 20mb). This also requires that you store the file metadata. -Apart from this, we have one more function which can be used to encrypt both strings and files: +To encrypt a Uint8Array, use: + +- [encryptUint8Array()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptUint8Array.html) - Used to encrypt a Uint8Array, which can be the output of a [compression algorithm](https://github.com/LIT-Protocol/compression) or anything else that does not adhere to the string or file types. + +Apart from those, we have one more function which can be used to encrypt both strings and files: - [encryptToJson()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptToJson.html) - Used to encrypt a string or file and serialize all the metadata required to decrypt i.e. accessControlConditions, evmContractConditions, solRpcConditions, unifiedAccessControlConditions & chain to JSON. It is useful for encrypting/decrypting data in IPFS or other storage without compressing it in a ZIP file. @@ -523,6 +527,7 @@ To decrypt use the following functions depending on the function used to encrypt - [decryptToString()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.decryptToString.html) for [encryptString()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptString.html) - [decryptToFile()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.decryptToFile.html) for [encryptFile()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptFile.html) +- [decryptToUint8Array()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.decryptToUint8Array.html) for [encryptUint8Array()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptUint8Array.html) - [decryptFromJson()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.decryptFromJson.html) for [encryptToJson()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptToJson.html) In the example, we used `encryptString()` to encrypt so we will use `decryptToString()` to decrypt. Pass in the data `accessControlConditions`, `ciphertext`, `dataToEncryptHash`, and `authSig`. @@ -563,4 +568,4 @@ class Lit { Check out [this example](https://github.com/LIT-Protocol/js-sdk/tree/feat/SDK-V3/apps/demo-encrypt-decrypt-react) for a full-fledged **React** application that encrypts and decrypts a **string** using the Lit JS SDK V3. - \ No newline at end of file + diff --git a/docs/sdk/access-control/quick-start.md b/docs/sdk/access-control/quick-start.md index 65e21dc4..75ff258f 100644 --- a/docs/sdk/access-control/quick-start.md +++ b/docs/sdk/access-control/quick-start.md @@ -185,7 +185,7 @@ const accessControlConditions = [ ### Encryption -To encrypt a string, use the following function: +To encrypt a string, use: - [encryptString()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptString.html) - Used to encrypt the raw string. @@ -193,9 +193,13 @@ To encrypt a file, use: - [encryptFile()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptFile.html) - Used to encrypt a file without doing any zipping or packing. Because zipping larger files takes time, this function is useful when encrypting large files ( > 20mb). This also requires that you store the file metadata. -Apart from these, we have one more function which can be used to encrypt both strings and files: +To encrypt a Uint8Array, use: -- [encryptToJson()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptToJson.html) - Used to encrypt a string or file and serialise all the metadata required to decrypt i.e. accessControlConditions, evmContractConditions, solRpcConditions, unifiedAccessControlConditions & chain to JSON. It is useful for encrypting/decrypting data in IPFS or other storage without compressing it in a ZIP file. +- [encryptUint8Array()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptUint8Array.html) - Used to encrypt a Uint8Array, which can be the output of a [compression algorithm](https://github.com/LIT-Protocol/compression) or anything else that does not adhere to the string or file types. + +Apart from those, we have one more function which can be used to encrypt both strings and files: + +- [encryptToJson()](https://v7-api-doc-lit-js-sdk.vercel.app/functions/encryption_src.encryptToJson.html) - Used to encrypt a string or file and serialize all the metadata required to decrypt i.e. accessControlConditions, evmContractConditions, solRpcConditions, unifiedAccessControlConditions & chain to JSON. It is useful for encrypting/decrypting data in IPFS or other storage without compressing it in a ZIP file. Encryption can be performed entirely client-side and doesn't require making a request to the Lit nodes. @@ -556,4 +560,4 @@ By now you should have successfully created an Access Control Condition and perf 3. [Off-Chain Conditions](../access-control/lit-action-conditions.md). 4. [Custom Contract Calls](../access-control/evm/custom-contract-calls.md). - \ No newline at end of file +