triki
Version, currently 0.0.22 versions
- 0.0.2latestApr 29, 2025
- 0.0.1not indexedApr 29, 2025
github.com/webmavens/triki-obfuscator
Mysql, PostgreSQL and SQL dump obfuscator aka anonimizer
Installation
# Add this to your shard.yml
dependencies:
triki:
github: webmavens/triki-obfuscator
version: ~> 0.0.2Then run:
shards installshard.yml
- Crystal
~> 1.0, >= 1.0.0- License
- MIT
- Author
- Jose Luis Salas
Dependencies
Runtime Dependencies
- faker*github: askn/faker
- triki*github: josacar/triki
- walker_method>= 0.1.1github: josacar/walker_method
Development Dependencies
- ameba>= 0.13github: crystal-ameba/amebadev
README
Triki - Laravel Obfuscated Database Dump Package
Introduction
Triki is a Laravel package that provides an obfuscated database dump using the Triki Crystal obfuscator. This package allows you to specify tables and columns to obfuscate while keeping selected columns intact.
Requirements
- Laravel
- PHP
- MySQL
- Crystal Language installed on your system/server
Installation
To install the package, run the following command:
composer require webmavens/triki-obfuscator
Configuration
php artisan vendor:publish --tag=triki-config
Environment Variables
Ensure your .env file contains database credentials:
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password
Ensure your .env file contains mail configuration:
MAIL_MAILER=
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
Middleware Authentication Key
To protect Triki routes, add an authentication key in your .env file(If you not set, it will be web-mavens by default):
TRIKI_AUTH_KEY=your_secure_key
Optional Route Protection
Configure Authorized Emails:
Update the config/triki.php file to enable authentication and define the allowed emails:
'auth' => [
'enabled' => true,
'authorized_emails' => [
'your.email@example.com',
'another@example.com',
],
],
If you want to more secure your route then use authorized_emails in config/triki.php
Usage
Accessing the Dump Page
You can access the dump interface via the following URL in your browser:
http://yourdomain.com/triki/download?auth_key=web-mavens
When prompted, enter the authentication key specified in your .env file.
Generating a Dump
- Select the tables you want to keep in the database dump (unchecked tables will be ignored).
- Provide an email address where the notification will be sent.
- Click Start Dump.
Obfuscation Logic
The obfuscator.cr file in the root directory determines which columns to obfuscate. Example:
require "triki"
obfuscator = Triki.new({
"users" => {
"email" => :email,
"password" => :keep,
},
})
obfuscator.fail_on_unspecified_columns = false
obfuscator.globally_kept_columns = %w[id created_at updated_at]
obfuscator.obfuscate(STDIN, STDOUT)
If a table is not specified, it will be included in the dump without obfuscation. check https://github.com/josacar/triki for more detaisl.
Queue Job for Dump Generation
The dump generation process runs as a queued job to avoid timeouts. Ensure your queue worker is running:
php artisan queue:work
Support
For any issues, feel free to create an issue in the GitHub repository.
License
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.0.2- Tagged
- Apr 29, 2025
- Commit
7e2461c12220- Crystal
~> 1.0, >= 1.0.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/webmavens/triki-obfuscator
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 16, 2026
- Synced
- Aug 15, 2026
- Versions
- 2