@libp2p/tls 1.0.13 → 1.1.0-15eb66428
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/tls.d.ts +3 -0
- package/dist/src/tls.d.ts.map +1 -1
- package/dist/src/tls.js +5 -1
- package/dist/src/tls.js.map +1 -1
- package/package.json +7 -7
- package/src/tls.ts +7 -1
- package/dist/typedoc-urls.json +0 -10
package/dist/src/tls.d.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* })
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
+
import { serviceCapabilities } from '@libp2p/interface';
|
|
20
21
|
import type { TLSComponents, TLSInit } from './index.js';
|
|
21
22
|
import type { MultiaddrConnection, ConnectionEncrypter, SecuredConnection, PeerId } from '@libp2p/interface';
|
|
22
23
|
import type { Duplex } from 'it-stream-types';
|
|
@@ -26,6 +27,8 @@ export declare class TLS implements ConnectionEncrypter {
|
|
|
26
27
|
private readonly log;
|
|
27
28
|
private readonly timeout;
|
|
28
29
|
constructor(components: TLSComponents, init?: TLSInit);
|
|
30
|
+
readonly [Symbol.toStringTag] = "@libp2p/tls";
|
|
31
|
+
readonly [serviceCapabilities]: string[];
|
|
29
32
|
secureInbound<Stream extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> = MultiaddrConnection>(localId: PeerId, conn: Stream, remoteId?: PeerId): Promise<SecuredConnection<Stream>>;
|
|
30
33
|
secureOutbound<Stream extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> = MultiaddrConnection>(localId: PeerId, conn: Stream, remoteId?: PeerId): Promise<SecuredConnection<Stream>>;
|
|
31
34
|
/**
|
package/dist/src/tls.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tls.d.ts","sourceRoot":"","sources":["../../src/tls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,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,QAAQ,CAAE,MAAM,SAAS,MAAM,CAAC,cAAc,CAAC,UAAU,GAAG,cAAc,CAAC,CAAC,GAAG,mBAAmB,EAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;CAgEpN"}
|
package/dist/src/tls.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
import { TLSSocket, connect } from 'node:tls';
|
|
21
|
-
import { CodeError } from '@libp2p/interface';
|
|
21
|
+
import { CodeError, serviceCapabilities } from '@libp2p/interface';
|
|
22
22
|
import { generateCertificate, verifyPeerCertificate, itToStream, streamToIt } from './utils.js';
|
|
23
23
|
import { PROTOCOL } from './index.js';
|
|
24
24
|
export class TLS {
|
|
@@ -29,6 +29,10 @@ export class TLS {
|
|
|
29
29
|
this.log = components.logger.forComponent('libp2p:tls');
|
|
30
30
|
this.timeout = init.timeout ?? 1000;
|
|
31
31
|
}
|
|
32
|
+
[Symbol.toStringTag] = '@libp2p/tls';
|
|
33
|
+
[serviceCapabilities] = [
|
|
34
|
+
'@libp2p/connection-encryption'
|
|
35
|
+
];
|
|
32
36
|
async secureInbound(localId, conn, remoteId) {
|
|
33
37
|
return this._encrypt(localId, conn, true, remoteId);
|
|
34
38
|
}
|
package/dist/src/tls.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tls.js","sourceRoot":"","sources":["../../src/tls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAyB,OAAO,EAAE,MAAM,UAAU,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"tls.js","sourceRoot":"","sources":["../../src/tls.ts"],"names":[],"mappings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,CAAC,GAAG,EAAE;oBACZ,YAAY,CAAC,YAAY,CAAC,CAAA;gBAC5B,CAAC,CAAC,CAAA;YACN,CAAC,CAAA;YAED,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE;gBACvB,MAAM,CAAC,GAAG,CAAC,CAAA;gBACX,YAAY,CAAC,YAAY,CAAC,CAAA;YAC5B,CAAC,CAAC,CAAA;YACF,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;gBAC5B,IAAI,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;gBACxC,YAAY,EAAE,CAAA;YAChB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/tls",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0-15eb66428",
|
|
4
4
|
"description": "A connection encrypter that uses TLS 1.3",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/connection-encrypter-tls#readme",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"doc-check": "aegir doc-check"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@libp2p/crypto": "
|
|
52
|
-
"@libp2p/interface": "
|
|
53
|
-
"@libp2p/peer-id": "
|
|
51
|
+
"@libp2p/crypto": "4.1.4-15eb66428",
|
|
52
|
+
"@libp2p/interface": "1.5.0-15eb66428",
|
|
53
|
+
"@libp2p/peer-id": "4.1.4-15eb66428",
|
|
54
54
|
"@peculiar/asn1-schema": "^2.3.8",
|
|
55
55
|
"@peculiar/asn1-x509": "^2.3.8",
|
|
56
56
|
"@peculiar/webcrypto": "^1.4.6",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"uint8arrays": "^5.1.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@libp2p/interface-compliance-tests": "
|
|
67
|
-
"@libp2p/logger": "
|
|
68
|
-
"@libp2p/peer-id-factory": "
|
|
66
|
+
"@libp2p/interface-compliance-tests": "5.4.7-15eb66428",
|
|
67
|
+
"@libp2p/logger": "4.0.15-15eb66428",
|
|
68
|
+
"@libp2p/peer-id-factory": "4.1.4-15eb66428",
|
|
69
69
|
"@multiformats/multiaddr": "^12.2.3",
|
|
70
70
|
"aegir": "^43.0.1",
|
|
71
71
|
"protons": "^7.5.0",
|
package/src/tls.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import { TLSSocket, type TLSSocketOptions, connect } from 'node:tls'
|
|
22
|
-
import { CodeError } from '@libp2p/interface'
|
|
22
|
+
import { CodeError, serviceCapabilities } from '@libp2p/interface'
|
|
23
23
|
import { generateCertificate, verifyPeerCertificate, itToStream, streamToIt } from './utils.js'
|
|
24
24
|
import { PROTOCOL } from './index.js'
|
|
25
25
|
import type { TLSComponents, TLSInit } from './index.js'
|
|
@@ -37,6 +37,12 @@ export class TLS implements ConnectionEncrypter {
|
|
|
37
37
|
this.timeout = init.timeout ?? 1000
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
readonly [Symbol.toStringTag] = '@libp2p/tls'
|
|
41
|
+
|
|
42
|
+
readonly [serviceCapabilities]: string[] = [
|
|
43
|
+
'@libp2p/connection-encryption'
|
|
44
|
+
]
|
|
45
|
+
|
|
40
46
|
async secureInbound <Stream extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> = MultiaddrConnection> (localId: PeerId, conn: Stream, remoteId?: PeerId): Promise<SecuredConnection<Stream>> {
|
|
41
47
|
return this._encrypt(localId, conn, true, remoteId)
|
|
42
48
|
}
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"TLSComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_tls.TLSComponents.html",
|
|
3
|
-
".:TLSComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_tls.TLSComponents.html",
|
|
4
|
-
"TLSInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_tls.TLSInit.html",
|
|
5
|
-
".:TLSInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_tls.TLSInit.html",
|
|
6
|
-
"PROTOCOL": "https://libp2p.github.io/js-libp2p/variables/_libp2p_tls.PROTOCOL.html",
|
|
7
|
-
".:PROTOCOL": "https://libp2p.github.io/js-libp2p/variables/_libp2p_tls.PROTOCOL.html",
|
|
8
|
-
"tls": "https://libp2p.github.io/js-libp2p/functions/_libp2p_tls.tls.html",
|
|
9
|
-
".:tls": "https://libp2p.github.io/js-libp2p/functions/_libp2p_tls.tls.html"
|
|
10
|
-
}
|