@cipherstash/stack 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/README.md +2 -2
  3. package/dist/{chunk-ZYOZHZMJ.js → chunk-36AA7IBJ.js} +151 -160
  4. package/dist/chunk-36AA7IBJ.js.map +1 -0
  5. package/dist/{chunk-VPOTNP4K.js → chunk-4AVL4VZD.js} +1 -1
  6. package/dist/chunk-4AVL4VZD.js.map +1 -0
  7. package/dist/{chunk-XWPGAHBZ.js → chunk-BNO32ZMV.js} +1 -1
  8. package/dist/chunk-BNO32ZMV.js.map +1 -0
  9. package/dist/{chunk-LLCCNKDL.js → chunk-HQANMV7R.js} +3 -3
  10. package/dist/{chunk-LLCCNKDL.js.map → chunk-HQANMV7R.js.map} +1 -1
  11. package/dist/chunk-IADZCZEA.js +23 -0
  12. package/dist/chunk-IADZCZEA.js.map +1 -0
  13. package/dist/chunk-IBSK6P33.js +209 -0
  14. package/dist/chunk-IBSK6P33.js.map +1 -0
  15. package/dist/chunk-JSG2AMDI.js +17 -0
  16. package/dist/chunk-JSG2AMDI.js.map +1 -0
  17. package/dist/chunk-MP3SSDNN.js +4439 -0
  18. package/dist/chunk-MP3SSDNN.js.map +1 -0
  19. package/dist/chunk-OFQ555AX.js +191 -0
  20. package/dist/chunk-OFQ555AX.js.map +1 -0
  21. package/dist/chunk-PZ5AY32C.js +10 -0
  22. package/dist/chunk-PZ5AY32C.js.map +1 -0
  23. package/dist/chunk-U66S7VIF.js +435 -0
  24. package/dist/chunk-U66S7VIF.js.map +1 -0
  25. package/dist/{client-Dt98Rugc.d.cts → client-DSGHBN-g.d.cts} +200 -58
  26. package/dist/{client-CIsfZ2zg.d.ts → client-DfCrlHXh.d.ts} +200 -58
  27. package/dist/client.cjs +4101 -43
  28. package/dist/client.cjs.map +1 -1
  29. package/dist/client.d.cts +5 -5
  30. package/dist/client.d.ts +5 -5
  31. package/dist/client.js +3 -1
  32. package/dist/drizzle/index.cjs +4133 -74
  33. package/dist/drizzle/index.cjs.map +1 -1
  34. package/dist/drizzle/index.d.cts +33 -33
  35. package/dist/drizzle/index.d.ts +33 -33
  36. package/dist/drizzle/index.js +35 -30
  37. package/dist/drizzle/index.js.map +1 -1
  38. package/dist/dynamodb/index.cjs +19 -12
  39. package/dist/dynamodb/index.cjs.map +1 -1
  40. package/dist/dynamodb/index.d.cts +2 -2
  41. package/dist/dynamodb/index.d.ts +2 -2
  42. package/dist/dynamodb/index.js +8 -10
  43. package/dist/dynamodb/index.js.map +1 -1
  44. package/dist/encryption/index.cjs +4448 -212
  45. package/dist/encryption/index.cjs.map +1 -1
  46. package/dist/encryption/index.d.cts +3 -3
  47. package/dist/encryption/index.d.ts +3 -3
  48. package/dist/encryption/index.js +15 -7
  49. package/dist/encryption/v3.cjs +7791 -0
  50. package/dist/encryption/v3.cjs.map +1 -0
  51. package/dist/encryption/v3.d.cts +100 -0
  52. package/dist/encryption/v3.d.ts +100 -0
  53. package/dist/encryption/v3.js +161 -0
  54. package/dist/encryption/v3.js.map +1 -0
  55. package/dist/eql/v3/index.cjs +612 -0
  56. package/dist/eql/v3/index.cjs.map +1 -0
  57. package/dist/eql/v3/index.d.cts +71 -0
  58. package/dist/eql/v3/index.d.ts +71 -0
  59. package/dist/eql/v3/index.js +89 -0
  60. package/dist/eql/v3/index.js.map +1 -0
  61. package/dist/errors/index.js +1 -0
  62. package/dist/identity/index.cjs +55 -35
  63. package/dist/identity/index.cjs.map +1 -1
  64. package/dist/identity/index.d.cts +54 -30
  65. package/dist/identity/index.d.ts +54 -30
  66. package/dist/identity/index.js +9 -177
  67. package/dist/identity/index.js.map +1 -1
  68. package/dist/index.cjs +4480 -228
  69. package/dist/index.cjs.map +1 -1
  70. package/dist/index.d.cts +18 -7
  71. package/dist/index.d.ts +18 -7
  72. package/dist/index.js +20 -5
  73. package/dist/index.js.map +1 -1
  74. package/dist/schema/index.cjs +4105 -43
  75. package/dist/schema/index.cjs.map +1 -1
  76. package/dist/schema/index.d.cts +1 -1
  77. package/dist/schema/index.d.ts +1 -1
  78. package/dist/schema/index.js +3 -1
  79. package/dist/supabase/index.cjs +4500 -75
  80. package/dist/supabase/index.cjs.map +1 -1
  81. package/dist/supabase/index.d.cts +113 -34
  82. package/dist/supabase/index.d.ts +113 -34
  83. package/dist/supabase/index.js +350 -32
  84. package/dist/supabase/index.js.map +1 -1
  85. package/dist/table-CIH7jZ2h.d.ts +603 -0
  86. package/dist/table-DihEAlxG.d.cts +603 -0
  87. package/dist/{types-public-BTxqjmtv.d.ts → types-public-CpS5KjwX.d.cts} +250 -92
  88. package/dist/{types-public-BTxqjmtv.d.cts → types-public-CpS5KjwX.d.ts} +250 -92
  89. package/dist/types-public.cjs.map +1 -1
  90. package/dist/types-public.d.cts +2 -2
  91. package/dist/types-public.d.ts +2 -2
  92. package/dist/types-public.js +2 -1
  93. package/dist/wasm-inline.d.ts +1269 -0
  94. package/dist/wasm-inline.js +4594 -0
  95. package/dist/wasm-inline.js.map +1 -0
  96. package/package.json +54 -4
  97. package/dist/chunk-VPOTNP4K.js.map +0 -1
  98. package/dist/chunk-XWPGAHBZ.js.map +0 -1
  99. package/dist/chunk-YWQXTZ5M.js +0 -383
  100. package/dist/chunk-YWQXTZ5M.js.map +0 -1
  101. package/dist/chunk-ZYOZHZMJ.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { h as EncryptedQueryResult, i as Client, S as ScalarQueryTerm, B as BulkDecryptedData, j as BulkDecryptPayload, D as Decrypted, k as BulkEncryptedData, l as BulkEncryptPayload, m as EncryptOptions, f as EncryptedColumn, n as EncryptedField, c as EncryptedTable, d as EncryptedTableColumn, E as Encrypted, o as EncryptQueryOptions, Q as QueryTypeName, p as EncryptedReturnType, q as EncryptConfig, K as KeysetIdentifier, r as EncryptedFromSchema, s as EncryptionClientConfig } from './types-public-BTxqjmtv.js';
2
- import { EncryptionError } from './errors/index.js';
3
1
  import { Result } from '@byteslice/result';
4
- import { JsPlaintext } from '@cipherstash/protect-ffi';
5
- import { LockContext } from './identity/index.js';
2
+ import { EncryptionError } from './errors/index.js';
3
+ import { n as EncryptedQueryResult, o as Client, S as ScalarQueryTerm, p as BulkDecryptedData, c as BulkDecryptPayload, D as Decrypted, q as BulkEncryptedData, B as BulkEncryptPayload, b as EncryptOptions, r as BuildableColumn, s as BuildableTable, a as Encrypted, P as Plaintext, t as EncryptQueryOptions, u as BuildableQueryColumn, Q as QueryTypeName, E as EncryptedReturnType, j as EncryptConfig, K as KeysetIdentifier, v as EncryptedFromBuildableTable, w as EncryptionClientConfig } from './types-public-CpS5KjwX.js';
4
+ import { LockContextInput } from './identity/index.js';
5
+ import { JsPlaintext, AuthStrategy } from '@cipherstash/protect-ffi';
6
6
 
7
7
  type AuditConfig = {
8
8
  metadata?: Record<string, unknown>;
@@ -36,14 +36,14 @@ declare class BatchEncryptQueryOperation extends EncryptionOperation<EncryptedQu
36
36
  private client;
37
37
  private terms;
38
38
  constructor(client: Client, terms: readonly ScalarQueryTerm[]);
39
- withLockContext(lockContext: LockContext): BatchEncryptQueryOperationWithLockContext;
39
+ withLockContext(lockContext: LockContextInput): BatchEncryptQueryOperationWithLockContext;
40
40
  execute(): Promise<Result<EncryptedQueryResult[], EncryptionError>>;
41
41
  }
42
42
  declare class BatchEncryptQueryOperationWithLockContext extends EncryptionOperation<EncryptedQueryResult[]> {
43
43
  private client;
44
44
  private terms;
45
45
  private lockContext;
46
- constructor(client: Client, terms: readonly ScalarQueryTerm[], lockContext: LockContext, auditMetadata?: Record<string, unknown>);
46
+ constructor(client: Client, terms: readonly ScalarQueryTerm[], lockContext: LockContextInput, auditMetadata?: Record<string, unknown>);
47
47
  execute(): Promise<Result<EncryptedQueryResult[], EncryptionError>>;
48
48
  }
49
49
 
@@ -51,7 +51,7 @@ declare class BulkDecryptOperation extends EncryptionOperation<BulkDecryptedData
51
51
  private client;
52
52
  private encryptedPayloads;
53
53
  constructor(client: Client, encryptedPayloads: BulkDecryptPayload);
54
- withLockContext(lockContext: LockContext): BulkDecryptOperationWithLockContext;
54
+ withLockContext(lockContext: LockContextInput): BulkDecryptOperationWithLockContext;
55
55
  execute(): Promise<Result<BulkDecryptedData, EncryptionError>>;
56
56
  getOperation(): {
57
57
  client: Client;
@@ -61,7 +61,7 @@ declare class BulkDecryptOperation extends EncryptionOperation<BulkDecryptedData
61
61
  declare class BulkDecryptOperationWithLockContext extends EncryptionOperation<BulkDecryptedData> {
62
62
  private operation;
63
63
  private lockContext;
64
- constructor(operation: BulkDecryptOperation, lockContext: LockContext);
64
+ constructor(operation: BulkDecryptOperation, lockContext: LockContextInput);
65
65
  execute(): Promise<Result<BulkDecryptedData, EncryptionError>>;
66
66
  }
67
67
 
@@ -69,7 +69,7 @@ declare class BulkDecryptModelsOperation<T extends Record<string, unknown>> exte
69
69
  private client;
70
70
  private models;
71
71
  constructor(client: Client, models: T[]);
72
- withLockContext(lockContext: LockContext): BulkDecryptModelsOperationWithLockContext<T>;
72
+ withLockContext(lockContext: LockContextInput): BulkDecryptModelsOperationWithLockContext<T>;
73
73
  execute(): Promise<Result<Decrypted<T>[], EncryptionError>>;
74
74
  getOperation(): {
75
75
  client: Client;
@@ -79,7 +79,7 @@ declare class BulkDecryptModelsOperation<T extends Record<string, unknown>> exte
79
79
  declare class BulkDecryptModelsOperationWithLockContext<T extends Record<string, unknown>> extends EncryptionOperation<Decrypted<T>[]> {
80
80
  private operation;
81
81
  private lockContext;
82
- constructor(operation: BulkDecryptModelsOperation<T>, lockContext: LockContext);
82
+ constructor(operation: BulkDecryptModelsOperation<T>, lockContext: LockContextInput);
83
83
  execute(): Promise<Result<Decrypted<T>[], EncryptionError>>;
84
84
  }
85
85
 
@@ -89,19 +89,19 @@ declare class BulkEncryptOperation extends EncryptionOperation<BulkEncryptedData
89
89
  private column;
90
90
  private table;
91
91
  constructor(client: Client, plaintexts: BulkEncryptPayload, opts: EncryptOptions);
92
- withLockContext(lockContext: LockContext): BulkEncryptOperationWithLockContext;
92
+ withLockContext(lockContext: LockContextInput): BulkEncryptOperationWithLockContext;
93
93
  execute(): Promise<Result<BulkEncryptedData, EncryptionError>>;
94
94
  getOperation(): {
95
95
  client: Client;
96
96
  plaintexts: BulkEncryptPayload;
97
- column: EncryptedColumn | EncryptedField;
98
- table: EncryptedTable<EncryptedTableColumn>;
97
+ column: BuildableColumn;
98
+ table: BuildableTable;
99
99
  };
100
100
  }
101
101
  declare class BulkEncryptOperationWithLockContext extends EncryptionOperation<BulkEncryptedData> {
102
102
  private operation;
103
103
  private lockContext;
104
- constructor(operation: BulkEncryptOperation, lockContext: LockContext);
104
+ constructor(operation: BulkEncryptOperation, lockContext: LockContextInput);
105
105
  execute(): Promise<Result<BulkEncryptedData, EncryptionError>>;
106
106
  }
107
107
 
@@ -109,19 +109,19 @@ declare class BulkEncryptModelsOperation<T extends Record<string, unknown>> exte
109
109
  private client;
110
110
  private models;
111
111
  private table;
112
- constructor(client: Client, models: Record<string, unknown>[], table: EncryptedTable<EncryptedTableColumn>);
113
- withLockContext(lockContext: LockContext): BulkEncryptModelsOperationWithLockContext<T>;
112
+ constructor(client: Client, models: Record<string, unknown>[], table: BuildableTable);
113
+ withLockContext(lockContext: LockContextInput): BulkEncryptModelsOperationWithLockContext<T>;
114
114
  execute(): Promise<Result<T[], EncryptionError>>;
115
115
  getOperation(): {
116
116
  client: Client;
117
117
  models: Record<string, unknown>[];
118
- table: EncryptedTable<EncryptedTableColumn>;
118
+ table: BuildableTable;
119
119
  };
120
120
  }
121
121
  declare class BulkEncryptModelsOperationWithLockContext<T extends Record<string, unknown>> extends EncryptionOperation<T[]> {
122
122
  private operation;
123
123
  private lockContext;
124
- constructor(operation: BulkEncryptModelsOperation<T>, lockContext: LockContext);
124
+ constructor(operation: BulkEncryptModelsOperation<T>, lockContext: LockContextInput);
125
125
  execute(): Promise<Result<T[], EncryptionError>>;
126
126
  }
127
127
 
@@ -133,7 +133,7 @@ declare class DecryptOperation extends EncryptionOperation<JsPlaintext> {
133
133
  private client;
134
134
  private encryptedData;
135
135
  constructor(client: Client, encryptedData: Encrypted | null);
136
- withLockContext(lockContext: LockContext): DecryptOperationWithLockContext;
136
+ withLockContext(lockContext: LockContextInput): DecryptOperationWithLockContext;
137
137
  execute(): Promise<Result<JsPlaintext, EncryptionError>>;
138
138
  getOperation(): {
139
139
  client: Client;
@@ -144,7 +144,7 @@ declare class DecryptOperation extends EncryptionOperation<JsPlaintext> {
144
144
  declare class DecryptOperationWithLockContext extends EncryptionOperation<JsPlaintext> {
145
145
  private operation;
146
146
  private lockContext;
147
- constructor(operation: DecryptOperation, lockContext: LockContext);
147
+ constructor(operation: DecryptOperation, lockContext: LockContextInput);
148
148
  execute(): Promise<Result<JsPlaintext, EncryptionError>>;
149
149
  }
150
150
 
@@ -152,7 +152,7 @@ declare class DecryptModelOperation<T extends Record<string, unknown>> extends E
152
152
  private client;
153
153
  private model;
154
154
  constructor(client: Client, model: T);
155
- withLockContext(lockContext: LockContext): DecryptModelOperationWithLockContext<T>;
155
+ withLockContext(lockContext: LockContextInput): DecryptModelOperationWithLockContext<T>;
156
156
  execute(): Promise<Result<Decrypted<T>, EncryptionError>>;
157
157
  getOperation(): {
158
158
  client: Client;
@@ -162,7 +162,7 @@ declare class DecryptModelOperation<T extends Record<string, unknown>> extends E
162
162
  declare class DecryptModelOperationWithLockContext<T extends Record<string, unknown>> extends EncryptionOperation<Decrypted<T>> {
163
163
  private operation;
164
164
  private lockContext;
165
- constructor(operation: DecryptModelOperation<T>, lockContext: LockContext);
165
+ constructor(operation: DecryptModelOperation<T>, lockContext: LockContextInput);
166
166
  execute(): Promise<Result<Decrypted<T>, EncryptionError>>;
167
167
  }
168
168
 
@@ -171,20 +171,20 @@ declare class EncryptOperation extends EncryptionOperation<Encrypted> {
171
171
  private plaintext;
172
172
  private column;
173
173
  private table;
174
- constructor(client: Client, plaintext: JsPlaintext | null, opts: EncryptOptions);
175
- withLockContext(lockContext: LockContext): EncryptOperationWithLockContext;
174
+ constructor(client: Client, plaintext: Plaintext | null, opts: EncryptOptions);
175
+ withLockContext(lockContext: LockContextInput): EncryptOperationWithLockContext;
176
176
  execute(): Promise<Result<Encrypted, EncryptionError>>;
177
177
  getOperation(): {
178
178
  client: Client;
179
- plaintext: JsPlaintext | null;
180
- column: EncryptedColumn | EncryptedField;
181
- table: EncryptedTable<EncryptedTableColumn>;
179
+ plaintext: Plaintext | null;
180
+ column: BuildableColumn;
181
+ table: BuildableTable;
182
182
  };
183
183
  }
184
184
  declare class EncryptOperationWithLockContext extends EncryptionOperation<Encrypted> {
185
185
  private operation;
186
186
  private lockContext;
187
- constructor(operation: EncryptOperation, lockContext: LockContext);
187
+ constructor(operation: EncryptOperation, lockContext: LockContextInput);
188
188
  execute(): Promise<Result<Encrypted, EncryptionError>>;
189
189
  }
190
190
 
@@ -192,19 +192,19 @@ declare class EncryptModelOperation<T extends Record<string, unknown>> extends E
192
192
  private client;
193
193
  private model;
194
194
  private table;
195
- constructor(client: Client, model: Record<string, unknown>, table: EncryptedTable<EncryptedTableColumn>);
196
- withLockContext(lockContext: LockContext): EncryptModelOperationWithLockContext<T>;
195
+ constructor(client: Client, model: Record<string, unknown>, table: BuildableTable);
196
+ withLockContext(lockContext: LockContextInput): EncryptModelOperationWithLockContext<T>;
197
197
  execute(): Promise<Result<T, EncryptionError>>;
198
198
  getOperation(): {
199
199
  client: Client;
200
200
  model: Record<string, unknown>;
201
- table: EncryptedTable<EncryptedTableColumn>;
201
+ table: BuildableTable;
202
202
  };
203
203
  }
204
204
  declare class EncryptModelOperationWithLockContext<T extends Record<string, unknown>> extends EncryptionOperation<T> {
205
205
  private operation;
206
206
  private lockContext;
207
- constructor(operation: EncryptModelOperation<T>, lockContext: LockContext);
207
+ constructor(operation: EncryptModelOperation<T>, lockContext: LockContextInput);
208
208
  execute(): Promise<Result<T, EncryptionError>>;
209
209
  }
210
210
 
@@ -212,16 +212,16 @@ declare class EncryptQueryOperation extends EncryptionOperation<EncryptedQueryRe
212
212
  private client;
213
213
  private plaintext;
214
214
  private opts;
215
- constructor(client: Client, plaintext: JsPlaintext | null | undefined, opts: EncryptQueryOptions);
216
- withLockContext(lockContext: LockContext): EncryptQueryOperationWithLockContext;
215
+ constructor(client: Client, plaintext: Plaintext | null | undefined, opts: EncryptQueryOptions);
216
+ withLockContext(lockContext: LockContextInput): EncryptQueryOperationWithLockContext;
217
217
  execute(): Promise<Result<EncryptedQueryResult, EncryptionError>>;
218
218
  getOperation(): {
219
- column: EncryptedColumn;
220
- table: EncryptedTable<EncryptedTableColumn>;
219
+ column: BuildableQueryColumn;
220
+ table: BuildableTable;
221
221
  queryType?: QueryTypeName;
222
222
  returnType?: EncryptedReturnType;
223
223
  client: Client;
224
- plaintext: JsPlaintext | null | undefined;
224
+ plaintext: Plaintext | null | undefined;
225
225
  };
226
226
  }
227
227
  declare class EncryptQueryOperationWithLockContext extends EncryptionOperation<EncryptedQueryResult> {
@@ -229,11 +229,32 @@ declare class EncryptQueryOperationWithLockContext extends EncryptionOperation<E
229
229
  private plaintext;
230
230
  private opts;
231
231
  private lockContext;
232
- constructor(client: Client, plaintext: JsPlaintext | null | undefined, opts: EncryptQueryOptions, lockContext: LockContext, auditMetadata?: Record<string, unknown>);
232
+ constructor(client: Client, plaintext: Plaintext | null | undefined, opts: EncryptQueryOptions, lockContext: LockContextInput, auditMetadata?: Record<string, unknown>);
233
233
  execute(): Promise<Result<EncryptedQueryResult, EncryptionError>>;
234
234
  }
235
235
 
236
236
  declare const noClientError: () => Error;
237
+ /**
238
+ * Resolve the EQL wire version for a client from its schema set.
239
+ *
240
+ * One FFI client emits exactly one wire format, so the whole schema set must
241
+ * agree. EQL v3 tables (from `@cipherstash/stack/v3`) are detected by their
242
+ * `buildColumnKeyMap()` marker — v2 tables don't have one:
243
+ *
244
+ * - every schema is v3 → `3`;
245
+ * - no schema is v3 → `undefined`, leaving the FFI's v2 default (and its
246
+ * byte-identical v2 output) untouched;
247
+ * - a mix of the two → throws: the v2 tables target `eql_v2_encrypted`
248
+ * columns and the v3 tables target `eql_v3` domains, so no single wire
249
+ * format serves both. Split them across two clients.
250
+ *
251
+ * An explicit `config.eqlVersion` bypasses detection (the wire format is
252
+ * then unambiguous — e.g. writing v2-wire from a v3 schema set during a
253
+ * migration), but a mixed schema set still throws.
254
+ *
255
+ * @internal exported for unit-test coverage of the detection matrix.
256
+ */
257
+ declare function resolveEqlVersion(schemas: readonly BuildableTable[], explicit?: 2 | 3): 2 | 3 | undefined;
237
258
  /** The EncryptionClient is the main entry point for interacting with the CipherStash Encryption library.
238
259
  * It provides methods for encrypting and decrypting individual values, as well as models (objects) and bulk operations.
239
260
  *
@@ -255,6 +276,8 @@ declare class EncryptionClient {
255
276
  clientId?: string;
256
277
  clientKey?: string;
257
278
  keyset?: KeysetIdentifier;
279
+ authStrategy?: AuthStrategy;
280
+ eqlVersion?: 2 | 3;
258
281
  }): Promise<Result<EncryptionClient, EncryptionError>>;
259
282
  /**
260
283
  * Encrypt a value - returns a promise which resolves to an encrypted value.
@@ -331,7 +354,7 @@ declare class EncryptionClient {
331
354
  * @see {@link LockContext}
332
355
  * @see {@link EncryptOperation}
333
356
  */
334
- encrypt(plaintext: JsPlaintext, opts: EncryptOptions): EncryptOperation;
357
+ encrypt(plaintext: Plaintext, opts: EncryptOptions): EncryptOperation;
335
358
  /**
336
359
  * Encrypt a query value - returns a promise which resolves to an encrypted query value.
337
360
  *
@@ -385,7 +408,7 @@ declare class EncryptionClient {
385
408
  * - String plaintext → `steVecSelector` (JSONPath queries like `'$.user.email'`)
386
409
  * - Object/Array plaintext → `steVecTerm` (containment queries like `{ role: 'admin' }`)
387
410
  */
388
- encryptQuery(plaintext: JsPlaintext, opts: EncryptQueryOptions): EncryptQueryOperation;
411
+ encryptQuery(plaintext: Plaintext, opts: EncryptQueryOptions): EncryptQueryOperation;
389
412
  /**
390
413
  * Encrypt multiple values for use in queries (batch operation).
391
414
  * @param terms - Array of query terms to encrypt
@@ -477,7 +500,7 @@ declare class EncryptionClient {
477
500
  * }
478
501
  * ```
479
502
  */
480
- encryptModel<T extends Record<string, unknown>, S extends EncryptedTableColumn = EncryptedTableColumn>(input: T, table: EncryptedTable<S>): EncryptModelOperation<EncryptedFromSchema<T, S>>;
503
+ encryptModel<T extends Record<string, unknown>, Table extends BuildableTable>(input: T, table: Table): EncryptModelOperation<EncryptedFromBuildableTable<T, Table>>;
481
504
  /**
482
505
  * Decrypt a model (object) whose fields contain encrypted values.
483
506
  *
@@ -552,7 +575,7 @@ declare class EncryptionClient {
552
575
  * }
553
576
  * ```
554
577
  */
555
- bulkEncryptModels<T extends Record<string, unknown>, S extends EncryptedTableColumn = EncryptedTableColumn>(input: Array<T>, table: EncryptedTable<S>): BulkEncryptModelsOperation<EncryptedFromSchema<T, S>>;
578
+ bulkEncryptModels<T extends Record<string, unknown>, Table extends BuildableTable>(input: Array<T>, table: Table): BulkEncryptModelsOperation<EncryptedFromBuildableTable<T, Table>>;
556
579
  /**
557
580
  * Decrypt multiple models (objects) in a single bulk operation.
558
581
  *
@@ -657,36 +680,155 @@ declare class EncryptionClient {
657
680
  */
658
681
  getEncryptConfig(): EncryptConfig | undefined;
659
682
  }
683
+ /**
684
+ * Reset the once-per-process deprecation-warning latch. Test-only hook so
685
+ * suites can assert the warning fires deterministically, independent of test
686
+ * ordering. Not re-exported from the package entry, so it stays off the public
687
+ * API surface.
688
+ * @internal
689
+ */
690
+ declare function __resetStrategyDeprecationWarningForTests(): void;
660
691
  /**
661
692
  * Creates and initializes an Encryption client for encrypting and decrypting data with CipherStash.
662
693
  *
663
694
  * Provide at least one schema (from {@link encryptedTable}) so the client knows which tables and
664
- * columns to use. Credentials are read from the optional `config` or from the environment
665
- * (`CS_WORKSPACE_CRN`, `CS_CLIENT_ID`, `CS_CLIENT_KEY`, `CS_CLIENT_ACCESS_KEY`).
666
- *
667
- * @param config - Initialization options. Must include `schemas`; optionally include `config` for
668
- * workspace/keys. Logging is configured via the `STASH_STACK_LOG` environment variable
669
- * (`debug | info | error`, default: `error`).
670
- * @returns A Promise that resolves to an initialized {@link EncryptionClient} ready for
671
- * {@link EncryptionClient.encrypt}, {@link EncryptionClient.decrypt}, and related operations.
672
- *
673
- * @throws Throws if `schemas` is empty, or if a keyset `id` is supplied but is not a valid UUID.
674
- * Also throws if the client fails to initialize (e.g. invalid credentials or config).
695
+ * columns to use:
675
696
  *
676
- * @example
677
697
  * ```typescript
678
698
  * import { Encryption, encryptedTable, encryptedColumn } from "@cipherstash/stack"
679
699
  *
680
- * const users = encryptedTable("users", {
681
- * email: encryptedColumn("email"),
682
- * })
700
+ * const users = encryptedTable("users", { email: encryptedColumn("email") })
683
701
  * const client = await Encryption({ schemas: [users] })
684
702
  * const result = await client.encrypt("alice@example.com", { column: users.email, table: users })
685
703
  * ```
686
704
  *
705
+ * ## Authentication
706
+ *
707
+ * The snippets in this section reuse the `users` schema from the example above, and
708
+ * `workspaceCrn` / `accessKey` stand in for your own workspace credentials (from the
709
+ * [dashboard](https://dashboard.cipherstash.com) or the `CS_*` variables below).
710
+ *
711
+ * By default the client uses the `auto` auth strategy. `auto` first looks for the `CS_*`
712
+ * environment variables (see below) and, if they are not set, falls back to the local **dev
713
+ * profile** on your machine. The dev profile also supplies the client key, so during local
714
+ * development you generally don't need to set any environment variables at all.
715
+ *
716
+ * ### Local development — create a dev profile
717
+ *
718
+ * Log in once to create the dev profile that `auto` picks up automatically:
719
+ *
720
+ * ```bash
721
+ * npx stash auth login
722
+ * ```
723
+ *
724
+ * ### Production / CI — environment variables
725
+ *
726
+ * In production and CI you typically authenticate with the four `CS_*` environment variables
727
+ * instead of a dev profile. Developers can obtain these values from the
728
+ * [CipherStash dashboard](https://dashboard.cipherstash.com):
729
+ *
730
+ * | Environment variable | Description |
731
+ * | ---------------------- | ------------------------------------------------------------------------------ |
732
+ * | `CS_WORKSPACE_CRN` | The workspace Cloud Resource Name (CRN) that identifies your workspace. |
733
+ * | `CS_CLIENT_ID` | The client identifier issued when you create an access key. |
734
+ * | `CS_CLIENT_KEY` | The client key material combined with ZeroKMS to perform encryption. |
735
+ * | `CS_CLIENT_ACCESS_KEY` | The API access key used to authenticate requests to CipherStash. |
736
+ *
737
+ * When these are set, `auto` uses them in preference to the local dev profile.
738
+ *
739
+ * ### Custom auth strategies — `config.authStrategy`
740
+ *
741
+ * For finer control, pass an explicit strategy via `config.authStrategy` (from `@cipherstash/auth`,
742
+ * re-exported by `@cipherstash/stack`). See the `@cipherstash/auth` package for the full list. Two
743
+ * common choices:
744
+ *
745
+ * `AccessKeyStrategy` — like `auto`, but only ever uses an access key; it never falls back to the
746
+ * local dev profile. Ideal for services and CI:
747
+ *
748
+ * ```typescript
749
+ * import { Encryption, AccessKeyStrategy } from "@cipherstash/stack"
750
+ *
751
+ * const client = await Encryption({
752
+ * schemas: [users],
753
+ * config: {
754
+ * authStrategy: AccessKeyStrategy.create(workspaceCrn, accessKey),
755
+ * },
756
+ * })
757
+ * ```
758
+ *
759
+ * `OidcFederationStrategy` — authenticate end users through your own identity provider (Supabase,
760
+ * Clerk, Auth0 or Okta) by federating their OIDC JWT into a CipherStash token. Add the provider to
761
+ * your workspace first at
762
+ * [dashboard.cipherstash.com/workspaces/_/oidc-providers](https://dashboard.cipherstash.com/workspaces/_/oidc-providers)
763
+ * (the `_` in the URL resolves to whichever workspace you select):
764
+ *
765
+ * ```typescript
766
+ * import { Encryption, OidcFederationStrategy } from "@cipherstash/stack"
767
+ *
768
+ * // Authenticate every ZeroKMS request as the signed-in user.
769
+ * const client = await Encryption({
770
+ * schemas: [users],
771
+ * config: {
772
+ * authStrategy: OidcFederationStrategy.create(workspaceCrn, () => getUserJwt()),
773
+ * },
774
+ * })
775
+ * ```
776
+ *
777
+ * ### Lock context (identity-bound encryption)
778
+ *
779
+ * Lock context is an **additional** capability layered on top of `OidcFederationStrategy`: it
780
+ * requires that strategy, but `OidcFederationStrategy` does not require lock context. It binds a
781
+ * value to a claim from the user's JWT (typically `sub`) so that only the user who encrypted a
782
+ * value can decrypt it:
783
+ *
784
+ * ```typescript
785
+ * // Bind the data key to the user's `sub` claim.
786
+ * const result = await client
787
+ * .encrypt("alice@example.com", { column: users.email, table: users })
788
+ * .withLockContext({ identityClaim: ["sub"] })
789
+ * ```
790
+ *
791
+ * Because the lock is tied to a specific end user's identity, `AccessKeyStrategy` (which
792
+ * authenticates a service, not a user) is not valid for lock context — there is no user `sub`
793
+ * claim to bind to.
794
+ *
795
+ * ## Keysets (multi-tenant isolation)
796
+ *
797
+ * Pass `config.keyset` to encrypt under a specific **keyset** — a named or UUID-identified keyspace
798
+ * that gives each tenant its own cryptographic isolation, so data encrypted under one keyset cannot
799
+ * be decrypted under another. Create and manage keysets in the
800
+ * [dashboard](https://dashboard.cipherstash.com/workspaces/_/keysets) (the `_` in the URL resolves
801
+ * to whichever workspace you select); omit `config.keyset` to use the workspace's default keyset.
802
+ *
803
+ * ```typescript
804
+ * // `users` is the schema from the first example above.
805
+ * const client = await Encryption({
806
+ * schemas: [users],
807
+ * config: {
808
+ * keyset: { name: "tenant-a" }, // or { id: "<uuid>" }
809
+ * },
810
+ * })
811
+ * ```
812
+ *
813
+ * A client is bound to a single keyset for its lifetime, so multi-tenant applications use **one
814
+ * `Encryption()` client per tenant**. Keysets are orthogonal to `authStrategy` and lock context —
815
+ * they isolate a whole tenant's *keyspace* (coarse, fixed per client), whereas lock context binds
816
+ * an individual value to a user's identity claim (fine-grained, per operation) — and can be
817
+ * combined with both.
818
+ *
819
+ * @param config - Initialization options. Must include `schemas`; optionally include `config` for
820
+ * credentials and authentication. Logging is configured via the `STASH_STACK_LOG` environment
821
+ * variable (`debug | info | error`, default: `error`).
822
+ * @returns A Promise that resolves to an initialized {@link EncryptionClient} ready for
823
+ * {@link EncryptionClient.encrypt}, {@link EncryptionClient.decrypt}, and related operations.
824
+ *
825
+ * @throws Throws if `schemas` is empty, or if a keyset `id` is supplied but is not a valid UUID.
826
+ * Also throws if the client fails to initialize (e.g. invalid credentials or config).
827
+ *
687
828
  * @see {@link EncryptionClientConfig} for full config options.
829
+ * @see {@link ClientConfig.authStrategy} for the auth strategy field.
688
830
  * @see {@link EncryptionClient} for available methods after initialization.
689
831
  */
690
832
  declare const Encryption: (config: EncryptionClientConfig) => Promise<EncryptionClient>;
691
833
 
692
- export { type AuditConfig as A, BatchEncryptQueryOperation as B, DecryptModelOperation as D, Encryption as E, EncryptionClient as a, BulkDecryptModelsOperation as b, BulkDecryptOperation as c, BulkEncryptModelsOperation as d, BulkEncryptOperation as e, DecryptOperation as f, EncryptModelOperation as g, EncryptOperation as h, EncryptQueryOperation as i, noClientError as n };
834
+ export { type AuditConfig as A, BulkEncryptModelsOperation as B, DecryptOperation as D, EncryptOperation as E, __resetStrategyDeprecationWarningForTests as _, EncryptQueryOperation as a, EncryptModelOperation as b, BulkEncryptOperation as c, BulkDecryptOperation as d, EncryptionClient as e, Encryption as f, BatchEncryptQueryOperation as g, BulkDecryptModelsOperation as h, DecryptModelOperation as i, noClientError as n, resolveEqlVersion as r };