{"id":14483660,"url":"https://github.com/47ng/cloak","last_synced_at":"2025-04-08T03:19:34.737Z","repository":{"id":38010646,"uuid":"228179198","full_name":"47ng/cloak","owner":"47ng","description":"Serialized AES-GCM 256 encryption, decryption and key management in the browser \u0026 Node.js","archived":false,"fork":false,"pushed_at":"2024-09-24T14:11:19.000Z","size":828,"stargazers_count":58,"open_issues_count":17,"forks_count":8,"subscribers_count":3,"default_branch":"next","last_synced_at":"2025-04-04T13:40:45.347Z","etag":null,"topics":["aes-256-gcm","cli","cryptography","decryption","encryption"],"latest_commit_sha":null,"homepage":"https://cloak.47ng.com","language":"TypeScript","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/47ng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["franky47"],"liberapay":"francoisbest","custom":["https://paypal.me/francoisbest?locale.x=fr_FR"]}},"created_at":"2019-12-15T12:18:50.000Z","updated_at":"2025-03-31T15:02:07.000Z","dependencies_parsed_at":"2024-06-18T15:36:34.886Z","dependency_job_id":"95ca509c-ad37-45d4-90ac-7e0e08e08605","html_url":"https://github.com/47ng/cloak","commit_stats":{"total_commits":274,"total_committers":4,"mean_commits":68.5,"dds":"0.33211678832116787","last_synced_commit":"b4eefb7f70ecb0c3872d938ed4625c7b36b7e8d6"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":"47ng/typescript-library-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/47ng%2Fcloak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/47ng%2Fcloak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/47ng%2Fcloak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/47ng%2Fcloak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/47ng","download_url":"https://codeload.github.com/47ng/cloak/tar.gz/refs/heads/next","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767239,"owners_count":20992548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["aes-256-gcm","cli","cryptography","decryption","encryption"],"created_at":"2024-09-03T00:01:57.633Z","updated_at":"2025-04-08T03:19:34.719Z","avatar_url":"https://github.com/47ng.png","language":"TypeScript","funding_links":["https://github.com/sponsors/franky47","https://liberapay.com/francoisbest","https://paypal.me/francoisbest?locale.x=fr_FR"],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\u003ccode\u003e@47ng/cloak\u003c/code\u003e\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![NPM](https://img.shields.io/npm/v/@47ng/cloak?color=red)](https://www.npmjs.com/package/@47ng/cloak)\n[![MIT License](https://img.shields.io/github/license/47ng/cloak.svg?color=blue)](https://github.com/47ng/cloak/blob/next/LICENSE)\n[![Continuous Integration](https://github.com/47ng/cloak/workflows/Continuous%20Integration/badge.svg?branch=next)](https://github.com/47ng/cloak/actions)\n[![Coverage Status](https://coveralls.io/repos/github/47ng/cloak/badge.svg?branch=next)](https://coveralls.io/github/47ng/cloak?branch=next)\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  Serialized AES-GCM 256 encryption, decryption and key management in the browser \u0026 Node.js.\n\u003c/p\u003e\n\n## Installation\n\n```shell\n$ yarn add @47ng/cloak\n# or\n$ npm i @47ng/cloak\n```\n\n## CLI\n\nThe package comes with a CLI tool you can use to generate and manage keys, as\nwell as encrypting and decrypting data in the terminal:\n\n```shell\n$ cloak --help\nUsage: cloak [options] [command]\n\nOptions:\n  -h, --help                 output usage information\n\nCommands:\n  generate                   Generate an AES-GCM key\n  encrypt [options] [key]    Encrypt stdin\n  decrypt                    Decrypt stdin\n  revoke \u003ckeyFingerprint\u003e    Remove a key from the environment keychain\n  keychain [options] [full]  List the contents of the environment keychain\n\n# Start by generating an empty keychain and master key:\n$ cloak generate\nKey:          k1.aesgcm256.DL2G9PQeZ9r65J59pph6dy9Sk4fBLEZ3CTQZsandgYE=\nFingerprint:  6f28c026\n\nGenerated new empty keychain:\nexport CLOAK_MASTER_KEY=k1.aesgcm256.DL2G9PQeZ9r65J59pph6dy9Sk4fBLEZ3CTQZsandgYE=\nexport CLOAK_KEYCHAIN=v1.aesgcm256.6f28c026.yhCUkzv5gOyHJ2M_.jrGSf2_MPVofk-kSDgnYzvEy\n\n# Copy/paste the exports into your terminal\n# (the CLI does not mutate your environment directly)\n$ export CLOAK_MASTER_KEY=k1.aesgcm256.DL2G9PQeZ9r65J59pph6dy9Sk4fBLEZ3CTQZsandgYE=\n$ export CLOAK_KEYCHAIN=v1.aesgcm256.6f28c026.yhCUkzv5gOyHJ2M_.jrGSf2_MPVofk-kSDgnYzvEy\n\n# Generate a key to use for encryption\n$ cloak generate\nKey:          k1.aesgcm256.pHLFYdaqXut62LoFbt8KV80x_YNyZPmY0kQaPhJ0Ehc=\nFingerprint:  cd38bcc4\n\nUpdated keychain:\nexport CLOAK_MASTER_KEY=k1.aesgcm256.DL2G9PQeZ9r65J59pph6dy9Sk4fBLEZ3CTQZsandgYE=\nexport CLOAK_KEYCHAIN=v1.aesgcm256.6f28c026.jr9fqMA_RfNhIjHz.lo4IfIYfZ0zxrdSns_ibWq6YX1D5AnzN-fhUF0CKVx5dRVIo0x-Atumr9WZqpHOeEIWT5bEGFKHhxGkFdwk2vg5TZQNk5Rj_jo3hnfSLaFAYncG59dB  jUkz1JE0Plq2d-GR1AbDs6P18VzOG_JrU\n\nTo use this new key as default for encryption:\nexport CLOAK_CURRENT_KEY=cd38bcc4\n\n# Encrypt sdtin\n$ echo 'Hello, World !' | cloak encrypt\nv1.aesgcm256.cd38bcc4.yxAp2iONy7zYOhbs.X2zmGpmGw9a7tiSnyukEW8Ac-2IIcIENW5uHxtHYyA==\n\n# Decrypt stdin\n$ echo 'v1.aesgcm256.cd38bcc4.yxAp2iONy7zYOhbs.X2zmGpmGw9a7tiSnyukEW8Ac-2IIcIENW5uHxtHYyA==' | cloak decrypt\nHello, World !\n```\n\n## Programmatic Usage\n\n```ts\n// Works in the browser or in Node.js\n\nimport { generateKey, encryptString, decryptString } from '@47ng/cloak'\n\nconst demo = async () =\u003e {\n  const key = generateKey()\n  const cipher = await encryptString('Hello, World', key)\n  const decipher = await decryptString(cipher, key)\n}\n```\n\n## License\n\n[MIT](./LICENSE) - Made with ❤️ by [François Best](https://francoisbest.com)\n\nUsing this package at work ? [Sponsor me](https://github.com/sponsors/franky47) to help with support and maintenance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F47ng%2Fcloak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F47ng%2Fcloak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F47ng%2Fcloak/lists"}