@growy/strapi-plugin-encrypted-field 2.3.1 → 2.3.2

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.
Files changed (2) hide show
  1. package/README.md +61 -35
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -22,9 +22,8 @@ Official **Growy AI** plugin for Strapi that provide a custom encrypted text fie
22
22
  - ✅ **Automatic Encryption** AES-256-GCM when saving.
23
23
  - ✅ **Transparent Decryption** when reading (Admin panel and API).
24
24
  - ✅ **Backend Validation** with regex support and length constraints.
25
- - ✅ **Native Strapi v5 UI** with visibility controls and copy to clipboard.
25
+ - ✅ **Native Strapi v5 UI** with visibility controls, redimensionable inputs and copy to clipboard.
26
26
  - ✅ **Multi-language support (i18n)**: English and Spanish.
27
- - ✅ **Secure Key Management** with validation and clear error messages.
28
27
  - ✅ **Encrypted Data** in database with unique IV and Auth Tag.
29
28
  - ✅ **Nested Components support** at any depth.
30
29
 
@@ -39,9 +38,7 @@ yarn add @growy/strapi-plugin-encrypted-field
39
38
  ### Configuration
40
39
 
41
40
  #### 1. Enable the plugin
42
-
43
- Create or edit `config/plugins.js` or `config/plugins.ts`:
44
-
41
+ Edit `config/plugins.js` or `config/plugins.ts`:
45
42
  ```javascript
46
43
  module.exports = {
47
44
  'encrypted-field': {
@@ -51,25 +48,43 @@ module.exports = {
51
48
  ```
52
49
 
53
50
  #### 2. Configure Encryption Key (REQUIRED)
54
-
55
51
  Add to your `.env`:
56
-
57
52
  ```bash
58
53
  ENCRYPTION_KEY=your_64_character_hex_key_here
59
54
  ```
60
55
 
61
- Generate a secure key:
56
+ **Generate a secure key:**
62
57
  ```bash
63
58
  node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
64
59
  ```
65
60
 
66
- ### Usage
61
+ ⚠️ **CRITICAL - Key Management**:
62
+ - **Store the key safely** (Secrets manager, encrypted env vars).
63
+ - **Never** include it in version control.
64
+ - **If you lose the key**, you will NOT be able to decrypt existing data.
65
+ - **Use the same key** across all environments sharing the same database.
66
+
67
+ ### Usage & Validation
67
68
 
68
- 1. Go to **Content-Type Builder**.
69
- 2. Select a collection or create a new one.
70
- 3. Click on **"Add another field"**.
71
- 4. Select **"Encrypted Text"** (look for the 🔒 icon).
72
- 5. Values are hidden by default in the Admin Panel but can be revealed or copied using the inline buttons.
69
+ #### Data Validation
70
+ The plugin supports validation before encryption:
71
+ 1. In Content-Type Builder, select the encrypted field.
72
+ 2. Go to **"Advanced Settings"**.
73
+ 3. In **"RegEx pattern"**, enter your regular expression.
74
+ **Example**: To validate an API key format: `^sk-[a-zA-Z0-9]{32}$`.
75
+
76
+ #### API Usage
77
+ The API returns decrypted values automatically for authorized requests.
78
+ ```bash
79
+ # Create an entry
80
+ curl -X POST http://localhost:1337/api/users \
81
+ -H "Content-Type: application/json" \
82
+ -d '{"data": {"apiKey": "my-secret-token"}}'
83
+
84
+ # Read (returns decrypted)
85
+ curl -X GET http://localhost:1337/api/users/1
86
+ # Response: { "data": { "apiKey": "my-secret-token" } }
87
+ ```
73
88
 
74
89
  ---
75
90
 
@@ -83,9 +98,8 @@ Plugin oficial de **Growy AI** para Strapi que proporciona un campo personalizad
83
98
  - ✅ **Cifrado automático** AES-256-GCM al guardar.
84
99
  - ✅ **Descifrado transparente** al leer (panel y API).
85
100
  - ✅ **Validación backend** con soporte para regex y restricciones.
86
- - ✅ **UI Nativa Strapi v5** con controles de visibilidad y copiar al portapapeles.
101
+ - ✅ **UI Nativa Strapi v5** con controles de visibilidad, inputs redimensionables y copiar al portapapeles.
87
102
  - ✅ **Soporte multi-idioma (i18n)**: Inglés y Español.
88
- - ✅ **Gestión de claves robusta** con validación y mensajes de error claros.
89
103
  - ✅ **Datos cifrados** en base de datos con IV único y Auth Tag.
90
104
  - ✅ **Soporte para componentes anidados** a cualquier profundidad.
91
105
 
@@ -100,9 +114,7 @@ yarn add @growy/strapi-plugin-encrypted-field
100
114
  ### Configuración
101
115
 
102
116
  #### 1. Habilitar el plugin
103
-
104
117
  Edita `config/plugins.js`:
105
-
106
118
  ```javascript
107
119
  module.exports = {
108
120
  'encrypted-field': {
@@ -112,44 +124,58 @@ module.exports = {
112
124
  ```
113
125
 
114
126
  #### 2. Configurar la clave (REQUERIDO)
115
-
116
127
  Agrega a tu `.env`:
117
-
118
128
  ```bash
119
129
  ENCRYPTION_KEY=tu_clave_de_64_caracteres_hexadecimales_aqui
120
130
  ```
121
131
 
122
- ### Uso
132
+ ⚠️ **CRÍTICO - Gestión de claves**:
133
+ - **Guarda la clave de forma segura** (gestor de secretos, variables de entorno cifradas).
134
+ - **Nunca** la incluyas en el control de versiones.
135
+ - **Si pierdes la clave**, NO podrás descifrar los datos existentes.
136
+
137
+ ### Uso y Validación
123
138
 
124
- 1. Ve a **Content-Type Builder**.
125
- 2. Selecciona una colección.
126
- 3. Click en **"Add another field"**.
127
- 4. Selecciona **"Texto Cifrado"** (icono 🔒).
128
- 5. Los valores están ocultos por defecto en el panel pero pueden mostrarse o copiarse con los botones integrados.
139
+ #### Validación de datos
140
+ El plugin soporta validación antes del cifrado:
141
+ 1. En el Content-Type Builder, selecciona el campo cifrado.
142
+ 2. Ve a la pestaña **"Advanced Settings"**.
143
+ 3. En **"RegEx pattern"**, ingresa tu expresión regular.
144
+ **Ejemplo**: Para validar formato de API key: `^sk-[a-zA-Z0-9]{32}$`.
129
145
 
130
- ### Seguridad y Especificaciones
146
+ #### Uso por API
147
+ La API devuelve los valores descifrados automáticamente.
148
+ ```bash
149
+ # Crear con campo cifrado
150
+ curl -X POST http://localhost:1337/api/usuarios \
151
+ -H "Content-Type: application/json" \
152
+ -d '{"data": {"apiKey": "mi-clave-secreta-123"}}'
153
+
154
+ # Leer (devuelve descifrado)
155
+ curl -X GET http://localhost:1337/api/usuarios/1
156
+ # Response: { "apiKey": "mi-clave-secreta-123" }
157
+ ```
131
158
 
132
- - **Algoritmo**: AES-256-GCM.
159
+ ### Especificaciones Técnicas
160
+
161
+ - **Algoritmo**: AES-256-GCM (Grado militar).
133
162
  - **IV (Initialization Vector)**: 96 bits generado aleatoriamente por operación.
134
- - **Auth Tag**: 128 bits para verificación de integridad.
163
+ - **Integridad**: Auth Tag de 128 bits para detectar manipulaciones.
135
164
  - **Formato almacenado**: `iv:authTag:encryptedData`.
136
165
 
137
- ### Limitaciones
166
+ ### Limitaciones Conocidas
138
167
 
139
- - ❌ **Búsqueda**: No se puede buscar por campos cifrados.
168
+ - ❌ **Búsqueda**: No se puede buscar por campos cifrados debido al cifrado en BD.
140
169
  - ❌ **Ordenamiento**: No se puede ordenar por campos cifrados.
141
- - ❌ **Filtros**: No se pueden aplicar filtros directos sobre datos cifrados.
170
+ - ❌ **Filtros**: No se pueden aplicar filtros directos en la consulta a la BD.
142
171
 
143
172
  ---
144
173
 
145
174
  ## License / Licencia
146
-
147
175
  MIT © 2025 Growy AI
148
176
 
149
177
  ## Credits / Créditos
150
-
151
178
  **Growy AI** - Soluciones de IA y automatización empresarial
152
-
153
179
  **Main Author / Autor principal**: Zahir El isaac
154
180
 
155
181
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growy/strapi-plugin-encrypted-field",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Campo personalizado de texto cifrado para Strapi",
5
5
  "strapi": {
6
6
  "name": "encrypted-field",