mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-22 02:07:56 +00:00
chore: update to version 14.0.11 and align website URLs
This commit is contained in:
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
export declare const crypto: Crypto;
|
||||
export declare function getRandomValues<T extends Uint8Array>(arr: T): T;
|
||||
@@ -0,0 +1,6 @@
|
||||
import { xglobal } from '@pezkuwi/x-global';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
export const crypto = xglobal.crypto;
|
||||
export function getRandomValues(arr) {
|
||||
return crypto.getRandomValues(arr);
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
export declare const crypto: Crypto;
|
||||
export declare function getRandomValues<T extends Uint8Array>(arr: T): T;
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.crypto = exports.packageInfo = void 0;
|
||||
exports.getRandomValues = getRandomValues;
|
||||
const x_global_1 = require("@pezkuwi/x-global");
|
||||
var packageInfo_js_1 = require("./packageInfo.js");
|
||||
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
||||
exports.crypto = x_global_1.xglobal.crypto;
|
||||
function getRandomValues(arr) {
|
||||
return exports.crypto.getRandomValues(arr);
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare function insecureRandomValues<T extends Uint8Array>(arr: T): T;
|
||||
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.insecureRandomValues = insecureRandomValues;
|
||||
let warned = false;
|
||||
function insecureRandomValues(arr) {
|
||||
if (!warned) {
|
||||
console.warn('Using an insecure random number generator, this should only happen when running in a debugger without support for crypto');
|
||||
warned = true;
|
||||
}
|
||||
let r = 0;
|
||||
for (let i = 0, count = arr.length; i < count; i++) {
|
||||
if ((i & 0b11) === 0) {
|
||||
r = Math.random() * 0x100000000;
|
||||
}
|
||||
arr[i] = (r >>> ((i & 0b11) << 3)) & 0xff;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
export declare const crypto: Crypto;
|
||||
export declare function getRandomValues<T extends Uint8Array>(output: T): T;
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.crypto = exports.packageInfo = void 0;
|
||||
exports.getRandomValues = getRandomValues;
|
||||
const tslib_1 = require("tslib");
|
||||
const node_crypto_1 = tslib_1.__importDefault(require("node:crypto"));
|
||||
const x_global_1 = require("@pezkuwi/x-global");
|
||||
var packageInfo_js_1 = require("./packageInfo.js");
|
||||
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
||||
exports.crypto = (0, x_global_1.extractGlobal)('crypto', node_crypto_1.default.webcrypto);
|
||||
function getRandomValues(output) {
|
||||
return exports.crypto.getRandomValues(output);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export declare const packageInfo: {
|
||||
name: string;
|
||||
path: string;
|
||||
type: string;
|
||||
version: string;
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.packageInfo = void 0;
|
||||
exports.packageInfo = { name: '@pezkuwi/x-randomvalues', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.10' };
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* A getRandomValues util that detects and uses the available RN
|
||||
* random utiliy generation functions.
|
||||
**/
|
||||
declare function getRandomValuesRn(output: Uint8Array): Uint8Array;
|
||||
export declare const getRandomValues: typeof getRandomValuesRn;
|
||||
export declare const crypto: Crypto | {
|
||||
getRandomValues: typeof getRandomValuesRn;
|
||||
};
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.crypto = exports.getRandomValues = exports.packageInfo = void 0;
|
||||
const react_native_1 = require("react-native");
|
||||
const base64_1 = require("@pezkuwi/wasm-util/base64");
|
||||
const x_global_1 = require("@pezkuwi/x-global");
|
||||
const browser_js_1 = require("./browser.js");
|
||||
var packageInfo_js_1 = require("./packageInfo.js");
|
||||
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* A getRandomValues util that detects and uses the available RN
|
||||
* random utiliy generation functions.
|
||||
**/
|
||||
function getRandomValuesRn(output) {
|
||||
if (!react_native_1.NativeModules['ExpoRandom'] && !react_native_1.NativeModules.RNGetRandomValues) {
|
||||
throw new Error('No secure random number generator available. This environment does not support crypto.getRandomValues and no React Native secure RNG module is available.');
|
||||
}
|
||||
return (0, base64_1.base64Decode)(react_native_1.NativeModules.RNGetRandomValues
|
||||
? react_native_1.NativeModules.RNGetRandomValues.getRandomBase64(output.length)
|
||||
: react_native_1.NativeModules.ExpoRandom.getRandomBase64String(output.length), output);
|
||||
}
|
||||
const hasNativeRNModules = !!react_native_1.NativeModules['ExpoRandom'] || !!react_native_1.NativeModules.RNGetRandomValues;
|
||||
const hasNativeCrypto = typeof x_global_1.xglobal.crypto === 'object' && typeof x_global_1.xglobal.crypto.getRandomValues === 'function';
|
||||
exports.getRandomValues = (hasNativeRNModules
|
||||
? getRandomValuesRn
|
||||
: hasNativeCrypto
|
||||
? browser_js_1.getRandomValues
|
||||
: () => {
|
||||
throw new Error('No secure random number generator available. This environment does not support crypto.getRandomValues.');
|
||||
});
|
||||
exports.crypto = (exports.getRandomValues === browser_js_1.getRandomValues
|
||||
? browser_js_1.crypto
|
||||
: { getRandomValues: exports.getRandomValues });
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const x_global_1 = require("@pezkuwi/x-global");
|
||||
const x_randomvalues_1 = require("@pezkuwi/x-randomvalues");
|
||||
(0, x_global_1.exposeGlobal)('crypto', x_randomvalues_1.crypto);
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare function insecureRandomValues<T extends Uint8Array>(arr: T): T;
|
||||
@@ -0,0 +1,15 @@
|
||||
let warned = false;
|
||||
export function insecureRandomValues(arr) {
|
||||
if (!warned) {
|
||||
console.warn('Using an insecure random number generator, this should only happen when running in a debugger without support for crypto');
|
||||
warned = true;
|
||||
}
|
||||
let r = 0;
|
||||
for (let i = 0, count = arr.length; i < count; i++) {
|
||||
if ((i & 0b11) === 0) {
|
||||
r = Math.random() * 0x100000000;
|
||||
}
|
||||
arr[i] = (r >>> ((i & 0b11) << 3)) & 0xff;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
export declare const crypto: Crypto;
|
||||
export declare function getRandomValues<T extends Uint8Array>(output: T): T;
|
||||
@@ -0,0 +1,7 @@
|
||||
import nodeCrypto from 'node:crypto';
|
||||
import { extractGlobal } from '@pezkuwi/x-global';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
export const crypto = /*#__PURE__*/ extractGlobal('crypto', nodeCrypto.webcrypto);
|
||||
export function getRandomValues(output) {
|
||||
return crypto.getRandomValues(output);
|
||||
}
|
||||
@@ -15,21 +15,183 @@
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"version": "14.0.10",
|
||||
"browser": "browser.js",
|
||||
"main": "node.js",
|
||||
"react-native": "react-native.js",
|
||||
"version": "14.0.11",
|
||||
"main": "./cjs/node.js",
|
||||
"module": "./node.js",
|
||||
"browser": "./cjs/browser.js",
|
||||
"react-native": "./cjs/react-native.js",
|
||||
"types": "./node.d.ts",
|
||||
"exports": {
|
||||
"./cjs/package.json": "./cjs/package.json",
|
||||
"./cjs/*": "./cjs/*.js",
|
||||
".": {
|
||||
"types": "./node.d.ts",
|
||||
"react-native": {
|
||||
"module": {
|
||||
"types": "./react-native.d.ts",
|
||||
"default": "./react-native.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./cjs/react-native.d.ts",
|
||||
"default": "./cjs/react-native.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./react-native.d.ts",
|
||||
"default": "./react-native.js"
|
||||
}
|
||||
},
|
||||
"browser": {
|
||||
"module": {
|
||||
"types": "./browser.d.ts",
|
||||
"default": "./browser.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./cjs/browser.d.ts",
|
||||
"default": "./cjs/browser.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./browser.d.ts",
|
||||
"default": "./browser.js"
|
||||
}
|
||||
},
|
||||
"node": {
|
||||
"module": {
|
||||
"types": "./node.d.ts",
|
||||
"default": "./node.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./cjs/node.d.ts",
|
||||
"default": "./cjs/node.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./node.d.ts",
|
||||
"default": "./node.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"./browser": {
|
||||
"module": {
|
||||
"types": "./browser.d.ts",
|
||||
"default": "./browser.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./cjs/browser.d.ts",
|
||||
"default": "./cjs/browser.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./browser.d.ts",
|
||||
"default": "./browser.js"
|
||||
}
|
||||
},
|
||||
"./fallback": {
|
||||
"module": {
|
||||
"types": "./fallback.d.ts",
|
||||
"default": "./fallback.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./cjs/fallback.d.ts",
|
||||
"default": "./cjs/fallback.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./fallback.d.ts",
|
||||
"default": "./fallback.js"
|
||||
}
|
||||
},
|
||||
"./node": {
|
||||
"module": {
|
||||
"types": "./node.d.ts",
|
||||
"default": "./node.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./cjs/node.d.ts",
|
||||
"default": "./cjs/node.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./node.d.ts",
|
||||
"default": "./node.js"
|
||||
}
|
||||
},
|
||||
"./package.json": {
|
||||
"require": "./cjs/package.json",
|
||||
"default": "./package.json"
|
||||
},
|
||||
"./packageInfo.js": {
|
||||
"module": {
|
||||
"types": "./packageInfo.d.ts",
|
||||
"default": "./packageInfo.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./cjs/packageInfo.d.ts",
|
||||
"default": "./cjs/packageInfo.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./packageInfo.d.ts",
|
||||
"default": "./packageInfo.js"
|
||||
}
|
||||
},
|
||||
"./packageInfo": {
|
||||
"module": {
|
||||
"types": "./packageInfo.d.ts",
|
||||
"default": "./packageInfo.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./cjs/packageInfo.d.ts",
|
||||
"default": "./cjs/packageInfo.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./packageInfo.d.ts",
|
||||
"default": "./packageInfo.js"
|
||||
}
|
||||
},
|
||||
"./react-native": {
|
||||
"module": {
|
||||
"types": "./react-native.d.ts",
|
||||
"default": "./react-native.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./cjs/react-native.d.ts",
|
||||
"default": "./cjs/react-native.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./react-native.d.ts",
|
||||
"default": "./react-native.js"
|
||||
}
|
||||
},
|
||||
"./shim.js": {
|
||||
"module": {
|
||||
"types": "./shim.d.ts",
|
||||
"default": "./shim.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./cjs/shim.d.ts",
|
||||
"default": "./cjs/shim.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./shim.d.ts",
|
||||
"default": "./shim.js"
|
||||
}
|
||||
},
|
||||
"./shim": {
|
||||
"module": {
|
||||
"types": "./shim.d.ts",
|
||||
"default": "./shim.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./cjs/shim.d.ts",
|
||||
"default": "./cjs/shim.js"
|
||||
},
|
||||
"default": {
|
||||
"types": "./shim.d.ts",
|
||||
"default": "./shim.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@pezkuwi/x-global": "workspace:*",
|
||||
"@pezkuwi/x-global": "14.0.11",
|
||||
"tslib": "^2.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@pezkuwi/util": "workspace:*",
|
||||
"@pezkuwi/wasm-util": "^7.5.3",
|
||||
"@types/react-native": "^0.73.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@pezkuwi/util": "workspace:*",
|
||||
"@pezkuwi/util": "14.0.11",
|
||||
"@pezkuwi/wasm-util": "*"
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export declare const packageInfo: {
|
||||
name: string;
|
||||
path: string;
|
||||
type: string;
|
||||
version: string;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
export const packageInfo = { name: '@pezkuwi/x-randomvalues', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.10' };
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* A getRandomValues util that detects and uses the available RN
|
||||
* random utiliy generation functions.
|
||||
**/
|
||||
declare function getRandomValuesRn(output: Uint8Array): Uint8Array;
|
||||
export declare const getRandomValues: typeof getRandomValuesRn;
|
||||
export declare const crypto: Crypto | {
|
||||
getRandomValues: typeof getRandomValuesRn;
|
||||
};
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
import { NativeModules } from 'react-native';
|
||||
import { base64Decode } from '@pezkuwi/wasm-util/base64';
|
||||
import { xglobal } from '@pezkuwi/x-global';
|
||||
import { crypto as cryptoBrowser, getRandomValues as getRandomValuesBrowser } from './browser.js';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* A getRandomValues util that detects and uses the available RN
|
||||
* random utiliy generation functions.
|
||||
**/
|
||||
function getRandomValuesRn(output) {
|
||||
if (!NativeModules['ExpoRandom'] && !NativeModules.RNGetRandomValues) {
|
||||
throw new Error('No secure random number generator available. This environment does not support crypto.getRandomValues and no React Native secure RNG module is available.');
|
||||
}
|
||||
return base64Decode(NativeModules.RNGetRandomValues
|
||||
? NativeModules.RNGetRandomValues.getRandomBase64(output.length)
|
||||
: NativeModules.ExpoRandom.getRandomBase64String(output.length), output);
|
||||
}
|
||||
const hasNativeRNModules = !!NativeModules['ExpoRandom'] || !!NativeModules.RNGetRandomValues;
|
||||
const hasNativeCrypto = typeof xglobal.crypto === 'object' && typeof xglobal.crypto.getRandomValues === 'function';
|
||||
export const getRandomValues = (hasNativeRNModules
|
||||
? getRandomValuesRn
|
||||
: hasNativeCrypto
|
||||
? getRandomValuesBrowser
|
||||
: () => {
|
||||
throw new Error('No secure random number generator available. This environment does not support crypto.getRandomValues.');
|
||||
});
|
||||
export const crypto = (getRandomValues === getRandomValuesBrowser
|
||||
? cryptoBrowser
|
||||
: { getRandomValues });
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
@@ -0,0 +1,3 @@
|
||||
import { exposeGlobal } from '@pezkuwi/x-global';
|
||||
import { crypto } from '@pezkuwi/x-randomvalues';
|
||||
exposeGlobal('crypto', crypto);
|
||||
Reference in New Issue
Block a user