Socket
Socket
Sign inDemoInstall

@rjweb/utils

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rjweb/utils - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 1.5.1
- Remove bcrypt
## 1.5.0

@@ -2,0 +6,0 @@

2

lib/cjs/pckg.json
{
"name": "@rjweb/utils",
"version": "1.5.0",
"version": "1.5.1",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

@@ -31,3 +31,2 @@ "use strict";

__export(string_exports, {
compareBCrypt: () => compareBCrypt,
decrypt: () => decrypt,

@@ -38,3 +37,2 @@ encrypt: () => encrypt,

hash: () => hash,
hashBCrypt: () => hashBCrypt,
limit: () => limit

@@ -44,3 +42,2 @@ });

var crypto = __toESM(require("crypto"));
var bcrypt = __toESM(require("bcrypt"));
let randomIndex;

@@ -130,29 +127,2 @@ let randomBytes;

}
function hashBCrypt(input, options) {
var _a, _b;
const pOptions = {
rounds: (_a = options == null ? void 0 : options.rounds) != null ? _a : 5,
async: (_b = options == null ? void 0 : options.async) != null ? _b : true
};
if (pOptions.async) {
return new Promise(async (resolve) => {
return resolve(bcrypt.hash(input, pOptions.rounds));
});
} else {
return bcrypt.hashSync(input, pOptions.rounds);
}
}
function compareBCrypt(input, hash2, options) {
var _a;
const pOptions = {
async: (_a = options == null ? void 0 : options.async) != null ? _a : true
};
if (pOptions.async) {
return new Promise(async (resolve) => {
return resolve(bcrypt.compare(input, hash2));
});
} else {
return bcrypt.hashSync(input, hash2);
}
}
function encrypt(input, key, options) {

@@ -200,3 +170,2 @@ var _a, _b;

0 && (module.exports = {
compareBCrypt,
decrypt,

@@ -207,4 +176,3 @@ encrypt,

hash,
hashBCrypt,
limit
});
{
"name": "@rjweb/utils",
"version": "1.5.0",
"version": "1.5.1",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

import * as crypto from "crypto";
import * as bcrypt from "bcrypt";
let randomIndex;

@@ -87,29 +86,2 @@ let randomBytes;

}
function hashBCrypt(input, options) {
var _a, _b;
const pOptions = {
rounds: (_a = options == null ? void 0 : options.rounds) != null ? _a : 5,
async: (_b = options == null ? void 0 : options.async) != null ? _b : true
};
if (pOptions.async) {
return new Promise(async (resolve) => {
return resolve(bcrypt.hash(input, pOptions.rounds));
});
} else {
return bcrypt.hashSync(input, pOptions.rounds);
}
}
function compareBCrypt(input, hash2, options) {
var _a;
const pOptions = {
async: (_a = options == null ? void 0 : options.async) != null ? _a : true
};
if (pOptions.async) {
return new Promise(async (resolve) => {
return resolve(bcrypt.compare(input, hash2));
});
} else {
return bcrypt.hashSync(input, hash2);
}
}
function encrypt(input, key, options) {

@@ -156,3 +128,2 @@ var _a, _b;

export {
compareBCrypt,
decrypt,

@@ -163,4 +134,3 @@ encrypt,

hash,
hashBCrypt,
limit
};

@@ -30,39 +30,2 @@ /// <reference types="node" />

/**
* Hash a String using bcrypt
* @example
* ```
* import { string } from "@rjweb/utils"
*
* string.hashBCrypt('Hello', { rounds: 5, async: false }) // $2b$05$vi7.v6gPf6IIzumgUEbMyes8yZ0v8.8U0QaZZfXcldhrjiajBD2v2
* ```
* @since 1.1.2
*/ export declare function hashBCrypt<Options extends {
/**
* The Amount of Rounds to Salt
* @default 5
* @since 1.1.2
*/ rounds?: number;
/**
* Whether to run bcrypt async
* @default true
* @since 1.1.2
*/ async?: boolean;
}>(input: string, options?: Options): Options['async'] extends false ? string : Promise<string>;
/**
* Compare a String using bcrypt
* @example
* ```
* import { string } from "@rjweb/utils"
*
* string.compareBCrypt('Hello', '$2b$05$vi7.v6gPf6IIzumgUEbMyes8yZ0v8.8U0QaZZfXcldhrjiajBD2v2', { async: false }) // true
* ```
* @since 1.1.2
*/ export declare function compareBCrypt<Options extends {
/**
* Whether to run bcrypt async
* @default true
* @since 1.1.2
*/ async?: boolean;
}>(input: string, hash: string, options?: Options): Options['async'] extends false ? boolean : Promise<boolean>;
/**
* Encrypt a String

@@ -69,0 +32,0 @@ * @example

{
"name": "@rjweb/utils",
"version": "1.5.0",
"version": "1.5.1",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc