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

sm-crypto-service

v1.1.2

Published

This package is an encryption and decryption service for Node.js applications. It uses the Sodium cryptographic library, ported to JavaScript via the tweetnacl library, to provide secure, efficient encryption and decryption functions. The package is desig

Downloads

15

Readme

CryptoService

CryptoService is an encryption and decryption package for Node.js applications written in TypeScript. It uses the Sodium cryptographic library, ported to JavaScript via the tweetnacl library, to provide secure, efficient encryption and decryption functions. The package is designed to be easy to use, with a simple API that integrates seamlessly into any Node.js application. It's perfect for applications that need to handle sensitive data securely

Installation

Installing CryptoService is a breeze with the package manager npm install sm-crypto-service. Follow the link to download and install npm if you have not already.

CryptoService Class Documentation

Overview

The CryptoService class provides encryption and decryption services using the Sodium cryptographic library. It uses a secret key of a 64 bits of random string.

Methods

encrypt(message: string, secretCode: string): string

This method encrypts a given message.

  • Parameters: - message (string): The message to be encrypted. - secretCode (string): A secret code used in the encryption process.
  • Returns: The encrypted message as a base64-encoded string.
  • Description: This method generates a random nonce and uses it along with the message and a hashed combination of key and secretCode to create an encrypted cipher. The cipher is then base64-encoded for safe transmission or storage. The memory of the message and key is cleared after encryption for security reasons.

decrypt(encrypted: string, secretCode: string): string

This method decrypts a given encrypted message.

  • Parameters: - encrypted (string): The message to be decrypted. - secretCode (string): A secret code used in the decryption process.
  • Returns: The decrypted message as a string. If decryption fails, it returns an error message.
  • Description: This method decodes the encrypted message, extracts the nonce and ciphertext, and attempts to decrypt the ciphertext using the nonce and a hashed combination of key and secretCode. If decryption is successful and the result is a string, it returns the decrypted message. If decryption fails or the result is not a string, it returns an error message. The memory of the ciphertext and key is cleared after decryption for security reasons.