@cipherstash/protect-ffi 0.24.0 → 0.26.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/lib/index.cjs CHANGED
@@ -126,7 +126,7 @@ function newClient(opts) {
126
126
  return wrapAsync(() => native.newClient({
127
127
  encryptConfig: (0, normalizeEncryptConfig_js_1.normalizeEncryptConfig)(opts.encryptConfig),
128
128
  clientOpts: (0, credentials_js_1.withEnvCredentials)(opts.clientOpts),
129
- }));
129
+ }, opts.strategy));
130
130
  }
131
131
  function encrypt(client, opts) {
132
132
  return wrapAsync(() => native.encrypt(client, opts));
package/lib/index.d.cts CHANGED
@@ -6,7 +6,7 @@ export type Client = {
6
6
  readonly [sym]: unknown;
7
7
  };
8
8
  declare module './load.cjs' {
9
- function newClient(opts: NativeNewClientOptions): Promise<Client>;
9
+ function newClient(opts: NativeNewClientOptions, strategy?: AuthStrategy): Promise<Client>;
10
10
  function encrypt(client: Client, opts: EncryptOptions): Promise<Encrypted>;
11
11
  function decrypt(client: Client, opts: DecryptOptions): Promise<JsPlaintext>;
12
12
  function isEncrypted(encrypted: unknown): boolean;
@@ -60,10 +60,6 @@ export type BulkDecryptPayload = {
60
60
  ciphertext: Encrypted;
61
61
  lockContext?: Context;
62
62
  };
63
- export type CtsToken = {
64
- accessToken: string;
65
- expiry: number;
66
- };
67
63
  export type Context = {
68
64
  identityClaim: string[];
69
65
  };
@@ -254,6 +250,22 @@ export type TokenFilter = {
254
250
  export type NewClientOptions = {
255
251
  encryptConfig: EncryptConfig;
256
252
  clientOpts?: ClientOpts;
253
+ /**
254
+ * Caller-supplied auth strategy. When provided, `getToken()` is invoked on
255
+ * every ZeroKMS request and `clientOpts.creds` is ignored for auth (the
256
+ * client key is still required). Without this, the native side builds an
257
+ * AutoStrategy from env / profile / `clientOpts.creds`.
258
+ */
259
+ strategy?: AuthStrategy;
260
+ };
261
+ /**
262
+ * Auth strategy shape compatible with `@cipherstash/auth` strategies (e.g.
263
+ * `AccessKeyStrategy`). Only `getToken` is required.
264
+ */
265
+ export type AuthStrategy = {
266
+ getToken: () => Promise<{
267
+ token: string;
268
+ }>;
257
269
  };
258
270
  /** Options passed to the native `newClient` after vocabulary normalization. */
259
271
  type NativeNewClientOptions = {
@@ -281,23 +293,19 @@ export type EncryptOptions = {
281
293
  column: string;
282
294
  table: string;
283
295
  lockContext?: Context;
284
- serviceToken?: CtsToken;
285
296
  unverifiedContext?: Record<string, unknown>;
286
297
  };
287
298
  export type EncryptBulkOptions = {
288
299
  plaintexts: EncryptPayload[];
289
- serviceToken?: CtsToken;
290
300
  unverifiedContext?: Record<string, unknown>;
291
301
  };
292
302
  export type DecryptOptions = {
293
303
  ciphertext: Encrypted;
294
304
  lockContext?: Context;
295
- serviceToken?: CtsToken;
296
305
  unverifiedContext?: Record<string, unknown>;
297
306
  };
298
307
  export type DecryptBulkOptions = {
299
308
  ciphertexts: BulkDecryptPayload[];
300
- serviceToken?: CtsToken;
301
309
  unverifiedContext?: Record<string, unknown>;
302
310
  };
303
311
  export type IndexTypeName = 'ste_vec' | 'match' | 'ore' | 'unique';
@@ -309,7 +317,6 @@ export type EncryptQueryOptions = {
309
317
  indexType: IndexTypeName;
310
318
  queryOp?: QueryOpName;
311
319
  lockContext?: Context;
312
- serviceToken?: CtsToken;
313
320
  unverifiedContext?: Record<string, unknown>;
314
321
  };
315
322
  export type QueryPayload = {
@@ -322,6 +329,5 @@ export type QueryPayload = {
322
329
  };
323
330
  export type EncryptQueryBulkOptions = {
324
331
  queries: QueryPayload[];
325
- serviceToken?: CtsToken;
326
332
  unverifiedContext?: Record<string, unknown>;
327
333
  };
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "name": "@cipherstash/protect-ffi",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/cipherstash/protectjs-ffi.git"
7
+ },
8
+ "bugs": {
9
+ "url": "https://github.com/cipherstash/protectjs-ffi/issues"
10
+ },
11
+ "homepage": "https://github.com/cipherstash/protectjs-ffi#readme",
4
12
  "description": "",
5
13
  "main": "./lib/index.cjs",
6
14
  "scripts": {
@@ -26,7 +34,7 @@
26
34
  "prepack": "tsc &&neon update",
27
35
  "version": "neon bump --binaries platforms && git add .",
28
36
  "release": "gh workflow run release.yml -f dryrun=false -f version=patch",
29
- "dryrun": "gh workflow run publish.yml -f dryrun=true",
37
+ "dryrun": "gh workflow run release.yml -f dryrun=true -f version=patch",
30
38
  "build:wasm": "wasm-pack build crates/protect-ffi --target bundler --out-dir ../../dist/wasm --no-pack",
31
39
  "postbuild:wasm": "node scripts/inline-wasm.mjs"
32
40
  },
@@ -95,11 +103,11 @@
95
103
  "vite": "^8.0.5"
96
104
  },
97
105
  "optionalDependencies": {
98
- "@cipherstash/protect-ffi-darwin-x64": "0.24.0",
99
- "@cipherstash/protect-ffi-darwin-arm64": "0.24.0",
100
- "@cipherstash/protect-ffi-win32-x64-msvc": "0.24.0",
101
- "@cipherstash/protect-ffi-linux-x64-gnu": "0.24.0",
102
- "@cipherstash/protect-ffi-linux-arm64-gnu": "0.24.0",
103
- "@cipherstash/protect-ffi-linux-x64-musl": "0.24.0"
106
+ "@cipherstash/protect-ffi-darwin-x64": "0.26.0",
107
+ "@cipherstash/protect-ffi-darwin-arm64": "0.26.0",
108
+ "@cipherstash/protect-ffi-win32-x64-msvc": "0.26.0",
109
+ "@cipherstash/protect-ffi-linux-x64-gnu": "0.26.0",
110
+ "@cipherstash/protect-ffi-linux-arm64-gnu": "0.26.0",
111
+ "@cipherstash/protect-ffi-linux-x64-musl": "0.26.0"
104
112
  }
105
113
  }