{"id":36617541,"url":"https://github.com/lordcodes/cloak-swift","last_synced_at":"2026-01-12T09:14:30.567Z","repository":{"id":41865432,"uuid":"509963351","full_name":"lordcodes/cloak-swift","owner":"lordcodes","description":"Encrypt and obfuscate secrets, then pass them into Swift applications","archived":false,"fork":false,"pushed_at":"2024-03-11T15:29:37.000Z","size":306,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-08T14:53:50.055Z","etag":null,"topics":["encryption","swift","swift-package-manager"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lordcodes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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}},"created_at":"2022-07-03T08:20:10.000Z","updated_at":"2025-09-15T17:05:51.000Z","dependencies_parsed_at":"2024-03-11T00:22:38.413Z","dependency_job_id":"9f4c7992-57bf-427b-90c4-87127f57b459","html_url":"https://github.com/lordcodes/cloak-swift","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/lordcodes/cloak-swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordcodes%2Fcloak-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordcodes%2Fcloak-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordcodes%2Fcloak-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordcodes%2Fcloak-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lordcodes","download_url":"https://codeload.github.com/lordcodes/cloak-swift/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordcodes%2Fcloak-swift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28337656,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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","swift","swift-package-manager"],"created_at":"2026-01-12T09:14:29.887Z","updated_at":"2026-01-12T09:14:30.562Z","avatar_url":"https://github.com/lordcodes.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"Art/logo.png\" width=\"500\" max-width=\"90%\" alt=\"Cloak Swift\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Swift-5.5-orange.svg\" /\u003e\n    \u003ca href=\"https://swift.org/package-manager\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/swiftpm-compatible-brightgreen.svg?style=flat\" alt=\"Swift Package Manager\" /\u003e\n    \u003c/a\u003e\n     \u003ca href=\"https://github.com/lordcodes/cloak-swift/releases/latest\"\u003e\n         \u003cimg src=\"https://img.shields.io/github/release/lordcodes/cloak-swift.svg?style=flat\" alt=\"Latest release\" /\u003e\n     \u003c/a\u003e\n    \u003ca href=\"https://twitter.com/lordcodes\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/twitter-@lordcodes-blue.svg?style=flat\" alt=\"Twitter: @lordcodes\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nThis is **Cloak Swift** - a CLI tool to encrypt secrets and then pass them in an obfuscated form into Swift applications.\n\n\u0026nbsp;\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"#features\"\u003eFeatures\u003c/a\u003e • \u003ca href=\"#install\"\u003eInstall\u003c/a\u003e • \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e • \u003ca href=\"#contributing-or-help\"\u003eContributing\u003c/a\u003e\n\u003c/p\u003e\n\n## Features\n\n#### ☑️ Keep your secrets out of Git\n\nSet up secrets locally outside of the Git repository to avoid them being embedded into the code.\n\n#### ☑️ Encrypt secrets\n\nCreate encryption key and encrypt secrets ready for use.\n\n#### ☑️ Access secrets from your app\n\nGenerate a Swift file to access the secrets from your app's code.\n\n#### ☑️ Obfuscation\n\nThe generated Swift uses obfuscation of the values rather than as raw strings.\n\n\u0026nbsp;\n\n## Install\n\n### ▶︎ ⚙️ Mise\n\nCloak Swift can be installed using Mise or ASDF either globally or with a project-specific version. \n\nNote: Currently, the plugin URL needs to be specified. The plugin will be added to the registry soon so that this is no longer required.\n\n**Mise `.mise.toml`**\n```toml\n[tools]\ncloak-swift = \"0.4.0\"\n\n[plugins]\ncloak-swift = \"https://github.com/lordcodes/asdf-cloak-swift\"\n```\n\n### ▶︎ 🖥 Standalone via Swift Package Manager\n\nCloak Swift can be easily installed globally using Swift Package Manager.\n\n```terminal\n git clone https://github.com/lordcodes/cloak-swift\n cd cloak-swift\n make install\n```\n\nThis will install cloakswift into `/usr/local/bin`. If you get a permission error it may be that you don't have permission to write there in which case you just need to adjust permissions using `sudo chown -R $(whoami) /usr/local/bin`.\n\nYou can uninstall it again using `make uninstall` which simply deletes it from `/usr/local/bin`.\n\n### ▶︎ 🍀 Mint\n\nYou can install Cloak Swift on MacOS using [Mint](https://github.com/yonaskolb/Mint) as follows:\n\n```terminal\nmint install lordcodes/cloak-swift\n```\n\n### ▶︎ 📦 As a Swift package\n\nTo install Cloak Swift for use in your own Swift code, add it is a Swift Package Manager dependency within your `Package.swift` file. For help in doing this, please check out the Swift Package Manager documentation.\n\n```swift\n.package(url: \"https://github.com/lordcodes/cloak-swift\", exact: \"0.4.0\")\n```\n\n\u0026nbsp;\n\n## Usage\n\n### Set up configuration\n\nCreate a configuration file within your project: `.cloak/config`, this file should be kept in Git and shared between contributors. Enter key-value pairs into the file [EnvironmentKey](Sources/CloakKit/Configuration/EnvironmentKey.swift).\n\n* CLOAK_SECRETS_CLASS_NAME -\u003e Name to give the generated Swift enum that contains the secrets in-app.\n* CLOAK_SECRETS_OUTPUT_FILEPATH -\u003e File path to put the generated Swift file.\n* CLOAK_SECRETS_ACCESS_LEVEL -\u003e Swift access level to give to the enum and each secret static property. E.g. public.\n\nEach of these settings can be provided as an environment variable instead of listed in the configuration file. The config file will take precedance.\n\nFor example:\n\n```\nCLOAK_SECRETS_CLASS_NAME=AppSecrets\nCLOAK_SECRETS_OUTPUT_FILEPATH=Sources/Generated/AppSecrets.swift\nCLOAK_SECRETS_ACCESS_LEVEL=public\n```\n\n### Configure required secret keys\n\nYou can list the required secret keys for your project in a `.cloak/secret-keys` file, which can be kept in Git. This ensures each contributor has provided all required secrets locally. Secret keys should be listed one on each line.\n\nFor example:\n\n```\nANALYTICS_WRITE_KEY\nAPI_CLIENT_ID\nAPI_CLIENT_SECRET\n```\n\n### Configure secrets\n\nEach contributor on a project will need to create a file at `.cloak/secrets` that uses the same format as the `config` file but that lists secret key names and values. This file should be added to your project's `.gitignore` to keep them out of Git.\n\nYou should also add your encryption key to this file using the key name `CLOAK_ENCRYPTION_KEY`. This will allow the encrypt/decrypt commands to function and will also allow it to be included into the generated Swift file so that your app can decrypt the secrets at runtime in order to use them.\n\nIf the secret keys are specified in the required keys file `secret-keys`, then they will be read as environment variables as well, where the environment variables take precendence. This is useful in a CI environment where you can specify them as environment variables and avoid having to write them to a file as you would locally.\n\nThe best practice is that the values should be encrypted first.\n\n### 🖥 Via the Standalone CLI\n\nRun Cloak's tasks via a CLI. The tool will check paths relative to the working directory for the `.cloak` directory configured above.\n\n```terminal\nUSAGE: cloakswift \u003csubcommand\u003e [-q|--quiet]\n\nSUBCOMMANDS:\n  createkey  Create encryption key.\n  decrypt    Decrypt a value encrypted using cloak.\n  encrypt    Encrypt a value.\n  generate   Read in secrets, obfuscate them and then generate a Swift file to access them within an app.\n  version    Print version.\n\nOPTIONS:\n  -q, --quiet             Silence any output except errors \n```\n\nYou can obtain help using `cloakswift --help` and also obtain help for each subcommand using `cloakswift \u003csubcommand\u003e --help`.\n\n#### Create encryption key\n\nGenerates an encryption key, that can then be used within your project to encrypt secrets. This key is then passed into your app so that you can decrypt them at runtime.\n\n`cloakswift createkey`\n\n#### Encrypt a value\n\nProvide a value and the encrypted version will be returned. Your encryption key should be provided as described above.\n\n`cloakswift encrypt \u003cvalue\u003e`\n\n#### Decrypt an encrypted value\n\nProvide an encrypted value and the decrypted version will be returned. Your encryption key should be provided as described above.\n\n`cloakswift decrypt \u003cencrypted\u003e`\n\n#### Generate a secrets file in-app\n\nGenerate a Swift file that can be used to access your secrets within your app at runtime. Certain aspects of the generated file can be customised using the `config` file as described above. The secrets will be obfuscated and included as `[UInt8]`, but with Swift properties to return them as `String` in their usable form.\n\n`cloakswift generate`\n\n### 📦 As a Swift Package\n\nTo use Cloak Swift within your own Swift code, import and use the public API of `CloakKit`.\n\n```swift\nimport CloakKit\n\n// Configure printing\nCloak.shared.printer = ConsolePrinter(quiet: false)\n\nEncryptionService().createKey()\n```\n\n## Contributing or Help\n\nIf you notice any bugs or have a new feature to suggest, please check out the [contributing guide](https://github.com/lordcodes/cloak-swift/blob/master/CONTRIBUTING.md). If you want to make changes, please make sure to discuss anything big before putting in the effort of creating the PR.\n\nTo reach out, please contact [@lordcodes on Twitter](https://twitter.com/lordcodes).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordcodes%2Fcloak-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flordcodes%2Fcloak-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordcodes%2Fcloak-swift/lists"}