{"id":32271260,"url":"https://github.com/edunatalec/encrypt-env","last_synced_at":"2026-02-23T17:02:10.236Z","repository":{"id":227480521,"uuid":"771566084","full_name":"edunatalec/encrypt-env","owner":"edunatalec","description":"Generate encrypted files to secure sensitive configuration data. Encrypt YAML files and streamline the protection of sensitive information in Flutter applications.","archived":false,"fork":false,"pushed_at":"2025-09-02T21:12:38.000Z","size":260,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T22:48:05.891Z","etag":null,"topics":["encryption","environment","security"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edunatalec.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-03-13T14:33:21.000Z","updated_at":"2025-09-19T09:04:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"7821c5ad-12a1-41b0-93ed-5bea0a1ca3cc","html_url":"https://github.com/edunatalec/encrypt-env","commit_stats":null,"previous_names":["edunatalec/encrypt-env"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/edunatalec/encrypt-env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edunatalec%2Fencrypt-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edunatalec%2Fencrypt-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edunatalec%2Fencrypt-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edunatalec%2Fencrypt-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edunatalec","download_url":"https://codeload.github.com/edunatalec/encrypt-env/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edunatalec%2Fencrypt-env/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29748791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encryption","environment","security"],"created_at":"2025-10-22T22:47:41.201Z","updated_at":"2026-02-23T17:02:10.230Z","avatar_url":"https://github.com/edunatalec.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![pub package](https://img.shields.io/pub/v/encrypt_env.svg)](https://pub.dev/packages/encrypt_env)\n[![package publisher](https://img.shields.io/pub/publisher/encrypt_env.svg)](https://pub.dev/packages/encrypt_env/publisher)\n\n**encrypt_env** is a Dart CLI tool designed to encrypt sensitive environment variables for Flutter and Dart applications. It helps you secure API keys, secrets, tokens, and other private configuration details by generating encrypted files from YAML definitions.\n\n## Summary\n\n- [Installation](#installation)\n- [How it works](#how-it-works)\n- [Setup](#setup)\n  - [Basic example](#basic-example)\n- [Merging Environments](#merging-environments)\n- [Customization](#customization)\n  - [Available Flags](#available-flags)\n- [Help](#help)\n\n## Installation\n\nActivate globally via Dart:\n\n```sh\ndart pub global activate encrypt_env\n```\n\n## How it works\n\nThe `encrypt_env` CLI reads your `environment.yaml` and generates a Dart class with **static, strongly-typed getters** where **all values are encrypted** at compile time and only decrypted at runtime.\n\n## Setup\n\nYou need to organize your project with a folder named `environment` and a file named `environment.yaml`, as shown in the image below:\n\n\u003cimg src=\"./assets/folder-example.png\"\u003e\n\nThis file will contain your sensitive environment variables, such as API keys, secrets, tokens, etc.\n\n```text\nyour_project/\n├── environment/\n│   └── environment.yaml\n```\n\n\u003e Note: You can change the folder and file name by using the --folder and --yaml options when running the CLI. For more details go to the section [Customization](#customization).\n\n### Basic example\n\nGiven the following `environment/environment.yaml`:\n\n```yaml\nenvironment:\n  base_url: 'http://localhost:3000'\n  version: '1.0.0'\n  production: false\n  headers:\n    api-key: 'value'\nendpoint:\n  endpoint_a: 'endpoint-a'\n  endpoint_b: 'endpoint-b'\n```\n\nThen, in the root folder, run the following command:\n\n```sh\nencrypt_env gen\n```\n\nYou should see the following log in the console:\n\n```json\nEncrypted\n\n{\n  \"environment\": {\n    \"base_url\": \"http://localhost:3000\",\n    \"version\": \"1.0.0\",\n    \"production\": false,\n    \"headers\": {\n      \"api-key\": \"value\"\n    }\n  },\n  \"endpoint\": {\n    \"endpoint_a\": \"endpoint-a\",\n    \"endpoint_b\": \"endpoint-b\"\n  }\n}\n\n✓ Path lib/environment.dart\n```\n\nAs indicated in the log, the file `lib/environment.dart` has been generated:\n\n```dart\nsealed class Environment {\n\t/// baseUrl: http://localhost:3000\n\tstatic String get baseUrl {\n\t\tfinal List\u003cint\u003e encoded = [0xd5, 0x98, 0x52, 0x52, 0xe6, 0x31, 0x9a, 0x43, 0x4, 0x9b, 0xc0, 0x80, 0x11, 0xf9, 0x2c, 0xeb, 0xd2, 0xa3, 0x2c, 0x1e, 0x38];\n\n\t\treturn _decode(encoded);\n\t}\n\n\t/// version: 1.0.0\n\tstatic String get version {\n\t\tfinal List\u003cint\u003e encoded = [0x8c, 0xc2, 0x16, 0xc, 0xec];\n\n\t\treturn _decode(encoded);\n\t}\n\n\t/// production: false\n\tstatic bool get production {\n\t\tfinal List\u003cint\u003e encoded = [0xdb, 0x8d, 0x4a, 0x51, 0xb9];\n\n\t\treturn bool.parse(_decode(encoded));\n\t}\n\n\tstatic Map\u003cString, dynamic\u003e get headers {\n\t\treturn {\n\t\t\t// api-key: value\n\t\t\t_decode([0xdc, 0x9c, 0x4f, 0xf, 0xb7, 0x7b, 0xcc]): _apiKey,\n\t\t};\n\t}\n\n\t/// _apiKey: value\n\tstatic String get _apiKey {\n\t\tfinal List\u003cint\u003e encoded = [0xcb, 0x8d, 0x4a, 0x57, 0xb9];\n\n\t\treturn _decode(encoded);\n\t}\n}\n\nsealed class Endpoint {\n\t/// endpointA: endpoint-a\n\tstatic String get endpointA {\n\t\tfinal List\u003cint\u003e encoded = [0xd8, 0x82, 0x42, 0x52, 0xb3, 0x77, 0xdb, 0x5b, 0x46, 0x99];\n\n\t\treturn _decode(encoded);\n\t}\n\n\t/// endpointB: endpoint-b\n\tstatic String get endpointB {\n\t\tfinal List\u003cint\u003e encoded = [0xd8, 0x82, 0x42, 0x52, 0xb3, 0x77, 0xdb, 0x5b, 0x46, 0x9a];\n\n\t\treturn _decode(encoded);\n\t}\n}\n```\n\n## Merging Environments\n\nYou can dynamically merge environment files using the `--environment` flag.\n\nBy default, the CLI looks for a base file:\n\n```yaml\n# environment/environment.yaml\n\nenvironment:\n  production: false\n  base_url: 'http://localhost:3000'\n  api_key: 'your_dev_api_key_here'\n  database_url: 'your_dev_database_url_here'\nendpoint:\n  endpoint_a: 'endpoint-a'\n  endpoint_b: 'endpoint-b'\n```\n\n```yaml\n# environment/prod_environment.yaml\n\nenvironment:\n  production: true\n  base_url: 'https://api.example.com'\n  api_key: 'your_production_api_key_here'\n  database_url: 'your_production_database_url_here'\n```\n\n```text\nenvironment/\n├── environment.yaml # Base config\n└── prod_environment.yaml # Overrides\n```\n\n```sh\nencrypt_env gen --environment prod\n```\n\nThis will merge both YAMLs, applying all values from `prod_environment.yaml` on top of the base config.\n\n\u003e You can use any prefix (e.g. `staging`, `dev`, `uat`). Just keep the format `prefix_environment.yaml` and match it in `--environment`.\n\n## Customization\n\nYou can customize how the CLI reads and writes files using optional flags.\n\n### Available Flags\n\n| Flag                  | Default       | Description                                                                            |\n| --------------------- | ------------- | -------------------------------------------------------------------------------------- |\n| `--folder`            | `environment` | Folder containing your configuration files                                             |\n| `--config`            | `environment` | Base config file name (without `.yaml` extension)                                      |\n| `-e`, `--environment` | _none_        | Optional environment name to merge (e.g., `dev`, `prod`)                               |\n| `--out-dir`           | `lib`         | Output directory for the generated Dart file                                           |\n| `--out-file`          | `environment` | Output Dart file name (without `.dart` extension)                                      |\n| `-s`, `--style`       | `cc`          | Getter naming style: `ssc` (SCREAMING_SNAKE_CASE), `cc` (camelCase), `sc` (snake_case) |\n\n## Help\n\nTo view all available commands and options, run:\n\n```bash\nencrypt_env -h\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedunatalec%2Fencrypt-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedunatalec%2Fencrypt-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedunatalec%2Fencrypt-env/lists"}