@libp2p/crypto 5.1.19-a34745c01 → 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.
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +4 -4
- package/dist/src/random-bytes.d.ts +2 -0
- package/dist/src/random-bytes.d.ts.map +1 -1
- package/dist/src/random-bytes.js +3 -2
- package/dist/src/random-bytes.js.map +1 -1
- package/dist/typedoc-urls.json +41 -0
- package/package.json +5 -5
- package/src/random-bytes.ts +3 -2
|
@@ -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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"AESCipher": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.ciphers.AES_GCM.AESCipher.html",
|
|
3
|
+
"CreateAESCipherOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.ciphers.AES_GCM.CreateAESCipherOptions.html",
|
|
4
|
+
"create": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.ciphers.AES_GCM.create.html",
|
|
5
|
+
"HMAC": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.hmac.HMAC.html",
|
|
6
|
+
"./hmac:HMAC": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.hmac.HMAC.html",
|
|
7
|
+
"./hmac:create": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.hmac.create.html",
|
|
8
|
+
"pbkdf2": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.index.pbkdf2.html",
|
|
9
|
+
"randomBytes": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.index.randomBytes.html",
|
|
10
|
+
"ECDHKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.keys.ECDHKey.html",
|
|
11
|
+
"ECDHKeyPair": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.keys.ECDHKeyPair.html",
|
|
12
|
+
"EnhancedKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.keys.EnhancedKey.html",
|
|
13
|
+
"EnhancedKeyPair": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.keys.EnhancedKeyPair.html",
|
|
14
|
+
"Curve": "https://libp2p.github.io/js-libp2p/types/_libp2p_crypto.keys.Curve.html",
|
|
15
|
+
"generateEphemeralKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.generateEphemeralKeyPair.html",
|
|
16
|
+
"generateKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.generateKeyPair.html",
|
|
17
|
+
"./keys:generateKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.generateKeyPair.html",
|
|
18
|
+
"generateKeyPairFromSeed": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.generateKeyPairFromSeed.html",
|
|
19
|
+
"./keys:generateKeyPairFromSeed": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.generateKeyPairFromSeed.html",
|
|
20
|
+
"keyStretcher": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.keyStretcher.html",
|
|
21
|
+
"privateKeyFromCryptoKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromCryptoKeyPair.html",
|
|
22
|
+
"./keys:privateKeyFromCryptoKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromCryptoKeyPair.html",
|
|
23
|
+
"privateKeyFromProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromProtobuf.html",
|
|
24
|
+
"./keys:privateKeyFromProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromProtobuf.html",
|
|
25
|
+
"privateKeyFromRaw": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromRaw.html",
|
|
26
|
+
"./keys:privateKeyFromRaw": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromRaw.html",
|
|
27
|
+
"privateKeyToCryptoKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyToCryptoKeyPair.html",
|
|
28
|
+
"./keys:privateKeyToCryptoKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyToCryptoKeyPair.html",
|
|
29
|
+
"privateKeyToProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyToProtobuf.html",
|
|
30
|
+
"./keys:privateKeyToProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyToProtobuf.html",
|
|
31
|
+
"publicKeyFromMultihash": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromMultihash.html",
|
|
32
|
+
"./keys:publicKeyFromMultihash": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromMultihash.html",
|
|
33
|
+
"publicKeyFromProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromProtobuf.html",
|
|
34
|
+
"./keys:publicKeyFromProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromProtobuf.html",
|
|
35
|
+
"publicKeyFromRaw": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromRaw.html",
|
|
36
|
+
"./keys:publicKeyFromRaw": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromRaw.html",
|
|
37
|
+
"publicKeyToProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyToProtobuf.html",
|
|
38
|
+
"./keys:publicKeyToProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyToProtobuf.html",
|
|
39
|
+
"default": "https://libp2p.github.io/js-libp2p/variables/_libp2p_crypto.webcrypto.default.html",
|
|
40
|
+
"./webcrypto:default": "https://libp2p.github.io/js-libp2p/variables/_libp2p_crypto.webcrypto.default.html"
|
|
41
|
+
}
|
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
|
}
|