@cipherstash/protect-ffi 0.15.0 → 0.16.0-1

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
@@ -1,20 +1,11 @@
1
1
  "use strict";
2
2
  // This module is the CJS entry point for the library.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.decryptBulk = exports.newClient = exports.encryptBulk = exports.encrypt = void 0;
5
- exports.decrypt = decrypt;
4
+ exports.decryptBulkFallible = exports.decrypt = exports.decryptBulk = exports.newClient = exports.encryptBulk = exports.encrypt = void 0;
6
5
  var load_cjs_1 = require("./load.cjs");
7
6
  Object.defineProperty(exports, "encrypt", { enumerable: true, get: function () { return load_cjs_1.encrypt; } });
8
7
  Object.defineProperty(exports, "encryptBulk", { enumerable: true, get: function () { return load_cjs_1.encryptBulk; } });
9
8
  Object.defineProperty(exports, "newClient", { enumerable: true, get: function () { return load_cjs_1.newClient; } });
10
9
  Object.defineProperty(exports, "decryptBulk", { enumerable: true, get: function () { return load_cjs_1.decryptBulk; } });
11
- const load_cjs_2 = require("./load.cjs");
12
- function decrypt(client, ciphertext, lockContext, ctsToken) {
13
- if (ctsToken) {
14
- return (0, load_cjs_2.decrypt)(client, ciphertext, lockContext, ctsToken);
15
- }
16
- if (lockContext) {
17
- return (0, load_cjs_2.decrypt)(client, ciphertext, lockContext);
18
- }
19
- return (0, load_cjs_2.decrypt)(client, ciphertext);
20
- }
10
+ Object.defineProperty(exports, "decrypt", { enumerable: true, get: function () { return load_cjs_1.decrypt; } });
11
+ Object.defineProperty(exports, "decryptBulkFallible", { enumerable: true, get: function () { return load_cjs_1.decryptBulkFallible; } });
package/lib/index.d.cts CHANGED
@@ -1,16 +1,21 @@
1
- export { encrypt, encryptBulk, newClient, decryptBulk } from './load.cjs';
1
+ export { encrypt, encryptBulk, newClient, decryptBulk, decrypt, decryptBulkFallible, } from './load.cjs';
2
2
  declare const sym: unique symbol;
3
3
  export type Client = {
4
4
  readonly [sym]: unknown;
5
5
  };
6
6
  declare module './load.cjs' {
7
7
  function newClient(encryptSchema: string, clientOpts?: string): Promise<Client>;
8
- function encrypt(client: Client, plaintext: EncryptPayload, ctsToken?: CtsToken): Promise<Encrypted>;
9
- function decrypt(client: Client, ciphertext: string, context?: Context, ctsToken?: CtsToken): Promise<string>;
10
- function encryptBulk(client: Client, plaintextTargets: EncryptPayload[], ctsToken?: CtsToken): Promise<Encrypted[]>;
11
- function decryptBulk(client: Client, ciphertexts: BulkDecryptPayload[], ctsToken?: CtsToken): Promise<string[]>;
8
+ function encrypt(client: Client, plaintext: EncryptPayload, ctsToken?: CtsToken, unverifiedContext?: Record<string, unknown>): Promise<Encrypted>;
9
+ function decrypt(client: Client, ciphertext: string, context?: Context, ctsToken?: CtsToken, unverifiedContext?: Record<string, unknown>): Promise<string>;
10
+ function encryptBulk(client: Client, plaintextTargets: EncryptPayload[], ctsToken?: CtsToken, unverifiedContext?: Record<string, unknown>): Promise<Encrypted[]>;
11
+ function decryptBulk(client: Client, ciphertexts: BulkDecryptPayload[], ctsToken?: CtsToken, unverifiedContext?: Record<string, unknown>): Promise<string[]>;
12
+ function decryptBulkFallible(client: Client, ciphertexts: BulkDecryptPayload[], ctsToken?: CtsToken, unverifiedContext?: Record<string, unknown>): Promise<DecryptResult[]>;
12
13
  }
13
- export declare function decrypt(client: Client, ciphertext: string, lockContext?: Context, ctsToken?: CtsToken): Promise<string>;
14
+ export type DecryptResult = {
15
+ data: string;
16
+ } | {
17
+ error: string;
18
+ };
14
19
  export type EncryptPayload = {
15
20
  plaintext: string;
16
21
  column: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cipherstash/protect-ffi",
3
- "version": "0.15.0",
3
+ "version": "0.16.0-1",
4
4
  "description": "",
5
5
  "main": "./lib/index.cjs",
6
6
  "scripts": {
@@ -61,10 +61,10 @@
61
61
  "@neon-rs/load": "^0.1.82"
62
62
  },
63
63
  "optionalDependencies": {
64
- "@cipherstash/protect-ffi-win32-x64-msvc": "0.15.0",
65
- "@cipherstash/protect-ffi-darwin-x64": "0.15.0",
66
- "@cipherstash/protect-ffi-darwin-arm64": "0.15.0",
67
- "@cipherstash/protect-ffi-linux-x64-gnu": "0.15.0",
68
- "@cipherstash/protect-ffi-linux-arm64-gnu": "0.15.0"
64
+ "@cipherstash/protect-ffi-win32-x64-msvc": "0.16.0-1",
65
+ "@cipherstash/protect-ffi-darwin-x64": "0.16.0-1",
66
+ "@cipherstash/protect-ffi-darwin-arm64": "0.16.0-1",
67
+ "@cipherstash/protect-ffi-linux-x64-gnu": "0.16.0-1",
68
+ "@cipherstash/protect-ffi-linux-arm64-gnu": "0.16.0-1"
69
69
  }
70
70
  }