pii_cipher 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f85ce2e6239e57922dc4d45337df8018d34ee1b292b1a069221e93398288b4b2
4
+ data.tar.gz: 435efc9780eca17230aa06a348e2549759cb2b3aec65e4d598ef27488c2b6128
5
+ SHA512:
6
+ metadata.gz: a048a2bec3fa13cbb463b261790f92af92898d4e793200e12e0c257324f1a9d334b4f090b01e1a0c075a1ba25c4e8d159e71448a8db781b55899f3525942209a
7
+ data.tar.gz: 285308387aee2a23193a0d0489f797752fc8b9e65f5db0e59d61bcecbf3106fc9b5b843b4ea1835ddf3923975ad397edc75366f1504b49ef1fb2347ae8938c76
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ ## [Unreleased]
2
+
3
+ - Case-insensitive search by default (values are downcased before hashing); opt out with `case_sensitive: true`.
4
+ - Configurable partial-search window via `gram_size:` (default 3).
5
+ - Query rewriting now works on chained relations and scopes, not just direct `Model.where` calls.
6
+ - `where` no longer mutates the conditions hash passed to it.
7
+ - Blanking an attribute now clears its blind index instead of leaving a stale one.
8
+ - Clearer error (`PiiCipher::MissingSecretKeyError`) when `PII_SECRET_KEY` is unset.
9
+ - Lowered requirements to Ruby >= 3.1 and ActiveRecord/Railties >= 7.1.
10
+ - Replaced placeholder test with a real RSpec suite (unit + PostgreSQL integration) and Rust unit tests; CI now runs across Ruby 3.1–4.0 with a Postgres service.
11
+ - Renamed the Rust entry point `generate_trigram_hashes` → `generate_ngram_hashes(text, secret, n)`.
12
+
13
+ ## [0.1.0] - 2026-05-16
14
+
15
+ - Initial release
@@ -0,0 +1,10 @@
1
+ # Code of Conduct
2
+
3
+ "pii_cipher" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
4
+
5
+ * Participants will be tolerant of opposing views.
6
+ * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
+ * When interpreting the words and actions of others, participants should always assume good intentions.
8
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
9
+
10
+ If you have any concerns about behaviour within this project, please contact us at ["selva.chezhian@momentivesoftware.com"](mailto:"selva.chezhian@momentivesoftware.com").
data/Cargo.lock ADDED
@@ -0,0 +1,394 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "aho-corasick"
7
+ version = "1.1.4"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
10
+ dependencies = [
11
+ "memchr",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "bindgen"
16
+ version = "0.72.1"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
19
+ dependencies = [
20
+ "bitflags",
21
+ "cexpr",
22
+ "clang-sys",
23
+ "itertools",
24
+ "proc-macro2",
25
+ "quote",
26
+ "regex",
27
+ "rustc-hash",
28
+ "shlex",
29
+ "syn",
30
+ ]
31
+
32
+ [[package]]
33
+ name = "bitflags"
34
+ version = "2.11.1"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
37
+
38
+ [[package]]
39
+ name = "block-buffer"
40
+ version = "0.10.4"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
43
+ dependencies = [
44
+ "generic-array",
45
+ ]
46
+
47
+ [[package]]
48
+ name = "cexpr"
49
+ version = "0.6.0"
50
+ source = "registry+https://github.com/rust-lang/crates.io-index"
51
+ checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
52
+ dependencies = [
53
+ "nom",
54
+ ]
55
+
56
+ [[package]]
57
+ name = "cfg-if"
58
+ version = "1.0.4"
59
+ source = "registry+https://github.com/rust-lang/crates.io-index"
60
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
61
+
62
+ [[package]]
63
+ name = "clang-sys"
64
+ version = "1.8.1"
65
+ source = "registry+https://github.com/rust-lang/crates.io-index"
66
+ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
67
+ dependencies = [
68
+ "glob",
69
+ "libc",
70
+ "libloading",
71
+ ]
72
+
73
+ [[package]]
74
+ name = "cpufeatures"
75
+ version = "0.2.17"
76
+ source = "registry+https://github.com/rust-lang/crates.io-index"
77
+ checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
78
+ dependencies = [
79
+ "libc",
80
+ ]
81
+
82
+ [[package]]
83
+ name = "crypto-common"
84
+ version = "0.1.7"
85
+ source = "registry+https://github.com/rust-lang/crates.io-index"
86
+ checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
87
+ dependencies = [
88
+ "generic-array",
89
+ "typenum",
90
+ ]
91
+
92
+ [[package]]
93
+ name = "digest"
94
+ version = "0.10.7"
95
+ source = "registry+https://github.com/rust-lang/crates.io-index"
96
+ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
97
+ dependencies = [
98
+ "block-buffer",
99
+ "crypto-common",
100
+ "subtle",
101
+ ]
102
+
103
+ [[package]]
104
+ name = "either"
105
+ version = "1.15.0"
106
+ source = "registry+https://github.com/rust-lang/crates.io-index"
107
+ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
108
+
109
+ [[package]]
110
+ name = "generic-array"
111
+ version = "0.14.7"
112
+ source = "registry+https://github.com/rust-lang/crates.io-index"
113
+ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
114
+ dependencies = [
115
+ "typenum",
116
+ "version_check",
117
+ ]
118
+
119
+ [[package]]
120
+ name = "glob"
121
+ version = "0.3.3"
122
+ source = "registry+https://github.com/rust-lang/crates.io-index"
123
+ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
124
+
125
+ [[package]]
126
+ name = "hmac"
127
+ version = "0.12.1"
128
+ source = "registry+https://github.com/rust-lang/crates.io-index"
129
+ checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
130
+ dependencies = [
131
+ "digest",
132
+ ]
133
+
134
+ [[package]]
135
+ name = "itertools"
136
+ version = "0.13.0"
137
+ source = "registry+https://github.com/rust-lang/crates.io-index"
138
+ checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
139
+ dependencies = [
140
+ "either",
141
+ ]
142
+
143
+ [[package]]
144
+ name = "lazy_static"
145
+ version = "1.5.0"
146
+ source = "registry+https://github.com/rust-lang/crates.io-index"
147
+ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
148
+
149
+ [[package]]
150
+ name = "libc"
151
+ version = "0.2.186"
152
+ source = "registry+https://github.com/rust-lang/crates.io-index"
153
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
154
+
155
+ [[package]]
156
+ name = "libloading"
157
+ version = "0.8.9"
158
+ source = "registry+https://github.com/rust-lang/crates.io-index"
159
+ checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
160
+ dependencies = [
161
+ "cfg-if",
162
+ "windows-link",
163
+ ]
164
+
165
+ [[package]]
166
+ name = "magnus"
167
+ version = "0.8.2"
168
+ source = "registry+https://github.com/rust-lang/crates.io-index"
169
+ checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012"
170
+ dependencies = [
171
+ "magnus-macros",
172
+ "rb-sys",
173
+ "rb-sys-env",
174
+ "seq-macro",
175
+ ]
176
+
177
+ [[package]]
178
+ name = "magnus-macros"
179
+ version = "0.8.0"
180
+ source = "registry+https://github.com/rust-lang/crates.io-index"
181
+ checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
182
+ dependencies = [
183
+ "proc-macro2",
184
+ "quote",
185
+ "syn",
186
+ ]
187
+
188
+ [[package]]
189
+ name = "memchr"
190
+ version = "2.8.0"
191
+ source = "registry+https://github.com/rust-lang/crates.io-index"
192
+ checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
193
+
194
+ [[package]]
195
+ name = "minimal-lexical"
196
+ version = "0.2.1"
197
+ source = "registry+https://github.com/rust-lang/crates.io-index"
198
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
199
+
200
+ [[package]]
201
+ name = "nom"
202
+ version = "7.1.3"
203
+ source = "registry+https://github.com/rust-lang/crates.io-index"
204
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
205
+ dependencies = [
206
+ "memchr",
207
+ "minimal-lexical",
208
+ ]
209
+
210
+ [[package]]
211
+ name = "pii_cipher"
212
+ version = "0.1.0"
213
+ dependencies = [
214
+ "hmac",
215
+ "magnus",
216
+ "rb-sys",
217
+ "rb-sys-env",
218
+ "rb-sys-test-helpers",
219
+ "sha2",
220
+ ]
221
+
222
+ [[package]]
223
+ name = "proc-macro2"
224
+ version = "1.0.106"
225
+ source = "registry+https://github.com/rust-lang/crates.io-index"
226
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
227
+ dependencies = [
228
+ "unicode-ident",
229
+ ]
230
+
231
+ [[package]]
232
+ name = "quote"
233
+ version = "1.0.45"
234
+ source = "registry+https://github.com/rust-lang/crates.io-index"
235
+ checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
236
+ dependencies = [
237
+ "proc-macro2",
238
+ ]
239
+
240
+ [[package]]
241
+ name = "rb-sys"
242
+ version = "0.9.128"
243
+ source = "registry+https://github.com/rust-lang/crates.io-index"
244
+ checksum = "45ca28513560e56cfb79a62b1fce363c73af170a182024ce880c77ee9429920a"
245
+ dependencies = [
246
+ "rb-sys-build",
247
+ ]
248
+
249
+ [[package]]
250
+ name = "rb-sys-build"
251
+ version = "0.9.128"
252
+ source = "registry+https://github.com/rust-lang/crates.io-index"
253
+ checksum = "ce04b2c55eff3a21aaa623fcc655d94373238e72cac6b3e1a3641ff31649f99a"
254
+ dependencies = [
255
+ "bindgen",
256
+ "lazy_static",
257
+ "proc-macro2",
258
+ "quote",
259
+ "regex",
260
+ "shell-words",
261
+ "syn",
262
+ ]
263
+
264
+ [[package]]
265
+ name = "rb-sys-env"
266
+ version = "0.2.3"
267
+ source = "registry+https://github.com/rust-lang/crates.io-index"
268
+ checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
269
+
270
+ [[package]]
271
+ name = "rb-sys-test-helpers"
272
+ version = "0.2.2"
273
+ source = "registry+https://github.com/rust-lang/crates.io-index"
274
+ checksum = "d6ccb543252549fc28f5d290322e041cd682bd199a8e1caaa813fb6e63dd221e"
275
+ dependencies = [
276
+ "rb-sys",
277
+ "rb-sys-env",
278
+ "rb-sys-test-helpers-macros",
279
+ ]
280
+
281
+ [[package]]
282
+ name = "rb-sys-test-helpers-macros"
283
+ version = "0.2.2"
284
+ source = "registry+https://github.com/rust-lang/crates.io-index"
285
+ checksum = "1508caed999cb659ab1b3308e7b2985186b3b550ef5492dc18da71b560c55615"
286
+ dependencies = [
287
+ "quote",
288
+ "syn",
289
+ ]
290
+
291
+ [[package]]
292
+ name = "regex"
293
+ version = "1.12.3"
294
+ source = "registry+https://github.com/rust-lang/crates.io-index"
295
+ checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
296
+ dependencies = [
297
+ "aho-corasick",
298
+ "memchr",
299
+ "regex-automata",
300
+ "regex-syntax",
301
+ ]
302
+
303
+ [[package]]
304
+ name = "regex-automata"
305
+ version = "0.4.14"
306
+ source = "registry+https://github.com/rust-lang/crates.io-index"
307
+ checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
308
+ dependencies = [
309
+ "aho-corasick",
310
+ "memchr",
311
+ "regex-syntax",
312
+ ]
313
+
314
+ [[package]]
315
+ name = "regex-syntax"
316
+ version = "0.8.10"
317
+ source = "registry+https://github.com/rust-lang/crates.io-index"
318
+ checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
319
+
320
+ [[package]]
321
+ name = "rustc-hash"
322
+ version = "2.1.2"
323
+ source = "registry+https://github.com/rust-lang/crates.io-index"
324
+ checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
325
+
326
+ [[package]]
327
+ name = "seq-macro"
328
+ version = "0.3.6"
329
+ source = "registry+https://github.com/rust-lang/crates.io-index"
330
+ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
331
+
332
+ [[package]]
333
+ name = "sha2"
334
+ version = "0.10.9"
335
+ source = "registry+https://github.com/rust-lang/crates.io-index"
336
+ checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
337
+ dependencies = [
338
+ "cfg-if",
339
+ "cpufeatures",
340
+ "digest",
341
+ ]
342
+
343
+ [[package]]
344
+ name = "shell-words"
345
+ version = "1.1.1"
346
+ source = "registry+https://github.com/rust-lang/crates.io-index"
347
+ checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
348
+
349
+ [[package]]
350
+ name = "shlex"
351
+ version = "1.3.0"
352
+ source = "registry+https://github.com/rust-lang/crates.io-index"
353
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
354
+
355
+ [[package]]
356
+ name = "subtle"
357
+ version = "2.6.1"
358
+ source = "registry+https://github.com/rust-lang/crates.io-index"
359
+ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
360
+
361
+ [[package]]
362
+ name = "syn"
363
+ version = "2.0.117"
364
+ source = "registry+https://github.com/rust-lang/crates.io-index"
365
+ checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
366
+ dependencies = [
367
+ "proc-macro2",
368
+ "quote",
369
+ "unicode-ident",
370
+ ]
371
+
372
+ [[package]]
373
+ name = "typenum"
374
+ version = "1.20.0"
375
+ source = "registry+https://github.com/rust-lang/crates.io-index"
376
+ checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de"
377
+
378
+ [[package]]
379
+ name = "unicode-ident"
380
+ version = "1.0.24"
381
+ source = "registry+https://github.com/rust-lang/crates.io-index"
382
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
383
+
384
+ [[package]]
385
+ name = "version_check"
386
+ version = "0.9.5"
387
+ source = "registry+https://github.com/rust-lang/crates.io-index"
388
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
389
+
390
+ [[package]]
391
+ name = "windows-link"
392
+ version = "0.2.1"
393
+ source = "registry+https://github.com/rust-lang/crates.io-index"
394
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
data/Cargo.toml ADDED
@@ -0,0 +1,13 @@
1
+ # This Cargo.toml is here to let externals tools (IDEs, etc.) know that this is
2
+ # a Rust project. Your extensions dependencies should be added to the Cargo.toml
3
+ # in the ext/ directory.
4
+
5
+ [workspace]
6
+ members = ["./ext/pii_cipher"]
7
+ resolver = "2"
8
+
9
+ [profile.release]
10
+ # By default, debug symbols are stripped from the final binary which makes it
11
+ # harder to debug if something goes wrong. It's recommended to keep debug
12
+ # symbols in the release build so that you can debug the final binary if needed.
13
+ debug = true
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Selva Chezhian
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.