@hapi/cryptiles
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -13,2 +13,13 @@ /** | ||
/** | ||
Generate a cryptographically strong pseudo-random alphanumeric data | ||
@param size - Size of the string | ||
@returns A cryptographically strong pseudo-random alphanumeric data | ||
*/ | ||
export function randomAlphanumString(size: number): string; | ||
/** | ||
Return a random string of digits | ||
@@ -15,0 +26,0 @@ |
@@ -21,2 +21,17 @@ 'use strict'; | ||
// Generate a cryptographically strong pseudo-random alphanum data | ||
exports.randomAlphanumString = function (size) { | ||
let result = ''; | ||
while (result.length < size) { | ||
const buffer = exports.randomBits((size + 1) * 6); | ||
result += buffer.toString('base64').replace(/[^a-zA-Z0-9]/g, ''); | ||
} | ||
return result.slice(0, size); | ||
}; | ||
// Return a random string of digits | ||
@@ -23,0 +38,0 @@ |
{ | ||
"name": "@hapi/cryptiles", | ||
"description": "General purpose crypto utilities", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"repository": "git://github.com/hapijs/cryptiles", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"engines": { | ||
"node": ">=12.0.0" | ||
}, | ||
"files": [ | ||
@@ -9,0 +12,0 @@ "lib" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
6137
92
0