Initial rebrand: @polkadot -> @pezkuwi (14 packages)

- Package namespace: @polkadot/* -> @pezkuwi/*
- Repository: polkadot-js/common -> pezkuwichain/pezkuwi-common
- Author: Pezkuwi Team <team@pezkuwichain.io>

Core packages:
- @pezkuwi/util (utilities)
- @pezkuwi/util-crypto (crypto primitives)
- @pezkuwi/keyring (account management)
- @pezkuwi/networks (chain metadata)
- @pezkuwi/hw-ledger (Ledger hardware wallet)
- @pezkuwi/x-* (10 polyfill packages)

Total: 14 packages
Upstream: polkadot-js/common v14.0.1
This commit is contained in:
2026-01-05 14:00:34 +03:00
commit ec06da0ebc
687 changed files with 48096 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
# @pezkuwi/x-randomvalues
A cross-environment `window.crypto.getRandomValues`.
+35
View File
@@ -0,0 +1,35 @@
{
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/pezkuwichain/pezkuwi-common/issues",
"description": "A cross-environment window.crypto.getRandomValues replacement",
"engines": {
"node": ">=18"
},
"homepage": "https://github.com/pezkuwichain/pezkuwi-common/tree/master/packages/x-randomvalues#readme",
"license": "Apache-2.0",
"name": "@pezkuwi/x-randomvalues",
"repository": {
"directory": "packages/x-randomvalues",
"type": "git",
"url": "https://github.com/pezkuwichain/pezkuwi-common.git"
},
"sideEffects": false,
"type": "module",
"version": "14.0.1",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@pezkuwi/x-global": "14.0.1",
"tslib": "^2.8.0"
},
"devDependencies": {
"@pezkuwi/util": "14.0.1",
"@pezkuwi/wasm-util": "^7.5.3",
"@types/react-native": "^0.73.0"
},
"peerDependencies": {
"@pezkuwi/util": "14.0.1",
"@pezkuwi/wasm-util": "*"
}
}
+14
View File
@@ -0,0 +1,14 @@
// Copyright 2017-2025 @polkadot/x-randomvalues authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { xglobal } from '@pezkuwi/x-global';
export { packageInfo } from './packageInfo.js';
export const crypto = xglobal.crypto;
// getRandomValues needs to be called on the crypto object,
// hence the need for the wrapper function
export function getRandomValues <T extends Uint8Array> (arr: T): T {
return crypto.getRandomValues(arr);
}
@@ -0,0 +1,22 @@
// Copyright 2017-2025 @polkadot/x-randomvalues authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { insecureRandomValues } from './fallback.js';
describe('fallback (insecure)', (): void => {
it('subsequent results does not match', (): void => {
expect(
insecureRandomValues(new Uint8Array(32)).toString()
).not.toEqual(
insecureRandomValues(new Uint8Array(32)).toString()
);
});
it('generates with the supplied length', (): void => {
expect(
insecureRandomValues(new Uint8Array(128))
).toHaveLength(128);
});
});
+28
View File
@@ -0,0 +1,28 @@
// Copyright 2017-2025 @polkadot/x-randomvalues authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Adapted from https://github.com/LinusU/react-native-get-random-values/blob/85f48393821c23b83b89a8177f56d3a81dc8b733/index.js
//
// Copyright (c) 2018, 2020 Linus Unnebäck
// SPDX-License-Identifier: MIT
let warned = false;
export function insecureRandomValues <T extends Uint8Array> (arr: T): T {
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;
}
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2025 @polkadot/x-randomvalues authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './browser.js';
+17
View File
@@ -0,0 +1,17 @@
// Copyright 2017-2025 @polkadot/x-randomvalues authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Needs Node 15+ for webcrypto
import nodeCrypto from 'node:crypto';
import { extractGlobal } from '@pezkuwi/x-global';
export { packageInfo } from './packageInfo.js';
export const crypto = /*#__PURE__*/ extractGlobal('crypto', nodeCrypto.webcrypto);
// getRandomValues needs to be called on the crypto object,
// hence the need for the wrapper function
export function getRandomValues <T extends Uint8Array> (output: T): T {
return crypto.getRandomValues(output);
}
@@ -0,0 +1,6 @@
// Copyright 2017-2025 @polkadot/x-randomvalues authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/x-randomvalues', path: 'auto', type: 'auto', version: '14.0.1' };
@@ -0,0 +1,64 @@
// Copyright 2017-2025 @polkadot/x-randomvalues authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Adapted from https://github.com/LinusU/react-native-get-random-values/blob/85f48393821c23b83b89a8177f56d3a81dc8b733/index.js
//
// Copyright (c) 2018, 2020 Linus Unnebäck
// SPDX-License-Identifier: MIT
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';
interface RNExt {
ExpoRandom: {
getRandomBase64String: (length: number) => string;
};
RNGetRandomValues: {
getRandomBase64: (length: number) => string;
}
}
/**
* @internal
*
* A getRandomValues util that detects and uses the available RN
* random utiliy generation functions.
**/
function getRandomValuesRn (output: Uint8Array): Uint8Array {
if (!NativeModules['ExpoRandom'] && !(NativeModules as RNExt).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 as RNExt).RNGetRandomValues
? (NativeModules as RNExt).RNGetRandomValues.getRandomBase64(output.length)
: (NativeModules as RNExt).ExpoRandom.getRandomBase64String(output.length),
output
);
}
// Check for native RN modules first (highest priority)
const hasNativeRNModules = !!NativeModules['ExpoRandom'] || !!(NativeModules as RNExt).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 }
);
+7
View File
@@ -0,0 +1,7 @@
// Copyright 2017-2025 @polkadot/x-randomvalues authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { exposeGlobal } from '@pezkuwi/x-global';
import { crypto } from '@pezkuwi/x-randomvalues';
exposeGlobal('crypto', crypto);
@@ -0,0 +1,15 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/*.spec.ts",
"**/mod.ts"
],
"references": [
{ "path": "../x-global/tsconfig.build.json" }
]
}
@@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src",
"emitDeclarationOnly": false,
"noEmit": true
},
"include": [
"**/*.spec.ts"
],
"references": [
{ "path": "../util/tsconfig.build.json" },
{ "path": "../x-global/tsconfig.build.json" }
]
}