@cipherstash/protect-ffi 0.18.0-9 → 0.18.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.d.cts CHANGED
@@ -5,82 +5,60 @@ export type Client = {
5
5
  };
6
6
  declare module './load.cjs' {
7
7
  function newClient(opts: NewClientOptions): Promise<Client>;
8
- function encrypt<T extends EncryptConfig>(client: Client, opts: EncryptOptions<T>): Promise<AnyEncrypted<T>>;
9
- function decrypt<T extends EncryptConfig>(client: Client, opts: DecryptOptions<T>): Promise<JsPlaintext>;
10
- function isEncrypted<T extends EncryptConfig>(encrypted: AnyEncrypted<T>): boolean;
11
- function encryptQuery<T extends EncryptConfig, Q extends EncryptedQueryTerm>(client: Client, opts: QueryOptions<T>): Promise<Q>;
12
- function encryptBulk<T extends EncryptConfig>(client: Client, opts: EncryptBulkOptions<T>): Promise<AnyEncrypted<T>[]>;
13
- function decryptBulk<T extends EncryptConfig>(client: Client, opts: DecryptBulkOptions<T>): Promise<JsPlaintext[]>;
14
- function decryptBulkFallible<T extends EncryptConfig>(client: Client, opts: DecryptBulkOptions<T>): Promise<DecryptResult[]>;
8
+ function encrypt(client: Client, opts: EncryptOptions): Promise<Encrypted>;
9
+ function decrypt(client: Client, opts: DecryptOptions): Promise<JsPlaintext>;
10
+ function isEncrypted(encrypted: Encrypted): boolean;
11
+ function encryptBulk(client: Client, opts: EncryptBulkOptions): Promise<Encrypted[]>;
12
+ function decryptBulk(client: Client, opts: DecryptBulkOptions): Promise<JsPlaintext[]>;
13
+ function decryptBulkFallible(client: Client, opts: DecryptBulkOptions): Promise<DecryptResult[]>;
15
14
  }
16
15
  export type DecryptResult = {
17
16
  data: string;
18
17
  } | {
19
18
  error: string;
20
19
  };
21
- export type EncryptPayload<T extends EncryptConfig> = {
20
+ export type EncryptPayload = {
22
21
  plaintext: JsPlaintext;
23
- lockContext?: Context[];
24
- } & Identifier<T>;
25
- export type BulkDecryptPayload<T extends EncryptConfig> = {
26
- ciphertext: AnyEncrypted<T>;
27
- lockContext?: Context[];
22
+ column: string;
23
+ table: string;
24
+ lockContext?: Context;
25
+ };
26
+ export type BulkDecryptPayload = {
27
+ ciphertext: Encrypted;
28
+ lockContext?: Context;
28
29
  };
29
30
  export type CtsToken = {
30
31
  accessToken: string;
31
32
  expiry: number;
32
33
  };
33
34
  export type Context = {
34
- identityClaim: string;
35
- } | {
36
- tag: string;
37
- };
38
- export type Versioned = {
39
- v: number;
35
+ identityClaim: string[];
40
36
  };
41
- export type Base85Ciphertext = string;
42
- export type BloomFilter = number[];
43
- export type HMAC = string;
44
- export type EncodedBlockOREArray = string[];
45
- export type EncodedFixedLengthORE = string;
46
- export type EncodedVariableLengthORE = string;
47
- export type JSONPathSelector = string;
48
- export type EncryptedCell<T extends EncryptConfig> = Versioned & {
37
+ export type Encrypted = {
49
38
  k: 'ct';
50
- c: Base85Ciphertext;
51
- ob: EncodedBlockOREArray | null;
52
- bf: BloomFilter | null;
53
- hm: HMAC | null;
54
- i: Identifier<T>;
55
- };
56
- export type EncryptedSV<T extends EncryptConfig> = Versioned & {
39
+ c: string;
40
+ ob: string[] | null;
41
+ bf: number[] | null;
42
+ hm: string | null;
43
+ i: {
44
+ c: string;
45
+ t: string;
46
+ };
47
+ v: number;
48
+ } | {
57
49
  k: 'sv';
58
50
  sv: SteVecEncryptedEntry[];
59
- i: Identifier<T>;
60
- };
61
- export type EncryptedSVE = {
62
- k: 'sve';
63
- sve: SteVecEncryptedEntry;
51
+ i: {
52
+ c: string;
53
+ t: string;
54
+ };
55
+ v: number;
64
56
  };
65
- export type AnyEncrypted<T extends EncryptConfig> = EncryptedCell<T> | EncryptedSV<T> | EncryptedSVE;
66
57
  export type SteVecEncryptedEntry = {
67
- c: Base85Ciphertext;
58
+ tokenized_selector: string;
59
+ term: string;
60
+ record: string;
68
61
  parent_is_array: boolean;
69
- } & SteVecTerm & {
70
- s: JSONPathSelector;
71
- };
72
- export type SteVecQuery = {
73
- svq: SteQueryVecEntry[];
74
- };
75
- export type SteQueryVecEntry = {
76
- s: JSONPathSelector;
77
- } & SteVecTerm;
78
- export type SteVecTerm = {
79
- hm: HMAC;
80
- } | {
81
- ocf: EncodedFixedLengthORE;
82
- } | {
83
- ocv: EncodedVariableLengthORE;
84
62
  };
85
63
  export type EncryptConfig = {
86
64
  v: number;
@@ -90,7 +68,7 @@ export type Column = {
90
68
  cast_as?: CastAs;
91
69
  indexes?: Indexes;
92
70
  };
93
- export type CastAs = 'big_int' | 'boolean' | 'date' | 'real' | 'double' | 'int' | 'small_int' | 'text' | 'jsonb';
71
+ export type CastAs = 'bigint' | 'boolean' | 'date' | 'number' | 'string' | 'json';
94
72
  type TablesOf<C extends EncryptConfig> = C['tables'];
95
73
  export type Identifier<C extends EncryptConfig> = {
96
74
  [T in keyof TablesOf<C>]: {
@@ -138,56 +116,35 @@ export type ClientOpts = {
138
116
  accessKey?: string;
139
117
  clientId?: string;
140
118
  clientKey?: string;
141
- keyset?: IdentifiedBy;
119
+ keyset?: KeysetIdentifier;
120
+ };
121
+ export type KeysetIdentifier = {
122
+ Uuid: string;
123
+ } | {
124
+ Name: string;
142
125
  };
143
- export type IdentifiedBy = string;
144
126
  export type JsPlaintext = string | number | Record<string, unknown> | JsPlaintext[];
145
- export type EncryptOptions<T extends EncryptConfig> = {
127
+ export type EncryptOptions = {
146
128
  plaintext: JsPlaintext;
147
- lockContext?: Context[];
129
+ column: string;
130
+ table: string;
131
+ lockContext?: Context;
148
132
  serviceToken?: CtsToken;
149
133
  unverifiedContext?: Record<string, unknown>;
150
- } & Identifier<T>;
151
- export type EncryptBulkOptions<T extends EncryptConfig> = {
152
- plaintexts: EncryptPayload<T>[];
134
+ };
135
+ export type EncryptBulkOptions = {
136
+ plaintexts: EncryptPayload[];
153
137
  serviceToken?: CtsToken;
154
138
  unverifiedContext?: Record<string, unknown>;
155
139
  };
156
- export type DecryptOptions<T extends EncryptConfig> = {
157
- ciphertext: AnyEncrypted<T>;
158
- lockContext?: Context[];
140
+ export type DecryptOptions = {
141
+ ciphertext: Encrypted;
142
+ lockContext?: Context;
159
143
  serviceToken?: CtsToken;
160
144
  unverifiedContext?: Record<string, unknown>;
161
145
  };
162
- export type DecryptBulkOptions<T extends EncryptConfig> = {
163
- ciphertexts: BulkDecryptPayload<T>[];
146
+ export type DecryptBulkOptions = {
147
+ ciphertexts: BulkDecryptPayload[];
164
148
  serviceToken?: CtsToken;
165
149
  unverifiedContext?: Record<string, unknown>;
166
150
  };
167
- export type QueryOptions<T extends EncryptConfig> = {
168
- plaintext: JsPlaintext;
169
- operator: QueryOperator;
170
- } & Identifier<T>;
171
- export type NumericOperator = '>' | '>=' | '<' | '<=' | '=';
172
- export type StringOperator = '~~' | '~~*' | '=';
173
- export type JsonbOperator = '@>' | '<@' | '->';
174
- export type QueryOperator = NumericOperator | StringOperator | JsonbOperator;
175
- export type EncryptedQueryTerm = {};
176
- export interface RangeQuery extends EncryptedQueryTerm {
177
- ob: EncodedBlockOREArray;
178
- }
179
- export interface MatchQuery extends EncryptedQueryTerm {
180
- bf: BloomFilter;
181
- }
182
- export interface ExactQuery extends EncryptedQueryTerm {
183
- hm: HMAC;
184
- }
185
- export interface JsonSelect extends EncryptedQueryTerm {
186
- s: JSONPathSelector;
187
- }
188
- export interface JsonContainsQuery extends EncryptedQueryTerm {
189
- sv: SteQueryVecEntry[];
190
- }
191
- export interface JsonIsContainedByQuery extends EncryptedQueryTerm {
192
- sv: SteQueryVecEntry[];
193
- }
package/lib/load.cjs CHANGED
@@ -12,6 +12,7 @@ module.exports = require('@neon-rs/load').proxy({
12
12
  'darwin-x64': () => require('@cipherstash/protect-ffi-darwin-x64'),
13
13
  'darwin-arm64': () => require('@cipherstash/protect-ffi-darwin-arm64'),
14
14
  'linux-x64-gnu': () => require('@cipherstash/protect-ffi-linux-x64-gnu'),
15
+ 'linux-x64-musl': () => require('@cipherstash/protect-ffi-linux-x64-musl'),
15
16
  'linux-arm64-gnu': () => require('@cipherstash/protect-ffi-linux-arm64-gnu'),
16
17
  },
17
18
  debug: () => require('../index.node'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cipherstash/protect-ffi",
3
- "version": "0.18.0-9",
3
+ "version": "0.18.1",
4
4
  "description": "",
5
5
  "main": "./lib/index.cjs",
6
6
  "scripts": {
@@ -45,7 +45,14 @@
45
45
  "neon": {
46
46
  "type": "library",
47
47
  "org": "@cipherstash",
48
- "platforms": "common",
48
+ "platforms": [
49
+ "darwin-x64",
50
+ "darwin-arm64",
51
+ "win32-x64-msvc",
52
+ "linux-x64-gnu",
53
+ "linux-arm64-gnu",
54
+ "linux-x64-musl"
55
+ ],
49
56
  "load": "./src/load.cts",
50
57
  "prefix": "protect-ffi-"
51
58
  },
@@ -60,10 +67,11 @@
60
67
  "@neon-rs/load": "^0.1.82"
61
68
  },
62
69
  "optionalDependencies": {
63
- "@cipherstash/protect-ffi-win32-x64-msvc": "0.18.0-9",
64
- "@cipherstash/protect-ffi-darwin-x64": "0.18.0-9",
65
- "@cipherstash/protect-ffi-darwin-arm64": "0.18.0-9",
66
- "@cipherstash/protect-ffi-linux-x64-gnu": "0.18.0-9",
67
- "@cipherstash/protect-ffi-linux-arm64-gnu": "0.18.0-9"
70
+ "@cipherstash/protect-ffi-darwin-x64": "0.18.1",
71
+ "@cipherstash/protect-ffi-darwin-arm64": "0.18.1",
72
+ "@cipherstash/protect-ffi-win32-x64-msvc": "0.18.1",
73
+ "@cipherstash/protect-ffi-linux-x64-gnu": "0.18.1",
74
+ "@cipherstash/protect-ffi-linux-arm64-gnu": "0.18.1",
75
+ "@cipherstash/protect-ffi-linux-x64-musl": "0.18.1"
68
76
  }
69
77
  }