Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Protect.js Documentation
# Protect.js documentation

The documentation for Protect.js is organized into the following sections:

Expand All @@ -12,7 +12,7 @@ The documentation for Protect.js is organized into the following sections:

- [Configuration and production deployment](./reference/configuration.md)
- [Bulk encryption and decryption](./reference/bulk-encryption-decryption.md)
- [Searchable encryption with PostgreSQL](./reference/searchable-encryption-postgres.md)q
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

- [Searchable encryption with PostgreSQL](./reference/searchable-encryption-postgres.md)
- [Protect.js schemas](./reference/schema.md)

## How-to guides
Expand Down
30 changes: 15 additions & 15 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

This getting started guide steps you through:

- Installing and configuring Protect.js in a standalone project
- Encrypting, searching, and decrypting data in a PostgreSQL database
1. Installing and configuring Protect.js in a standalone project
2. Encrypting, searching, and decrypting data in a PostgreSQL database

> [!IMPORTANT]
> **Prerequisites:** Before you start you need to have this software installed:
Expand All @@ -13,8 +13,8 @@ This getting started guide steps you through:

### Step 0: Basic file structure

This is the basic file structure of the standalone project for this getting started guide.
In the `src/protect/` directory, we have table definition in `schema.ts` and the Protect.js client in `index.ts`.
The following is the basic file structure of the standalone project for this getting started guide.
In the `src/protect/` directory, we have the table definition in `schema.ts` and the Protect.js client in `index.ts`.

```
📦 <project root>
Expand All @@ -30,9 +30,9 @@ In the `src/protect/` directory, we have table definition in `schema.ts` and the
└ 📜 tsconfig.json
```

If you are following this getting started guide with an existing app, you can skip to [the next step](#step-1-install-protectjs).
If you're following this getting started guide with an existing app, skip to [the next step](#step-1-install-protectjs).

If you are following this getting started guide with a clean slate, create a basic structure by running:
If you're following this getting started guide with a clean slate, create a basic structure by running:

```bash
mkdir -p protect-example/src/protect
Expand Down Expand Up @@ -69,15 +69,15 @@ Lastly, install the CipherStash CLI:
- [Linux x86_64](https://github.com/cipherstash/cli-releases/releases/latest/download/stash-x86_64-unknown-linux-gnu)

> [!NOTE]
> **You need to opt-out of bundling when using Protect.js.**
> **You need to opt out of bundling when using Protect.js.**
>
> Protect.js uses Node.js specific features and requires the use of the [native Node.js `require`](https://nodejs.org/api/modules.html#requireid).
>
> You need to opt-out of bundling for tools like [Webpack](https://webpack.js.org/configuration/externals/), [esbuild](https://webpack.js.org/configuration/externals/), or [Next.js](https://nextjs.org/docs/app/api-reference/config/next-config-js/serverExternalPackages).
> You need to opt out of bundling for tools like [Webpack](https://webpack.js.org/configuration/externals/), [esbuild](https://webpack.js.org/configuration/externals/), or [Next.js](https://nextjs.org/docs/app/api-reference/config/next-config-js/serverExternalPackages).
>
> Read more about [building and bundling with Protect.js](#builds-and-bundling).

### Step 2: Setup credentials
### Step 2: Set up credentials

> [!IMPORTANT]
> Make sure you have [installed the CipherStash CLI](#step-1-install-protectjs) before following these steps.
Expand All @@ -92,8 +92,8 @@ If you haven't already signed up for a CipherStash account, this will prompt you

At the end of `stash setup`, you will have two files in your project:

- `cipherstash.toml` which contains the configuration for Protect.js
- `cipherstash.secret.toml`: which contains the credentials for Protect.js
- `cipherstash.toml`, which contains the configuration for Protect.js
- `cipherstash.secret.toml`, which contains the credentials for Protect.js

> [!WARNING]
> Don't commit `cipherstash.secret.toml` to git; it contains sensitive credentials.
Expand All @@ -105,7 +105,7 @@ Read more about [configuration via TOML file or environment variables](./docs/re

Protect.js uses a schema to define the tables and columns that you want to encrypt and decrypt.

Define your tables and columns by adding this to `src/protect/schema.ts`:
To define your tables and columns, add the following to `src/protect/schema.ts`:

```ts
import { csTable, csColumn } from '@cipherstash/protect'
Expand Down Expand Up @@ -139,7 +139,7 @@ Read more about [defining your schema](./docs/reference/schema.md).

### Step 4: Initialize the Protect client

Import the `protect` function and initialize a client with your defined schema, by adding this to `src/protect/index.ts`:
To import the `protect` function and initialize a client with your defined schema, add the following to `src/protect/index.ts`:

```ts
import { protect } from '@cipherstash/protect'
Expand All @@ -149,7 +149,7 @@ import { users } from './schema'
export const protectClient = await protect(users, orders)
```

The `protect` function requires at least one `csTable` be provided.
The `protect` function requires at least one `csTable` to be provided.

### Step 5: Encrypt data

Expand Down Expand Up @@ -247,7 +247,7 @@ The `decryptResult` will return one of the following:

Encrypted data can be stored in any database that supports JSONB.

To store the encrypted data, you will need to specify the column type as `jsonb`:
To store the encrypted data, specify the column type as `jsonb`:

```sql
CREATE TABLE users (
Expand Down
26 changes: 13 additions & 13 deletions packages/protect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,19 @@ Lastly, install the CipherStash CLI:
- [Linux x86_64](https://github.com/cipherstash/cli-releases/releases/latest/download/stash-x86_64-unknown-linux-gnu)

> [!NOTE]
> **You need to opt-out of bundling when using Protect.js.**
> **You need to opt out of bundling when using Protect.js.**
>
> Protect.js uses Node.js specific features and requires the use of the [native Node.js `require`](https://nodejs.org/api/modules.html#requireid).
>
> You need to opt-out of bundling for tools like [Webpack](https://webpack.js.org/configuration/externals/), [esbuild](https://webpack.js.org/configuration/externals/), or [Next.js](https://nextjs.org/docs/app/api-reference/config/next-config-js/serverExternalPackages).
> You need to opt out of bundling for tools like [Webpack](https://webpack.js.org/configuration/externals/), [esbuild](https://webpack.js.org/configuration/externals/), or [Next.js](https://nextjs.org/docs/app/api-reference/config/next-config-js/serverExternalPackages).
>
> Read more about [building and bundling with Protect.js](#builds-and-bundling).

## Getting started

If you are following this getting started guide with an existing app, you can skip to [the next step](#configuration).
If you're following this getting started guide with an existing app, skip to [the next step](#configuration).

If you are following this getting started guide with a clean slate, check out the dedicated [getting started guide](./docs/getting-started.md)
If you're following this getting started guide with a clean slate, check out the dedicated [getting started guide](./docs/getting-started.md)

### Configuration

Expand Down Expand Up @@ -148,7 +148,7 @@ Read more about [configuration via TOML file or environment variables](./docs/re

### Basic file structure

This is the basic file structure of the project.
The following is the basic file structure of the project.
In the `src/protect/` directory, we have the table definition in `schema.ts` and the protect client in `index.ts`.

```
Expand Down Expand Up @@ -203,7 +203,7 @@ Read more about [defining your schema](./docs/reference/schema.md).

### Initialize the Protect client

Import the `protect` function and initialize a client with your defined schema, by adding this to `src/protect/index.ts`:
To import the `protect` function and initialize a client with your defined schema, add the following to `src/protect/index.ts`:

```ts
import { protect } from '@cipherstash/protect'
Expand All @@ -220,7 +220,7 @@ The `protect` function requires at least one `csTable` be provided.
Protect.js provides the `encrypt` function on `protectClient` to encrypt data.
`encrypt` takes a plaintext string, and an object with the table and column as parameters.

Start encrypting data by adding this to `src/index.ts`:
To start encrypting data, add the following to `src/index.ts`:

```typescript
import { users } from './protect/schema'
Expand Down Expand Up @@ -268,7 +268,7 @@ The `encryptResult` will return one of the following:
Protect.js provides the `decrypt` function on `protectClient` to decrypt data.
`decrypt` takes an encrypted data object as a parameter.

Start decrypting data by adding this to `src/index.ts`:
To start decrypting data, add the following to `src/index.ts`:

```typescript
import { protectClient } from './protect'
Expand Down Expand Up @@ -309,7 +309,7 @@ The `decryptResult` will return one of the following:

Encrypted data can be stored in any database that supports JSONB, noting that searchable encryption is only supported in PostgreSQL at the moment.

To store the encrypted data, you will need to specify the column type as `jsonb`.
To store the encrypted data, specify the column type as `jsonb`.

```sql
CREATE TABLE users (
Expand All @@ -320,7 +320,7 @@ CREATE TABLE users (

#### Searchable encryption in PostgreSQL

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 enable searchable encryption in PostgreSQL, [install the EQL custom types and functions](https://github.com/cipherstash/encrypt-query-language?tab=readme-ov-file#installation).

1. Download the latest EQL install script:

Expand Down Expand Up @@ -429,7 +429,7 @@ const plaintext = decryptResult.data

## Bulk encryption and decryption

If you have a large list of items to encrypt or decrypt, you can use the **`bulkEncrypt`** and **`bulkDecrypt`** methods to batch encryption/decryption.
If you have a large list of items to encrypt or decrypt, use the **`bulkEncrypt`** and **`bulkDecrypt`** methods to batch encryption/decryption.
`bulkEncrypt` and `bulkDecrypt` give your app significantly better throughput than the single-item [`encrypt`](#encrypting-data) and [`decrypt`](#decrypting-data) methods.


Expand Down Expand Up @@ -542,7 +542,7 @@ Learn more about [bulk decryption](./docs/reference/bulk-encryption-decryption.m
## Supported data types

Protect.js currently supports encrypting and decrypting text.
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.
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.

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).

Expand Down Expand Up @@ -570,7 +570,7 @@ PROTECT_LOG_LEVEL=error # Enable error logging
Protect.js is built on top of the CipherStash Client Rust SDK which is embedded with the `@cipherstash/protect-ffi` package.
The `@cipherstash/protect-ffi` source code is available on [GitHub](https://github.com/cipherstash/protectjs-ffi).

Read more about configuring the CipherStash client in the [configuration docs](./docs/reference/configuration.md).
Read more about configuring the CipherStash Client in the [configuration docs](./docs/reference/configuration.md).

## Example applications

Expand Down