@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.
- package/README.md +60 -0
- package/dist/wasm/protect_ffi_bg.js +11 -11
- package/dist/wasm/protect_ffi_bg.wasm +0 -0
- package/dist/wasm/protect_ffi_bg.wasm.d.ts +5 -5
- package/dist/wasm/protect_ffi_inline.js +1 -1
- package/lib/eql-v3-types/Bigint.d.ts +13 -0
- package/lib/eql-v3-types/Bigint.js +2 -0
- package/lib/eql-v3-types/BigintEq.d.ts +15 -0
- package/lib/eql-v3-types/BigintEq.js +2 -0
- package/lib/eql-v3-types/BigintOrd.d.ts +15 -0
- package/lib/eql-v3-types/BigintOrd.js +2 -0
- package/lib/eql-v3-types/BigintOrdOpe.d.ts +15 -0
- package/lib/eql-v3-types/BigintOrdOpe.js +2 -0
- package/lib/eql-v3-types/BigintOrdOre.d.ts +15 -0
- package/lib/eql-v3-types/BigintOrdOre.js +2 -0
- package/lib/eql-v3-types/BloomFilter.d.ts +9 -0
- package/lib/eql-v3-types/BloomFilter.js +5 -0
- package/lib/eql-v3-types/Boolean.d.ts +13 -0
- package/lib/eql-v3-types/Boolean.js +2 -0
- package/lib/eql-v3-types/Ciphertext.d.ts +6 -0
- package/lib/eql-v3-types/Ciphertext.js +5 -0
- package/lib/eql-v3-types/Date.d.ts +13 -0
- package/lib/eql-v3-types/Date.js +2 -0
- package/lib/eql-v3-types/DateEq.d.ts +15 -0
- package/lib/eql-v3-types/DateEq.js +2 -0
- package/lib/eql-v3-types/DateOrd.d.ts +15 -0
- package/lib/eql-v3-types/DateOrd.js +2 -0
- package/lib/eql-v3-types/DateOrdOpe.d.ts +15 -0
- package/lib/eql-v3-types/DateOrdOpe.js +2 -0
- package/lib/eql-v3-types/DateOrdOre.d.ts +15 -0
- package/lib/eql-v3-types/DateOrdOre.js +2 -0
- package/lib/eql-v3-types/Double.d.ts +13 -0
- package/lib/eql-v3-types/Double.js +2 -0
- package/lib/eql-v3-types/DoubleEq.d.ts +15 -0
- package/lib/eql-v3-types/DoubleEq.js +2 -0
- package/lib/eql-v3-types/DoubleOrd.d.ts +15 -0
- package/lib/eql-v3-types/DoubleOrd.js +2 -0
- package/lib/eql-v3-types/DoubleOrdOpe.d.ts +15 -0
- package/lib/eql-v3-types/DoubleOrdOpe.js +2 -0
- package/lib/eql-v3-types/DoubleOrdOre.d.ts +15 -0
- package/lib/eql-v3-types/DoubleOrdOre.js +2 -0
- package/lib/eql-v3-types/Hmac256.d.ts +5 -0
- package/lib/eql-v3-types/Hmac256.js +5 -0
- package/lib/eql-v3-types/Identifier.d.ts +15 -0
- package/lib/eql-v3-types/Identifier.js +5 -0
- package/lib/eql-v3-types/Integer.d.ts +13 -0
- package/lib/eql-v3-types/Integer.js +2 -0
- package/lib/eql-v3-types/IntegerEq.d.ts +15 -0
- package/lib/eql-v3-types/IntegerEq.js +2 -0
- package/lib/eql-v3-types/IntegerOrd.d.ts +15 -0
- package/lib/eql-v3-types/IntegerOrd.js +2 -0
- package/lib/eql-v3-types/IntegerOrdOpe.d.ts +15 -0
- package/lib/eql-v3-types/IntegerOrdOpe.js +2 -0
- package/lib/eql-v3-types/IntegerOrdOre.d.ts +15 -0
- package/lib/eql-v3-types/IntegerOrdOre.js +2 -0
- package/lib/eql-v3-types/Numeric.d.ts +13 -0
- package/lib/eql-v3-types/Numeric.js +2 -0
- package/lib/eql-v3-types/NumericEq.d.ts +15 -0
- package/lib/eql-v3-types/NumericEq.js +2 -0
- package/lib/eql-v3-types/NumericOrd.d.ts +15 -0
- package/lib/eql-v3-types/NumericOrd.js +2 -0
- package/lib/eql-v3-types/NumericOrdOpe.d.ts +15 -0
- package/lib/eql-v3-types/NumericOrdOpe.js +2 -0
- package/lib/eql-v3-types/NumericOrdOre.d.ts +15 -0
- package/lib/eql-v3-types/NumericOrdOre.js +2 -0
- package/lib/eql-v3-types/OpeCllw.d.ts +9 -0
- package/lib/eql-v3-types/OpeCllw.js +5 -0
- package/lib/eql-v3-types/OreBlock256.d.ts +9 -0
- package/lib/eql-v3-types/OreBlock256.js +5 -0
- package/lib/eql-v3-types/OreCllw.d.ts +7 -0
- package/lib/eql-v3-types/OreCllw.js +5 -0
- package/lib/eql-v3-types/Real.d.ts +13 -0
- package/lib/eql-v3-types/Real.js +2 -0
- package/lib/eql-v3-types/RealEq.d.ts +15 -0
- package/lib/eql-v3-types/RealEq.js +2 -0
- package/lib/eql-v3-types/RealOrd.d.ts +15 -0
- package/lib/eql-v3-types/RealOrd.js +2 -0
- package/lib/eql-v3-types/RealOrdOpe.d.ts +15 -0
- package/lib/eql-v3-types/RealOrdOpe.js +2 -0
- package/lib/eql-v3-types/RealOrdOre.d.ts +15 -0
- package/lib/eql-v3-types/RealOrdOre.js +2 -0
- package/lib/eql-v3-types/SchemaVersion.d.ts +10 -0
- package/lib/eql-v3-types/SchemaVersion.js +5 -0
- package/lib/eql-v3-types/Selector.d.ts +5 -0
- package/lib/eql-v3-types/Selector.js +5 -0
- package/lib/eql-v3-types/Smallint.d.ts +13 -0
- package/lib/eql-v3-types/Smallint.js +2 -0
- package/lib/eql-v3-types/SmallintEq.d.ts +15 -0
- package/lib/eql-v3-types/SmallintEq.js +2 -0
- package/lib/eql-v3-types/SmallintOrd.d.ts +15 -0
- package/lib/eql-v3-types/SmallintOrd.js +2 -0
- package/lib/eql-v3-types/SmallintOrdOpe.d.ts +15 -0
- package/lib/eql-v3-types/SmallintOrdOpe.js +2 -0
- package/lib/eql-v3-types/SmallintOrdOre.d.ts +15 -0
- package/lib/eql-v3-types/SmallintOrdOre.js +2 -0
- package/lib/eql-v3-types/SteVecDocument.d.ts +15 -0
- package/lib/eql-v3-types/SteVecDocument.js +2 -0
- package/lib/eql-v3-types/SteVecEntry.d.ts +19 -0
- package/lib/eql-v3-types/SteVecEntry.js +2 -0
- package/lib/eql-v3-types/SteVecForm.d.ts +18 -0
- package/lib/eql-v3-types/SteVecForm.js +5 -0
- package/lib/eql-v3-types/SteVecQuery.d.ts +7 -0
- package/lib/eql-v3-types/SteVecQuery.js +2 -0
- package/lib/eql-v3-types/SteVecQueryEntry.d.ts +15 -0
- package/lib/eql-v3-types/SteVecQueryEntry.js +2 -0
- package/lib/eql-v3-types/SteVecTerm.d.ts +11 -0
- package/lib/eql-v3-types/SteVecTerm.js +2 -0
- package/lib/eql-v3-types/Text.d.ts +13 -0
- package/lib/eql-v3-types/Text.js +2 -0
- package/lib/eql-v3-types/TextEq.d.ts +15 -0
- package/lib/eql-v3-types/TextEq.js +2 -0
- package/lib/eql-v3-types/TextMatch.d.ts +15 -0
- package/lib/eql-v3-types/TextMatch.js +2 -0
- package/lib/eql-v3-types/TextOrd.d.ts +17 -0
- package/lib/eql-v3-types/TextOrd.js +2 -0
- package/lib/eql-v3-types/TextOrdOpe.d.ts +17 -0
- package/lib/eql-v3-types/TextOrdOpe.js +2 -0
- package/lib/eql-v3-types/TextOrdOre.d.ts +17 -0
- package/lib/eql-v3-types/TextOrdOre.js +2 -0
- package/lib/eql-v3-types/TextSearch.d.ts +19 -0
- package/lib/eql-v3-types/TextSearch.js +2 -0
- package/lib/eql-v3-types/Timestamp.d.ts +13 -0
- package/lib/eql-v3-types/Timestamp.js +2 -0
- package/lib/eql-v3-types/TimestampEq.d.ts +15 -0
- package/lib/eql-v3-types/TimestampEq.js +2 -0
- package/lib/eql-v3-types/TimestampOrd.d.ts +15 -0
- package/lib/eql-v3-types/TimestampOrd.js +2 -0
- package/lib/eql-v3-types/TimestampOrdOpe.d.ts +15 -0
- package/lib/eql-v3-types/TimestampOrdOpe.js +2 -0
- package/lib/eql-v3-types/TimestampOrdOre.d.ts +15 -0
- package/lib/eql-v3-types/TimestampOrdOre.js +2 -0
- package/lib/eql-v3.d.ts +90 -0
- package/lib/eql-v3.js +6 -0
- package/lib/errors.d.ts +14 -0
- package/lib/errors.js +77 -0
- package/lib/index.cjs +32 -59
- package/lib/index.d.cts +63 -24
- package/lib/normalizeEncryptConfig.d.ts +1 -1
- 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
|
|
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:
|
|
746
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
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:
|
|
751
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
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
|
|
789
|
-
wasm.
|
|
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
|
|
793
|
-
const ret = wasm.
|
|
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
|
|
800
|
-
wasm.
|
|
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
|
|
29
|
-
export const
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
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;
|