You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ffeed7a
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Contributing to CipherStash Stack
2
2
3
-
Thank you for your interest in contributing to the CipherStash Stack for TypeScript! This document walks you through the repository's structure, how to build and run the project locally, and how to make contributions effectively.
3
+
Thank you for your interest in contributing to CipherStash Stack. This document walks you through the repository's structure, how to build and run the project locally, and how to make contributions effectively.
4
4
5
5
## I want to report a bug, or make a feature request
6
6
@@ -20,6 +20,7 @@ This is a [Turborepo](https://turbo.build/) monorepo managed with [pnpm](https:/
├── languages/golang/ <-- Go SDK, stashgen and credential packages
23
24
├── packages/eql/ <-- EQL (@cipherstash/eql and its Rust crates)
24
25
├── e2e/ <-- Cross-package end-to-end tests
25
26
├── skills/ <-- Agent skills
@@ -29,6 +30,8 @@ This is a [Turborepo](https://turbo.build/) monorepo managed with [pnpm](https:/
29
30
30
31
See [AGENTS.md](./AGENTS.md) for a detailed layout, key APIs, environment variables, and gotchas — it's written for coding agents but is the most complete developer reference in the repo.
31
32
33
+
For the Go module, start with [languages/golang/README.md](languages/golang/README.md).
34
+
32
35
### `languages/typescript/packages/stack`
33
36
34
37
**@cipherstash/stack** is the main package published to npm. It contains the encryption client and all integrations (Drizzle, Supabase, DynamoDB, secrets, identity). This is likely where you'll spend most of your time.
@@ -44,6 +47,7 @@ The `languages/typescript/examples/` directory contains applications demonstrati
44
47
-**Node.js** >= 22
45
48
-**pnpm** (the version pinned in `package.json`'s `packageManager` field)
46
49
- CipherStash credentials if you want to run integration tests or examples (see [AGENTS.md](./AGENTS.md) for the required environment variables)
50
+
- For Go work: mise and the Go and Rust toolchains pinned in `mise.toml`
47
51
48
52
### 1. Clone the Repo
49
53
@@ -76,6 +80,27 @@ pnpm run dev
76
80
77
81
Then navigate to one of the examples in `languages/typescript/examples/` and follow its README.
78
82
83
+
### Go module
84
+
85
+
The Go module is in `languages/golang/`, outside the pnpm workspace. Its
86
+
`encrypt` and `auth` packages embed WASI guests built from Rust. In a source
87
+
checkout, build those guests before running the Go suite:
88
+
89
+
```bash
90
+
mise run wasm:guest:build
91
+
mise run wasm:guest:build:eql
92
+
mise run wasm:guest:build:deterministic
93
+
mise run wasm:guest:build:eql:deterministic
94
+
mise run wasm:auth-guest:build
95
+
mise run go:test
96
+
```
97
+
98
+
For EQL v4 PostgreSQL coverage, set `EQL_TEST_DATABASE_URL` and run
99
+
`mise run go:test:postgres`. Go examples that connect to ZeroKMS need
100
+
CipherStash credentials. The [Go module guide](languages/golang/README.md)
101
+
links to the SDK, generator, credentials, examples and release notes. Commit
102
+
generated `*_stash.go` files when changing Go model tags; CI checks for drift.
|`JsonSearch`| struct, map, slice, or `json.RawMessage`; see [Encrypted JSON documents](#encrypted-json-documents)|
294
299
295
300
The `Eq` types answer `Eq`; the `Ord`, `OrdOpe` and `OrdOre` types answer `Lt`, `Lte`, `Gt` and `Gte`, and on text `Eq` too; `TextMatch` answers `Matches`, and `TextSearch` and `TextSearchOre` all of `Eq`, `Lt`, `Lte`, `Gt`, `Gte` and `Matches`, each query carrying only the term its operator reads; `Text`, `Smallint`, `Integer`, `Bigint`, `Boolean`, `Real`, `Double`, `Date`, `Timestamp` and `Numeric` are stored and read only, with no query method.
296
-
The ordered date, timestamp and numeric types are refused: the engine derives no order term for these kinds yet.
297
-
An ordered type has no `Between` method yet, because a `BETWEEN` operand needs EQL v4's range query domains.
301
+
The ordered date, timestamp and numeric types answer the four comparisons, as do the other ordered EQL types. The generated EQL fields have no `Between` method yet: EQL v4 has range query domains, but `stashgen` does not construct their operands. A JSON document's declared ordered paths have their own `Between` method, which returns two leaf query values; see [Encrypted JSON documents](#encrypted-json-documents).
298
302
299
303
Any built-in Go integer field takes an integer type (ADR-0002) and seals at the type's width: an `int16` field always fits an `Integer`, and an `int64` field is range checked value by value, `Encrypt` refusing a value that does not fit with `encrypt.ErrEncoding`. `encrypt.Int128` and `encrypt.Uint128` are not converted. A float's width must match: a `float64` field is not a `Real`.
300
304
A `TextMatch` field indexes the 3-grams of its text and each two-letter word whole, so a two-letter surname such as "Ng" is stored and found by the query "ng"; a query's two-letter words must be whole words of the row.
|`JsonSearch` (`eql.JSONSearch`) | struct, map, slice, or `json.RawMessage`| containment, equality at a path, ordering at declared paths, selection, subtree reads; see [Encrypted JSON documents](#encrypted-json-documents)|
519
524
520
525
Any built-in Go integer field takes an integer EQL type (ADR-0002): the field
521
526
is sealed at the type's width, and opens back into the field's type. A type
@@ -552,8 +557,8 @@ decimal with its scale and a `time.Time` with its nanoseconds, in UTC. A
552
557
`time.Time` is sealed as its instant, whatever its location. A zero
553
558
`encrypt.Date`, a date or instant outside years -262143 to 262142 and a
554
559
decimal with more than 28 digits after the point are refused with
555
-
`ErrEncoding`. The ordered date, timestamp and numeric types are not
556
-
produced yet: the engine derives no order term for these kinds.
560
+
`ErrEncoding`. Ordered dates compare by day, timestamps by the truncated
561
+
microsecond, and decimals by value (`1.5` ties `1.50`).
557
562
558
563
The `Ord` and `OrdOpe` types store an OPE term, which EQL compares as bytes,
559
564
and order by ADR-0002's order key: integers by value, floats as PostgreSQL's
@@ -570,7 +575,8 @@ answers `Eq` through an equality term only. A text order type also stores
570
575
`TextEq`'s equality term, and `=` reads that, so `Café` and `cafe` are
571
576
neither `<` nor `>` each other and not `=` either. Text holding a code point
572
577
Unicode 16 does not assign has no order term and is refused. There is no
573
-
`Between` method yet: a `BETWEEN` needs EQL v4's range query domains.
578
+
generated `Between` method on these EQL fields yet, although EQL v4 has
579
+
range query domains and `eql_v4.between` for them.
574
580
575
581
The `OrdOre` types and `TextSearchOre` order by the same key, through a block
576
582
ORE term (ore-rs's 6-bit schemes) in place of the OPE term. Each term
@@ -582,9 +588,9 @@ the installer disables these domains, and the `Ord` types are the ones to
582
588
use. Text whose fold is longer than 1023 bytes, or ends in NUL, has no block
583
589
ORE term and is refused, stored or queried.
584
590
585
-
The rest of the catalog (ordered dates, timestamps and decimals, the v3 JSON types) is listed in
586
-
`eql.Types`with the reason it is not produced yet, and `stashgen` refuses it
587
-
with that reason. The guest builds the value: the generated code
591
+
The catalog in `eql.Types` also lists EQL types the engine does not produce,
592
+
with the reason for each; `stashgen` refuses those types with that reason.
593
+
The guest builds a producible value: the generated code
588
594
imports `encrypt/eql`, which embeds the build of the engine that holds the
589
595
EQL types and registers it on import, so the program runs that build and
590
596
stores what it returns. `Fields.Email.Eq` returns the `eql.TextEqQuery`
@@ -601,8 +607,10 @@ column.
601
607
602
608
`JsonSearch` stores a whole JSON document in one `public.eql_v4_json_search`
603
609
column, from a struct, map or slice field, or a `json.RawMessage`
604
-
(`stash:"profile,encrypt_into=JsonSearch(ordered=$.age)"`; see the
605
-
stashgen README). A struct is marshalled with `encoding/json` when it is
610
+
(`stash:"profile,encrypt_into=JsonSearch(ordered=$.age)"`). See the
611
+
[stashgen reference](../cmd/stashgen/README.md#encrypted-json-documents) and
612
+
the [runnable typed-document example](example/json/README.md). A struct is
613
+
marshalled with `encoding/json` when it is
606
614
sealed and read back into its type when it is opened. Its numbers come back
607
615
exactly; the stashgen README lists what `encoding/json` does not keep
608
616
(invalid UTF-8, a nil map or slice, a time's zone). Unlike the types above,
0 commit comments