@libp2p/crypto 5.1.13 → 5.1.14-4580b64fa
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/keys/keys.d.ts +22 -4
- package/dist/src/keys/keys.d.ts.map +1 -1
- package/dist/src/keys/keys.js +71 -9
- package/dist/src/keys/keys.js.map +1 -1
- package/dist/src/pbkdf2.js +1 -1
- package/package.json +4 -4
- package/src/keys/keys.ts +88 -5
- package/src/pbkdf2.ts +1 -1
- package/dist/typedoc-urls.json +0 -40
package/dist/src/keys/keys.d.ts
CHANGED
|
@@ -15,8 +15,17 @@ export interface PublicKey {
|
|
|
15
15
|
}
|
|
16
16
|
export declare namespace PublicKey {
|
|
17
17
|
const codec: () => Codec<PublicKey>;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
interface PublicKeyTypeFieldEvent {
|
|
19
|
+
field: '$.Type';
|
|
20
|
+
value: KeyType;
|
|
21
|
+
}
|
|
22
|
+
interface PublicKeyDataFieldEvent {
|
|
23
|
+
field: '$.Data';
|
|
24
|
+
value: Uint8Array;
|
|
25
|
+
}
|
|
26
|
+
function encode(obj: Partial<PublicKey>): Uint8Array;
|
|
27
|
+
function decode(buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PublicKey>): PublicKey;
|
|
28
|
+
function stream(buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PublicKey>): Generator<PublicKeyTypeFieldEvent | PublicKeyDataFieldEvent>;
|
|
20
29
|
}
|
|
21
30
|
export interface PrivateKey {
|
|
22
31
|
Type?: KeyType;
|
|
@@ -24,7 +33,16 @@ export interface PrivateKey {
|
|
|
24
33
|
}
|
|
25
34
|
export declare namespace PrivateKey {
|
|
26
35
|
const codec: () => Codec<PrivateKey>;
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
interface PrivateKeyTypeFieldEvent {
|
|
37
|
+
field: '$.Type';
|
|
38
|
+
value: KeyType;
|
|
39
|
+
}
|
|
40
|
+
interface PrivateKeyDataFieldEvent {
|
|
41
|
+
field: '$.Data';
|
|
42
|
+
value: Uint8Array;
|
|
43
|
+
}
|
|
44
|
+
function encode(obj: Partial<PrivateKey>): Uint8Array;
|
|
45
|
+
function decode(buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PrivateKey>): PrivateKey;
|
|
46
|
+
function stream(buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PrivateKey>): Generator<PrivateKeyTypeFieldEvent | PrivateKeyDataFieldEvent>;
|
|
29
47
|
}
|
|
30
48
|
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/keys/keys.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,oBAAY,OAAO;IACjB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,KAAK,UAAU;CAChB;AASD,yBAAiB,OAAO,CAAC;IAChB,MAAM,KAAK,QAAO,KAAK,CAAC,OAAO,CAErC,CAAA;CACF;
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/keys/keys.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,oBAAY,OAAO;IACjB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,KAAK,UAAU;CAChB;AASD,yBAAiB,OAAO,CAAC;IAChB,MAAM,KAAK,QAAO,KAAK,CAAC,OAAO,CAErC,CAAA;CACF;AAED,MAAM,WAAW,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CAAC,GAAG,UAAU,CAEtG;IAED,SAAgB,MAAM,CAAE,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,IAAI,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC,wBAAwB,GAAG,wBAAwB,CAAC,CAE1J;CACF"}
|
package/dist/src/keys/keys.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decodeMessage, encodeMessage, enumeration, message } from 'protons-runtime';
|
|
1
|
+
import { decodeMessage, encodeMessage, enumeration, message, streamMessage } from 'protons-runtime';
|
|
2
2
|
export var KeyType;
|
|
3
3
|
(function (KeyType) {
|
|
4
4
|
KeyType["RSA"] = "RSA";
|
|
@@ -59,16 +59,47 @@ export var PublicKey;
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
return obj;
|
|
62
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
63
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
64
|
+
while (reader.pos < end) {
|
|
65
|
+
const tag = reader.uint32();
|
|
66
|
+
switch (tag >>> 3) {
|
|
67
|
+
case 1: {
|
|
68
|
+
yield {
|
|
69
|
+
field: `${prefix}.Type`,
|
|
70
|
+
value: KeyType.codec().decode(reader)
|
|
71
|
+
};
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case 2: {
|
|
75
|
+
yield {
|
|
76
|
+
field: `${prefix}.Data`,
|
|
77
|
+
value: reader.bytes()
|
|
78
|
+
};
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
default: {
|
|
82
|
+
reader.skipType(tag & 7);
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
62
87
|
});
|
|
63
88
|
}
|
|
64
89
|
return _codec;
|
|
65
90
|
};
|
|
66
|
-
|
|
91
|
+
function encode(obj) {
|
|
67
92
|
return encodeMessage(obj, PublicKey.codec());
|
|
68
|
-
}
|
|
69
|
-
PublicKey.
|
|
93
|
+
}
|
|
94
|
+
PublicKey.encode = encode;
|
|
95
|
+
function decode(buf, opts) {
|
|
70
96
|
return decodeMessage(buf, PublicKey.codec(), opts);
|
|
71
|
-
}
|
|
97
|
+
}
|
|
98
|
+
PublicKey.decode = decode;
|
|
99
|
+
function stream(buf, opts) {
|
|
100
|
+
return streamMessage(buf, PublicKey.codec(), opts);
|
|
101
|
+
}
|
|
102
|
+
PublicKey.stream = stream;
|
|
72
103
|
})(PublicKey || (PublicKey = {}));
|
|
73
104
|
export var PrivateKey;
|
|
74
105
|
(function (PrivateKey) {
|
|
@@ -111,15 +142,46 @@ export var PrivateKey;
|
|
|
111
142
|
}
|
|
112
143
|
}
|
|
113
144
|
return obj;
|
|
145
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
146
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
147
|
+
while (reader.pos < end) {
|
|
148
|
+
const tag = reader.uint32();
|
|
149
|
+
switch (tag >>> 3) {
|
|
150
|
+
case 1: {
|
|
151
|
+
yield {
|
|
152
|
+
field: `${prefix}.Type`,
|
|
153
|
+
value: KeyType.codec().decode(reader)
|
|
154
|
+
};
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
case 2: {
|
|
158
|
+
yield {
|
|
159
|
+
field: `${prefix}.Data`,
|
|
160
|
+
value: reader.bytes()
|
|
161
|
+
};
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
default: {
|
|
165
|
+
reader.skipType(tag & 7);
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
114
170
|
});
|
|
115
171
|
}
|
|
116
172
|
return _codec;
|
|
117
173
|
};
|
|
118
|
-
|
|
174
|
+
function encode(obj) {
|
|
119
175
|
return encodeMessage(obj, PrivateKey.codec());
|
|
120
|
-
}
|
|
121
|
-
PrivateKey.
|
|
176
|
+
}
|
|
177
|
+
PrivateKey.encode = encode;
|
|
178
|
+
function decode(buf, opts) {
|
|
122
179
|
return decodeMessage(buf, PrivateKey.codec(), opts);
|
|
123
|
-
}
|
|
180
|
+
}
|
|
181
|
+
PrivateKey.decode = decode;
|
|
182
|
+
function stream(buf, opts) {
|
|
183
|
+
return streamMessage(buf, PrivateKey.codec(), opts);
|
|
184
|
+
}
|
|
185
|
+
PrivateKey.stream = stream;
|
|
124
186
|
})(PrivateKey || (PrivateKey = {}));
|
|
125
187
|
//# sourceMappingURL=keys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../src/keys/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../src/keys/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAInG,MAAM,CAAN,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,8BAAmB,CAAA;IACnB,kCAAuB,CAAA;IACvB,0BAAe,CAAA;AACjB,CAAC,EALW,OAAO,KAAP,OAAO,QAKlB;AAED,IAAK,eAKJ;AALD,WAAK,eAAe;IAClB,mDAAO,CAAA;IACP,2DAAW,CAAA;IACX,+DAAa,CAAA;IACb,uDAAS,CAAA;AACX,CAAC,EALI,eAAe,KAAf,eAAe,QAKnB;AAED,WAAiB,OAAO;IACT,aAAK,GAAG,GAAmB,EAAE;QACxC,OAAO,WAAW,CAAU,eAAe,CAAC,CAAA;IAC9C,CAAC,CAAA;AACH,CAAC,EAJgB,OAAO,KAAP,OAAO,QAIvB;AAOD,MAAM,KAAW,SAAS,CAsGzB;AAtGD,WAAiB,SAAS;IACxB,IAAI,MAAwB,CAAA;IAEf,eAAK,GAAG,GAAqB,EAAE;QAC1C,IAAI,MAAM,I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AAA;AACH,CAAC,EAtGgB,UAAU,KAAV,UAAU,QAsG1B"}
|
package/dist/src/pbkdf2.js
CHANGED
|
@@ -6,7 +6,7 @@ import { base64 } from 'multiformats/bases/base64';
|
|
|
6
6
|
/**
|
|
7
7
|
* Maps an IPFS hash name to its @noble/hashes equivalent.
|
|
8
8
|
*
|
|
9
|
-
* See https://github.com/multiformats/
|
|
9
|
+
* See https://github.com/multiformats/multicodec/blob/master/table.csv
|
|
10
10
|
*
|
|
11
11
|
* @private
|
|
12
12
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/crypto",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.14-4580b64fa",
|
|
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",
|
|
@@ -85,11 +85,11 @@
|
|
|
85
85
|
"generate": "protons ./src/keys/keys.proto"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@libp2p/interface": "
|
|
88
|
+
"@libp2p/interface": "3.1.1-4580b64fa",
|
|
89
89
|
"@noble/curves": "^2.0.1",
|
|
90
90
|
"@noble/hashes": "^2.0.1",
|
|
91
91
|
"multiformats": "^13.4.0",
|
|
92
|
-
"protons-runtime": "^
|
|
92
|
+
"protons-runtime": "^6.0.1",
|
|
93
93
|
"uint8arraylist": "^2.4.8",
|
|
94
94
|
"uint8arrays": "^5.1.0"
|
|
95
95
|
},
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"aegir": "^47.0.22",
|
|
99
99
|
"asn1js": "^3.0.6",
|
|
100
100
|
"benchmark": "^2.1.4",
|
|
101
|
-
"protons": "^
|
|
101
|
+
"protons": "^8.1.1"
|
|
102
102
|
},
|
|
103
103
|
"browser": {
|
|
104
104
|
"./dist/src/ciphers/aes-gcm.js": "./dist/src/ciphers/aes-gcm.browser.js",
|
package/src/keys/keys.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decodeMessage, encodeMessage, enumeration, message } from 'protons-runtime'
|
|
1
|
+
import { decodeMessage, encodeMessage, enumeration, message, streamMessage } from 'protons-runtime'
|
|
2
2
|
import type { Codec, DecodeOptions } from 'protons-runtime'
|
|
3
3
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
4
4
|
|
|
@@ -21,6 +21,7 @@ export namespace KeyType {
|
|
|
21
21
|
return enumeration<KeyType>(__KeyTypeValues)
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
|
|
24
25
|
export interface PublicKey {
|
|
25
26
|
Type?: KeyType
|
|
26
27
|
Data?: Uint8Array
|
|
@@ -74,19 +75,60 @@ export namespace PublicKey {
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
return obj
|
|
78
|
+
}, function * (reader, length, prefix, opts = {}) {
|
|
79
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
80
|
+
|
|
81
|
+
while (reader.pos < end) {
|
|
82
|
+
const tag = reader.uint32()
|
|
83
|
+
|
|
84
|
+
switch (tag >>> 3) {
|
|
85
|
+
case 1: {
|
|
86
|
+
yield {
|
|
87
|
+
field: `${prefix}.Type`,
|
|
88
|
+
value: KeyType.codec().decode(reader)
|
|
89
|
+
}
|
|
90
|
+
break
|
|
91
|
+
}
|
|
92
|
+
case 2: {
|
|
93
|
+
yield {
|
|
94
|
+
field: `${prefix}.Data`,
|
|
95
|
+
value: reader.bytes()
|
|
96
|
+
}
|
|
97
|
+
break
|
|
98
|
+
}
|
|
99
|
+
default: {
|
|
100
|
+
reader.skipType(tag & 7)
|
|
101
|
+
break
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
77
105
|
})
|
|
78
106
|
}
|
|
79
107
|
|
|
80
108
|
return _codec
|
|
81
109
|
}
|
|
82
110
|
|
|
83
|
-
export
|
|
111
|
+
export interface PublicKeyTypeFieldEvent {
|
|
112
|
+
field: '$.Type'
|
|
113
|
+
value: KeyType
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface PublicKeyDataFieldEvent {
|
|
117
|
+
field: '$.Data'
|
|
118
|
+
value: Uint8Array
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function encode (obj: Partial<PublicKey>): Uint8Array {
|
|
84
122
|
return encodeMessage(obj, PublicKey.codec())
|
|
85
123
|
}
|
|
86
124
|
|
|
87
|
-
export
|
|
125
|
+
export function decode (buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PublicKey>): PublicKey {
|
|
88
126
|
return decodeMessage(buf, PublicKey.codec(), opts)
|
|
89
127
|
}
|
|
128
|
+
|
|
129
|
+
export function stream (buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PublicKey>): Generator<PublicKeyTypeFieldEvent | PublicKeyDataFieldEvent> {
|
|
130
|
+
return streamMessage(buf, PublicKey.codec(), opts)
|
|
131
|
+
}
|
|
90
132
|
}
|
|
91
133
|
|
|
92
134
|
export interface PrivateKey {
|
|
@@ -142,17 +184,58 @@ export namespace PrivateKey {
|
|
|
142
184
|
}
|
|
143
185
|
|
|
144
186
|
return obj
|
|
187
|
+
}, function * (reader, length, prefix, opts = {}) {
|
|
188
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
189
|
+
|
|
190
|
+
while (reader.pos < end) {
|
|
191
|
+
const tag = reader.uint32()
|
|
192
|
+
|
|
193
|
+
switch (tag >>> 3) {
|
|
194
|
+
case 1: {
|
|
195
|
+
yield {
|
|
196
|
+
field: `${prefix}.Type`,
|
|
197
|
+
value: KeyType.codec().decode(reader)
|
|
198
|
+
}
|
|
199
|
+
break
|
|
200
|
+
}
|
|
201
|
+
case 2: {
|
|
202
|
+
yield {
|
|
203
|
+
field: `${prefix}.Data`,
|
|
204
|
+
value: reader.bytes()
|
|
205
|
+
}
|
|
206
|
+
break
|
|
207
|
+
}
|
|
208
|
+
default: {
|
|
209
|
+
reader.skipType(tag & 7)
|
|
210
|
+
break
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
145
214
|
})
|
|
146
215
|
}
|
|
147
216
|
|
|
148
217
|
return _codec
|
|
149
218
|
}
|
|
150
219
|
|
|
151
|
-
export
|
|
220
|
+
export interface PrivateKeyTypeFieldEvent {
|
|
221
|
+
field: '$.Type'
|
|
222
|
+
value: KeyType
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface PrivateKeyDataFieldEvent {
|
|
226
|
+
field: '$.Data'
|
|
227
|
+
value: Uint8Array
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export function encode (obj: Partial<PrivateKey>): Uint8Array {
|
|
152
231
|
return encodeMessage(obj, PrivateKey.codec())
|
|
153
232
|
}
|
|
154
233
|
|
|
155
|
-
export
|
|
234
|
+
export function decode (buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PrivateKey>): PrivateKey {
|
|
156
235
|
return decodeMessage(buf, PrivateKey.codec(), opts)
|
|
157
236
|
}
|
|
237
|
+
|
|
238
|
+
export function stream (buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PrivateKey>): Generator<PrivateKeyTypeFieldEvent | PrivateKeyDataFieldEvent> {
|
|
239
|
+
return streamMessage(buf, PrivateKey.codec(), opts)
|
|
240
|
+
}
|
|
158
241
|
}
|
package/src/pbkdf2.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { base64 } from 'multiformats/bases/base64'
|
|
|
7
7
|
/**
|
|
8
8
|
* Maps an IPFS hash name to its @noble/hashes equivalent.
|
|
9
9
|
*
|
|
10
|
-
* See https://github.com/multiformats/
|
|
10
|
+
* See https://github.com/multiformats/multicodec/blob/master/table.csv
|
|
11
11
|
*
|
|
12
12
|
* @private
|
|
13
13
|
*/
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
}
|