@libp2p/crypto 1.0.1 → 1.0.2
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.
package/dist/src/random-bytes.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { utils } from '@noble/secp256k1';
|
|
2
2
|
import errcode from 'err-code';
|
|
3
3
|
export default function randomBytes(length) {
|
|
4
4
|
if (isNaN(length) || length <= 0) {
|
|
5
5
|
throw errcode(new Error('random bytes length must be a Number bigger than 0'), 'ERR_INVALID_LENGTH');
|
|
6
6
|
}
|
|
7
|
-
return
|
|
7
|
+
return utils.randomBytes(length);
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=random-bytes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random-bytes.js","sourceRoot":"","sources":["../../src/random-bytes.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"random-bytes.js","sourceRoot":"","sources":["../../src/random-bytes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,OAAO,MAAM,UAAU,CAAA;AAE9B,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,MAAc;IACjD,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE;QAChC,MAAM,OAAO,CAAC,IAAI,KAAK,CAAC,oDAAoD,CAAC,EAAE,oBAAoB,CAAC,CAAA;KACrG;IACD,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;AAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/crypto",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Crypto primitives for libp2p",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p-crypto#readme",
|
|
@@ -182,7 +182,6 @@
|
|
|
182
182
|
"@noble/ed25519": "^1.6.0",
|
|
183
183
|
"@noble/secp256k1": "^1.5.4",
|
|
184
184
|
"err-code": "^3.0.1",
|
|
185
|
-
"iso-random-stream": "^2.0.0",
|
|
186
185
|
"multiformats": "^9.4.5",
|
|
187
186
|
"node-forge": "^1.1.0",
|
|
188
187
|
"protons-runtime": "^2.0.2",
|
package/src/random-bytes.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { utils } from '@noble/secp256k1'
|
|
2
2
|
import errcode from 'err-code'
|
|
3
3
|
|
|
4
4
|
export default function randomBytes (length: number): Uint8Array {
|
|
5
5
|
if (isNaN(length) || length <= 0) {
|
|
6
6
|
throw errcode(new Error('random bytes length must be a Number bigger than 0'), 'ERR_INVALID_LENGTH')
|
|
7
7
|
}
|
|
8
|
-
return
|
|
8
|
+
return utils.randomBytes(length)
|
|
9
9
|
}
|