Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
crypto-extra
Advanced tools
Readme
Adds convenience methods to the native Node.js crypto module. It is a drop in replacement, and extends the original module functionality.
The native crypto
module can be a pain to work with, and requires a lot of boilerplate to do things such as randomizing and encryption. This abstracts all of that.
$ npm install crypto-extra --save
To use in your project, simply require into your project as you would the crypto
module.
const crypto = require("crypto-extra")
crypto.randomString()
//= L0e84MUt0n
crypto.hash("hello")
//= 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
Encrypts a value with a secret key using AES-256-CTR.
value - The value you want to encrypt. Everything (except objects) is converted to a string before encryption for consistency. Objects are stringified using JSON.stringify
.
Type:
any
secretKey - The key used in the encryption. If not supplied, the lib will fallback to the environment variable ENCRYPTION_KEY
.
Type:
string
Default:process.env.ENCRYPTION_KEY
Decrypts a value using AES-256-CTR.
value - The encrypted value you want to decrypt. Will automatically parse objects that were encrypted.
Type:
string
secretKey - The key used in the encryption. If not supplied, the lib will fallback to the environment variable ENCRYPTION_KEY
.
Type:
string
Default:process.env.ENCRYPTION_KEY
Hashes a string with the provided algorithm.
value - The value you want to hash. Any non-string value is converted to a string before hashing for consistency.
Type:
string
options
rounds - The number of rounds to use when hashing.
Type:
integer
Default:1
salt - A string to be appended to the value before it is hashed.
Type:
string
algorithm - The hashing algorithm to use.
Type:
string
Default:SHA256
Generates a random 256-bit key that can be used as an encryption key.
length - The length of the key you want to generate. Must be an even number.
Type:
number
Default:32
Returns a random string of a defined length.
length - Length of the random string. Must be above 0.
Type:
integer
Default:10
charset - The character set to take from.
Type:
string
Default:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Returns a random string within a defined range.
options
min - Minimum number of range. Must be a positive integer.
Type:
integer
Default:0
max - Maximum number of range. This cannot be higher than 9007199254740991
due to Javascript integer limits (http://mzl.la/1A1nVyU). If you need a number higher than this, consider using randomString with the charset 0123456789
instead.
Type:
integer
Default:9007199254740991
FAQs
Convenience methods for the crypto module
The npm package crypto-extra receives a total of 39,442 weekly downloads. As such, crypto-extra popularity was classified as popular.
We found that crypto-extra demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.