https://github.com/jihyunlab/web-secret
JihyunLab Web secret.
https://github.com/jihyunlab/web-secret
cipher crypto decryption encryption env secret web
Last synced: over 1 year ago
JSON representation
JihyunLab Web secret.
- Host: GitHub
- URL: https://github.com/jihyunlab/web-secret
- Owner: jihyunlab
- License: mit
- Created: 2024-07-16T12:42:28.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-18T09:36:38.000Z (almost 2 years ago)
- Last Synced: 2025-03-16T08:48:32.841Z (over 1 year ago)
- Topics: cipher, crypto, decryption, encryption, env, secret, web
- Language: TypeScript
- Homepage:
- Size: 182 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @jihyunlab/web-secret
[](https://www.npmjs.com/package/@jihyunlab/web-secret?activeTab=versions) [](https://www.npmjs.com/org/jihyunlab) [](https://github.com/jihyunlab/web-secret/graphs/commit-activity) [](https://github.com/jihyunlab/web-secret/blob/master/LICENSE) [](https://eslint.org) [](https://github.com/prettier/prettier)\
[](https://github.com/jihyunlab/web-secret/actions/workflows/build.yml) [](https://github.com/jihyunlab/web-secret/actions/workflows/lint.yml) [](https://codecov.io/gh/jihyunlab/web-secret)
@jihyunlab/web-secret provides functionality in web applications to decrypt .env files encrypted with [@jihyunlab/secret-cli](https://www.npmjs.com/package/@jihyunlab/secret-cli).
The encryption function is implemented with [@jihyunlab/web-crypto](https://www.npmjs.com/package/@jihyunlab/web-crypto) and provides encryption for AES 256 GCM.
## Installation
```bash
npm i @jihyunlab/web-secret
```
## Usage
Decrypt the .env key value by directly entering the separately managed encryption key.
```
import { CIPHER, Env } from '@jihyunlab/web-secret';
const cipher = await Env.createCipher(CIPHER.AES_256_GCM, 'YourSecretKey');
const value = await cipher.decrypt(process.env.ENV_KEY);
```
## Encryption key
In web applications, since it's not possible to retrieve system or user environment variables, it's recommended to manage and directly input encryption keys separately.
## Credits
Authored and maintained by JihyunLab <>
## License
Open source [licensed as MIT](https://github.com/jihyunlab/web-secret/blob/master/LICENSE).