Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-crypto-random

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-crypto-random - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

6

dist/index.d.ts
/**
* index.js
*/
import { getRandomBytes, getRandomAsciiString, getRandomString, getRandomSampledString } from './random';
export declare const getRandomBytes: (len: number) => Uint8Array;
export declare const getRandomAsciiString: (len: number) => string;
export declare const getRandomString: (len: number) => string;
export declare const getRandomSampledString: (len: number, candidates: string) => string;
declare const _default: {

@@ -12,2 +15,1 @@ getRandomBytes: (len: number) => Uint8Array;

export default _default;
export { getRandomBytes, getRandomAsciiString, getRandomString, getRandomSampledString };

@@ -5,9 +5,16 @@ "use strict";

*/
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var random_1 = require("./random");
exports.getRandomBytes = random_1.getRandomBytes;
exports.getRandomAsciiString = random_1.getRandomAsciiString;
exports.getRandomString = random_1.getRandomString;
exports.getRandomSampledString = random_1.getRandomSampledString;
exports.default = { getRandomBytes: random_1.getRandomBytes, getRandomAsciiString: random_1.getRandomAsciiString, getRandomString: random_1.getRandomString, getRandomSampledString: random_1.getRandomSampledString };
var random = __importStar(require("./random"));
exports.getRandomBytes = random.getRandomBytes;
exports.getRandomAsciiString = random.getRandomAsciiString;
exports.getRandomString = random.getRandomString;
exports.getRandomSampledString = random.getRandomSampledString;
exports.default = { getRandomBytes: exports.getRandomBytes, getRandomAsciiString: exports.getRandomAsciiString, getRandomString: exports.getRandomString, getRandomSampledString: exports.getRandomSampledString };
//# sourceMappingURL=index.js.map

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("crypto")):"function"==typeof define&&define.amd?define(["crypto"],e):"object"==typeof exports?exports.jscrandom=e(require("crypto")):t.jscrandom=e(t.crypto)}(this,function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/home/circleci/repo/packages/js-crypto-random/dist",r(r.s=0)}([function(t,e,r){t.exports=r(1)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(2);n.getRandomBytes,n.getRandomAsciiString,n.getRandomString,n.getRandomSampledString,n.getRandomBytes,n.getRandomAsciiString,n.getRandomString,n.getRandomSampledString},function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(3));e.getRandomString=function(t){for(var r=e.getRandomBytes(t),n=e.getRandomBytes(t),o="",i=0;i<t;i++)n[i]=n[i]%3,r[i]=0===n[i]?r[i]%10+48:r[i]%26+(1===n[i]?65:97),o+=String.fromCharCode(r[i]);return o},e.getRandomAsciiString=function(t){for(var r=e.getRandomBytes(t),n="",o=0;o<t;o++)r[o]=r[o]%94+32,n+=String.fromCharCode(r[o]);return n},e.getRandomSampledString=function(t,r){var n=r.length;if(0===n)return"";for(var o=e.getRandomBytes(t),i="",u=0;u<t;u++)i+=r[o[u]%n];return i},e.getRandomBytes=function(t){var e=o.getRootWebCryptoAll(),r=o.getNodeCrypto();if(void 0!==e&&"function"==typeof e.getRandomValues){var n=new Uint8Array(t);return e.getRandomValues(n),n}if(void 0!==r)return new Uint8Array(r.randomBytes(t));throw new Error("UnsupportedEnvironment")}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){return"undefined"!=typeof window?void 0:r(4)};e.getNodeCrypto=n;var o=function(){if("undefined"!=typeof window&&window.crypto)return window.crypto.subtle};e.getWebCrypto=o;var i=function(){if("undefined"!=typeof window){if(window.msCrypto)return window.msCrypto.subtle;if(window.crypto)return window.crypto.subtle}};e.getWebCryptoAll=i;var u=function(){if("undefined"!=typeof window){if(window.msCrypto)return window.msCrypto;if(window.crypto)return window.crypto}};e.getRootWebCryptoAll=u;var d=function(){if("undefined"!=typeof window&&window.msCrypto)return window.msCrypto.subtle};e.getMsCrypto=d,e.default={getNodeCrypto:n,getWebCrypto:o,getMsCrypto:d,getWebCryptoAll:i,getRootWebCryptoAll:u}},function(e,r){e.exports=t}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("crypto")):"function"==typeof define&&define.amd?define(["crypto"],e):"object"==typeof exports?exports.jscrandom=e(require("crypto")):t.jscrandom=e(t.crypto)}(this,function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/home/circleci/repo/packages/js-crypto-random/dist",r(r.s=0)}([function(t,e,r){t.exports=r(1)},function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(2));e.getRandomBytes=o.getRandomBytes,e.getRandomAsciiString=o.getRandomAsciiString,e.getRandomString=o.getRandomString,e.getRandomSampledString=o.getRandomSampledString,e.getRandomBytes,e.getRandomAsciiString,e.getRandomString,e.getRandomSampledString},function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(3));e.getRandomString=function(t){for(var r=e.getRandomBytes(t),n=e.getRandomBytes(t),o="",i=0;i<t;i++)n[i]=n[i]%3,r[i]=0===n[i]?r[i]%10+48:r[i]%26+(1===n[i]?65:97),o+=String.fromCharCode(r[i]);return o},e.getRandomAsciiString=function(t){for(var r=e.getRandomBytes(t),n="",o=0;o<t;o++)r[o]=r[o]%94+32,n+=String.fromCharCode(r[o]);return n},e.getRandomSampledString=function(t,r){var n=r.length;if(0===n)return"";for(var o=e.getRandomBytes(t),i="",u=0;u<t;u++)i+=r[o[u]%n];return i},e.getRandomBytes=function(t){var e=o.getRootWebCryptoAll(),r=o.getNodeCrypto();if(void 0!==e&&"function"==typeof e.getRandomValues){var n=new Uint8Array(t);return e.getRandomValues(n),n}if(void 0!==r)return new Uint8Array(r.randomBytes(t));throw new Error("UnsupportedEnvironment")}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){return"undefined"!=typeof window?void 0:r(4)};e.getNodeCrypto=n;var o=function(){if("undefined"!=typeof window&&window.crypto)return window.crypto.subtle};e.getWebCrypto=o;var i=function(){if("undefined"!=typeof window){if(window.msCrypto)return window.msCrypto.subtle;if(window.crypto)return window.crypto.subtle}};e.getWebCryptoAll=i;var u=function(){if("undefined"!=typeof window){if(window.msCrypto)return window.msCrypto;if(window.crypto)return window.crypto}};e.getRootWebCryptoAll=u;var d=function(){if("undefined"!=typeof window&&window.msCrypto)return window.msCrypto.subtle};e.getMsCrypto=d,e.default={getNodeCrypto:n,getWebCrypto:o,getMsCrypto:d,getWebCryptoAll:i,getRootWebCryptoAll:u}},function(e,r){e.exports=t}])});
{
"name": "js-crypto-random",
"version": "0.4.0",
"version": "0.4.1",
"description": "Universal Module for Secure Random Generator in JavaScript",

@@ -5,0 +5,0 @@ "main": "dist/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