@libp2p/interface 1.2.0-fd1f8343d → 1.3.0
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/keys/index.d.ts +5 -5
- package/dist/src/keys/index.d.ts.map +1 -1
- package/dist/src/peer-id/index.d.ts +15 -16
- package/dist/src/peer-id/index.d.ts.map +1 -1
- package/dist/src/peer-id/index.js.map +1 -1
- package/dist/typedoc-urls.json +161 -0
- package/package.json +1 -1
- package/src/keys/index.ts +5 -5
- package/src/peer-id/index.ts +16 -17
package/dist/src/keys/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { Uint8ArrayList } from 'uint8arraylist';
|
|
2
|
-
export interface PublicKey {
|
|
2
|
+
export interface PublicKey<Type extends KeyType = 'Ed25519'> {
|
|
3
3
|
readonly bytes: Uint8Array;
|
|
4
4
|
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>;
|
|
5
5
|
marshal(): Uint8Array;
|
|
6
|
-
equals(key: PublicKey): boolean;
|
|
6
|
+
equals(key: PublicKey<Type>): boolean;
|
|
7
7
|
hash(): Uint8Array | Promise<Uint8Array>;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Generic private key interface
|
|
11
11
|
*/
|
|
12
|
-
export interface PrivateKey {
|
|
13
|
-
readonly public: PublicKey
|
|
12
|
+
export interface PrivateKey<Type extends KeyType = 'Ed25519'> {
|
|
13
|
+
readonly public: PublicKey<Type>;
|
|
14
14
|
readonly bytes: Uint8Array;
|
|
15
15
|
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>;
|
|
16
16
|
marshal(): Uint8Array;
|
|
17
|
-
equals(key: PrivateKey): boolean;
|
|
17
|
+
equals(key: PrivateKey<Type>): boolean;
|
|
18
18
|
hash(): Uint8Array | Promise<Uint8Array>;
|
|
19
19
|
/**
|
|
20
20
|
* Gets the ID of the key.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,WAAW,SAAS;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,WAAW,SAAS,CAAC,IAAI,SAAS,OAAO,GAAG,SAAS;IACzD,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtF,OAAO,IAAI,UAAU,CAAA;IACrB,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;IACrC,IAAI,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,IAAI,SAAS,OAAO,GAAG,SAAS;IAC1D,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;IAChC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IACzE,OAAO,IAAI,UAAU,CAAA;IACrB,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;IACtC,IAAI,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IACxC;;;;;;OAMG;IACH,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IACrB;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACtE;AAED,eAAO,MAAM,OAAO,YAAY,CAAA;AAChC,eAAO,MAAM,GAAG,QAAQ,CAAA;AACxB,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,GAAG,OAAO,GAAG,GAAG,OAAO,SAAS,CAAA"}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
+
import type { KeyType } from '../keys/index.js';
|
|
1
2
|
import type { CID } from 'multiformats/cid';
|
|
2
3
|
import type { MultihashDigest } from 'multiformats/hashes/interface';
|
|
3
|
-
export type PeerIdType =
|
|
4
|
-
interface
|
|
5
|
-
readonly type: PeerIdType;
|
|
6
|
-
readonly multihash: MultihashDigest;
|
|
7
|
-
readonly privateKey?: Uint8Array;
|
|
8
|
-
readonly publicKey?: Uint8Array;
|
|
9
|
-
toString(): string;
|
|
10
|
-
toCID(): CID;
|
|
11
|
-
toBytes(): Uint8Array;
|
|
12
|
-
equals(other?: PeerId | Uint8Array | string): boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface RSAPeerId extends BasePeerId {
|
|
4
|
+
export type PeerIdType = KeyType | string;
|
|
5
|
+
export interface RSAPeerId extends PeerId {
|
|
15
6
|
readonly type: 'RSA';
|
|
16
7
|
readonly publicKey?: Uint8Array;
|
|
17
8
|
}
|
|
18
|
-
export interface Ed25519PeerId extends
|
|
9
|
+
export interface Ed25519PeerId extends PeerId {
|
|
19
10
|
readonly type: 'Ed25519';
|
|
20
11
|
readonly publicKey: Uint8Array;
|
|
21
12
|
}
|
|
22
|
-
export interface Secp256k1PeerId extends
|
|
13
|
+
export interface Secp256k1PeerId extends PeerId {
|
|
23
14
|
readonly type: 'secp256k1';
|
|
24
15
|
readonly publicKey: Uint8Array;
|
|
25
16
|
}
|
|
26
|
-
export
|
|
17
|
+
export interface PeerId {
|
|
18
|
+
type: PeerIdType;
|
|
19
|
+
multihash: MultihashDigest;
|
|
20
|
+
privateKey?: Uint8Array;
|
|
21
|
+
publicKey?: Uint8Array;
|
|
22
|
+
toString(): string;
|
|
23
|
+
toCID(): CID;
|
|
24
|
+
toBytes(): Uint8Array;
|
|
25
|
+
equals(other?: PeerId | Uint8Array | string): boolean;
|
|
26
|
+
}
|
|
27
27
|
export declare const peerIdSymbol: unique symbol;
|
|
28
28
|
export declare function isPeerId(other: any): other is PeerId;
|
|
29
|
-
export {};
|
|
30
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-id/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,MAAM,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-id/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,CAAA;AAEzC,MAAM,WAAW,SAAU,SAAQ,MAAM;IACvC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,CAAA;CAChC;AAED,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAA;CAC/B;AAED,MAAM,WAAW,eAAgB,SAAQ,MAAM;IAC7C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAA;CAC/B;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,eAAe,CAAA;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,SAAS,CAAC,EAAE,UAAU,CAAA;IAEtB,QAAQ,IAAI,MAAM,CAAA;IAClB,KAAK,IAAI,GAAG,CAAA;IACZ,OAAO,IAAI,UAAU,CAAA;IACrB,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAA;CACtD;AAED,eAAO,MAAM,YAAY,eAAgC,CAAA;AAEzD,wBAAgB,QAAQ,CAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAErD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/peer-id/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/peer-id/index.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;AAEzD,MAAM,UAAU,QAAQ,CAAE,KAAU;IAClC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;AACtD,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
{
|
|
2
|
+
"KeyTypes": "https://libp2p.github.io/js-libp2p/types/_libp2p_crypto.keys.KeyTypes.html",
|
|
3
|
+
"FaultTolerance": "https://libp2p.github.io/js-libp2p/enums/_libp2p_interface.FaultTolerance.html",
|
|
4
|
+
"TopicValidatorResult": "https://libp2p.github.io/js-libp2p/enums/_libp2p_interface.TopicValidatorResult.html",
|
|
5
|
+
"AbortError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.AbortError.html",
|
|
6
|
+
"AggregateCodeError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.AggregateCodeError.html",
|
|
7
|
+
"CodeError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.CodeError.html",
|
|
8
|
+
"InvalidCryptoExchangeError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidCryptoExchangeError.html",
|
|
9
|
+
"InvalidCryptoTransmissionError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidCryptoTransmissionError.html",
|
|
10
|
+
"TypedEventEmitter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.TypedEventEmitter.html",
|
|
11
|
+
"UnexpectedPeerError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.UnexpectedPeerError.html",
|
|
12
|
+
"AbortOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AbortOptions.html",
|
|
13
|
+
".:AbortOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AbortOptions.html",
|
|
14
|
+
"Address": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Address.html",
|
|
15
|
+
"AddressSorter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AddressSorter.html",
|
|
16
|
+
".:AddressSorter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AddressSorter.html",
|
|
17
|
+
"CalculatedMetricOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.CalculatedMetricOptions.html",
|
|
18
|
+
"ComponentLogger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ComponentLogger.html",
|
|
19
|
+
".:ComponentLogger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ComponentLogger.html",
|
|
20
|
+
"Connection": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Connection.html",
|
|
21
|
+
"ConnectionEncrypter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionEncrypter.html",
|
|
22
|
+
"ConnectionGater": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionGater.html",
|
|
23
|
+
"ConnectionHandler": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionHandler.html",
|
|
24
|
+
"ConnectionProtector": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionProtector.html",
|
|
25
|
+
"ConnectionTimeline": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionTimeline.html",
|
|
26
|
+
"ContentRouting": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ContentRouting.html",
|
|
27
|
+
"ContentRoutingProvider": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ContentRoutingProvider.html",
|
|
28
|
+
"Counter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Counter.html",
|
|
29
|
+
"CounterGroup": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.CounterGroup.html",
|
|
30
|
+
"CreateListenerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.CreateListenerOptions.html",
|
|
31
|
+
"DialOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.DialOptions.html",
|
|
32
|
+
"Ed25519PeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Ed25519PeerId.html",
|
|
33
|
+
"Envelope": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Envelope.html",
|
|
34
|
+
"EventCallback": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.EventCallback.html",
|
|
35
|
+
"EventObject": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.EventObject.html",
|
|
36
|
+
"IdentifyResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IdentifyResult.html",
|
|
37
|
+
".:IdentifyResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IdentifyResult.html",
|
|
38
|
+
"IncomingStreamData": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IncomingStreamData.html",
|
|
39
|
+
"IsDialableOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IsDialableOptions.html",
|
|
40
|
+
".:IsDialableOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IsDialableOptions.html",
|
|
41
|
+
"Libp2p": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Libp2p.html",
|
|
42
|
+
".:Libp2p": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2p.html",
|
|
43
|
+
"Libp2pEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Libp2pEvents.html",
|
|
44
|
+
".:Libp2pEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Libp2pEvents.html",
|
|
45
|
+
"Listener": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Listener.html",
|
|
46
|
+
"ListenerEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ListenerEvents.html",
|
|
47
|
+
"Logger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Logger.html",
|
|
48
|
+
".:Logger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Logger.html",
|
|
49
|
+
"LoggerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.LoggerOptions.html",
|
|
50
|
+
".:LoggerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.LoggerOptions.html",
|
|
51
|
+
"Metric": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Metric.html",
|
|
52
|
+
"MetricGroup": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MetricGroup.html",
|
|
53
|
+
"MetricOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MetricOptions.html",
|
|
54
|
+
"Metrics": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Metrics.html",
|
|
55
|
+
"MultiaddrConnection": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MultiaddrConnection.html",
|
|
56
|
+
"MultiaddrConnectionTimeline": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MultiaddrConnectionTimeline.html",
|
|
57
|
+
"MultiaddrFilter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MultiaddrFilter.html",
|
|
58
|
+
"NewStreamOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.NewStreamOptions.html",
|
|
59
|
+
"NodeInfo": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.NodeInfo.html",
|
|
60
|
+
".:NodeInfo": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.NodeInfo.html",
|
|
61
|
+
"Peer": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Peer.html",
|
|
62
|
+
"PeerData": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerData.html",
|
|
63
|
+
"PeerDiscovery": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerDiscovery.html",
|
|
64
|
+
"PeerDiscoveryEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerDiscoveryEvents.html",
|
|
65
|
+
"PeerDiscoveryProvider": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerDiscoveryProvider.html",
|
|
66
|
+
"PeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerId.html",
|
|
67
|
+
"PeerInfo": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerInfo.html",
|
|
68
|
+
"PeerQuery": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerQuery.html",
|
|
69
|
+
"PeerQueryFilter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerQueryFilter.html",
|
|
70
|
+
"PeerQueryOrder": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerQueryOrder.html",
|
|
71
|
+
"PeerRouting": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerRouting.html",
|
|
72
|
+
"PeerRoutingProvider": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerRoutingProvider.html",
|
|
73
|
+
"PeerStore": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerStore.html",
|
|
74
|
+
"PeerStreamEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerStreamEvents.html",
|
|
75
|
+
"PeerStreams": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerStreams.html",
|
|
76
|
+
"PeerUpdate": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerUpdate.html",
|
|
77
|
+
".:PeerUpdate": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerUpdate.html",
|
|
78
|
+
"PendingDial": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PendingDial.html",
|
|
79
|
+
".:PendingDial": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PendingDial.html",
|
|
80
|
+
"PrivateKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PrivateKey.html",
|
|
81
|
+
"PubSub": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSub.html",
|
|
82
|
+
"PubSubEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubEvents.html",
|
|
83
|
+
"PubSubInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubInit.html",
|
|
84
|
+
"PubSubRPC": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubRPC.html",
|
|
85
|
+
"PubSubRPCMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubRPCMessage.html",
|
|
86
|
+
"PubSubRPCSubscription": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubRPCSubscription.html",
|
|
87
|
+
"PublicKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PublicKey.html",
|
|
88
|
+
"PublishResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PublishResult.html",
|
|
89
|
+
"RSAPeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.RSAPeerId.html",
|
|
90
|
+
"Record": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Record.html",
|
|
91
|
+
"RoutingOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.RoutingOptions.html",
|
|
92
|
+
".:RoutingOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.RoutingOptions.html",
|
|
93
|
+
"Secp256k1PeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Secp256k1PeerId.html",
|
|
94
|
+
"SecuredConnection": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SecuredConnection.html",
|
|
95
|
+
"SignedMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SignedMessage.html",
|
|
96
|
+
"SignedPeerRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SignedPeerRecord.html",
|
|
97
|
+
".:SignedPeerRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SignedPeerRecord.html",
|
|
98
|
+
"Startable": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Startable.html",
|
|
99
|
+
"StopTimer": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StopTimer.html",
|
|
100
|
+
"Stream": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Stream.html",
|
|
101
|
+
"StreamHandler": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamHandler.html",
|
|
102
|
+
"StreamHandlerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamHandlerOptions.html",
|
|
103
|
+
"StreamHandlerRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamHandlerRecord.html",
|
|
104
|
+
"StreamMuxer": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamMuxer.html",
|
|
105
|
+
"StreamMuxerFactory": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamMuxerFactory.html",
|
|
106
|
+
"StreamMuxerInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamMuxerInit.html",
|
|
107
|
+
"StreamTimeline": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamTimeline.html",
|
|
108
|
+
"SubscriptionChangeData": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SubscriptionChangeData.html",
|
|
109
|
+
"Tag": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Tag.html",
|
|
110
|
+
"TagOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TagOptions.html",
|
|
111
|
+
"TopicValidatorFn": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TopicValidatorFn.html",
|
|
112
|
+
"Topology": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Topology.html",
|
|
113
|
+
"Transport": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Transport.html",
|
|
114
|
+
"TypedEventTarget": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TypedEventTarget.html",
|
|
115
|
+
"UnsignedMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.UnsignedMessage.html",
|
|
116
|
+
"Upgrader": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Upgrader.html",
|
|
117
|
+
"UpgraderOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.UpgraderOptions.html",
|
|
118
|
+
"CalculateMetric": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.CalculateMetric.html",
|
|
119
|
+
"ConnectionStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ConnectionStatus.html",
|
|
120
|
+
"Direction": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Direction.html",
|
|
121
|
+
"EventHandler": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.EventHandler.html",
|
|
122
|
+
"KeyType": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.KeyType.html",
|
|
123
|
+
"Libp2pStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Libp2pStatus.html",
|
|
124
|
+
".:Libp2pStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Libp2pStatus.html",
|
|
125
|
+
"Message": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Message.html",
|
|
126
|
+
"PeerIdType": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PeerIdType.html",
|
|
127
|
+
"PendingDialStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PendingDialStatus.html",
|
|
128
|
+
".:PendingDialStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PendingDialStatus.html",
|
|
129
|
+
"ReadStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ReadStatus.html",
|
|
130
|
+
"RecursivePartial": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.RecursivePartial.html",
|
|
131
|
+
".:RecursivePartial": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.RecursivePartial.html",
|
|
132
|
+
"ServiceMap": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ServiceMap.html",
|
|
133
|
+
".:ServiceMap": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ServiceMap.html",
|
|
134
|
+
"SignaturePolicy": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.SignaturePolicy.html",
|
|
135
|
+
"StreamStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.StreamStatus.html",
|
|
136
|
+
"WriteStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.WriteStatus.html",
|
|
137
|
+
"CustomEvent": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.CustomEvent.html",
|
|
138
|
+
"ERR_INVALID_MESSAGE": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.ERR_INVALID_MESSAGE.html",
|
|
139
|
+
"ERR_INVALID_PARAMETERS": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.ERR_INVALID_PARAMETERS.html",
|
|
140
|
+
"ERR_NOT_FOUND": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.ERR_NOT_FOUND.html",
|
|
141
|
+
"ERR_TIMEOUT": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.ERR_TIMEOUT.html",
|
|
142
|
+
"Ed25519": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.Ed25519.html",
|
|
143
|
+
"KEEP_ALIVE": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.KEEP_ALIVE.html",
|
|
144
|
+
"RSA": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.RSA.html",
|
|
145
|
+
"StrictNoSign": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.StrictNoSign.html",
|
|
146
|
+
"StrictSign": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.StrictSign.html",
|
|
147
|
+
"connectionSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.connectionSymbol.html",
|
|
148
|
+
"contentRoutingSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.contentRoutingSymbol.html",
|
|
149
|
+
"peerDiscoverySymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.peerDiscoverySymbol.html",
|
|
150
|
+
"peerIdSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.peerIdSymbol.html",
|
|
151
|
+
"peerRoutingSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.peerRoutingSymbol.html",
|
|
152
|
+
"secp256k1": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.secp256k1.html",
|
|
153
|
+
"transportSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.transportSymbol.html",
|
|
154
|
+
"isConnection": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isConnection.html",
|
|
155
|
+
"isPeerId": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isPeerId.html",
|
|
156
|
+
"isStartable": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isStartable.html",
|
|
157
|
+
"isTransport": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isTransport.html",
|
|
158
|
+
"setMaxListeners": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.setMaxListeners.html",
|
|
159
|
+
"start": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.start.html",
|
|
160
|
+
"stop": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.stop.html"
|
|
161
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/interface",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "The interface implemented by a libp2p node",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/interface#readme",
|
package/src/keys/index.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
2
2
|
|
|
3
|
-
export interface PublicKey {
|
|
3
|
+
export interface PublicKey<Type extends KeyType = 'Ed25519'> {
|
|
4
4
|
readonly bytes: Uint8Array
|
|
5
5
|
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>
|
|
6
6
|
marshal(): Uint8Array
|
|
7
|
-
equals(key: PublicKey): boolean
|
|
7
|
+
equals(key: PublicKey<Type>): boolean
|
|
8
8
|
hash(): Uint8Array | Promise<Uint8Array>
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Generic private key interface
|
|
13
13
|
*/
|
|
14
|
-
export interface PrivateKey {
|
|
15
|
-
readonly public: PublicKey
|
|
14
|
+
export interface PrivateKey<Type extends KeyType = 'Ed25519'> {
|
|
15
|
+
readonly public: PublicKey<Type>
|
|
16
16
|
readonly bytes: Uint8Array
|
|
17
17
|
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>
|
|
18
18
|
marshal(): Uint8Array
|
|
19
|
-
equals(key: PrivateKey): boolean
|
|
19
|
+
equals(key: PrivateKey<Type>): boolean
|
|
20
20
|
hash(): Uint8Array | Promise<Uint8Array>
|
|
21
21
|
/**
|
|
22
22
|
* Gets the ID of the key.
|
package/src/peer-id/index.ts
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
|
+
import type { KeyType } from '../keys/index.js'
|
|
1
2
|
import type { CID } from 'multiformats/cid'
|
|
2
3
|
import type { MultihashDigest } from 'multiformats/hashes/interface'
|
|
3
4
|
|
|
4
|
-
export type PeerIdType =
|
|
5
|
+
export type PeerIdType = KeyType | string
|
|
5
6
|
|
|
6
|
-
interface
|
|
7
|
-
readonly type: PeerIdType
|
|
8
|
-
readonly multihash: MultihashDigest
|
|
9
|
-
readonly privateKey?: Uint8Array
|
|
10
|
-
readonly publicKey?: Uint8Array
|
|
11
|
-
|
|
12
|
-
toString(): string
|
|
13
|
-
toCID(): CID
|
|
14
|
-
toBytes(): Uint8Array
|
|
15
|
-
equals(other?: PeerId | Uint8Array | string): boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface RSAPeerId extends BasePeerId {
|
|
7
|
+
export interface RSAPeerId extends PeerId {
|
|
19
8
|
readonly type: 'RSA'
|
|
20
9
|
readonly publicKey?: Uint8Array
|
|
21
10
|
}
|
|
22
11
|
|
|
23
|
-
export interface Ed25519PeerId extends
|
|
12
|
+
export interface Ed25519PeerId extends PeerId {
|
|
24
13
|
readonly type: 'Ed25519'
|
|
25
14
|
readonly publicKey: Uint8Array
|
|
26
15
|
}
|
|
27
16
|
|
|
28
|
-
export interface Secp256k1PeerId extends
|
|
17
|
+
export interface Secp256k1PeerId extends PeerId {
|
|
29
18
|
readonly type: 'secp256k1'
|
|
30
19
|
readonly publicKey: Uint8Array
|
|
31
20
|
}
|
|
32
21
|
|
|
33
|
-
export
|
|
22
|
+
export interface PeerId {
|
|
23
|
+
type: PeerIdType
|
|
24
|
+
multihash: MultihashDigest
|
|
25
|
+
privateKey?: Uint8Array
|
|
26
|
+
publicKey?: Uint8Array
|
|
27
|
+
|
|
28
|
+
toString(): string
|
|
29
|
+
toCID(): CID
|
|
30
|
+
toBytes(): Uint8Array
|
|
31
|
+
equals(other?: PeerId | Uint8Array | string): boolean
|
|
32
|
+
}
|
|
34
33
|
|
|
35
34
|
export const peerIdSymbol = Symbol.for('@libp2p/peer-id')
|
|
36
35
|
|