{"id":16556310,"url":"https://github.com/miraclx/libeaes-js","last_synced_at":"2025-10-28T20:30:28.554Z","repository":{"id":54980271,"uuid":"197083853","full_name":"miraclx/libeaes-js","owner":"miraclx","description":"Enhanced simultaneous compression + encryption prototype with NodeJS","archived":false,"fork":false,"pushed_at":"2021-01-18T08:05:15.000Z","size":111,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-05T05:06:29.221Z","etag":null,"topics":["aes-ctr","aes-encryption","compression","cryptography","decrypt","eaes","encrypt","gzip","pipe","stream"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/miraclx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-15T23:05:51.000Z","updated_at":"2021-01-18T11:34:41.000Z","dependencies_parsed_at":"2022-08-14T08:01:02.890Z","dependency_job_id":null,"html_url":"https://github.com/miraclx/libeaes-js","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miraclx%2Flibeaes-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miraclx%2Flibeaes-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miraclx%2Flibeaes-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miraclx%2Flibeaes-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miraclx","download_url":"https://codeload.github.com/miraclx/libeaes-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219858902,"owners_count":16556039,"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-ctr","aes-encryption","compression","cryptography","decrypt","eaes","encrypt","gzip","pipe","stream"],"created_at":"2024-10-11T20:04:09.931Z","updated_at":"2025-10-28T20:30:23.196Z","avatar_url":"https://github.com/miraclx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libE-AES\n\n\u003e Enhanced simultaneous compression + encryption\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n\n[![NPM][npm-image-url]][npm-url]\n\n## Installing\n\nVia [NPM][npm]:\n\n``` bash\nnpm install libeaes\n```\n\nThis installs a CLI binary accessible with the `libeaes` command.\n\n``` bash\n# Check if libeaes command has been installed and accessible on your path\n$ libeaes -v\nv1.2.0\n```\n\n## Usage\n\n### CLI\n\nThe `libeaes` command, using the algorithm, can perfectly process anything thrown at it. No matter the size. And give useful statistics at the end.\n\n``` bash\n$ libeaes encrypt file.txt outputfile.enc\n$ libeaes decrypt outputfile.enc outputfile.dec\n\n# Piping output\n$ libeaes encrypt movie.mp4 \u003e movie.enc\n# Stream an encrypted file in real time (e.g Watching the movie)\n$ libeaes decrypt movie.enc | vlc -\n```\n\nUse `--help` to see full usage documentation.\nUse `--help` on specific commands to see docmentation for that command.\n\n``` bash\n$ libeaes encrypt --help\n$ libeaes decrypt --help\n```\n\nThe commands can also be shortened to `enc` and `dec` respectfully.\n\n``` bash\n$ libeaes enc file.txt output.enc\n$ libeaes dec output.enc output.dec\n```\n\n### Programmatically\n\n``` javascript\n// Node CommonJS\nconst libeaes = require('libeaes');\n// Or ES6\nimport libeaes from 'libeaes';\n```\n\n## Examples\n\n### Singular Operation\n\n``` javascript\nlet password = \"#P@$$W0R9\";\nlet encrypted = libeaes.encrypt('Hello world', password);\n// Compressed, encrypted content\n\nlet decrypted = libeaes.decrypt(encrypted, password);\n// \"Hello world\"\n```\n\n### Stream Operation\n\n``` javascript\n// Encrypt a stream, pipe output elsewhere\nlet encryptor = libeaes.EAESEncryptor(\"#P@$$W0R9\");\ninputStream.pipe(encryptor).pipe(outputStream);\n\n// Decrypt a stream, pipe output elsewhere\nlet decryptor = libeaes.EAESDecryptor(\"#P@$$W0R9\");\ninputStream.pipe(decryptor).pipe(outputStream);\n\n// Stream sequential encryption and decryption operations\nlet encryptor = libeaes.EAESEncryptor(\"#P@$$W0R9\");\nlet decryptor = libeaes.EAESDecryptor(\"#P@$$W0R9\");\n\ninputStream.pipe(encryptor).pipe(decryptor).pipe(outputStream);\n// inputStream == outputStream\n```\n\n### File Operations\n\n``` javascript\nlibeaes.encryptFileStream(\"rawfile.txt\", \"encryptedfile.txt\", \"#P@$$W0R9\");\nlibeaes.decryptFileStream(\"encryptedfile.txt\", \"decryptedfile.txt\", \"#P@$$W0R9\");\n```\n\n## API\n\n### libeaes.encrypt(data, key)\n\n* `data`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* `key`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* Returns: [\u0026lt;Buffer\u0026gt;][buffer]\n\nCompress + Encrypt the input data, return the processed data\n\n### libeaes.decrypt(data, key)\n\n* `data`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* `key`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* Returns: [\u0026lt;Buffer\u0026gt;][buffer]\n\nDecrypt + Decompress the input data, return the processed data\n\n### libeaes.rawencrypt(data, key) *_Excluding compression_\n\n* `data`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* `key`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* Returns: [\u0026lt;Buffer\u0026gt;][buffer]\n\nEncrypt the input data, return the processed data.\n\nInput data is encrypted without initial compression.\n\n### libeaes.rawdecrypt(data, key) *_Excluding decompression_\n\n* `data`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* `key`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* Returns: [\u0026lt;Buffer\u0026gt;][buffer]\n\nDecrypt raw input data, return the processed data.\n\nInput data is assumed to be uncompressed.\n\n### Class: EAESEncryptor(key[, opts]) \u003csub\u003eextends\u003c/sub\u003e [`zlib.Gzip`][gzip]\n\n* `key`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* `opts`: [\u0026lt;zlib options\u0026gt;](https://nodejs.org/api/zlib.html#zlib_class_options)\n\nCreate a Transforming EAES Encryptor.\n\nData piped in here is compressed and encryped with the `key` configuration.\n\nEAES Streams are encrypted, compressed streams that are tailored to [the algorithm](lib/index.js) in this repo.\n\nThe `opts` object are passed directly into [zlib.Gzip][gzip]\n\n#### Event: `'error'`\n\n* `err`: [\u0026lt;Error\u0026gt;][error]\n* `code`: [\u0026lt;number\u0026gt;][number]\n\nThis is emitted by either the compression or encryption process.\n\n`code` is `1` when emitted by the encryption engine and [`undefined`][undefined] otherwise.\n\nCatch errors explicitly with the `'error:compressor'` and `'error:encryptor'` events.\n\n#### Event: `'error:encryptor'`\n\n* `err`: [\u0026lt;Error\u0026gt;][error]\n\nThe `'error:encryptor'` event is emitted if an error occurred while encrypting compressed data. The listener callback is passed a single `Error` argument when called.\n\nThe stream is not closed when the `'error:encryptor'` event is emitted.\n\n#### Event: `'error:compressor'`\n\n* `err`: [\u0026lt;Error\u0026gt;][error]\n\nThe `'error:compressor'` event is emitted if an error occurred while encrypting raw data. The listener callback is passed a single `Error` argument when called.\n\nThe stream is not closed when the `'error:compressor'` event is emitted.\n\n### Class: EAESDecryptor(key[, opts]) \u003csub\u003eextends\u003c/sub\u003e [`zlib.Gunzip`][gunzip]\n\n* `key`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* `opts`: [\u0026lt;zlib options\u0026gt;](https://nodejs.org/api/zlib.html#zlib_class_options)\n\nCreate an EAES Decryptor Stream.\n\nData piped in here is decrypted and decompressed with the `key` configuration.\n\nEAES Streams are encrypted, compressed streams that are tailored to [the algorithm](lib/index.js) in this repo.\n\nThe `opts` object are passed directly into [zlib.Gunzip][gunzip]\n\n#### Event: `'error'`\n\n* `err`: [\u0026lt;Error\u0026gt;][error]\n* `code`: [\u0026lt;number\u0026gt;][number]\n\nThis is emitted by either the decompression or decryption process.\n\n`code` is `1` when emitted by the decryption engine and [`undefined`][undefined] otherwise.\n\nCatch errors explicitly with the `'error:decompressor'` and `'error:decryptor'` events.\n\n#### Event: `'error:decryptor'`\n\n* `err`: [\u0026lt;Error\u0026gt;][error]\n\nThe `'error:decryptor'` event is emitted if an error occurred while decrypting decompressed data. The listener callback is passed a single `Error` argument when called.\n\nThe stream is not closed when the `'error:decryptor'` event is emitted.\n\n#### Event: `'error:decompressor'`\n\n* `err`: [\u0026lt;Error\u0026gt;][error]\n\nThe `'error:decompressor'` event is emitted if an error occurred while decrypting raw data. The listener callback is passed a single `Error` argument when called.\n\nThe stream is not closed when the `'error:decompressor'` event is emitted.\n\n### libeaes.encryptFileStream(infile, outfile, key)\n\n* `infile`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;buffer\u0026gt;][buffer] | [\u0026lt;url\u0026gt;][url]\n* `outfile`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;buffer\u0026gt;][buffer] | [\u0026lt;url\u0026gt;][url]\n* `key`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* Returns: [\u0026lt;fs.WriteStream\u0026gt;](https://nodejs.org/api/fs.html#fs_class_fs_writestream)\n\nRead the file, compress and encrypt each chunk, write to the outfile.\n\nReturns the `outputfile`'s stream object.\n\n### libeaes.decryptFileStream(infile, outfile, key)\n\n* `infile`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;buffer\u0026gt;][buffer] | [\u0026lt;url\u0026gt;][url]\n* `outfile`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;buffer\u0026gt;][buffer] | [\u0026lt;url\u0026gt;][url]\n* `key`: [\u0026lt;string\u0026gt;][string] | [\u0026lt;Buffer\u0026gt;][buffer]\n* Returns: [\u0026lt;fs.WriteStream\u0026gt;](https://nodejs.org/api/fs.html#fs_class_fs_writestream)\n\nRead the file, decrypt and decompress each chunk, write to the outfile.\n\nReturns the `outputfile`'s stream object.\n\n## ClI Info\n\n* When using pipes, it's not possible to seek through the stream\n* To avoid the terminal being cluttered while using pipes, direct other chained binaries' `stdout` and `stderr` to `/dev/null`\n\n``` bash\n# Watching from an encrypted movie, hiding vlc's log information\n$ libeaes dec movie.enc | vlc - \u003e /dev/null 2\u003e\u00261\n```\n\n## Development\n\n### Building\n\nFeel free to clone, use in adherance to the [license](#license) and perhaps send pull requests\n\n``` bash\ngit clone https://github.com/miraclx/libeaes-js.git\ncd libeaes-js\nnpm install\n# hack on code\nnpm run build\nnpm test\n```\n\n### Testing\n\nTests are executed with [Jest][jest]. To use it, simple run `npm install`, it will install\nJest and its dependencies in your project's `node_modules` directory followed by `npm run build` and finally `npm test`.\n\nTo run the tests:\n\n```bash\nnpm install\nnpm run build\nnpm test\n```\n\n## License\n\n[Apache 2.0][license] © **Miraculous Owonubi** ([@miraclx][author-url]) \u0026lt;omiraculous@gmail.com\u0026gt;\n\n[npm]:  https://github.com/npm/cli \"The Node Package Manager\"\n[jest]:  https://github.com/facebook/jest \"Delightful JavaScript Testing\"\n[license]:  LICENSE \"Apache 2.0 License\"\n[author-url]: https://github.com/miraclx\n\n[npm-url]: https://npmjs.org/package/libeaes\n[npm-image]: https://badgen.net/npm/node/libeaes\n[npm-image-url]: https://nodei.co/npm/libeaes.png?stars\u0026downloads\n[downloads-url]: https://npmjs.org/package/libeaes\n[downloads-image]: https://badgen.net/npm/dm/libeaes\n\n[url]: https://nodejs.org/api/url.html#url_the_whatwg_url_api\n[buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer\n[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\n[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type\n[undefined]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type\n[gzip]: https://nodejs.org/api/zlib.html#zlib_class_zlib_gzip\n[gunzip]: https://nodejs.org/api/zlib.html#zlib_class_zlib_gunzip\n[error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\n[object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiraclx%2Flibeaes-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiraclx%2Flibeaes-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiraclx%2Flibeaes-js/lists"}