Installations
npm install crypto-extra
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=6
Node Version
10.16.3
NPM Version
6.9.0
Score
92.8
Supply Chain
100
Quality
75.7
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (100%)
Developer
jsonmaur
Download Statistics
Total Downloads
5,941,056
Last Day
2,809
Last Week
11,906
Last Month
52,666
Last Year
1,540,445
GitHub Statistics
14 Stars
83 Commits
1 Forks
4 Watching
1 Branches
1 Contributors
Bundle Size
3.20 kB
Minified
1.40 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.1
Package Id
crypto-extra@1.0.1
Size
5.56 kB
NPM Version
6.9.0
Node Version
10.16.3
Publised On
22 Oct 2019
Total Downloads
Cumulative downloads
Total Downloads
5,941,056
Last day
2.6%
2,809
Compared to previous day
Last week
-13.2%
11,906
Compared to previous week
Last month
7.5%
52,666
Compared to previous month
Last year
4.3%
1,540,445
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
7
Crypto-Extra for Node.js
Adds convenience methods to the native Node.js crypto module. It is a drop in replacement, and extends the original module functionality.
Why?
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.
Getting Started
1$ npm install crypto-extra --save
To use in your project, simply require into your project as you would the crypto
module.
1const crypto = require("crypto-extra") 2 3crypto.randomString() 4//= L0e84MUt0n 5 6crypto.hash("hello") 7//= 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
API
.encrypt (value, secretKey)
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
.decrypt (value, secretKey)
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
.hash (value, options)
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
-
.randomKey (length)
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
.randomString (length, charset)
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
.randomNumber (options)
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 charset0123456789
instead.Type:
integer
Default:9007199254740991
-
License
MIT © Jason Maurer
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: license:0
- Info: FSF or OSI recognized license: MIT License: license:0
Reason
Found 0/27 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 4 are checked with a SAST tool
Reason
45 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-6chw-6frg-f759
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3
- Warn: Project is vulnerable to: MAL-2023-462
- Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv
- Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8
- Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65
- Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.7
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to crypto-extra
crypto-binary-extra
Assemble and disassemble binary messages used in cryptocoin applications
@cryptosheet/extract-spreadsheet-id
Extracts the google spreadsheet id from a given spreadsheet url
1broker-client
node.js wrapper for 1broker.com api, providing extra features
crypto-color-extracter
simple js crypto-currency primary color extractor util