You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTE.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,27 @@ We use [**Changesets**](https://github.com/changesets/changesets) to manage vers
98
98
- Follow the prompts to indicate the type of version bump (patch, minor, major).
99
99
- The [GitHub Actions](./.github/workflows/) (or other CI pipeline) will handle the **publish** step to npm once your PR is merged and the changeset is committed to `main`.
100
100
101
+
## Pre release process
102
+
103
+
We currently use [changesets to manage pre-releasing](https://github.com/changesets/changesets/blob/main/docs/prereleases.md) the `next` version of the package, and the process is executed manually.
104
+
105
+
To do so, you need to:
106
+
107
+
1. Check out the `next` branch
108
+
2. Run `pnpm changeset pre enter next`
109
+
3. Run `pnpm changeset version`
110
+
4. Run `git add .`
111
+
5. Run `git commit -m "Enter prerelease mode and version packages"`
112
+
6. Run `pnpm changeset publish --tag next`
113
+
7. Run `git push --follow-tags`
114
+
115
+
When you are ready to release, you can run `pnpm changeset pre exit` to exit prerelease mode and commit the changes.
116
+
When you merge the PR, the `next` branch will be merged into `main`, and the package will be published to npm without the prerelease tag.
117
+
118
+
> [!IMPORTANT]
119
+
> This process can be dangerous, so please be careful when using it as it's difficult to undo mistakes.
120
+
> If you are unfamiliar with the process, please reach out to the maintainers for help.
[](https://cipherstash.com)
5
+
Protect.js</h1>
6
+
<palign="center">
7
+
Implement robust data security without sacrificing performance or usability
8
+
<br/>
9
+
<ahref="https://cipherstash.com">Built by CipherStash</a>
10
+
</p>
11
+
<br/>
5
12
6
-
Protect.js is a JavaScript/TypeScript package for encrypting and decrypting data in PostgreSQL databases.
7
-
Encryption operations happen directly in your app, and the ciphertext is stored in your PostgreSQL database.
13
+
<!-- start -->
8
14
9
-
Every value you encrypt with Protect.js has a unique key, made possible by CipherStash [ZeroKMS](https://cipherstash.com/products/zerokms)'s blazing fast bulk key operations.
10
-
Under the hood Protect.js uses CipherStash [Encrypt Query Language (EQL)](https://github.com/cipherstash/encrypt-query-language), and all ZeroKMS data keys are backed by a root key in [AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/overview.html).
15
+
## What's Protect.js?
16
+
17
+
Protect.js is a TypeScript package for encrypting and decrypting data.
18
+
Encryption operations happen directly in your app, and the ciphertext is stored in your database.
19
+
20
+
Every value you encrypt with Protect.js has a unique key, made possible by CipherStash [ZeroKMS](https://cipherstash.com/products/zerokms)'s blazing fast bulk key operations, and backed by a root key in [AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/overview.html).
21
+
22
+
The encrypted data is structured as an [EQL](https://github.com/cipherstash/encrypt-query-language) JSON payload, and can be stored in any database that supports JSONB.
23
+
24
+
> [!IMPORTANT]
25
+
> Searching, sorting, and filtering on encrypted data is only supported in PostgreSQL at the moment.
26
+
> Read more about [searching encrypted data](./docs/concepts/searchable-encryption.md).
11
27
12
28
## Table of contents
13
29
@@ -29,7 +45,7 @@ For more specific documentation, please refer to the [docs](https://github.com/c
29
45
30
46
## Features
31
47
32
-
Protect.js protects data in PostgreSQL databases using industry-standard AES encryption.
48
+
Protect.js protects data in using industry-standard AES encryption.
33
49
Protect.js uses [ZeroKMS](https://cipherstash.com/products/zerokms) for bulk encryption and decryption operations.
34
50
This enables every encrypted value, in every column, in every row in your database to have a unique key — without sacrificing performance.
35
51
@@ -38,6 +54,8 @@ This enables every encrypted value, in every column, in every row in your databa
38
54
-**Single item encryption and decryption**: Just looking for a way to encrypt and decrypt single values? Protect.js has you covered.
39
55
-**Really fast:** ZeroKMS's performance makes using millions of unique keys feasible and performant for real-world applications built with Protect.js.
40
56
-**Identity-aware encryption**: Lock down access to sensitive data by requiring a valid JWT to perform a decryption.
57
+
-**Audit trail**: Every decryption event will be logged in ZeroKMS to help you prove compliance.
58
+
-**Searchable encryption**: Protect.js supports searching encrypted data in PostgreSQL.
41
59
-**TypeScript support**: Strongly typed with TypeScript interfaces and types.
42
60
43
61
**Use cases:**
@@ -54,7 +72,7 @@ Check out the example applications:
54
72
-[Drizzle example](/apps/drizzle) demonstrates how to use Protect.js with an ORM
55
73
-[Next.js and lock contexts example using Clerk](/apps/nextjs-clerk) demonstrates how to protect data with identity-aware encryption
56
74
57
-
`@cipherstash/protect` can be used with most ORMs that support PostgreSQL.
75
+
`@cipherstash/protect` can be used with most ORMs.
58
76
If you're interested in using `@cipherstash/protect` with a specific ORM, please [create an issue](https://github.com/cipherstash/protectjs/issues/new).
59
77
60
78
## Installing Protect.js
@@ -115,33 +133,86 @@ At the end of `stash setup`, you will have two files in your project:
115
133
> `cipherstash.secret.toml` should not be committed to git, because it contains sensitive credentials.
116
134
> The `stash setup` command will attempt to append to your `.gitignore` file with the `cipherstash.secret.toml` file.
117
135
118
-
You can read more about [configuration via toml file or environment variables here](./docs/configuration.md).
136
+
You can read more about [configuration via toml file or environment variables here](./docs/reference/configuration.md).
119
137
120
-
### Initializing the EQL client
138
+
### Basic file structure
121
139
122
-
In your application, import the `protect` function from the `@cipherstash/protect`package, and initialize a client with your CipherStash credentials.
140
+
This is the basic file structure of the project. In the `src/protect`directory, we have table definition in `schema.ts` and the protect client in `index.ts`.
@@ -212,7 +285,9 @@ The `decryptResult` will return one of the following:
212
285
213
286
### Storing encrypted data in a database
214
287
215
-
To store the encrypted data in PostgreSQL, you will need to specify the column type as `jsonb`.
288
+
Encrypted data can be stored in any database that supports JSONB, noting that searchable encryption is only supported in PostgreSQL at the moment.
289
+
290
+
To store the encrypted data, you will need to specify the column type as `jsonb`.
216
291
217
292
```sql
218
293
CREATETABLEusers (
@@ -221,8 +296,37 @@ CREATE TABLE users (
221
296
);
222
297
```
223
298
299
+
#### Searchable encryption in PostgreSQL
300
+
301
+
To enable searchable encryption in PostgreSQL, you need to [install the EQL custom types and functions](https://github.com/cipherstash/encrypt-query-language?tab=readme-ov-file#installation).
To encrypt data with a lock context, call the optional `withLockContext` method on the `encrypt` function and pass the lock context object as a parameter:
To decrypt data with a lock context, call the optional `withLockContext` method on the `decrypt` function and pass the lock context object as a parameter:
Learn more about [bulk decryption](./docs/bulk-encryption-decryption.md#bulk-decrypting-data)
518
+
Learn more about [bulk decryption](./docs/reference/bulk-encryption-decryption.md#bulk-decrypting-data)
410
519
411
520
## Supported data types
412
521
413
-
`@cipherstash/protect` currently supports encrypting and decrypting text.
414
-
Other data types like booleans, dates, ints, floats, and JSON are extremely well supported in other CipherStash products, and will be coming to `@cipherstash/protect`.
415
-
Until support for other data types are available in `@cipherstash/protect`, you can:
522
+
Protect.js currently supports encrypting and decrypting text.
523
+
Other data types like booleans, dates, ints, floats, and JSON are well supported in other CipherStash products, and will be coming to Protect.js soon.
416
524
417
-
- Read [about how these data types work in EQL](https://github.com/cipherstash/encrypt-query-language/blob/main/docs/reference/INDEX.md)
418
-
- Express interest in this feature by adding a :+1: on this [GitHub Issue](https://github.com/cipherstash/protectjs/issues/48).
525
+
Until support for other data types are available, you can express interest in this feature by adding a :+1: on this [GitHub Issue](https://github.com/cipherstash/protectjs/issues/48).
419
526
420
527
## Searchable encryption
421
528
422
-
`@cipherstash/protect` does not currently support searching encrypted data.
423
-
Searchable encryption is an extremely well supported capability in other CipherStash products, and will be coming to `@cipherstash/protect`.
424
-
Until searchable encryption support is released in `@cipherstash/protect`, you can:
425
-
426
-
- Read [about how searchable encryption works in EQL](https://github.com/cipherstash/encrypt-query-language)
427
-
- Express interest in this feature by adding a :+1: on this [GitHub Issue](https://github.com/cipherstash/protectjs/issues/46).
529
+
Read more about [searching encrypted data](./docs/concepts/searchable-encryption.md) in the docs.
0 commit comments