Package Information
Documentation
n8n-nodes-keystone
Zero-Knowledge PII Redaction & Restoration for n8n
An n8n community node package that integrates Keystone ā a privacy-first middleware that redacts personally identifiable information (PII) before it reaches any LLM, and restores it afterwards. Your sensitive data never leaves your infrastructure.
⨠Why Keystone?
| Problem | Keystone Solution |
|---|---|
| LLMs see raw PII (names, emails, addresses) | PII is replaced with safe placeholders before the LLM ever receives the text |
| Data privacy compliance complexity | Zero-knowledge architecture ā sensitive data stays on your server |
| Manual redaction is error-prone | AI-powered entity detection with vault-backed token storage |
| Restoration is a separate engineering task | One-step restoration using encrypted vault tokens |
š¦ Nodes Included
| Node | Description |
|---|---|
| Keystone Redact | Scans text for PII entities (names, emails, phone numbers, etc.) and replaces them with deterministic placeholders like [PERSON_A]. Returns an encrypted vault token for later restoration. |
| Keystone Restore | Takes redacted text and a vault token, then re-inserts the original PII values ā even after the text has been transformed by an LLM. |
š Installation
Via n8n Community Nodes (Recommended)
- Open your n8n instance
- Go to Settings ā Community Nodes
- Enter
n8n-nodes-keystoneand click Install - Restart n8n
Manual Installation
# Navigate to your n8n custom nodes directory
cd ~/.n8n/nodes
# Install the package
npm install n8n-nodes-keystone
āļø Prerequisites
A running Keystone server is required. The quickest way to get started:
cd keystone_core
./start.sh
This launches both the Keystone API on port 8000 and n8n on port 5678.
š§ Configuration
1. Add Credentials
- In n8n, go to Credentials ā Add Credential ā Keystone API
- Fill in:
| Field | Value | Notes |
|---|---|---|
| Server URL | http://host.docker.internal:8000 |
Use this when n8n runs in Docker |
http://localhost:8000 |
Use this when running locally | |
| API Key | ks_live_xxxxxxxxxxxx |
Obtain from the Keystone dashboard |
2. Build Your Workflow
The typical pattern wraps your LLM call between a Redact and Restore step:
[Data Source] ā Keystone Redact ā [LLM / AI Agent] ā Keystone Restore ā [Output]
Example: Privacy-Safe Email Generator
Google Sheets āāā Keystone Redact āāā AI Agent āāā Keystone Restore āāā Update Sheet
ā ā
"Dear [PERSON_A], "Dear John Smith,
your order #[ID_1]..." your order #48291..."
The LLM only ever sees anonymised placeholders ā never the real data.
š Node Reference
Keystone Redact
Detects and replaces PII in the input text.
Inputs
| Parameter | Type | Required | Description |
|---|---|---|---|
text |
string |
ā | The text to scan and redact |
taskId |
string |
ā | Optional identifier for audit / traceability |
Outputs
| Field | Description |
|---|---|
redacted_text |
Text with PII replaced by [PERSON_A]-style placeholders |
vault_token |
Encrypted token mapping placeholders ā original values |
entities_redacted |
Number of PII entities that were redacted |
entities_warned |
Number of entities flagged but not redacted |
status |
Response status from the Keystone API |
Keystone Restore
Re-inserts original PII values using a vault token.
Inputs
| Parameter | Type | Required | Description |
|---|---|---|---|
redactedText |
string |
ā | Text containing [PLACEHOLDER] tokens |
vaultToken |
string |
ā | Encrypted vault token from the Redact step |
Outputs
| Field | Description |
|---|---|
restored_text |
Fully restored text with original PII values |
entities_restored |
Number of entities that were restored |
status |
Response status from the Keystone API |
šļø Development
# Clone the repo
git clone https://github.com/karantomar11/n8n-nodes-keystone.git
cd n8n-nodes-keystone
# Install dependencies
npm install
# Build
npm run build
# Watch mode (auto-rebuild on save)
npm run dev
Project Structure
n8n-nodes-keystone/
āāā credentials/
ā āāā KeystoneApi.credentials.ts # API key + server URL credential
āāā nodes/
ā āāā KeystoneRedact/
ā ā āāā KeystoneRedact.node.ts # Redaction node
ā ā āāā keystone.svg # Node icon
ā āāā KeystoneRestore/
ā āāā KeystoneRestore.node.ts # Restore node
ā āāā keystone.svg # Node icon
āāā gulpfile.js # Copies SVG icons into dist/
āāā tsconfig.json
āāā package.json
š¤ Contributing
Contributions are welcome! Please open an issue or submit a pull request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
š License
Distributed under the MIT License. See LICENSE for details.
Built with ā¤ļø by Karan Tomar