From 58f6341f4cdd45099f9ed7448421709e465e6d5f Mon Sep 17 00:00:00 2001 From: CJ Brewer Date: Tue, 10 Dec 2024 14:36:37 -0700 Subject: [PATCH 1/4] docs: add use cases and clearer examples --- CONTRIBUTING.md => CONTRIBUTE.md | 0 README.md | 24 +++++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) rename CONTRIBUTING.md => CONTRIBUTE.md (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTE.md similarity index 100% rename from CONTRIBUTING.md rename to CONTRIBUTE.md diff --git a/README.md b/README.md index 40a89554f..ec34b1c9e 100644 --- a/README.md +++ b/README.md @@ -13,23 +13,34 @@ - [getPlaintext](#getplaintext) - [Logging](#logging) - [Releasing new versions](#releasing-new-versions) -- [Contributing](#contributing) +- [ContributE](#contributE) - [License](#license) ## Features +`jseql` leverages [Encrypt Query Language (EQL)](https://github.com/cipherstash/encrypt-query-language) and [CipherStash](https://cipherstash.com) to encrypt data in a PostgreSQL database. + +**Features:** - **Data encoding**: Easily create EQL payloads with the `createEqlPayload` function. - **Data decoding**: Extract plaintext data from EQL payloads using `getPlaintext`. - **TypeScript support**: Strongly typed with TypeScript interfaces and types. - **Logging**: Integrated logging using [logtape](https://github.com/logtape/logtape) for debugging and monitoring. +**Use cases:** +- Meet compliance requirements for data encryption in your application. +- Ensure only the intended users can access sensitive data. +- Exceed customer expectations for data security. +- Improve your overall security posture and reduce the risk of data breaches. + ## Installation Install `jseql` via one of the following methods: ```bash npm install @cipherstash/jseql +# or yarn add @cipherstash/jseql +# or bun add @cipherstash/jseql ``` @@ -67,10 +78,11 @@ const payload = createEqlPayload({ table: 'messages', column: 'content', }) -console.log(payload) + +sql = `INSERT INTO messages (content) VALUES (${payload});` ``` -**Output:** +**Payload:** ```json { @@ -88,7 +100,7 @@ console.log(payload) #### getPlaintext -Extracts the plaintext data from an EQL payload. +Extracts the plaintext data from an EQL payload which has been decrypted. **Parameters:** @@ -112,6 +124,8 @@ const payload = { const plaintext = getPlaintext(payload) console.log(plaintext) // Output: 'Hello, World!' ``` +> [!TIP] +> Note: the payload that is stored in the database is encrypted, so it is not possible to view the plaintext data directly even if you have direct access to the database as an administrator. ### Logging @@ -175,7 +189,7 @@ Create a pull request and merge it into the `main` branch, which will trigger th ## Contributing -Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information. +Please see the [CONTRIBUTE.md](CONTRIBUTE.md) file for more information. ## License From 9f7f48346b98c0ddd4342a501d07128570420a36 Mon Sep 17 00:00:00 2001 From: CJ Brewer Date: Tue, 10 Dec 2024 14:37:44 -0700 Subject: [PATCH 2/4] docs: spelling mistake --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec34b1c9e..691d7a421 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ - [getPlaintext](#getplaintext) - [Logging](#logging) - [Releasing new versions](#releasing-new-versions) -- [ContributE](#contributE) +- [Contributing](#contributing) - [License](#license) ## Features From ce0da244f7e9cf4c2db950b592c9245bfe1495b8 Mon Sep 17 00:00:00 2001 From: CJ Brewer Date: Tue, 10 Dec 2024 14:41:01 -0700 Subject: [PATCH 3/4] docs: add examples --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 691d7a421..7947e1e64 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,13 @@ const payload = createEqlPayload({ By setting up the logger, you can monitor the internal operations of `jseql`, which is especially useful for debugging and development purposes. +## Examples + +- [Drizzle](/apps/drizzle) +- [Prisma](/apps/prisma) + +`jseql` can be used with most ORMs that support PostgreSQL. If you're interested in using `jseql` with a specific ORM, please [create an issue](https://github.com/cipherstash/jseql/issues/new). + ## Releasing new versions We use [Changesets](https://github.com/changesets/changesets) to manage our releases. From a2a2a15b43d57b96911e1ab22094f62f1d63fee5 Mon Sep 17 00:00:00 2001 From: CJ Brewer Date: Tue, 10 Dec 2024 14:41:27 -0700 Subject: [PATCH 4/4] docs: add examples --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7947e1e64..17b27e770 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ - [createEqlPayload](#createeqlpayload) - [getPlaintext](#getplaintext) - [Logging](#logging) +- [Examples](#examples) - [Releasing new versions](#releasing-new-versions) - [Contributing](#contributing) - [License](#license)