|  | 
| 1 | 1 | <?php | 
| 2 | 2 | 
 | 
|  | 3 | +/** | 
|  | 4 | + * ----------------------------------------------------------------------------- | 
|  | 5 | + * Ginkelsoft Laravel Encrypted Search Index - Configuration | 
|  | 6 | + * ----------------------------------------------------------------------------- | 
|  | 7 | + * | 
|  | 8 | + * This configuration file defines how the encrypted search indexing system | 
|  | 9 | + * behaves. It supports both local database indexing and Elasticsearch as | 
|  | 10 | + * a backend. It also provides automatic detection of encrypted model casts, | 
|  | 11 | + * customizable prefix depth, and peppering for secure token hashing. | 
|  | 12 | + * | 
|  | 13 | + * @package   Ginkelsoft\EncryptedSearch | 
|  | 14 | + */ | 
|  | 15 | + | 
| 3 | 16 | return [ | 
|  | 17 | + | 
| 4 | 18 |     /* | 
| 5 | 19 |     |-------------------------------------------------------------------------- | 
| 6 | 20 |     | Search Pepper | 
| 7 | 21 |     |-------------------------------------------------------------------------- | 
| 8 |  | -    | Een geheime “pepper” die wordt mee-gehasht met genormaliseerde tokens. | 
| 9 |  | -    | Dit voorkomt dat een gelekte index triviaal terug te rekenen is. | 
| 10 |  | -    | Zet dit in .env als SEARCH_PEPPER="random-string". | 
|  | 22 | +    | | 
|  | 23 | +    | A secret “pepper” value that is concatenated with the normalized text | 
|  | 24 | +    | before hashing. This ensures that even if the token index is leaked, | 
|  | 25 | +    | it cannot be reversed or correlated with plaintext values. | 
|  | 26 | +    | | 
|  | 27 | +    | Define this in your `.env` file, for example: | 
|  | 28 | +    |   SEARCH_PEPPER="random-secret-string" | 
|  | 29 | +    | | 
| 11 | 30 |     */ | 
| 12 | 31 |     'search_pepper' => env('SEARCH_PEPPER', ''), | 
| 13 | 32 | 
 | 
| 14 | 33 |     /* | 
| 15 | 34 |     |-------------------------------------------------------------------------- | 
| 16 |  | -    | Prefix token lengte | 
|  | 35 | +    | Maximum Prefix Depth | 
| 17 | 36 |     |-------------------------------------------------------------------------- | 
| 18 |  | -    | Maximaal aantal prefix-niveaus voor prefix-zoekopdrachten. | 
| 19 |  | -    | Bijv. "wietse" -> ["w","wi","wie"] | 
|  | 37 | +    | | 
|  | 38 | +    | The maximum number of prefix levels to generate for prefix-based search. | 
|  | 39 | +    | For example, the term “wietse” would generate: | 
|  | 40 | +    |   ["w", "wi", "wie", "wiet", "wiets", "wietse"] | 
|  | 41 | +    | | 
|  | 42 | +    | Increasing this value improves search precision for short terms, but | 
|  | 43 | +    | slightly increases the number of stored tokens per record. | 
|  | 44 | +    | | 
| 20 | 45 |     */ | 
| 21 | 46 |     'max_prefix_depth' => 6, | 
| 22 | 47 | 
 | 
| 23 | 48 |     /* | 
| 24 | 49 |     |-------------------------------------------------------------------------- | 
| 25 |  | -    | Auto-index encrypted casts | 
|  | 50 | +    | Automatic Indexing of Encrypted Casts | 
| 26 | 51 |     |-------------------------------------------------------------------------- | 
| 27 | 52 |     | | 
| 28 |  | -    | When enabled, the package will automatically include any model attributes | 
| 29 |  | -    | that use Laravel's "encrypted" casts (e.g. AsEncryptedString, AsEncryptedArray) | 
| 30 |  | -    | in the encrypted search index. | 
|  | 53 | +    | When enabled, the package automatically includes any model attributes | 
|  | 54 | +    | that use Laravel’s encrypted cast types (e.g. AsEncryptedString, | 
|  | 55 | +    | AsEncryptedArrayObject, etc.) in the search index. | 
| 31 | 56 |     | | 
| 32 |  | -    | You can still override or fine-tune behavior via: | 
|  | 57 | +    | You can still override or refine behavior per field via: | 
| 33 | 58 |     | - Attributes: #[EncryptedSearch(exact: true, prefix: false)] | 
| 34 |  | -    | - The $encryptedSearch property on your model | 
|  | 59 | +    | - Model property: protected array $encryptedSearch | 
| 35 | 60 |     | | 
| 36 | 61 |     */ | 
| 37 | 62 |     'auto_index_encrypted_casts' => true, | 
| 38 | 63 | 
 | 
|  | 64 | +    /* | 
|  | 65 | +    |-------------------------------------------------------------------------- | 
|  | 66 | +    | Elasticsearch Integration | 
|  | 67 | +    |-------------------------------------------------------------------------- | 
|  | 68 | +    | | 
|  | 69 | +    | Configure Elasticsearch as the backend for storing and querying | 
|  | 70 | +    | encrypted search tokens. When enabled, the package will skip all | 
|  | 71 | +    | database writes to `encrypted_search_index` and instead sync tokens | 
|  | 72 | +    | directly to Elasticsearch using the internal ElasticsearchService. | 
|  | 73 | +    | | 
|  | 74 | +    | Example environment configuration: | 
|  | 75 | +    |   ENCRYPTED_SEARCH_ELASTIC_ENABLED=true | 
|  | 76 | +    |   ELASTICSEARCH_HOST=http://localhost:9200 | 
|  | 77 | +    |   ELASTICSEARCH_INDEX=encrypted_search | 
|  | 78 | +    | | 
|  | 79 | +    */ | 
| 39 | 80 |     'elasticsearch' => [ | 
| 40 | 81 |         'enabled' => env('ENCRYPTED_SEARCH_ELASTIC_ENABLED', false), | 
| 41 | 82 |         'host'    => env('ELASTICSEARCH_HOST', 'http://elasticsearch:9200'), | 
|  | 
0 commit comments