{"id":23038276,"url":"https://github.com/jihyunlab/web-crypto","last_synced_at":"2026-05-19T03:42:59.771Z","repository":{"id":248086814,"uuid":"826818693","full_name":"jihyunlab/web-crypto","owner":"jihyunlab","description":"JihyunLab Web crypto.","archived":false,"fork":false,"pushed_at":"2024-07-17T09:20:05.000Z","size":553,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T07:01:59.117Z","etag":null,"topics":["aes-cbc","aes-gcm","cipher","crypto","decryption","encryption","web"],"latest_commit_sha":null,"homepage":"","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/jihyunlab.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":"2024-07-10T12:45:10.000Z","updated_at":"2024-07-17T09:20:10.000Z","dependencies_parsed_at":"2024-07-17T11:40:59.396Z","dependency_job_id":null,"html_url":"https://github.com/jihyunlab/web-crypto","commit_stats":null,"previous_names":["jihyunlab/web-crypto"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jihyunlab%2Fweb-crypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jihyunlab%2Fweb-crypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jihyunlab%2Fweb-crypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jihyunlab%2Fweb-crypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jihyunlab","download_url":"https://codeload.github.com/jihyunlab/web-crypto/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244908043,"owners_count":20529968,"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-cbc","aes-gcm","cipher","crypto","decryption","encryption","web"],"created_at":"2024-12-15T18:17:38.060Z","updated_at":"2026-05-19T03:42:59.754Z","avatar_url":"https://github.com/jihyunlab.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @jihyunlab/web-crypto\n\n[![Version](https://img.shields.io/npm/v/@jihyunlab/web-crypto.svg?style=flat-square)](https://www.npmjs.com/package/@jihyunlab/web-crypto?activeTab=versions) [![Downloads](https://img.shields.io/npm/dt/@jihyunlab/web-crypto.svg?style=flat-square)](https://www.npmjs.com/package/@jihyunlab/web-crypto) [![Last commit](https://img.shields.io/github/last-commit/jihyunlab/web-crypto.svg?style=flat-square)](https://github.com/jihyunlab/web-crypto/graphs/commit-activity) [![License](https://img.shields.io/github/license/jihyunlab/web-crypto.svg?style=flat-square)](https://github.com/jihyunlab/web-crypto/blob/master/LICENSE) [![Linter](https://img.shields.io/badge/linter-eslint-blue?style=flat-square)](https://eslint.org) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\\\n[![Build](https://github.com/jihyunlab/web-crypto/actions/workflows/build.yml/badge.svg)](https://github.com/jihyunlab/web-crypto/actions/workflows/build.yml) [![Lint](https://github.com/jihyunlab/web-crypto/actions/workflows/lint.yml/badge.svg)](https://github.com/jihyunlab/web-crypto/actions/workflows/lint.yml) [![codecov](https://codecov.io/gh/jihyunlab/web-crypto/graph/badge.svg?token=UW73ZNZY03)](https://codecov.io/gh/jihyunlab/web-crypto)\n\n@jihyunlab/web-crypto was developed to enhance the convenience of implementing cryptographic functionalities in web applications.\n\nThe encryption function is implemented with [Web Crypto API](https://nodejs.org/api/webcrypto.html) in Node.js and provides encryption for AES 256 CBC and AES 256 GCM.\n\n## Installation\n\n```bash\nnpm i @jihyunlab/web-crypto\n```\n\n## Usage\n\nYou can easily encrypt and decrypt data with a simple method.\n\n```\nimport { CIPHER, createCipher } from '@jihyunlab/web-crypto';\n\nconst cipher = await createCipher(CIPHER.AES_256_GCM, 'your secret key');\n\nconst encrypted = await cipher.encrypt('jihyunlab');\nconsole.log(encrypted); // Uint8Array(37)[51, 174, 20, 84, 12, 141, 173, 206, 249, 11, 59, 112, 88, 223, 163, 211, 128, 234, 102, 116, 16, 224, 175, 45, 46, 52, 186, 141, 15, 243, 9, 120, 64, 27, 135, 169, 65]\n\nconst decrypted = await cipher.decrypt(encrypted);\nconsole.log(decrypted); // Uint8Array(9)[106, 105, 104, 121, 117, 110, 108, 97, 98]\n```\n\nProvides encryption functionality for Uint8Array data.\n\n```\nconst encrypted = await cipher.encrypt(\n  new Uint8Array([106, 105, 104, 121, 117, 110, 108, 97, 98])\n);\nconsole.log(encrypted); // Uint8Array(37)[185, 95, 254, 103, 109, 250, 109, 50, 8, 218, 251, 74, 215, 108, 74, 86, 177, 82, 144, 154, 156, 120, 128, 169, 112, 236, 153, 23, 253, 164, 238, 159, 236, 17, 85, 26, 75]\n\nconst decrypted = await cipher.decrypt(encrypted);\nconsole.log(decrypted); // Uint8Array(9)[106, 105, 104, 121, 117, 110, 108, 97, 98]\n```\n\nYou can configure encryption options such as salt and iteration.\n\n```\nconst cipher = await createCipher(CIPHER.AES_256_GCM, 'your secret key', {\n  salt: 'salt',\n  iterations: 256,\n});\n```\n\nProvides hashing functionality for Uint8Array data.\n\n```\nimport { HASH, createHash } from '@jihyunlab/web-crypto';\n\nconst hash = await createHash(HASH.SHA_256);\n\nconst hashed = await hash.digest(\n  new Uint8Array([106, 105, 104, 121, 117, 110, 108, 97, 98])\n);\nconsole.log(hashed); // Uint8Array(32) [200, 111, 45, 209, 157, 58, 63, 244, 241, 200, 144, 165, 32, 243, 10, 145, 101, 204, 44, 179, 226, 63, 57, 208, 185, 93, 101, 0, 122, 198, 82, 100]\n```\n\n## @jihyunlab/web-buffer\n\nYou can install [@jihyunlab/web-buffer](https://www.npmjs.com/package/@jihyunlab/web-buffer) to perform additional data conversions.\n\n```\nnpm i @jihyunlab/web-buffer\n```\n\n```\nimport { WebBuffer } from '@jihyunlab/web-buffer';\n\nconst buffer = WebBuffer.from(\n  new Uint8Array([106, 105, 104, 121, 117, 110, 108, 97, 98]),\n  'uint8array' /* hex, base64, base64url, utf8, uint8array */\n);\n\nconst utf8 = buffer.toString('utf8');\nconsole.log(utf8); // jihyunlab\n```\n\n## @jihyunlab/crypto\n\n[@jihyunlab/crypto](https://www.npmjs.com/package/@jihyunlab/crypto) implements encryption functionalities for Node.js applications using the same interface as @jihyunlab/web-crypto.\n\nConsider using @jihyunlab/crypto for decrypting encrypted data from @jihyunlab/web-crypto in Node.js applications, or vice versa.\n\n```\nimport { CIPHER, createCipher } from '@jihyunlab/crypto';\n\nconst cipher = await createCipher(CIPHER.AES_256_GCM, 'your secret key');\nconst encrypted = await cipher.encrypt('jihyunlab');\n```\n\n## Credits\n\nAuthored and maintained by JihyunLab \u003c\u003cinfo@jihyunlab.com\u003e\u003e\n\n## License\n\nOpen source [licensed as MIT](https://github.com/jihyunlab/web-crypto/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjihyunlab%2Fweb-crypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjihyunlab%2Fweb-crypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjihyunlab%2Fweb-crypto/lists"}