{"id":17223422,"url":"https://github.com/conduitry/split-crypt","last_synced_at":"2025-03-25T16:23:31.692Z","repository":{"id":163440909,"uuid":"345462913","full_name":"Conduitry/split-crypt","owner":"Conduitry","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-27T23:45:16.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T14:28:14.588Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"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/Conduitry.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-07T22:01:30.000Z","updated_at":"2023-03-11T03:45:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"ffb4b0e3-8db7-445d-bf05-ba74487a6c17","html_url":"https://github.com/Conduitry/split-crypt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conduitry%2Fsplit-crypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conduitry%2Fsplit-crypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conduitry%2Fsplit-crypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conduitry%2Fsplit-crypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Conduitry","download_url":"https://codeload.github.com/Conduitry/split-crypt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245497151,"owners_count":20624957,"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":[],"created_at":"2024-10-15T04:08:16.991Z","updated_at":"2025-03-25T16:23:31.656Z","avatar_url":"https://github.com/Conduitry.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# split-crypt\n\nSplit files into chunks and encrypt them. Then decrypt them and combine them again.\n\n## Goals\n\n- Files should be split and combined for storage in environments with a maximum file size\n- Folder structure and names of original files should be concealed in encrypted data\n- Partial updates of encrypted set of files should be possible without re-encrypting everything\n- Encrypting files should be possible without the use of a passphrase\n\n## Requirements\n\nThis library uses new Node.js features, and requires version 16+ of Node.js.\n\n## Usage\n\nThis library consists primarily of `crypt.js` which has the exports `init`, `encrypt`, `decrypt`, and `clean`.\n\nIt also contains helper utilities in `pass.js` which has the exports `get_pass` and `confirm_pass`.\n\n### Initializing a new encrypted file store\n\n```js\nimport { init } from './crypt.js';\nimport { confirm_pass } from './pass.js';\n\ninit({\n\tcrypt: '/path/to/directory/to/initialize',\n\tcipher: 'aes-256-cbc',\n\thash: 'sha512',\n\thmac: 32,\n\trsa: 2048,\n\tsplit: 33554432,\n\tpassphrase: await confirm_pass(\n\t\t'Enter passphrase: ',\n\t\t'Confirm passphrase: ',\n\t\t'Passphrases do not match.',\n\t),\n});\n```\n\n`init` expects to be passed:\n\n- `crypt` - the directory to initialize as the encrypted file store\n- `cipher` - the cipher to use for the (symmetric) encryption of data\n- `hash` - the hash algorithm to use for file contents and names\n- `hmac` - the number of bytes in the HMAC key to use\n- `rsa` - the number of bits in the modulus of the (asymmetric) key pairs\n- `split` - the number of bytes to split files into before encrypting\n- `passphrase` - a string used to encrypt the private key on disk\n\n### Updating encrypted file store with new and changed files\n\n```js\nimport { encrypt } from './crypt.js';\n\nconst response = await encrypt({\n\tplain: '/path/to/plain/directory',\n\tcrypt: '/path/to/encrypted/directory',\n\tcache: '/path/to/cache/file',\n\tfilter: (path) =\u003e some_logic(path),\n});\n\nconsole.log(response);\n```\n\n`encrypt` expects to be passed:\n\n- `plain` - the directory containing the original, unencrypted files\n- `crypt` - the directory containing the encrypted file store to update\n- `cache` (optional) - the path of the file to maintain various hash information\n- `filter` (optional) - a function that is passed a path (the portion after `plain`) and returns whether the given file should be included in the encrypted file store\n- `passphrase` (optional) - if passed, also delete unused `-data` files and reuse symmetric encryption parameters on renamed input files so the resultant encrypted files are also effectively renamed\n\n### Updating decrypted file store with new and changed files\n\n```js\nimport { decrypt } from './crypt.js';\nimport { get_pass } from './pass.js';\n\nconst response = await decrypt({\n\tcrypt: '/path/to/encrypted/directory',\n\tplain: '/path/to/decrypted/directory',\n\tcache: '/path/to/cache/file',\n\tfilter: (path) =\u003e some_logic(path),\n\tpassphrase: await get_pass('Enter passphrase: '),\n});\n\nconsole.log(response);\n```\n\n`decrypt` expects to be passed:\n\n- `crypt` - the directory containing the encrypted file store to decrypt\n- `plain` - the destination directory for the decrypted files\n- `cache` (optional) - the path of the file to maintain various hash information\n- `filter` (optional) - a function that is passed a path (the portion after `plain`) and returns whether the given file should be decrypted from the encrypted file store, including whether it should be deleted if it does not exist in the store\n- `passphrase` - the passphrase for the private key\n\n### Cleaning unused data files in an encrypted file store\n\n```js\nimport { clean } from './crypt.js';\nimport { get_pass } from './pass.js';\n\nconst response = await clean({\n\tcrypt: '/path/to/encrypted/directory',\n\tpassphrase: await get_pass('Enter passphrase: '),\n});\n\nconsole.log(response);\n```\n\n`clean` expects to be passed:\n\n- `crypt` - the directory containing the encrypted file store to clean\n- `passphrase` - the passphrase for the private key\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduitry%2Fsplit-crypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconduitry%2Fsplit-crypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduitry%2Fsplit-crypt/lists"}