{"id":23288640,"url":"https://github.com/ryanbekhen/cryptkhen","last_synced_at":"2025-08-21T20:31:06.109Z","repository":{"id":35085088,"uuid":"204790335","full_name":"ryanbekhen/cryptkhen","owner":"ryanbekhen","description":"Node.js library for simple implementation of encryption, decryption and digital signatures","archived":false,"fork":false,"pushed_at":"2024-12-11T18:08:39.000Z","size":724,"stargazers_count":19,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-15T04:15:09.382Z","etag":null,"topics":["aes-256","encrypted-data","encryption-decryption","javascript","nodejs","passphrase","rsa","rsa-key-encryption","rsa-key-pair","security-signature","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ryanbekhen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ryanbekhen","patreon":null,"open_collective":null,"ko_fi":"ryanbekhen","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":"https://saweria.co/ryanbekhen"}},"created_at":"2019-08-27T21:04:49.000Z","updated_at":"2024-12-11T18:06:38.000Z","dependencies_parsed_at":"2024-02-28T12:29:39.617Z","dependency_job_id":"fb2b16a2-2221-4bcc-9830-9ca30fbeac3e","html_url":"https://github.com/ryanbekhen/cryptkhen","commit_stats":{"total_commits":117,"total_committers":6,"mean_commits":19.5,"dds":0.5641025641025641,"last_synced_commit":"02f8bef9e1166ad6104ee3cd9c991179fdb7a164"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanbekhen%2Fcryptkhen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanbekhen%2Fcryptkhen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanbekhen%2Fcryptkhen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanbekhen%2Fcryptkhen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanbekhen","download_url":"https://codeload.github.com/ryanbekhen/cryptkhen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230530648,"owners_count":18240497,"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","encrypted-data","encryption-decryption","javascript","nodejs","passphrase","rsa","rsa-key-encryption","rsa-key-pair","security-signature","typescript"],"created_at":"2024-12-20T03:32:03.079Z","updated_at":"2024-12-20T03:32:03.641Z","avatar_url":"https://github.com/ryanbekhen.png","language":"TypeScript","funding_links":["https://github.com/sponsors/ryanbekhen","https://ko-fi.com/ryanbekhen","https://saweria.co/ryanbekhen"],"categories":[],"sub_categories":[],"readme":"# CRYPTKHEN\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![npm version](https://badge.fury.io/js/@ryanbekhen%2Fcryptkhen.svg)](https://badge.fury.io/js/@ryanbekhen%2Fcryptkhen)\n[![Rate on Openbase](https://badges.openbase.com/js/rating/@ryanbekhen/cryptkhen.svg)](https://openbase.com/js/@ryanbekhen/cryptkhen?utm_source=embedded\u0026utm_medium=badge\u0026utm_campaign=rate-badge)\n\nNode.js library for simple implementation of encryption, decryption and digital signatures based on the Node.js [crypto module](https://nodejs.org/api/crypto.html)\n\n## Features\n\n- Encryption \u0026 Decryption (RSA, AES-256).\n- Generate signature \u0026 verify (RSA)\n\n## Install\n\n```bash\nnpm i @ryanbekhen/cryptkhen\n```\n\n## Quick start\n\nFirst of all, initialize:\n\n```typescript\nimport { AES256Encryption, RSAEncryption } from '@ryanbekhen/cryptkhen';\nconst aes256 = new AES256Encryption('secret');\nconst rsa = new RSAEncryption();\n```\n\n### AES-256\n\nBefore encrypting data of type string, the data is first converted into a buffer. The encrypted data will be in the form of a buffer and converted to base64.\n\n```typescript\nconst data = Buffer.from('data');\nconst encryptedText = aes256.encrypt(data).toString('base64');\n```\n\nWhen decrypting encrypted text, the encrypted text will be converted into a buffer first. The decrypted data will be buffered and converted to a string.\n\n```typescript\nconst decryptedText = aes256.decrypt(Buffer.from(encryptedText, 'base64')).toString();\n```\n\nIf you are encrypting a file that will produce an encrypted file, there is no need to change the encryption result to base64 because the encryption result in the form of a buffer will be written into a new file, for example it will be written in the `data.enc` file.\n\n### RSA\n\nWhen generating a public key and a private key, the function defaults to using bits of size 2048 without a passphrase.\n\n```typescript\nconst pem = await rsa.generateKey();\n```\n\nText encryption will produce encrypted text in base64 form.\n\n```typescript\nconst encryptedText = rsa.encrypt(pem.publicKey, 'data');\n```\n\nWhen decrypting encrypted text, a passphrase is required if at the time of generating the RSA key the passphrase is used.\n\n```typescript\nconst decryptedText = rsa.decrypt(pem.privateKey, encryptedText);\n```\n\nCreate digital signatures based on verifiable data.\n\n```typescript\nconst signature = rsa.signature(pem.privateKey, 'data');\n```\n\nVerify signature authenticity.\n\n```typescript\nconst verify = rsa.isVerified(pem.publicKey, signature, 'data');\n```\n\n## Contributing\n\nQuestions, comments, bug reports, and pull requests are all welcome.\n\n## License\n\nThis software is licensed under the [Apache 2 license](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanbekhen%2Fcryptkhen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanbekhen%2Fcryptkhen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanbekhen%2Fcryptkhen/lists"}