Skip to content

Commit 4c01c34

Browse files
calvinbrewerclaude
andcommitted
fix: final sweep — comments, env vars, db names, migration guide (round 4)
Comments: - "protected table schema" → "encrypted table schema" in 6 dynamo example files + dynamodb README - "protectjs" → "CipherStash" in nextjs-clerk schema comment - eql_payload_created_by_protect → eql_payload_created_by_encryption in docs Environment variables: - PROTECT_LOG_LEVEL → CS_LOG_LEVEL in .env files and nest module - AGENTS.md env var reference updated Database/infrastructure: - protect_example → encryption_example in next-drizzle-mysql (docker-compose, drizzle config, .env.example) - protectNestedJson → encryptedNestedJson in dynamodb test Documentation: - protect-example → encryption-example in getting-started.md - jsprotect.git → protectjs.git in hono-supabase README - Updated product URLs in next-drizzle-mysql README - MIGRATION.md: updated "after" examples with new function names - Nest README: fixed src/protect/ → src/encryption/ path Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c8d20aa commit 4c01c34

File tree

20 files changed

+50
-42
lines changed

20 files changed

+50
-42
lines changed

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ USER_JWT=
6464
USER_2_JWT=
6565

6666
# Logging (plaintext is never logged by design)
67-
PROTECT_LOG_LEVEL=debug|info|error
67+
CS_LOG_LEVEL=debug|info|error
6868
```
6969

7070
If these variables are missing, tests that require live encryption will fail or be skipped; prefer filtering to specific packages and tests while developing.

MIGRATION.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ npm install @cipherstash/stack
1717
If you use the DynamoDB helpers, update the peer dependency:
1818

1919
```bash
20-
# @cipherstash/protect-dynamodb now expects @cipherstash/stack
21-
npm install @cipherstash/stack @cipherstash/protect-dynamodb
20+
# @cipherstash/dynamodb now expects @cipherstash/stack
21+
npm install @cipherstash/stack @cipherstash/dynamodb
2222
```
2323

2424
If you use the Drizzle integration, update the peer dependency:
@@ -118,22 +118,24 @@ npm install @cipherstash/stack @cipherstash/drizzle
118118
```diff
119119
-import { protect } from '@cipherstash/protect'
120120
+import { Encryption } from '@cipherstash/stack'
121-
import { extractProtectSchema, createProtectOperators } from '@cipherstash/drizzle/pg'
121+
-import { extractProtectSchema, createProtectOperators } from '@cipherstash/drizzle/pg'
122+
+import { extractEncryptionSchema, createEncryptionOperators } from '@cipherstash/drizzle/pg'
122123

123-
const users = extractProtectSchema(usersTable)
124+
-const users = extractProtectSchema(usersTable)
125+
+const users = extractEncryptionSchema(usersTable)
124126
-const client = await protect({ schemas: [users] })
125127
+const client = await Encryption({ schemas: [users] })
126-
const ops = createProtectOperators(client)
128+
-const ops = createProtectOperators(client)
129+
+const ops = createEncryptionOperators(client)
127130
```
128131

129-
> Note: `extractProtectSchema` and `createProtectOperators` retain their names in the Drizzle package.
130-
131132
### DynamoDB integration
132133

133134
```diff
134135
-import { protect, csTable, csColumn } from '@cipherstash/protect'
135136
+import { Encryption, encryptedTable, encryptedColumn } from '@cipherstash/stack'
136-
import { protectDynamoDB } from '@cipherstash/protect-dynamodb'
137+
-import { protectDynamoDB } from '@cipherstash/protect-dynamodb'
138+
+import { encryptedDynamoDB } from '@cipherstash/dynamodb'
137139

138140
-const users = csTable('users', {
139141
- email: csColumn('email').equality(),
@@ -143,7 +145,8 @@ npm install @cipherstash/stack @cipherstash/drizzle
143145

144146
-const client = await protect({ schemas: [users] })
145147
+const client = await Encryption({ schemas: [users] })
146-
const dynamo = protectDynamoDB({ protectClient: client })
148+
-const dynamo = protectDynamoDB({ protectClient: client })
149+
+const dynamo = encryptedDynamoDB({ encryptionClient: client })
147150
```
148151

149152
## 4. Deprecated aliases
@@ -183,6 +186,11 @@ ProtectColumn → EncryptedColumn
183186
ProtectValue → EncryptedValue
184187
ProtectTableColumn → EncryptedTableColumn
185188
ProtectOperation → EncryptionOperation
189+
extractProtectSchema → extractEncryptionSchema
190+
createProtectOperators → createEncryptionOperators
191+
@cipherstash/protect-dynamodb → @cipherstash/dynamodb
192+
protectDynamoDB → encryptedDynamoDB
193+
protectClient → encryptionClient
186194
```
187195

188196
> **Important**: Run the more specific replacements first (e.g., `@cipherstash/protect/identify` before `@cipherstash/protect`) to avoid partial matches.

docs/concepts/searchable-encryption.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Using the above approach, Stash Encryption is generating the EQL payloads and wh
9898
So does this solve the original problem of searching on encrypted data?
9999

100100
```sql
101-
# SELECT * FROM users WHERE WHERE cs_unique_v2(email) = cs_unique_v2(eql_payload_created_by_protect);
101+
# SELECT * FROM users WHERE WHERE cs_unique_v2(email) = cs_unique_v2(eql_payload_created_by_encryption);
102102
id | name | email
103103
----+----------------+----------------------------
104104
1 | Alice Johnson | mBbKmsMMkbKBSN...

docs/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ If you're following this getting started guide with an existing app, skip to [th
4747
If you're following this getting started guide with a clean slate, create a basic structure by running:
4848

4949
```bash
50-
mkdir -p protect-example/src/encryption
51-
cd protect-example
50+
mkdir -p encryption-example/src/encryption
51+
cd encryption-example
5252
git init
5353
npm init -y
5454
```

examples/dynamo/src/bulk-operations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ const main = async () => {
3434

3535
const items = [
3636
{
37-
// `pk` won't be encrypted because it's not included in the `users` protected table schema.
37+
// `pk` won't be encrypted because it's not included in the `users` encrypted table schema.
3838
pk: 'user#1',
39-
// `email` will be encrypted because it's included in the `users` protected table schema.
39+
// `email` will be encrypted because it's included in the `users` encrypted table schema.
4040
email: 'abc@example.com',
4141
},
4242
{

examples/dynamo/src/encrypted-key-in-gsi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ const main = async () => {
4949
})
5050

5151
const user = {
52-
// `pk` won't be encrypted because it's not included in the `users` protected table schema.
52+
// `pk` won't be encrypted because it's not included in the `users` encrypted table schema.
5353
pk: 'user#1',
54-
// `email` will be encrypted because it's included in the `users` protected table schema.
54+
// `email` will be encrypted because it's included in the `users` encrypted table schema.
5555
email: 'abc@example.com',
5656
}
5757

examples/dynamo/src/encrypted-partition-key.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ const main = async () => {
3232
})
3333

3434
const user = {
35-
// `email` will be encrypted because it's included in the `users` protected table schema.
35+
// `email` will be encrypted because it's included in the `users` encrypted table schema.
3636
email: 'abc@example.com',
37-
// `somePlaintextAttr` won't be encrypted because it's not in the protected table schema.
37+
// `somePlaintextAttr` won't be encrypted because it's not in the encrypted table schema.
3838
somePlaintextAttr: 'abc',
3939
}
4040

examples/dynamo/src/encrypted-sort-key.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ const main = async () => {
4141
})
4242

4343
const user = {
44-
// `pk` won't be encrypted because it's not in the protected table schema.
44+
// `pk` won't be encrypted because it's not in the encrypted table schema.
4545
pk: 'user#1',
46-
// `email` will be encrypted because it's included in the `users` protected table schema.
46+
// `email` will be encrypted because it's included in the `users` encrypted table schema.
4747
email: 'abc@example.com',
4848
}
4949

examples/dynamo/src/export-to-pg.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ const main = async () => {
3636
})
3737

3838
const user = {
39-
// `pk` won't be encrypted because it's not included in the `users` protected table schema.
39+
// `pk` won't be encrypted because it's not included in the `users` encrypted table schema.
4040
pk: 'user#1',
41-
// `email` will be encrypted because it's included in the `users` protected table schema.
41+
// `email` will be encrypted because it's included in the `users` encrypted table schema.
4242
email: 'abc@example.com',
4343
}
4444

examples/dynamo/src/simple.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ const main = async () => {
3333
})
3434

3535
const user = {
36-
// `pk` won't be encrypted because it's not included in the `users` protected table schema.
36+
// `pk` won't be encrypted because it's not included in the `users` encrypted table schema.
3737
pk: 'user#1',
38-
// `email` will be encrypted because it's included in the `users` protected table schema.
38+
// `email` will be encrypted because it's included in the `users` encrypted table schema.
3939
email: 'abc@example.com',
4040
}
4141

0 commit comments

Comments
 (0)