@cipherstash/protect-ffi 0.25.0 → 0.27.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 (139) hide show
  1. package/README.md +60 -0
  2. package/dist/wasm/protect_ffi_bg.js +11 -11
  3. package/dist/wasm/protect_ffi_bg.wasm +0 -0
  4. package/dist/wasm/protect_ffi_bg.wasm.d.ts +5 -5
  5. package/dist/wasm/protect_ffi_inline.js +1 -1
  6. package/lib/eql-v3-types/Bigint.d.ts +13 -0
  7. package/lib/eql-v3-types/Bigint.js +2 -0
  8. package/lib/eql-v3-types/BigintEq.d.ts +15 -0
  9. package/lib/eql-v3-types/BigintEq.js +2 -0
  10. package/lib/eql-v3-types/BigintOrd.d.ts +15 -0
  11. package/lib/eql-v3-types/BigintOrd.js +2 -0
  12. package/lib/eql-v3-types/BigintOrdOpe.d.ts +15 -0
  13. package/lib/eql-v3-types/BigintOrdOpe.js +2 -0
  14. package/lib/eql-v3-types/BigintOrdOre.d.ts +15 -0
  15. package/lib/eql-v3-types/BigintOrdOre.js +2 -0
  16. package/lib/eql-v3-types/BloomFilter.d.ts +9 -0
  17. package/lib/eql-v3-types/BloomFilter.js +5 -0
  18. package/lib/eql-v3-types/Boolean.d.ts +13 -0
  19. package/lib/eql-v3-types/Boolean.js +2 -0
  20. package/lib/eql-v3-types/Ciphertext.d.ts +6 -0
  21. package/lib/eql-v3-types/Ciphertext.js +5 -0
  22. package/lib/eql-v3-types/Date.d.ts +13 -0
  23. package/lib/eql-v3-types/Date.js +2 -0
  24. package/lib/eql-v3-types/DateEq.d.ts +15 -0
  25. package/lib/eql-v3-types/DateEq.js +2 -0
  26. package/lib/eql-v3-types/DateOrd.d.ts +15 -0
  27. package/lib/eql-v3-types/DateOrd.js +2 -0
  28. package/lib/eql-v3-types/DateOrdOpe.d.ts +15 -0
  29. package/lib/eql-v3-types/DateOrdOpe.js +2 -0
  30. package/lib/eql-v3-types/DateOrdOre.d.ts +15 -0
  31. package/lib/eql-v3-types/DateOrdOre.js +2 -0
  32. package/lib/eql-v3-types/Double.d.ts +13 -0
  33. package/lib/eql-v3-types/Double.js +2 -0
  34. package/lib/eql-v3-types/DoubleEq.d.ts +15 -0
  35. package/lib/eql-v3-types/DoubleEq.js +2 -0
  36. package/lib/eql-v3-types/DoubleOrd.d.ts +15 -0
  37. package/lib/eql-v3-types/DoubleOrd.js +2 -0
  38. package/lib/eql-v3-types/DoubleOrdOpe.d.ts +15 -0
  39. package/lib/eql-v3-types/DoubleOrdOpe.js +2 -0
  40. package/lib/eql-v3-types/DoubleOrdOre.d.ts +15 -0
  41. package/lib/eql-v3-types/DoubleOrdOre.js +2 -0
  42. package/lib/eql-v3-types/Hmac256.d.ts +5 -0
  43. package/lib/eql-v3-types/Hmac256.js +5 -0
  44. package/lib/eql-v3-types/Identifier.d.ts +15 -0
  45. package/lib/eql-v3-types/Identifier.js +5 -0
  46. package/lib/eql-v3-types/Integer.d.ts +13 -0
  47. package/lib/eql-v3-types/Integer.js +2 -0
  48. package/lib/eql-v3-types/IntegerEq.d.ts +15 -0
  49. package/lib/eql-v3-types/IntegerEq.js +2 -0
  50. package/lib/eql-v3-types/IntegerOrd.d.ts +15 -0
  51. package/lib/eql-v3-types/IntegerOrd.js +2 -0
  52. package/lib/eql-v3-types/IntegerOrdOpe.d.ts +15 -0
  53. package/lib/eql-v3-types/IntegerOrdOpe.js +2 -0
  54. package/lib/eql-v3-types/IntegerOrdOre.d.ts +15 -0
  55. package/lib/eql-v3-types/IntegerOrdOre.js +2 -0
  56. package/lib/eql-v3-types/Numeric.d.ts +13 -0
  57. package/lib/eql-v3-types/Numeric.js +2 -0
  58. package/lib/eql-v3-types/NumericEq.d.ts +15 -0
  59. package/lib/eql-v3-types/NumericEq.js +2 -0
  60. package/lib/eql-v3-types/NumericOrd.d.ts +15 -0
  61. package/lib/eql-v3-types/NumericOrd.js +2 -0
  62. package/lib/eql-v3-types/NumericOrdOpe.d.ts +15 -0
  63. package/lib/eql-v3-types/NumericOrdOpe.js +2 -0
  64. package/lib/eql-v3-types/NumericOrdOre.d.ts +15 -0
  65. package/lib/eql-v3-types/NumericOrdOre.js +2 -0
  66. package/lib/eql-v3-types/OpeCllw.d.ts +9 -0
  67. package/lib/eql-v3-types/OpeCllw.js +5 -0
  68. package/lib/eql-v3-types/OreBlock256.d.ts +9 -0
  69. package/lib/eql-v3-types/OreBlock256.js +5 -0
  70. package/lib/eql-v3-types/OreCllw.d.ts +7 -0
  71. package/lib/eql-v3-types/OreCllw.js +5 -0
  72. package/lib/eql-v3-types/Real.d.ts +13 -0
  73. package/lib/eql-v3-types/Real.js +2 -0
  74. package/lib/eql-v3-types/RealEq.d.ts +15 -0
  75. package/lib/eql-v3-types/RealEq.js +2 -0
  76. package/lib/eql-v3-types/RealOrd.d.ts +15 -0
  77. package/lib/eql-v3-types/RealOrd.js +2 -0
  78. package/lib/eql-v3-types/RealOrdOpe.d.ts +15 -0
  79. package/lib/eql-v3-types/RealOrdOpe.js +2 -0
  80. package/lib/eql-v3-types/RealOrdOre.d.ts +15 -0
  81. package/lib/eql-v3-types/RealOrdOre.js +2 -0
  82. package/lib/eql-v3-types/SchemaVersion.d.ts +10 -0
  83. package/lib/eql-v3-types/SchemaVersion.js +5 -0
  84. package/lib/eql-v3-types/Selector.d.ts +5 -0
  85. package/lib/eql-v3-types/Selector.js +5 -0
  86. package/lib/eql-v3-types/Smallint.d.ts +13 -0
  87. package/lib/eql-v3-types/Smallint.js +2 -0
  88. package/lib/eql-v3-types/SmallintEq.d.ts +15 -0
  89. package/lib/eql-v3-types/SmallintEq.js +2 -0
  90. package/lib/eql-v3-types/SmallintOrd.d.ts +15 -0
  91. package/lib/eql-v3-types/SmallintOrd.js +2 -0
  92. package/lib/eql-v3-types/SmallintOrdOpe.d.ts +15 -0
  93. package/lib/eql-v3-types/SmallintOrdOpe.js +2 -0
  94. package/lib/eql-v3-types/SmallintOrdOre.d.ts +15 -0
  95. package/lib/eql-v3-types/SmallintOrdOre.js +2 -0
  96. package/lib/eql-v3-types/SteVecDocument.d.ts +15 -0
  97. package/lib/eql-v3-types/SteVecDocument.js +2 -0
  98. package/lib/eql-v3-types/SteVecEntry.d.ts +19 -0
  99. package/lib/eql-v3-types/SteVecEntry.js +2 -0
  100. package/lib/eql-v3-types/SteVecForm.d.ts +18 -0
  101. package/lib/eql-v3-types/SteVecForm.js +5 -0
  102. package/lib/eql-v3-types/SteVecQuery.d.ts +7 -0
  103. package/lib/eql-v3-types/SteVecQuery.js +2 -0
  104. package/lib/eql-v3-types/SteVecQueryEntry.d.ts +15 -0
  105. package/lib/eql-v3-types/SteVecQueryEntry.js +2 -0
  106. package/lib/eql-v3-types/SteVecTerm.d.ts +11 -0
  107. package/lib/eql-v3-types/SteVecTerm.js +2 -0
  108. package/lib/eql-v3-types/Text.d.ts +13 -0
  109. package/lib/eql-v3-types/Text.js +2 -0
  110. package/lib/eql-v3-types/TextEq.d.ts +15 -0
  111. package/lib/eql-v3-types/TextEq.js +2 -0
  112. package/lib/eql-v3-types/TextMatch.d.ts +15 -0
  113. package/lib/eql-v3-types/TextMatch.js +2 -0
  114. package/lib/eql-v3-types/TextOrd.d.ts +17 -0
  115. package/lib/eql-v3-types/TextOrd.js +2 -0
  116. package/lib/eql-v3-types/TextOrdOpe.d.ts +17 -0
  117. package/lib/eql-v3-types/TextOrdOpe.js +2 -0
  118. package/lib/eql-v3-types/TextOrdOre.d.ts +17 -0
  119. package/lib/eql-v3-types/TextOrdOre.js +2 -0
  120. package/lib/eql-v3-types/TextSearch.d.ts +19 -0
  121. package/lib/eql-v3-types/TextSearch.js +2 -0
  122. package/lib/eql-v3-types/Timestamp.d.ts +13 -0
  123. package/lib/eql-v3-types/Timestamp.js +2 -0
  124. package/lib/eql-v3-types/TimestampEq.d.ts +15 -0
  125. package/lib/eql-v3-types/TimestampEq.js +2 -0
  126. package/lib/eql-v3-types/TimestampOrd.d.ts +15 -0
  127. package/lib/eql-v3-types/TimestampOrd.js +2 -0
  128. package/lib/eql-v3-types/TimestampOrdOpe.d.ts +15 -0
  129. package/lib/eql-v3-types/TimestampOrdOpe.js +2 -0
  130. package/lib/eql-v3-types/TimestampOrdOre.d.ts +15 -0
  131. package/lib/eql-v3-types/TimestampOrdOre.js +2 -0
  132. package/lib/eql-v3.d.ts +90 -0
  133. package/lib/eql-v3.js +6 -0
  134. package/lib/errors.d.ts +14 -0
  135. package/lib/errors.js +77 -0
  136. package/lib/index.cjs +32 -59
  137. package/lib/index.d.cts +63 -24
  138. package/lib/normalizeEncryptConfig.d.ts +1 -1
  139. package/package.json +17 -9
package/README.md CHANGED
@@ -44,6 +44,66 @@ $ node
44
44
  > console.log({ciphertext, plaintext});
45
45
  ```
46
46
 
47
+ ## EQL version selection
48
+
49
+ `newClient` accepts an `eqlVersion` option selecting the wire format that
50
+ `encrypt` / `encryptBulk` / `encryptQuery` emit:
51
+
52
+ ```js
53
+ // EQL v2 (default) — the `eql_v2_encrypted` payload format
54
+ const v2 = await addon.newClient({ encryptConfig })
55
+
56
+ // EQL v3 — payloads for the per-capability `eql_v3` domains
57
+ const v3 = await addon.newClient({ encryptConfig, eqlVersion: 3 })
58
+ ```
59
+
60
+ With `eqlVersion: 3`, each column's payload targets the `eql_v3` domain
61
+ derived from its `cast_as` and indexes:
62
+
63
+ | `cast_as` | family | indexes | domain |
64
+ |-----------|--------|---------|--------|
65
+ | `text` | `text` | `unique` + `ore` + `match` | `text_search` |
66
+ | `text` | `text` | `unique` + `ore` | `text_ord_ore` |
67
+ | `text` | `text` | `match` | `text_match` |
68
+ | `text` | `text` | `unique` | `text_eq` |
69
+ | `int` / `small_int` / `bigint` | `integer` / `smallint` / `bigint` | `ore` (with or without `unique`) | `<family>_ord_ore` |
70
+ | `int` / `small_int` / `bigint` | `integer` / `smallint` / `bigint` | `unique` | `<family>_eq` |
71
+ | `number` / `decimal` / `date` / `timestamp` | `double` / `numeric` / `date` / `timestamp` | as above | as above |
72
+ | any scalar | — | none | storage-only domain (`text`, `integer`, …) |
73
+ | `boolean` | `boolean` | none only | `boolean` (storage-only — any index errors) |
74
+ | `json` | `json` | `ste_vec` (required) | `json` |
75
+
76
+ Notes:
77
+
78
+ - The richest matching domain wins, and it must cover every configured
79
+ capability — a combination that would silently drop a term errors instead
80
+ (e.g. `unique` + `match`, `unique` + `ope` + `match`, or `ore` + `match`
81
+ on text: no single domain carries those term sets, so add the missing
82
+ index to reach `text_search`, split the capabilities across columns, or
83
+ use `eqlVersion: 2`).
84
+ - Exception: dropping a *term* is fine when the *capability* survives.
85
+ Non-text ordering domains carry only `ob`, so `unique` + `ore` on a
86
+ numeric column drops `hm` — equality still works via the ORE operators.
87
+ - Ordered text requires a `unique` index (`text_ord_ore`/`text_ord_ope`
88
+ carry `hm` + `ob`/`op`); `ore`-only text errors.
89
+ - `decrypt` accepts **both** formats regardless of `eqlVersion`, so v2 and
90
+ v3 data can coexist during a migration.
91
+ - v3 query encryption currently supports JSON containment only; scalar and
92
+ selector queries throw `EQL_V3_QUERY_UNSUPPORTED` and need an
93
+ `eqlVersion: 2` client.
94
+ - `ope`-indexed columns map to `<family>_ord_ope` but cannot be produced
95
+ end-to-end yet: the client does not emit the `op` term (CIP-3280).
96
+
97
+ > [!NOTE]
98
+ > **Breaking TypeScript change:** `encrypt`/`encryptBulk` now return
99
+ > `EncryptedPayload` (`Encrypted | EncryptedV3`) instead of `Encrypted`.
100
+ > Runtime output is unchanged for v2 clients, but code that accessed `.k`
101
+ > or assigned the result to `Encrypted` must narrow first. v3 scalars carry
102
+ > no `k`, so guard its presence before reading it:
103
+ > `'k' in payload && payload.k === 'ct'` (a v2 scalar), or check
104
+ > `payload.v === 3` to detect the v3 members. (A bare `payload.k === 'ct'`
105
+ > does not compile against the union.)
106
+
47
107
  ## Errors
48
108
 
49
109
  Async API calls throw `ProtectError` with a stable `code` for programmatic handling.
@@ -570,7 +570,7 @@ export function __wbg_new_typed_aaaeaf29cf802876(arg0, arg1) {
570
570
  const a = state0.a;
571
571
  state0.a = 0;
572
572
  try {
573
- return wasm_bindgen__convert__closures_____invoke__h1201fec59d36da32(a, state0.b, arg0, arg1);
573
+ return wasm_bindgen__convert__closures_____invoke__h0cb80728b35f261e(a, state0.b, arg0, arg1);
574
574
  } finally {
575
575
  state0.a = a;
576
576
  }
@@ -742,13 +742,13 @@ export function __wbg_wasmclient_new(arg0) {
742
742
  return ret;
743
743
  }
744
744
  export function __wbindgen_cast_0000000000000001(arg0, arg1) {
745
- // Cast intrinsic for `Closure(Closure { dtor_idx: 494, function: Function { arguments: [], shim_idx: 495, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
746
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h379cc5f9ba73967b, wasm_bindgen__convert__closures_____invoke__hc060a2339985e908);
745
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 879, function: Function { arguments: [], shim_idx: 880, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
746
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hd9dedd770edb0aa1, wasm_bindgen__convert__closures_____invoke__h8b170b34f8b593df);
747
747
  return ret;
748
748
  }
749
749
  export function __wbindgen_cast_0000000000000002(arg0, arg1) {
750
- // Cast intrinsic for `Closure(Closure { dtor_idx: 542, function: Function { arguments: [Externref], shim_idx: 543, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
751
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h18e55ed08acd10aa, wasm_bindgen__convert__closures_____invoke__h425499e9ab8a95b4);
750
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 932, function: Function { arguments: [Externref], shim_idx: 933, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
751
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h94971d029da3e81d, wasm_bindgen__convert__closures_____invoke__hacad64c6c6b78997);
752
752
  return ret;
753
753
  }
754
754
  export function __wbindgen_cast_0000000000000003(arg0) {
@@ -785,19 +785,19 @@ export function __wbindgen_init_externref_table() {
785
785
  table.set(offset + 2, true);
786
786
  table.set(offset + 3, false);
787
787
  }
788
- function wasm_bindgen__convert__closures_____invoke__hc060a2339985e908(arg0, arg1) {
789
- wasm.wasm_bindgen__convert__closures_____invoke__hc060a2339985e908(arg0, arg1);
788
+ function wasm_bindgen__convert__closures_____invoke__h8b170b34f8b593df(arg0, arg1) {
789
+ wasm.wasm_bindgen__convert__closures_____invoke__h8b170b34f8b593df(arg0, arg1);
790
790
  }
791
791
 
792
- function wasm_bindgen__convert__closures_____invoke__h425499e9ab8a95b4(arg0, arg1, arg2) {
793
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h425499e9ab8a95b4(arg0, arg1, arg2);
792
+ function wasm_bindgen__convert__closures_____invoke__hacad64c6c6b78997(arg0, arg1, arg2) {
793
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hacad64c6c6b78997(arg0, arg1, arg2);
794
794
  if (ret[1]) {
795
795
  throw takeFromExternrefTable0(ret[0]);
796
796
  }
797
797
  }
798
798
 
799
- function wasm_bindgen__convert__closures_____invoke__h1201fec59d36da32(arg0, arg1, arg2, arg3) {
800
- wasm.wasm_bindgen__convert__closures_____invoke__h1201fec59d36da32(arg0, arg1, arg2, arg3);
799
+ function wasm_bindgen__convert__closures_____invoke__h0cb80728b35f261e(arg0, arg1, arg2, arg3) {
800
+ wasm.wasm_bindgen__convert__closures_____invoke__h0cb80728b35f261e(arg0, arg1, arg2, arg3);
801
801
  }
802
802
 
803
803
 
Binary file
@@ -25,11 +25,11 @@ export const intounderlyingbytesource_cancel: (a: number) => void;
25
25
  export const intounderlyingbytesource_pull: (a: number, b: any) => any;
26
26
  export const intounderlyingbytesource_start: (a: number, b: any) => void;
27
27
  export const intounderlyingbytesource_type: (a: number) => number;
28
- export const wasm_bindgen__closure__destroy__h379cc5f9ba73967b: (a: number, b: number) => void;
29
- export const wasm_bindgen__closure__destroy__h18e55ed08acd10aa: (a: number, b: number) => void;
30
- export const wasm_bindgen__convert__closures_____invoke__h425499e9ab8a95b4: (a: number, b: number, c: any) => [number, number];
31
- export const wasm_bindgen__convert__closures_____invoke__h1201fec59d36da32: (a: number, b: number, c: any, d: any) => void;
32
- export const wasm_bindgen__convert__closures_____invoke__hc060a2339985e908: (a: number, b: number) => void;
28
+ export const wasm_bindgen__closure__destroy__hd9dedd770edb0aa1: (a: number, b: number) => void;
29
+ export const wasm_bindgen__closure__destroy__h94971d029da3e81d: (a: number, b: number) => void;
30
+ export const wasm_bindgen__convert__closures_____invoke__hacad64c6c6b78997: (a: number, b: number, c: any) => [number, number];
31
+ export const wasm_bindgen__convert__closures_____invoke__h0cb80728b35f261e: (a: number, b: number, c: any, d: any) => void;
32
+ export const wasm_bindgen__convert__closures_____invoke__h8b170b34f8b593df: (a: number, b: number) => void;
33
33
  export const __wbindgen_malloc: (a: number, b: number) => number;
34
34
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
35
35
  export const __wbindgen_exn_store: (a: number) => void;