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 🙏

© 2025 – Pkg Stats / Ryan Hefner

aes-object

v1.0.0

Published

AES encryption for objects

Readme

aes-object

CI NPM Version MIT License Install Size

A lightweight library that leverages AES encryption to securely encrypt and decrypt JavaScript objects—supporting arrays, records, buffers, and more.


📦 Installation

npm install aes-object

📖 Usage

import { decryptObject, encryptObject } from 'aes-object';

const secretKey = 'mySecretKey';
const data = { message: Buffer.from('Hello, world!') };

const encrypted = encryptObject({ input: data, secretKey });
console.log('Encrypted:', encrypted); // S7WhaSK63RuL3r+AQ5cG5AMSG9r4356DX1wUXZXgTUgeh19GlTl1wbsW1+jZUBqJl0pBKDMBBxAKDrTOqBbD0U5clObURb2OyRCKsf1LtqM=

const decrypted = decryptObject({ input: encrypted, secretKey });
console.log('Decrypted:', decrypted); // { message: <Buffer 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21> }

console.log('Message:', decrypted.message.toString()); // Hello, world!;

📚 Documentation

For all configuration options, please see the API docs.

API
/**
 * Encrypts an object using AES encryption.
 *
 * @template T - The type of the input object.
 * @param {AesEncryptObjectParams<T>} params - The encryption parameters.
 * @param {T} params.input - The object to be encrypted.
 * @param {string} params.secretKey - The secret key for encryption.
 * @param {string} [params.iv] - The initialization vector (IV) for encryption. If not provided, a random IV will be generated.
 * @returns {string} The encrypted data as a string in Base64 format.
 * @throws {TypeError} If the input is not an object.
 */
function encryptObject<T extends ObjectLike>(params: AesEncryptObjectParams<T>): string;

/**
 * Decrypts an AES-encrypted string back into an object.
 *
 * @template T - The expected type of the decrypted object.
 * @param {AesDecryptObjectParams} params - The decryption parameters.
 * @param {string} params.input - The encrypted string in Base64 format.
 * @param {string} params.secretKey - The secret key used for decryption.
 * @param {string} [params.iv] - The initialization vector (IV) used for decryption. If not provided, it uses the IV from the encrypted data.
 * @returns {T | null} The decrypted object if successful, or null if decryption fails.
 */
function decryptObject<T extends ObjectLike>(params: AesDecryptObjectParams): T | null;

🤝 Contributing

Want to contribute? Awesome! To show your support is to star the project, or to raise issues on GitHub

Thanks again for your support, it is much appreciated! 🙏

License

MIT © Shahrad Elahi and contributors.