Use x-randomvalues (#140)

* Use x-randomvalues

* Install
This commit is contained in:
Jaco Greeff
2020-11-07 13:46:27 +01:00
committed by GitHub
parent 11997092c3
commit 5be84df651
7 changed files with 16 additions and 32 deletions
+3 -1
View File
@@ -14,9 +14,11 @@
"devDependencies": {
"@polkadot/dev": "^0.59.19",
"@polkadot/util": "^4.0.0-5",
"@polkadot/x-randomvalues": "^4.0.0-5",
"override-require": "^1.1.1"
},
"peerDependencies": {
"@polkadot/util": "*"
"@polkadot/util": "*",
"@polkadot/x-randomvalues": "*"
}
}
+2 -1
View File
@@ -1,8 +1,9 @@
// Copyright 2019-2020 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const getRandomValues = require('@polkadot/x-randomvalues').default;
const { getString, getU8a } = require('./bridge');
const getRandomValues = require('./randomvalues');
const DEFAULT_SELF = { crypto: { getRandomValues } };
@@ -1,6 +0,0 @@
// Copyright 2019-2020 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = function getRandomValues (arr) {
return crypto.getRandomValues(arr);
};
@@ -1,12 +0,0 @@
// Copyright 2019-2020 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const crypto = require('crypto');
module.exports = function getRandomValues (arr) {
return crypto.randomBytes(arr.length).reduce((arr, value, index) => {
arr[index] = value;
return arr;
}, arr);
};
@@ -1,6 +0,0 @@
// Copyright 2019-2020 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const getRandomValues = require('./randomvalues-node');
module.exports = getRandomValues;
@@ -1,6 +0,0 @@
// Copyright 2019-2020 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const getRandomValues = require('./randomvalues-node');
module.exports = getRandomValues;
+11
View File
@@ -1846,12 +1846,23 @@ __metadata:
dependencies:
"@polkadot/dev": ^0.59.19
"@polkadot/util": ^4.0.0-5
"@polkadot/x-randomvalues": ^4.0.0-5
override-require: ^1.1.1
peerDependencies:
"@polkadot/util": "*"
"@polkadot/x-randomvalues": "*"
languageName: unknown
linkType: soft
"@polkadot/x-randomvalues@npm:^4.0.0-5":
version: 4.0.0-6
resolution: "@polkadot/x-randomvalues@npm:4.0.0-6"
dependencies:
"@babel/runtime": ^7.12.1
checksum: a19fffec41b330e261354464da21706592b2553dbbde9fe5547f0564051d856a0e1d0664c61c9f00f8a3d308b60a611e2ffa44265c378fe0f1aefaeac2f680aa
languageName: node
linkType: hard
"@polkadot/x-textdecoder@npm:^4.0.0-5":
version: 4.0.0-5
resolution: "@polkadot/x-textdecoder@npm:4.0.0-5"