@cipherstash/stack 0.3.0 → 0.5.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 (93) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +10 -37
  3. package/dist/bin/stash.js +261 -320
  4. package/dist/bin/stash.js.map +1 -1
  5. package/dist/{chunk-SUYMGQBY.js → chunk-4RNBI3UH.js} +1 -7
  6. package/dist/chunk-4RNBI3UH.js.map +1 -0
  7. package/dist/{chunk-OAPLZLR5.js → chunk-GXGEW6T4.js} +2 -76
  8. package/dist/chunk-GXGEW6T4.js.map +1 -0
  9. package/dist/{chunk-JLI27P46.js → chunk-HCL75LXQ.js} +1 -1
  10. package/dist/chunk-HCL75LXQ.js.map +1 -0
  11. package/dist/chunk-LBMC4D6D.js +19 -0
  12. package/dist/chunk-LBMC4D6D.js.map +1 -0
  13. package/dist/chunk-Q5FTQLYG.js +68 -0
  14. package/dist/chunk-Q5FTQLYG.js.map +1 -0
  15. package/dist/{chunk-MW6D52V2.js → chunk-TGUELLJS.js} +58 -150
  16. package/dist/chunk-TGUELLJS.js.map +1 -0
  17. package/dist/{chunk-TBAIVO6T.js → chunk-Y35W4WFN.js} +6 -6
  18. package/dist/chunk-Y35W4WFN.js.map +1 -0
  19. package/dist/chunk-YLISU7FD.js +357 -0
  20. package/dist/chunk-YLISU7FD.js.map +1 -0
  21. package/dist/{client-Bf0Xw2xo.d.cts → client-BFrHTgC6.d.ts} +50 -18
  22. package/dist/{client-Kfp8OsPB.d.ts → client-BVQvgvdY.d.cts} +50 -18
  23. package/dist/client.cjs +5 -5
  24. package/dist/client.cjs.map +1 -1
  25. package/dist/client.d.cts +4 -4
  26. package/dist/client.d.ts +4 -4
  27. package/dist/client.js +1 -1
  28. package/dist/drizzle/index.cjs +5 -5
  29. package/dist/drizzle/index.cjs.map +1 -1
  30. package/dist/drizzle/index.d.cts +14 -6
  31. package/dist/drizzle/index.d.ts +14 -6
  32. package/dist/drizzle/index.js +4 -4
  33. package/dist/drizzle/index.js.map +1 -1
  34. package/dist/dynamodb/index.cjs +68 -0
  35. package/dist/dynamodb/index.cjs.map +1 -1
  36. package/dist/dynamodb/index.d.cts +4 -4
  37. package/dist/dynamodb/index.d.ts +4 -4
  38. package/dist/dynamodb/index.js +9 -0
  39. package/dist/dynamodb/index.js.map +1 -1
  40. package/dist/encryption/index.cjs +2572 -0
  41. package/dist/encryption/index.cjs.map +1 -0
  42. package/dist/encryption/index.d.cts +7 -0
  43. package/dist/encryption/index.d.ts +7 -0
  44. package/dist/encryption/index.js +17 -0
  45. package/dist/encryption/index.js.map +1 -0
  46. package/dist/errors/index.cjs +44 -0
  47. package/dist/errors/index.cjs.map +1 -0
  48. package/dist/errors/index.d.cts +94 -0
  49. package/dist/errors/index.d.ts +94 -0
  50. package/dist/errors/index.js +9 -0
  51. package/dist/errors/index.js.map +1 -0
  52. package/dist/identity/index.cjs +21 -13
  53. package/dist/identity/index.cjs.map +1 -1
  54. package/dist/identity/index.d.cts +78 -2
  55. package/dist/identity/index.d.ts +78 -2
  56. package/dist/identity/index.js +7 -3
  57. package/dist/identity/index.js.map +1 -1
  58. package/dist/index.cjs +425 -182
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.d.cts +21 -19
  61. package/dist/index.d.ts +21 -19
  62. package/dist/index.js +15 -9
  63. package/dist/schema/index.cjs +5 -5
  64. package/dist/schema/index.cjs.map +1 -1
  65. package/dist/schema/index.d.cts +1 -2
  66. package/dist/schema/index.d.ts +1 -2
  67. package/dist/schema/index.js +1 -1
  68. package/dist/secrets/index.cjs +116 -180
  69. package/dist/secrets/index.cjs.map +1 -1
  70. package/dist/secrets/index.d.cts +4 -6
  71. package/dist/secrets/index.d.ts +4 -6
  72. package/dist/secrets/index.js +9 -318
  73. package/dist/secrets/index.js.map +1 -1
  74. package/dist/supabase/index.cjs +86 -3
  75. package/dist/supabase/index.cjs.map +1 -1
  76. package/dist/supabase/index.d.cts +4 -4
  77. package/dist/supabase/index.d.ts +4 -4
  78. package/dist/supabase/index.js +26 -3
  79. package/dist/supabase/index.js.map +1 -1
  80. package/dist/{types-public-0CzBV45X.d.cts → types-public-dKxDzTIL.d.cts} +47 -34
  81. package/dist/{types-public-0CzBV45X.d.ts → types-public-dKxDzTIL.d.ts} +47 -34
  82. package/dist/types-public.cjs.map +1 -1
  83. package/dist/types-public.d.cts +1 -2
  84. package/dist/types-public.d.ts +1 -2
  85. package/dist/types-public.js +1 -1
  86. package/package.json +30 -2
  87. package/dist/chunk-JLI27P46.js.map +0 -1
  88. package/dist/chunk-MW6D52V2.js.map +0 -1
  89. package/dist/chunk-OAPLZLR5.js.map +0 -1
  90. package/dist/chunk-SUYMGQBY.js.map +0 -1
  91. package/dist/chunk-TBAIVO6T.js.map +0 -1
  92. package/dist/index-9-Ya3fDK.d.cts +0 -169
  93. package/dist/index-9-Ya3fDK.d.ts +0 -169
@@ -2,26 +2,30 @@ import {
2
2
  formatEncryptedResult,
3
3
  isEncryptedPayload,
4
4
  toFfiKeysetIdentifier
5
- } from "./chunk-SUYMGQBY.js";
5
+ } from "./chunk-4RNBI3UH.js";
6
+ import {
7
+ buildEncryptConfig,
8
+ encryptConfigSchema
9
+ } from "./chunk-Y35W4WFN.js";
6
10
  import {
7
11
  queryTypeToFfi,
8
12
  queryTypeToQueryOp
9
- } from "./chunk-JLI27P46.js";
13
+ } from "./chunk-HCL75LXQ.js";
14
+ import {
15
+ loadWorkSpaceId
16
+ } from "./chunk-GXGEW6T4.js";
10
17
  import {
11
- EncryptionErrorTypes,
12
18
  createRequestLogger,
13
- initStackLogger,
14
- loadWorkSpaceId,
15
19
  logger
16
- } from "./chunk-OAPLZLR5.js";
20
+ } from "./chunk-Q5FTQLYG.js";
17
21
  import {
18
- buildEncryptConfig,
19
- encryptConfigSchema
20
- } from "./chunk-TBAIVO6T.js";
22
+ EncryptionErrorTypes
23
+ } from "./chunk-LBMC4D6D.js";
21
24
 
22
25
  // src/encryption/index.ts
23
26
  import { withResult as withResult11 } from "@byteslice/result";
24
27
  import { newClient } from "@cipherstash/protect-ffi";
28
+ import { validate as uuidValidate } from "uuid";
25
29
 
26
30
  // src/encryption/helpers/type-guards.ts
27
31
  function isScalarQueryTermArray(value) {
@@ -167,18 +171,6 @@ var EncryptionOperation = class {
167
171
  };
168
172
 
169
173
  // src/encryption/operations/batch-encrypt-query.ts
170
- function filterNullTerms(terms) {
171
- const nullIndices = /* @__PURE__ */ new Set();
172
- const nonNullTerms = [];
173
- terms.forEach((term, index) => {
174
- if (term.value === null || term.value === void 0) {
175
- nullIndices.add(index);
176
- } else {
177
- nonNullTerms.push({ term, originalIndex: index });
178
- }
179
- });
180
- return { nullIndices, nonNullTerms };
181
- }
182
174
  function buildQueryPayload(term, lockContext) {
183
175
  assertValidNumericValue(term.value);
184
176
  const { indexType, queryOp } = resolveIndexType(
@@ -199,13 +191,10 @@ function buildQueryPayload(term, lockContext) {
199
191
  }
200
192
  return payload;
201
193
  }
202
- function assembleResults(totalLength, encryptedValues, nonNullTerms) {
203
- const results = new Array(totalLength).fill(null);
204
- nonNullTerms.forEach(({ term, originalIndex }, i) => {
205
- const encrypted = encryptedValues[i];
206
- results[originalIndex] = formatEncryptedResult(encrypted, term.returnType);
207
- });
208
- return results;
194
+ function assembleResults(terms, encryptedValues) {
195
+ return terms.map(
196
+ (term, i) => formatEncryptedResult(encryptedValues[i], term.returnType)
197
+ );
209
198
  }
210
199
  var BatchEncryptQueryOperation = class extends EncryptionOperation {
211
200
  constructor(client, terms) {
@@ -232,23 +221,18 @@ var BatchEncryptQueryOperation = class extends EncryptionOperation {
232
221
  log.emit();
233
222
  return { data: [] };
234
223
  }
235
- const { nullIndices, nonNullTerms } = filterNullTerms(this.terms);
236
- if (nonNullTerms.length === 0) {
237
- log.emit();
238
- return { data: this.terms.map(() => null) };
239
- }
240
224
  const result = await withResult(
241
225
  async () => {
242
226
  if (!this.client) throw noClientError();
243
227
  const { metadata } = this.getAuditData();
244
- const queries = nonNullTerms.map(
245
- ({ term }) => buildQueryPayload(term)
228
+ const queries = this.terms.map(
229
+ (term) => buildQueryPayload(term)
246
230
  );
247
231
  const encrypted = await ffiEncryptQueryBulk(this.client, {
248
232
  queries,
249
233
  unverifiedContext: metadata
250
234
  });
251
- return assembleResults(this.terms.length, encrypted, nonNullTerms);
235
+ return assembleResults(this.terms, encrypted);
252
236
  },
253
237
  (error) => {
254
238
  log.set({ errorCode: getErrorCode(error) ?? "unknown" });
@@ -282,11 +266,6 @@ var BatchEncryptQueryOperationWithLockContext = class extends EncryptionOperatio
282
266
  log.emit();
283
267
  return { data: [] };
284
268
  }
285
- const { nullIndices, nonNullTerms } = filterNullTerms(this.terms);
286
- if (nonNullTerms.length === 0) {
287
- log.emit();
288
- return { data: this.terms.map(() => null) };
289
- }
290
269
  const lockContextResult = await this.lockContext.getLockContext();
291
270
  if (lockContextResult.failure) {
292
271
  log.emit();
@@ -297,15 +276,15 @@ var BatchEncryptQueryOperationWithLockContext = class extends EncryptionOperatio
297
276
  async () => {
298
277
  if (!this.client) throw noClientError();
299
278
  const { metadata } = this.getAuditData();
300
- const queries = nonNullTerms.map(
301
- ({ term }) => buildQueryPayload(term, context)
279
+ const queries = this.terms.map(
280
+ (term) => buildQueryPayload(term, context)
302
281
  );
303
282
  const encrypted = await ffiEncryptQueryBulk(this.client, {
304
283
  queries,
305
284
  serviceToken: ctsToken,
306
285
  unverifiedContext: metadata
307
286
  });
308
- return assembleResults(this.terms.length, encrypted, nonNullTerms);
287
+ return assembleResults(this.terms, encrypted);
309
288
  },
310
289
  (error) => {
311
290
  log.set({ errorCode: getErrorCode(error) ?? "unknown" });
@@ -327,42 +306,25 @@ import {
327
306
  decryptBulkFallible
328
307
  } from "@cipherstash/protect-ffi";
329
308
  var createDecryptPayloads = (encryptedPayloads, lockContext) => {
330
- return encryptedPayloads.map((item, index) => ({ ...item, originalIndex: index })).filter(({ data }) => data !== null).map(({ id, data, originalIndex }) => ({
309
+ return encryptedPayloads.map(({ id, data }) => ({
331
310
  id,
332
311
  ciphertext: data,
333
- originalIndex,
334
312
  ...lockContext && { lockContext }
335
313
  }));
336
314
  };
337
- var createNullResult = (encryptedPayloads) => {
338
- return encryptedPayloads.map(({ id }) => ({
339
- id,
340
- data: null
341
- }));
342
- };
343
315
  var mapDecryptedDataToResult = (encryptedPayloads, decryptedData) => {
344
- const result = new Array(encryptedPayloads.length);
345
- let decryptedIndex = 0;
346
- for (let i = 0; i < encryptedPayloads.length; i++) {
347
- if (encryptedPayloads[i].data === null) {
348
- result[i] = { id: encryptedPayloads[i].id, data: null };
349
- } else {
350
- const decryptResult = decryptedData[decryptedIndex];
351
- if ("error" in decryptResult) {
352
- result[i] = {
353
- id: encryptedPayloads[i].id,
354
- error: decryptResult.error
355
- };
356
- } else {
357
- result[i] = {
358
- id: encryptedPayloads[i].id,
359
- data: decryptResult.data
360
- };
361
- }
362
- decryptedIndex++;
316
+ return decryptedData.map((decryptResult, i) => {
317
+ if ("error" in decryptResult) {
318
+ return {
319
+ id: encryptedPayloads[i].id,
320
+ error: decryptResult.error
321
+ };
363
322
  }
364
- }
365
- return result;
323
+ return {
324
+ id: encryptedPayloads[i].id,
325
+ data: decryptResult.data
326
+ };
327
+ });
366
328
  };
367
329
  var BulkDecryptOperation = class extends EncryptionOperation {
368
330
  client;
@@ -387,13 +349,10 @@ var BulkDecryptOperation = class extends EncryptionOperation {
387
349
  if (!this.client) throw noClientError();
388
350
  if (!this.encryptedPayloads || this.encryptedPayloads.length === 0)
389
351
  return [];
390
- const nonNullPayloads = createDecryptPayloads(this.encryptedPayloads);
391
- if (nonNullPayloads.length === 0) {
392
- return createNullResult(this.encryptedPayloads);
393
- }
352
+ const payloads = createDecryptPayloads(this.encryptedPayloads);
394
353
  const { metadata } = this.getAuditData();
395
354
  const decryptedData = await decryptBulkFallible(this.client, {
396
- ciphertexts: nonNullPayloads,
355
+ ciphertexts: payloads,
397
356
  unverifiedContext: metadata
398
357
  });
399
358
  return mapDecryptedDataToResult(this.encryptedPayloads, decryptedData);
@@ -445,16 +404,13 @@ var BulkDecryptOperationWithLockContext = class extends EncryptionOperation {
445
404
  if (context.failure) {
446
405
  throw new Error(`[encryption]: ${context.failure.message}`);
447
406
  }
448
- const nonNullPayloads = createDecryptPayloads(
407
+ const payloads = createDecryptPayloads(
449
408
  encryptedPayloads,
450
409
  context.data.context
451
410
  );
452
- if (nonNullPayloads.length === 0) {
453
- return createNullResult(encryptedPayloads);
454
- }
455
411
  const { metadata } = this.getAuditData();
456
412
  const decryptedData = await decryptBulkFallible(client, {
457
- ciphertexts: nonNullPayloads,
413
+ ciphertexts: payloads,
458
414
  serviceToken: context.data.ctsToken,
459
415
  unverifiedContext: metadata
460
416
  });
@@ -1096,34 +1052,14 @@ var BulkDecryptModelsOperationWithLockContext = class extends EncryptionOperatio
1096
1052
  import { withResult as withResult4 } from "@byteslice/result";
1097
1053
  import { encryptBulk as encryptBulk2 } from "@cipherstash/protect-ffi";
1098
1054
  var createEncryptPayloads = (plaintexts, column, table, lockContext) => {
1099
- return plaintexts.map((item, index) => ({ ...item, originalIndex: index })).filter(({ plaintext }) => plaintext !== null).map(({ id, plaintext, originalIndex }) => ({
1055
+ return plaintexts.map(({ id, plaintext }) => ({
1100
1056
  id,
1101
1057
  plaintext,
1102
1058
  column: column.getName(),
1103
1059
  table: table.tableName,
1104
- originalIndex,
1105
1060
  ...lockContext && { lockContext }
1106
1061
  }));
1107
1062
  };
1108
- var createNullResult2 = (plaintexts) => {
1109
- return plaintexts.map(({ id }) => ({ id, data: null }));
1110
- };
1111
- var mapEncryptedDataToResult = (plaintexts, encryptedData) => {
1112
- const result = new Array(plaintexts.length);
1113
- let encryptedIndex = 0;
1114
- for (let i = 0; i < plaintexts.length; i++) {
1115
- if (plaintexts[i].plaintext === null) {
1116
- result[i] = { id: plaintexts[i].id, data: null };
1117
- } else {
1118
- result[i] = {
1119
- id: plaintexts[i].id,
1120
- data: encryptedData[encryptedIndex]
1121
- };
1122
- encryptedIndex++;
1123
- }
1124
- }
1125
- return result;
1126
- };
1127
1063
  var BulkEncryptOperation = class extends EncryptionOperation {
1128
1064
  client;
1129
1065
  plaintexts;
@@ -1156,20 +1092,20 @@ var BulkEncryptOperation = class extends EncryptionOperation {
1156
1092
  if (!this.plaintexts || this.plaintexts.length === 0) {
1157
1093
  return [];
1158
1094
  }
1159
- const nonNullPayloads = createEncryptPayloads(
1095
+ const payloads = createEncryptPayloads(
1160
1096
  this.plaintexts,
1161
1097
  this.column,
1162
1098
  this.table
1163
1099
  );
1164
- if (nonNullPayloads.length === 0) {
1165
- return createNullResult2(this.plaintexts);
1166
- }
1167
1100
  const { metadata } = this.getAuditData();
1168
1101
  const encryptedData = await encryptBulk2(this.client, {
1169
- plaintexts: nonNullPayloads,
1102
+ plaintexts: payloads,
1170
1103
  unverifiedContext: metadata
1171
1104
  });
1172
- return mapEncryptedDataToResult(this.plaintexts, encryptedData);
1105
+ return encryptedData.map((data, i) => ({
1106
+ id: this.plaintexts[i].id,
1107
+ data
1108
+ }));
1173
1109
  },
1174
1110
  (error) => {
1175
1111
  log.set({ errorCode: getErrorCode(error) ?? "unknown" });
@@ -1226,22 +1162,22 @@ var BulkEncryptOperationWithLockContext = class extends EncryptionOperation {
1226
1162
  if (context.failure) {
1227
1163
  throw new Error(`[encryption]: ${context.failure.message}`);
1228
1164
  }
1229
- const nonNullPayloads = createEncryptPayloads(
1165
+ const payloads = createEncryptPayloads(
1230
1166
  plaintexts,
1231
1167
  column,
1232
1168
  table,
1233
1169
  context.data.context
1234
1170
  );
1235
- if (nonNullPayloads.length === 0) {
1236
- return createNullResult2(plaintexts);
1237
- }
1238
1171
  const { metadata } = this.getAuditData();
1239
1172
  const encryptedData = await encryptBulk2(client, {
1240
- plaintexts: nonNullPayloads,
1173
+ plaintexts: payloads,
1241
1174
  serviceToken: context.data.ctsToken,
1242
1175
  unverifiedContext: metadata
1243
1176
  });
1244
- return mapEncryptedDataToResult(plaintexts, encryptedData);
1177
+ return encryptedData.map((data, i) => ({
1178
+ id: plaintexts[i].id,
1179
+ data
1180
+ }));
1245
1181
  },
1246
1182
  (error) => {
1247
1183
  log.set({ errorCode: getErrorCode(error) ?? "unknown" });
@@ -1393,9 +1329,6 @@ var DecryptOperation = class extends EncryptionOperation {
1393
1329
  if (!this.client) {
1394
1330
  throw noClientError();
1395
1331
  }
1396
- if (this.encryptedData === null) {
1397
- return null;
1398
- }
1399
1332
  const { metadata } = this.getAuditData();
1400
1333
  return await ffiDecrypt(this.client, {
1401
1334
  ciphertext: this.encryptedData,
@@ -1446,9 +1379,6 @@ var DecryptOperationWithLockContext = class extends EncryptionOperation {
1446
1379
  if (!client) {
1447
1380
  throw noClientError();
1448
1381
  }
1449
- if (encryptedData === null) {
1450
- return null;
1451
- }
1452
1382
  const { metadata } = this.getAuditData();
1453
1383
  const context = await this.lockContext.getLockContext();
1454
1384
  if (context.failure) {
@@ -1604,9 +1534,6 @@ var EncryptOperation = class extends EncryptionOperation {
1604
1534
  if (!this.client) {
1605
1535
  throw noClientError();
1606
1536
  }
1607
- if (this.plaintext === null) {
1608
- return null;
1609
- }
1610
1537
  if (typeof this.plaintext === "number" && Number.isNaN(this.plaintext)) {
1611
1538
  throw new Error("[encryption]: Cannot encrypt NaN value");
1612
1539
  }
@@ -1668,9 +1595,6 @@ var EncryptOperationWithLockContext = class extends EncryptionOperation {
1668
1595
  if (!client) {
1669
1596
  throw noClientError();
1670
1597
  }
1671
- if (plaintext === null) {
1672
- return null;
1673
- }
1674
1598
  const { metadata } = this.getAuditData();
1675
1599
  const context = await this.lockContext.getLockContext();
1676
1600
  if (context.failure) {
@@ -1836,10 +1760,6 @@ var EncryptQueryOperation = class extends EncryptionOperation {
1836
1760
  queryType: this.opts.queryType,
1837
1761
  lockContext: false
1838
1762
  });
1839
- if (this.plaintext === null || this.plaintext === void 0) {
1840
- log.emit();
1841
- return { data: null };
1842
- }
1843
1763
  const validationError = validateNumericValue(this.plaintext);
1844
1764
  if (validationError?.failure) {
1845
1765
  log.emit();
@@ -1903,10 +1823,6 @@ var EncryptQueryOperationWithLockContext = class extends EncryptionOperation {
1903
1823
  queryType: this.opts.queryType,
1904
1824
  lockContext: true
1905
1825
  });
1906
- if (this.plaintext === null || this.plaintext === void 0) {
1907
- log.emit();
1908
- return { data: null };
1909
- }
1910
1826
  const validationError = validateNumericValue(this.plaintext);
1911
1827
  if (validationError?.failure) {
1912
1828
  log.emit();
@@ -2011,7 +1927,7 @@ var EncryptionClient = class {
2011
1927
  /**
2012
1928
  * Encrypt a value - returns a promise which resolves to an encrypted value.
2013
1929
  *
2014
- * @param plaintext - The plaintext value to be encrypted. Can be null.
1930
+ * @param plaintext - The plaintext value to be encrypted.
2015
1931
  * @param opts - Options specifying the column (or nested field) and table for encryption. See {@link EncryptOptions}.
2016
1932
  * @returns An EncryptOperation that can be awaited or chained with additional methods.
2017
1933
  *
@@ -2312,7 +2228,7 @@ var EncryptionClient = class {
2312
2228
  *
2313
2229
  * Each value is encrypted with its own unique key via a single call to ZeroKMS.
2314
2230
  * Values can include optional `id` fields for correlating results back to
2315
- * your application data. Null plaintext values are preserved as null.
2231
+ * your application data.
2316
2232
  *
2317
2233
  * @param plaintexts - An array of objects with `plaintext` (and optional `id`) fields.
2318
2234
  * @param opts - Options specifying the target column (or nested {@link encryptedField}) and table. See {@link EncryptOptions}.
@@ -2333,7 +2249,6 @@ var EncryptionClient = class {
2333
2249
  * [
2334
2250
  * { id: "u1", plaintext: "alice@example.com" },
2335
2251
  * { id: "u2", plaintext: "bob@example.com" },
2336
- * { id: "u3", plaintext: null },
2337
2252
  * ],
2338
2253
  * { column: users.email, table: users },
2339
2254
  * )
@@ -2387,23 +2302,14 @@ var EncryptionClient = class {
2387
2302
  };
2388
2303
  }
2389
2304
  };
2390
-
2391
- // src/index.ts
2392
- function isValidUuid(uuid) {
2393
- const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
2394
- return uuidRegex.test(uuid);
2395
- }
2396
2305
  var Encryption = async (config) => {
2397
- if (config.logging) {
2398
- initStackLogger(config.logging);
2399
- }
2400
2306
  const { schemas, config: clientConfig } = config;
2401
2307
  if (!schemas.length) {
2402
2308
  throw new Error(
2403
2309
  "[encryption]: At least one encryptedTable must be provided to initialize the encryption client"
2404
2310
  );
2405
2311
  }
2406
- if (clientConfig?.keyset && "id" in clientConfig.keyset && !isValidUuid(clientConfig.keyset.id)) {
2312
+ if (clientConfig?.keyset && "id" in clientConfig.keyset && !uuidValidate(clientConfig.keyset.id)) {
2407
2313
  throw new Error(
2408
2314
  "[encryption]: Invalid UUID provided for keyset id. Must be a valid UUID."
2409
2315
  );
@@ -2421,6 +2327,8 @@ var Encryption = async (config) => {
2421
2327
  };
2422
2328
 
2423
2329
  export {
2330
+ noClientError,
2331
+ EncryptionClient,
2424
2332
  Encryption
2425
2333
  };
2426
- //# sourceMappingURL=chunk-MW6D52V2.js.map
2334
+ //# sourceMappingURL=chunk-TGUELLJS.js.map