@libp2p/crypto 5.1.19 → 5.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random-bytes.d.ts","sourceRoot":"","sources":["../../src/random-bytes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"random-bytes.d.ts","sourceRoot":"","sources":["../../src/random-bytes.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAK/D"}
|
package/dist/src/random-bytes.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { InvalidParametersError } from '@libp2p/interface';
|
|
2
|
-
import { randomBytes as randB } from '@noble/hashes/utils.js';
|
|
3
2
|
/**
|
|
4
3
|
* Generates a Uint8Array with length `number` populated by random bytes
|
|
4
|
+
*
|
|
5
|
+
* @deprecated use `crypto.getRandomValues()` instead
|
|
5
6
|
*/
|
|
6
7
|
export default function randomBytes(length) {
|
|
7
8
|
if (isNaN(length) || length <= 0) {
|
|
8
9
|
throw new InvalidParametersError('random bytes length must be a Number bigger than 0');
|
|
9
10
|
}
|
|
10
|
-
return
|
|
11
|
+
return crypto.getRandomValues(new Uint8Array(length));
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=random-bytes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random-bytes.js","sourceRoot":"","sources":["../../src/random-bytes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"random-bytes.js","sourceRoot":"","sources":["../../src/random-bytes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE1D;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,MAAc;IACjD,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,sBAAsB,CAAC,oDAAoD,CAAC,CAAA;IACxF,CAAC;IACD,OAAO,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;AACvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/crypto",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.20",
|
|
4
4
|
"description": "Crypto primitives for libp2p",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/crypto#readme",
|
|
@@ -90,12 +90,12 @@
|
|
|
90
90
|
"generate": "protons ./src/keys/keys.proto"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@libp2p/interface": "^3.2.
|
|
93
|
+
"@libp2p/interface": "^3.2.4",
|
|
94
94
|
"@noble/curves": "^2.0.1",
|
|
95
95
|
"@noble/hashes": "^2.0.1",
|
|
96
96
|
"multiformats": "^14.0.0",
|
|
97
|
-
"protons-runtime": "^
|
|
98
|
-
"uint8arraylist": "^
|
|
97
|
+
"protons-runtime": "^7.0.0",
|
|
98
|
+
"uint8arraylist": "^3.0.2",
|
|
99
99
|
"uint8arrays": "^6.1.1"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"aegir": "^48.0.11",
|
|
104
104
|
"asn1js": "^3.0.6",
|
|
105
105
|
"benchmark": "^2.1.4",
|
|
106
|
-
"protons": "^
|
|
106
|
+
"protons": "^9.0.1"
|
|
107
107
|
},
|
|
108
108
|
"browser": {
|
|
109
109
|
"./dist/src/ciphers/aes-gcm.js": "./dist/src/ciphers/aes-gcm.browser.js",
|
package/src/random-bytes.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { InvalidParametersError } from '@libp2p/interface'
|
|
2
|
-
import { randomBytes as randB } from '@noble/hashes/utils.js'
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Generates a Uint8Array with length `number` populated by random bytes
|
|
5
|
+
*
|
|
6
|
+
* @deprecated use `crypto.getRandomValues()` instead
|
|
6
7
|
*/
|
|
7
8
|
export default function randomBytes (length: number): Uint8Array {
|
|
8
9
|
if (isNaN(length) || length <= 0) {
|
|
9
10
|
throw new InvalidParametersError('random bytes length must be a Number bigger than 0')
|
|
10
11
|
}
|
|
11
|
-
return
|
|
12
|
+
return crypto.getRandomValues(new Uint8Array(length))
|
|
12
13
|
}
|