You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+59-36Lines changed: 59 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,35 +21,35 @@ When data is fully encrypted, you lose the ability to perform meaningful queries
21
21
22
22
This package removes that trade-off by introducing a **detached searchable index** that maps encrypted records to deterministic tokens.
23
23
24
-
---\n
24
+
---
25
25
26
26
## Key Features
27
27
28
-
***Searchable encryption**: Enables exact and prefix-based searches over encrypted data.
29
-
***Detached search index**: Tokens are stored separately from the main data, reducing exposure risk.
30
-
***Deterministic hashing with peppering**: Each token is derived from normalized text combined with a secret pepper, preventing reverse-engineering.
31
-
***No blind indexes in primary tables**: Encrypted fields remain opaque—only hashed references are stored elsewhere.
32
-
***High scalability**: Indexes can handle millions of records efficiently using native database indexes.
33
-
***Laravel-native integration**: Fully compatible with Eloquent models, query scopes, and events.
28
+
***Searchable encryption** — Enables exact and prefix-based searches over encrypted data.
29
+
***Detached search index** — Tokens are stored separately from the main data, reducing exposure risk.
30
+
***Deterministic hashing with peppering** — Each token is derived from normalized text combined with a secret pepper.
31
+
***No blind indexes in primary tables** — Encrypted fields remain opaque; only hashed references are stored elsewhere.
32
+
***High scalability** — Efficient for millions of records through database indexing.
33
+
***Laravel-native integration** — Works directly with Eloquent models, query scopes, and model events.
34
34
35
35
---
36
36
37
37
## How It Works
38
38
39
-
Each model can declare specific fields as searchable. When the model is saved, a background process normalizes the field value, generates one or more hashed tokens, and stores them in a separate database table named `encrypted_search_index`.
39
+
Each model can declare specific fields as searchable. When the model is saved, the system normalizes the field value, generates one or more hashed tokens, and stores them in a separate table named `encrypted_search_index`.
40
40
41
41
When you search, the package hashes your input using the same process and retrieves matching model IDs from the index.
42
42
43
43
### 1. Token Generation
44
44
45
45
For each configured field:
46
46
47
-
***Exact match token:** A SHA-256 hash of the normalized value plus a secret pepper.
48
-
***Prefix tokens:** Multiple SHA-256 hashes representing progressive prefixes of the normalized text (e.g.,`w`, `wi`, `wie`).
47
+
***Exact match token:** A SHA-256 hash of the normalized value + secret pepper.
48
+
***Prefix tokens:** Multiple SHA-256 hashes representing progressive prefixes of the normalized text (e.g. `w`, `wi`, `wie`).
49
49
50
50
### 2. Token Storage
51
51
52
-
All tokens are stored in `encrypted_search_index` with the following structure:
52
+
All tokens are stored in `encrypted_search_index`:
| Database dump or breach | Tokens cannot be reversed (salted + peppered SHA-256).|
77
+
| Statistical analysis | Tokens are detached; frequency analysis yields no correlation.|
78
+
| Insider access | No sensitive data in index table; encrypted fields remain opaque. |
79
+
| Leaked `APP_KEY`|Irrelevant for tokens; pepper is stored separately in `.env`.|
80
80
81
-
The system follows a **defense-in-depth**approach: encrypted data remains fully protected, while token search provides limited, controlled visibility for queries.
81
+
This design follows a **defense-in-depth**model: encrypted data stays secure, while search operations remain practical.
***Chunked rebuilds** for large datasets (`--chunk` option).
160
+
***Queue-compatible** for asynchronous index rebuilds.
163
161
164
-
Unlike in-memory search systems, this index-based approach scales linearly with the size of your dataset and can efficiently handle millions of records.
162
+
The detached index structure scales linearly and supports millions of records efficiently.
165
163
166
164
---
167
165
168
-
## Compliance
166
+
## Framework Compatibility
167
+
168
+
| Laravel Version | PHP Version(s) Supported |
169
+
| --------------- | ------------------------ |
170
+
| 8.x | 8.0 – 8.1 |
171
+
| 9.x | 8.1 – 8.2 |
172
+
| 10.x | 8.1 – 8.3 |
173
+
| 11.x | 8.2 – 8.3 |
174
+
| 12.x | 8.3+ |
175
+
176
+
The package is continuously tested across all supported combinations using GitHub Actions.
177
+
178
+
---
179
+
180
+
## Continuous Integration
169
181
170
-
This approach aligns with major privacy and compliance frameworks:
182
+
This repository includes automated testing for all Laravel 8–12 releases.
183
+
Each test matrix validates functionality on PHP 8.1, 8.2, and 8.3.
184
+
185
+
Example badge (replace `USERNAME/REPOSITORY` with yours):
0 commit comments