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