Skip to content

docs(solutions): port the use-cases section into /solutions#56

Merged
coderdan merged 4 commits into
v2from
docs/v2-solutions-port
Jul 9, 2026
Merged

docs(solutions): port the use-cases section into /solutions#56
coderdan merged 4 commits into
v2from
docs/v2-solutions-port

Conversation

@coderdan

@coderdan coderdan commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Ports content/stack/reference/use-cases/* into /solutions, per the mapping in v2-redirects.mjs. Four pages: the section index, ai-and-rag, data-residency, provable-access.

Three API errors found and fixed

This was supposed to be a mechanical port. It wasn't. I checked every code example against the generated TypeDoc for @cipherstash/stack v0.18.0, and three of them were wrong:

1. provable-access used an API that does not exist. Every code block called client.withLockContext({ identityToken: jwt }).encrypt(...). The real API constructs a LockContext, identifies it with the JWT (which returns a Result, because the CTS token exchange can fail), and attaches it to the operation:

const lockContext = await new LockContext().identify(providerJwt)
if (lockContext.failure) throw new Error(lockContext.failure.message)

const result = await client
  .encrypt(diagnosis, { column: patients.diagnosis, table: patients })
  .withLockContext(lockContext.data)

2. data-residency passed credentials as top-level keys to Encryption({ schemas, workspaceCrn, clientId, ... }). EncryptionClientConfig puts them in a nested config object.

3. ai-and-rag queried with eql_v2.eq(user_id, $1), removed in EQL 3.0.0. Now uses a typed operand, WHERE user_id = $1::public.text_eq, with a pointer to the typed-operand rule and to indexes, since that predicate needs a functional index to avoid a sequential scan.

The provable-access bug is exactly the signature drift this overhaul exists to eliminate, and it survived on a live page.

The legacy index was not an index

use-cases/index.mdx was three unrelated things. Handled as follows:

  • "What data should I protect?" (PII, PHI, financial, authentication, with applicable regulations) moves onto the Solutions index, where it works as orientation for the audience door.
  • "Data sovereignty" duplicated data-residency almost line for line. Folded in; the distinct material (the three properties that give you residency) is now that page's opening section.
  • "CipherStash vs data vaults" (Skyflow, VGS) is a vendor comparison, not a solution. Not ported here. Tracked separately, since it belongs in /concepts/compare/data-vaults and is a sixth comparison page beyond the five in IA.md. It is distinct from hashicorp-vault: Skyflow and VGS are PII data vaults, HashiCorp Vault is a secrets manager. Until that lands, /stack/reference/use-cases redirects to /solutions and that comparison is not reachable from its old URL.

Other changes

  • Added a callout to ai-and-rag noting that CipherStash encrypts chunks and metadata, not the embeddings, and that embeddings should themselves be treated as sensitive. The original page implied full coverage.
  • ai-and-rag ingest now uses encryptModel and retrieval uses bulkDecryptModels rather than per-field calls in a Promise.all, so a reranking pass is one ZeroKMS round trip instead of one per row.
  • Softened provable-access's "mathematically impossible to bypass" framing. A lock context moves enforcement into key derivation; it does not stop a caller holding a valid token.
  • Added a note that keysets, not lock contexts, are usually the right tool for coarse tenant isolation.

Checks

  • bun run build passes; all four pages prerender.
  • bun run validate-redirects passes (194 legacy pages covered).
  • All internal links resolve. Targets not yet built (/stack/cipherstash/kms/*, /stack/cipherstash/proxy/audit) point at legacy homes and are tracked for repointing.
  • Code examples verified against generated TypeDoc, packageVersion: v0.18.0. Pages carry verifiedAgainst: { stack: "0.18.0" }.

One upstream nit

The TypeDoc for EncryptionClient contains an example that passes the Result to .withLockContext(lockContext), while LockContext's own example correctly passes .withLockContext(identified.data). withLockContext takes a LockContext, so the EncryptionClient example is wrong. Worth fixing in the SDK's doc comments.

Ports the use-cases section into /solutions, correcting three API errors
found by checking the examples against the generated TypeDoc for
@cipherstash/stack v0.18.0.

- provable-access used `client.withLockContext({ identityToken }).encrypt()`,
  which does not exist. The real API constructs a LockContext, identifies it
  with the JWT, and attaches it to the operation:
  `client.encrypt(v, opts).withLockContext(lockContext.data)`.
- data-residency passed credentials as top-level keys to `Encryption()`.
  They belong in the nested `config` object.
- ai-and-rag queried with `eql_v2.eq(user_id, $1)`, removed in EQL 3.0.0.
  Now a typed operand: `WHERE user_id = $1::public.text_eq`.

The legacy use-cases index was not a section index. Its "what data should I
protect" primer moves onto the Solutions index; its data-sovereignty section
folds into data-residency, which already covered the same ground.
@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
public-docs Ready Ready Preview, Comment Jul 9, 2026 6:08am

Request Review

Comment thread content/docs/solutions/data-residency.mdx Outdated
Comment thread content/docs/solutions/provable-access.mdx Outdated
Comment thread content/docs/solutions/ai-and-rag.mdx Outdated
- provable-access: rewrite on the strategy-based API. LockContext.identify()
  is deprecated (per-operation CTS tokens were removed in protect-ffi 0.25).
  Authenticate the client as the end user with OidcFederationStrategy via
  config.authStrategy, then bind with .withLockContext({ identityClaim }).
  Verified against @cipherstash/stack 0.19.0 and @cipherstash/auth 0.42.0.

- regions: extract the ZeroKMS region list into @/lib/zerokms-regions and a
  <ZeroKmsRegions /> MDX component, used by both the regions reference and
  data-residency so the list can't drift. Adds the two missing regions, the
  .aws suffix on identifiers, and states that ZeroKMS is AWS-only.

- ai-and-rag: remove pending a rewrite. Its legacy URL now redirects to the
  Solutions index rather than a page that no longer exists.
Only identify() and getLockContext() are deprecated. The constructor is not:
.withLockContext() accepts a LockContext or a plain { identityClaim }.
Comment thread content/docs/solutions/provable-access.mdx
…e-access

- Note that OidcFederationStrategy is the only strategy supporting lock
  contexts; AccessKeyStrategy authenticates as the service, so there is no
  end-user identity to bind a claim to.
- Say that the examples depend on the authStrategy-configured client.
- Explain that the '_' in the dashboard OIDC providers URL is the current
  workspace.
@coderdan
coderdan merged commit b4883db into v2 Jul 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant