npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jihyunlab/web-crypto

v1.0.13

Published

JihyunLab Web crypto.

Downloads

179

Readme

@jihyunlab/web-crypto

Version Downloads Last commit License Linter code style: prettier
Build Lint codecov

@jihyunlab/web-crypto was developed to enhance the convenience of implementing cryptographic functionalities in web applications.

The encryption function is implemented with Web Crypto API in Node.js and provides encryption for AES 256 CBC and AES 256 GCM.

Installation

npm i @jihyunlab/web-crypto

Usage

You can easily encrypt and decrypt data with a simple method.

import { CIPHER, createCipher } from '@jihyunlab/web-crypto';

const cipher = await createCipher(CIPHER.AES_256_GCM, 'your secret key');

const encrypted = await cipher.encrypt('jihyunlab');
console.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]

const decrypted = await cipher.decrypt(encrypted);
console.log(decrypted); // Uint8Array(9)[106, 105, 104, 121, 117, 110, 108, 97, 98]

Provides encryption functionality for Uint8Array data.

const encrypted = await cipher.encrypt(
  new Uint8Array([106, 105, 104, 121, 117, 110, 108, 97, 98])
);
console.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]

const decrypted = await cipher.decrypt(encrypted);
console.log(decrypted); // Uint8Array(9)[106, 105, 104, 121, 117, 110, 108, 97, 98]

You can configure encryption options such as salt and iteration.

const cipher = await createCipher(CIPHER.AES_256_GCM, 'your secret key', {
  salt: 'salt',
  iterations: 256,
});

@jihyunlab/web-buffer

You can install @jihyunlab/web-buffer to perform additional data conversions.

npm i @jihyunlab/web-buffer
import { WebBuffer } from '@jihyunlab/web-buffer';

const buffer = WebBuffer.from(
  new Uint8Array([106, 105, 104, 121, 117, 110, 108, 97, 98]),
  'uint8array' /* hex, base64, base64url, utf8, uint8array */
);

const utf8 = buffer.toString('utf8');
console.log(utf8); // jihyunlab

@jihyunlab/crypto

@jihyunlab/crypto implements encryption functionalities for Node.js applications using the same interface as @jihyunlab/web-crypto.

Consider using @jihyunlab/crypto for decrypting encrypted data from @jihyunlab/web-crypto in Node.js applications, or vice versa.

import { CIPHER, createCipher } from '@jihyunlab/crypto';

const cipher = await createCipher(CIPHER.AES_256_GCM, 'your secret key');
const encrypted = await cipher.encrypt('jihyunlab');

Credits

Authored and maintained by JihyunLab <[email protected]>

License

Open source licensed as MIT.