An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# @jihyunlab/web-secret

[![Version](https://img.shields.io/npm/v/@jihyunlab/web-secret.svg?style=flat-square)](https://www.npmjs.com/package/@jihyunlab/web-secret?activeTab=versions) [![Downloads](https://img.shields.io/npm/dt/@jihyunlab/web-secret.svg?style=flat-square)](https://www.npmjs.com/org/jihyunlab) [![Last commit](https://img.shields.io/github/last-commit/jihyunlab/web-secret.svg?style=flat-square)](https://github.com/jihyunlab/web-secret/graphs/commit-activity) [![License](https://img.shields.io/github/license/jihyunlab/web-secret.svg?style=flat-square)](https://github.com/jihyunlab/web-secret/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)\
[![Build](https://github.com/jihyunlab/web-secret/actions/workflows/build.yml/badge.svg)](https://github.com/jihyunlab/web-secret/actions/workflows/build.yml) [![Lint](https://github.com/jihyunlab/web-secret/actions/workflows/lint.yml/badge.svg)](https://github.com/jihyunlab/web-secret/actions/workflows/lint.yml) [![codecov](https://codecov.io/gh/jihyunlab/web-secret/graph/badge.svg?token=K2536J64LQ)](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).