Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7ccb9e5
feat: ✨ add searchable JSON encryption and update FFI to v0.17.0
calvinbrewer Oct 3, 2025
a6b94b1
♻️ refactor: update DynamoDB package to use Encrypted type instead of…
calvinbrewer Oct 7, 2025
5b87d7d
🧪 test: clean up debug test file boilerplate
calvinbrewer Oct 7, 2025
1495a73
chore: remove console log
calvinbrewer Oct 7, 2025
dd466a8
✨ feat: add JSONB support for DynamoDB operations
calvinbrewer Oct 7, 2025
503aaf3
💡 docs: add TODO for FFI encrypt payload type update
calvinbrewer Oct 7, 2025
89488ea
chore: remove debug test
calvinbrewer Oct 7, 2025
52cec2f
feat(protect, schema): remove prefix requirments for searchable json
calvinbrewer Oct 21, 2025
17195f3
feat(protect): init ffi 0.18.0 pre release
calvinbrewer Oct 21, 2025
c2bf1a1
Merge pull request #192 from cipherstash/jjson-query
calvinbrewer Oct 21, 2025
e8fe444
Revert "feat(protect): init ffi 18 pre release"
calvinbrewer Oct 22, 2025
cce2c93
Merge pull request #194 from cipherstash/revert-192-jjson-query
calvinbrewer Oct 22, 2025
c7cdf97
test: reduce timeout for JSON performance test to 5 seconds
coderdan Oct 28, 2025
fe4bf4e
refactor: comment out tests and methods related to ste_vec indexing f…
coderdan Oct 28, 2025
33760e5
refactor: comment out searchableJson method for jsonSearchable column…
coderdan Oct 28, 2025
5da45a5
refactor: comment out searchableJson method for json column in tests …
coderdan Oct 28, 2025
8e83232
refactor: ♻️ standardize data type names from PostgreSQL-specific to …
calvinbrewer Oct 28, 2025
37aeaaa
chore: 👷 update dependencies and add Protect.js initialization guide
calvinbrewer Oct 28, 2025
788dbfc
chore: changeset
calvinbrewer Oct 28, 2025
fd649cc
fix: handle NaN and Infinity values in encryption process, update num…
coderdan Oct 29, 2025
87c8b26
docs: update README to reflect supported data types and handling of s…
coderdan Oct 29, 2025
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
Prev Previous commit
Next Next commit
♻️ refactor: update DynamoDB package to use Encrypted type instead of…
… EncryptedPayload

- Replace EncryptedPayload imports with Encrypted type across all DynamoDB operations
- Update EQL payload structure in toItemWithEqlPayloads helper function
- Simplify payload structure by removing unused fields (bf, hm, ob)
- Update type annotations in decrypt operations and bulk operations
- Add TODO comment for future ste_vec EQL type support
  • Loading branch information
calvinbrewer committed Oct 7, 2025
commit a6b94b11fceb44032f95324b8f715c0221f738a7
13 changes: 6 additions & 7 deletions packages/protect-dynamodb/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { EncryptedPayload } from '@cipherstash/protect'
import type { Encrypted } from '@cipherstash/protect'
import type { ProtectDynamoDBError } from './types'
export const ciphertextAttrSuffix = '__source'
export const searchTermAttrSuffix = '__hmac'
Expand Down Expand Up @@ -83,7 +83,7 @@ export function toEncryptedDynamoItem(
typeof attrValue === 'object' &&
'c' in (attrValue as object))
) {
const encryptPayload = attrValue as EncryptedPayload
const encryptPayload = attrValue as Encrypted
if (encryptPayload?.c) {
const result: Record<string, unknown> = {}
if (encryptPayload.hm) {
Expand Down Expand Up @@ -122,7 +122,7 @@ export function toEncryptedDynamoItem(
}

export function toItemWithEqlPayloads(
decrypted: Record<string, EncryptedPayload | unknown>,
decrypted: Record<string, Encrypted | unknown>,
encryptedAttrs: string[],
): Record<string, unknown> {
function processValue(
Expand All @@ -148,14 +148,13 @@ export function toItemWithEqlPayloads(
isNested)
) {
const baseName = attrName.slice(0, -ciphertextAttrSuffix.length)

// TODO: in order to support the ste_vec eql type, this needs to be updated
return {
[baseName]: {
c: attrValue,
bf: null,
hm: null,
i: { c: 'notUsed', t: 'notUsed' },
k: 'notUsed',
ob: null,
k: 'ct',
v: 2,
},
}
Expand Down
6 changes: 3 additions & 3 deletions packages/protect-dynamodb/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {
EncryptedPayload,
Encrypted,
ProtectTable,
ProtectTableColumn,
SearchTerm,
Expand Down Expand Up @@ -42,7 +42,7 @@ export function protectDynamoDB(
},

decryptModel<T extends Record<string, unknown>>(
item: Record<string, EncryptedPayload | unknown>,
item: Record<string, Encrypted | unknown>,
protectTable: ProtectTable<ProtectTableColumn>,
) {
return new DecryptModelOperation<T>(
Expand All @@ -54,7 +54,7 @@ export function protectDynamoDB(
},

bulkDecryptModels<T extends Record<string, unknown>>(
items: Record<string, EncryptedPayload | unknown>[],
items: Record<string, Encrypted | unknown>[],
protectTable: ProtectTable<ProtectTableColumn>,
) {
return new BulkDecryptModelsOperation<T>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Result, withResult } from '@byteslice/result'
import type {
Decrypted,
EncryptedPayload,
Encrypted,
ProtectClient,
ProtectTable,
ProtectTableColumn,
Expand All @@ -17,12 +17,12 @@ export class BulkDecryptModelsOperation<
T extends Record<string, unknown>,
> extends DynamoDBOperation<Decrypted<T>[]> {
private protectClient: ProtectClient
private items: Record<string, EncryptedPayload | unknown>[]
private items: Record<string, Encrypted | unknown>[]
private protectTable: ProtectTable<ProtectTableColumn>

constructor(
protectClient: ProtectClient,
items: Record<string, EncryptedPayload | unknown>[],
items: Record<string, Encrypted | unknown>[],
protectTable: ProtectTable<ProtectTableColumn>,
options?: DynamoDBOperationOptions,
) {
Expand Down
6 changes: 3 additions & 3 deletions packages/protect-dynamodb/src/operations/decrypt-model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Result, withResult } from '@byteslice/result'
import type {
Decrypted,
EncryptedPayload,
Encrypted,
ProtectClient,
ProtectTable,
ProtectTableColumn,
Expand All @@ -17,12 +17,12 @@ export class DecryptModelOperation<
T extends Record<string, unknown>,
> extends DynamoDBOperation<Decrypted<T>> {
private protectClient: ProtectClient
private item: Record<string, EncryptedPayload | unknown>
private item: Record<string, Encrypted | unknown>
private protectTable: ProtectTable<ProtectTableColumn>

constructor(
protectClient: ProtectClient,
item: Record<string, EncryptedPayload | unknown>,
item: Record<string, Encrypted | unknown>,
protectTable: ProtectTable<ProtectTableColumn>,
options?: DynamoDBOperationOptions,
) {
Expand Down
8 changes: 3 additions & 5 deletions packages/protect-dynamodb/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { Result } from '@byteslice/result'
import type {
Decrypted,
EncryptedPayload,
Encrypted,
ProtectClient,
ProtectTable,
ProtectTableColumn,
Expand Down Expand Up @@ -40,12 +38,12 @@ export interface ProtectDynamoDBInstance {
): BulkEncryptModelsOperation<T>

decryptModel<T extends Record<string, unknown>>(
item: Record<string, EncryptedPayload | unknown>,
item: Record<string, Encrypted | unknown>,
protectTable: ProtectTable<ProtectTableColumn>,
): DecryptModelOperation<T>

bulkDecryptModels<T extends Record<string, unknown>>(
items: Record<string, EncryptedPayload | unknown>[],
items: Record<string, Encrypted | unknown>[],
protectTable: ProtectTable<ProtectTableColumn>,
): BulkDecryptModelsOperation<T>

Expand Down
Loading