@constl/utils-tests 1.6.15 → 2.0.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/.aegir.js +2 -2
- package/dist/attente.d.ts +8 -30
- package/dist/attente.js +101 -141
- package/dist/attente.js.map +1 -1
- package/dist/config.d.ts +4 -1
- package/dist/config.js +4 -4
- package/dist/config.js.map +1 -1
- package/dist/constellation.d.ts +14 -10
- package/dist/constellation.js +24 -42
- package/dist/constellation.js.map +1 -1
- package/dist/dossiers.d.ts +1 -1
- package/dist/dossiers.js +19 -5
- package/dist/dossiers.js.map +1 -1
- package/dist/h/303/251lia.d.ts +11 -0
- package/dist/h/303/251lia.js +38 -0
- package/dist/h/303/251lia.js.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/libp2p/config.d.ts +25 -0
- package/dist/{libp2p.js → libp2p/config.js} +47 -56
- package/dist/libp2p/config.js.map +1 -0
- package/dist/libp2p/index.d.ts +3 -0
- package/dist/libp2p/index.js +4 -0
- package/dist/libp2p/index.js.map +1 -0
- package/dist/libp2p/libp2p.d.ts +9 -0
- package/dist/libp2p/libp2p.js +21 -0
- package/dist/libp2p/libp2p.js.map +1 -0
- package/dist/libp2p/utils.d.ts +10 -0
- package/dist/libp2p/utils.js +41 -0
- package/dist/libp2p/utils.js.map +1 -0
- package/dist/orbite.d.ts +7 -21
- package/dist/orbite.js +31 -156
- package/dist/orbite.js.map +1 -1
- package/dist/{scripts/relai.js → relai/bin.js} +12 -17
- package/dist/relai/bin.js.map +1 -0
- package/dist/relai/consts.d.ts +3 -0
- package/dist/relai/consts.js +4 -0
- package/dist/relai/consts.js.map +1 -0
- package/dist/relai/index.d.ts +3 -0
- package/dist/relai/index.js +4 -0
- package/dist/relai/index.js.map +1 -0
- package/dist/relai/relai.d.ts +5 -0
- package/dist/relai/relai.js +29 -0
- package/dist/relai/relai.js.map +1 -0
- package/dist/relai/utils.d.ts +4 -0
- package/dist/relai/utils.js +6 -0
- package/dist/relai/utils.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +5 -0
- package/dist/utils.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +43 -43
- package/renovate.json +10 -4
- package/src/attente.ts +129 -156
- package/src/config.ts +10 -4
- package/src/constellation.ts +38 -58
- package/src/dossiers.ts +18 -6
- package/src/h/303/251lia.ts +61 -0
- package/src/index.ts +24 -8
- package/src/libp2p/config.ts +115 -0
- package/src/libp2p/index.ts +9 -0
- package/src/libp2p/libp2p.ts +41 -0
- package/src/libp2p/utils.ts +59 -0
- package/src/orbite.ts +43 -223
- package/src/{scripts/relai.ts → relai/bin.ts} +11 -17
- package/src/relai/consts.ts +5 -0
- package/src/relai/index.ts +3 -0
- package/src/relai/relai.ts +40 -0
- package/src/relai/utils.ts +14 -0
- package/src/utils.ts +5 -0
- package/src/version.ts +1 -1
- package/dist/libp2p.d.ts +0 -26
- package/dist/libp2p.js.map +0 -1
- package/dist/scripts/relai.js.map +0 -1
- package/dist/sfip.d.ts +0 -13
- package/dist/sfip.js +0 -89
- package/dist/sfip.js.map +0 -1
- package/src/libp2p.ts +0 -112
- package/src/sfip.ts +0 -127
- /package/dist/{scripts/relai.d.ts → relai/bin.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
1
|
+
export { ServiceClefPrivée, OptionsDéfautLibp2pNode, OptionsDéfautLibp2pNavigateur, créerLibp2psTest, toutesConnectées, connecterPairs, } from "./libp2p/index.js";
|
|
2
|
+
export { ID_DÉFAUT_RELAI, PORT_DÉFAUT_RELAI, obtenirAdresseRelai, lancerRelai, obtenirFichierRelai, } from "./relai/index.js";
|
|
3
|
+
export { attendreFichierExiste, attendreFichierModifié } from "./attente.js";
|
|
4
|
+
export { obtConfigEsbuild, générerConfigÆgir } from "./config.js";
|
|
5
|
+
export { créerConstellationsTest } from "./constellation.js";
|
|
6
|
+
export { dossierTempo } from "./dossiers.js";
|
|
7
|
+
export { créerHéliasTest } from "./hélia.js";
|
|
8
|
+
export { créerOrbitesTest } from "./orbite.js";
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EACjB,uBAAuB,EACvB,6BAA6B,EAC7B,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GossipSub } from "@chainsafe/libp2p-gossipsub";
|
|
2
|
+
import { Identify } from "@libp2p/identify";
|
|
3
|
+
import { Libp2pOptions } from "libp2p";
|
|
4
|
+
import { PrivateKey } from "@libp2p/interface";
|
|
5
|
+
export type ServicesLibp2pTest = {
|
|
6
|
+
identify: Identify;
|
|
7
|
+
pubsub: GossipSub;
|
|
8
|
+
obtClefPrivée: ServiceClefPrivée;
|
|
9
|
+
};
|
|
10
|
+
export interface ComposantesServiceClefPrivée {
|
|
11
|
+
privateKey: PrivateKey;
|
|
12
|
+
}
|
|
13
|
+
export declare class ServiceClefPrivée {
|
|
14
|
+
privateKey: PrivateKey;
|
|
15
|
+
constructor(components: ComposantesServiceClefPrivée);
|
|
16
|
+
obtenirClef(): PrivateKey;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Configuration Libp2p pour Node.js.
|
|
20
|
+
*/
|
|
21
|
+
export declare const OptionsDéfautLibp2pNode: () => Libp2pOptions<ServicesLibp2pTest>;
|
|
22
|
+
/**
|
|
23
|
+
* Configuration Libp2p pour les navigateurs.
|
|
24
|
+
*/
|
|
25
|
+
export declare const OptionsDéfautLibp2pNavigateur: () => Libp2pOptions<ServicesLibp2pTest>;
|
|
@@ -23,64 +23,13 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
23
23
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
24
|
SOFTWARE.
|
|
25
25
|
*/
|
|
26
|
-
import {
|
|
27
|
-
import { webSockets } from "@libp2p/websockets";
|
|
28
|
-
import { webRTC } from "@libp2p/webrtc";
|
|
29
|
-
import { all } from "@libp2p/websockets/filters";
|
|
26
|
+
import { gossipsub, } from "@chainsafe/libp2p-gossipsub";
|
|
30
27
|
import { noise } from "@chainsafe/libp2p-noise";
|
|
31
28
|
import { yamux } from "@chainsafe/libp2p-yamux";
|
|
32
|
-
import { gossipsub } from "@chainsafe/libp2p-gossipsub";
|
|
33
29
|
import { circuitRelayTransport } from "@libp2p/circuit-relay-v2";
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export const DefaultLibp2pOptions = {
|
|
38
|
-
addresses: {
|
|
39
|
-
listen: ["/ip4/0.0.0.0/tcp/0/ws", "/p2p-circuit"],
|
|
40
|
-
},
|
|
41
|
-
transports: [
|
|
42
|
-
webSockets({
|
|
43
|
-
filter: all,
|
|
44
|
-
}),
|
|
45
|
-
webRTC(),
|
|
46
|
-
circuitRelayTransport(),
|
|
47
|
-
],
|
|
48
|
-
connectionEncrypters: [noise()],
|
|
49
|
-
streamMuxers: [yamux()],
|
|
50
|
-
connectionGater: {
|
|
51
|
-
denyDialMultiaddr: () => false,
|
|
52
|
-
},
|
|
53
|
-
services: {
|
|
54
|
-
identify: identify(),
|
|
55
|
-
pubsub: gossipsub({ allowPublishToZeroTopicPeers: true }),
|
|
56
|
-
obtClefPrivée: (components) => new ServiceClefPrivée(components),
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* A basic Libp2p configuration for browser nodes.
|
|
61
|
-
*/
|
|
62
|
-
export const DefaultLibp2pBrowserOptions = {
|
|
63
|
-
addresses: {
|
|
64
|
-
listen: ["/webrtc", "/p2p-circuit"],
|
|
65
|
-
},
|
|
66
|
-
transports: [
|
|
67
|
-
webSockets({
|
|
68
|
-
filter: all,
|
|
69
|
-
}),
|
|
70
|
-
webRTC(),
|
|
71
|
-
circuitRelayTransport(),
|
|
72
|
-
],
|
|
73
|
-
connectionEncrypters: [noise()],
|
|
74
|
-
streamMuxers: [yamux()],
|
|
75
|
-
connectionGater: {
|
|
76
|
-
denyDialMultiaddr: () => false,
|
|
77
|
-
},
|
|
78
|
-
services: {
|
|
79
|
-
identify: identify(),
|
|
80
|
-
pubsub: gossipsub({ allowPublishToZeroTopicPeers: true }),
|
|
81
|
-
obtClefPrivée: (components) => new ServiceClefPrivée(components),
|
|
82
|
-
},
|
|
83
|
-
};
|
|
30
|
+
import { identify } from "@libp2p/identify";
|
|
31
|
+
import { webRTC } from "@libp2p/webrtc";
|
|
32
|
+
import { webSockets } from "@libp2p/websockets";
|
|
84
33
|
export class ServiceClefPrivée {
|
|
85
34
|
privateKey;
|
|
86
35
|
constructor(components) {
|
|
@@ -90,4 +39,46 @@ export class ServiceClefPrivée {
|
|
|
90
39
|
return this.privateKey;
|
|
91
40
|
}
|
|
92
41
|
}
|
|
93
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Configuration Libp2p pour Node.js.
|
|
44
|
+
*/
|
|
45
|
+
export const OptionsDéfautLibp2pNode = () => {
|
|
46
|
+
return {
|
|
47
|
+
addresses: {
|
|
48
|
+
listen: ["/ip4/0.0.0.0/tcp/0/ws", "/p2p-circuit"],
|
|
49
|
+
},
|
|
50
|
+
transports: [webSockets(), webRTC(), circuitRelayTransport()],
|
|
51
|
+
connectionEncrypters: [noise()],
|
|
52
|
+
streamMuxers: [yamux()],
|
|
53
|
+
connectionGater: {
|
|
54
|
+
denyDialMultiaddr: () => false,
|
|
55
|
+
},
|
|
56
|
+
services: {
|
|
57
|
+
identify: identify(),
|
|
58
|
+
pubsub: gossipsub({ allowPublishToZeroTopicPeers: true }), // Erreur de type dans @chainsafe/pubsub
|
|
59
|
+
obtClefPrivée: (components) => new ServiceClefPrivée(components),
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Configuration Libp2p pour les navigateurs.
|
|
65
|
+
*/
|
|
66
|
+
export const OptionsDéfautLibp2pNavigateur = () => {
|
|
67
|
+
return {
|
|
68
|
+
addresses: {
|
|
69
|
+
listen: ["/webrtc", "/p2p-circuit"],
|
|
70
|
+
},
|
|
71
|
+
transports: [webSockets(), webRTC(), circuitRelayTransport()],
|
|
72
|
+
connectionEncrypters: [noise()],
|
|
73
|
+
streamMuxers: [yamux()],
|
|
74
|
+
connectionGater: {
|
|
75
|
+
denyDialMultiaddr: () => false,
|
|
76
|
+
},
|
|
77
|
+
services: {
|
|
78
|
+
identify: identify(),
|
|
79
|
+
pubsub: gossipsub({ allowPublishToZeroTopicPeers: true }), // Erreur de type dans @chainsafe/pubsub,
|
|
80
|
+
obtClefPrivée: (components) => new ServiceClefPrivée(components),
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/libp2p/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;EAwBE;AAEF,OAAO,EACL,SAAS,GAGV,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAY,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAgBhD,MAAM,OAAO,iBAAiB;IAC5B,UAAU,CAAa;IAEvB,YAAY,UAAwC;QAClD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;IAC1C,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAClC,GAAG,EAAE;IACH,OAAO;QACL,SAAS,EAAE;YACT,MAAM,EAAE,CAAC,uBAAuB,EAAE,cAAc,CAAC;SAClD;QACD,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,qBAAqB,EAAE,CAAC;QAC7D,oBAAoB,EAAE,CAAC,KAAK,EAAE,CAAC;QAC/B,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC;QACvB,eAAe,EAAE;YACf,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;SAC/B;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,QAAQ,EAAE;YACpB,MAAM,EAAE,SAAS,CAAC,EAAE,4BAA4B,EAAE,IAAI,EAAE,CAE1C,EAAE,wCAAwC;YACxD,aAAa,EAAE,CAAC,UAAwC,EAAE,EAAE,CAC1D,IAAI,iBAAiB,CAAC,UAAU,CAAC;SACpC;KACF,CAAC;AACJ,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GACxC,GAAG,EAAE;IACH,OAAO;QACL,SAAS,EAAE;YACT,MAAM,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC;SACpC;QACD,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,qBAAqB,EAAE,CAAC;QAC7D,oBAAoB,EAAE,CAAC,KAAK,EAAE,CAAC;QAC/B,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC;QACvB,eAAe,EAAE;YACf,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;SAC/B;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,QAAQ,EAAE;YACpB,MAAM,EAAE,SAAS,CAAC,EAAE,4BAA4B,EAAE,IAAI,EAAE,CAE1C,EAAE,yCAAyC;YACzD,aAAa,EAAE,CAAC,UAAwC,EAAE,EAAE,CAC1D,IAAI,iBAAiB,CAAC,UAAU,CAAC;SACpC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/libp2p/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EACjB,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Libp2p } from "@libp2p/interface";
|
|
2
|
+
import { ServicesLibp2pTest } from "./config.js";
|
|
3
|
+
export declare const créerLibp2psTest: ({ n, adresseRelai, }: {
|
|
4
|
+
n: number;
|
|
5
|
+
adresseRelai?: string;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
libp2ps: Libp2p<ServicesLibp2pTest>[];
|
|
8
|
+
fermer: () => Promise<void>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createLibp2p } from "libp2p";
|
|
2
|
+
import { OptionsDéfautLibp2pNavigateur, OptionsDéfautLibp2pNode, } from "./config.js";
|
|
3
|
+
import { isBrowser } from "wherearewe";
|
|
4
|
+
import { connecterPairs } from "./utils.js";
|
|
5
|
+
import { obtenirAdresseRelai } from "../relai/index.js";
|
|
6
|
+
export const créerLibp2psTest = async ({ n, adresseRelai, }) => {
|
|
7
|
+
adresseRelai = adresseRelai ?? obtenirAdresseRelai();
|
|
8
|
+
const libp2ps = [];
|
|
9
|
+
for (const _ of Array(n).keys()) {
|
|
10
|
+
const libp2p = await createLibp2p(isBrowser ? OptionsDéfautLibp2pNavigateur() : OptionsDéfautLibp2pNode());
|
|
11
|
+
for (const l of libp2ps) {
|
|
12
|
+
await connecterPairs(libp2p, l, { adresseRelai });
|
|
13
|
+
}
|
|
14
|
+
libp2ps.push(libp2p);
|
|
15
|
+
}
|
|
16
|
+
const fermer = async () => {
|
|
17
|
+
await Promise.all(libp2ps.map((l) => l.stop()));
|
|
18
|
+
};
|
|
19
|
+
return { libp2ps, fermer };
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=libp2p.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libp2p.js","sourceRoot":"","sources":["../../src/libp2p/libp2p.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,GAExB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,EACrC,CAAC,EACD,YAAY,GAIb,EAGE,EAAE;IACH,YAAY,GAAG,YAAY,IAAI,mBAAmB,EAAE,CAAC;IAErD,MAAM,OAAO,GAAiC,EAAE,CAAC;IACjD,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,MAAM,YAAY,CAC/B,SAAS,CAAC,CAAC,CAAC,6BAA6B,EAAE,CAAC,CAAC,CAAC,uBAAuB,EAAE,CACxE,CAAC;QAEF,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,MAAM,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACxB,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Libp2p } from "@libp2p/interface";
|
|
2
|
+
import { Multiaddr } from "@multiformats/multiaddr";
|
|
3
|
+
import { ServicesLibp2pTest } from "./config.js";
|
|
4
|
+
type OptionsConnectionPairs = {
|
|
5
|
+
adresseRelai: string;
|
|
6
|
+
filtre?: (ma: Multiaddr) => boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const connecterPairs: <T extends Libp2p = Libp2p<ServicesLibp2pTest>>(libp2p1: T, libp2p2: T, options: OptionsConnectionPairs) => Promise<void>;
|
|
9
|
+
export declare const toutesConnectées: (libp2ps: Libp2p<ServicesLibp2pTest>[], options: OptionsConnectionPairs) => Promise<void>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { WebRTC } from "@multiformats/multiaddr-matcher";
|
|
2
|
+
import { multiaddr } from "@multiformats/multiaddr";
|
|
3
|
+
import { isBrowser, isElectronRenderer } from "wherearewe";
|
|
4
|
+
const filtreParDéfaut = () => true;
|
|
5
|
+
export const connecterPairs = async (libp2p1, libp2p2, options) => {
|
|
6
|
+
const filtre = options.filtre ?? filtreParDéfaut;
|
|
7
|
+
if (isBrowser || isElectronRenderer) {
|
|
8
|
+
await libp2p1.dial(multiaddr(options.adresseRelai));
|
|
9
|
+
const adresse1 = await new Promise((resolve) => {
|
|
10
|
+
const testConnecté = () => {
|
|
11
|
+
const adresse = libp2p1
|
|
12
|
+
.getMultiaddrs()
|
|
13
|
+
.filter((ma) => WebRTC.matches(ma) && filtre(ma))
|
|
14
|
+
.pop();
|
|
15
|
+
if (adresse != null) {
|
|
16
|
+
clearInterval(interval);
|
|
17
|
+
resolve(adresse);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const interval = setInterval(testConnecté, 100);
|
|
21
|
+
testConnecté();
|
|
22
|
+
});
|
|
23
|
+
await libp2p2.dial(adresse1);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
await libp2p2.peerStore.save(libp2p1.peerId, {
|
|
27
|
+
multiaddrs: libp2p1.getMultiaddrs().filter(filtre),
|
|
28
|
+
});
|
|
29
|
+
await libp2p2.dial(libp2p1.peerId);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const toutesConnectées = async (libp2ps, options) => {
|
|
33
|
+
const connectées = [];
|
|
34
|
+
for (const lib of libp2ps) {
|
|
35
|
+
for (const autre of connectées) {
|
|
36
|
+
await connecterPairs(lib, autre, options);
|
|
37
|
+
}
|
|
38
|
+
connectées.push(lib);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/libp2p/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,SAAS,EAAa,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG3D,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;AAMnC,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAGjC,OAAU,EACV,OAAU,EACV,OAA+B,EAC/B,EAAE;IACF,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,eAAe,CAAC;IAEjD,IAAI,SAAS,IAAI,kBAAkB,EAAE,CAAC;QACpC,MAAM,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;QAEpD,MAAM,QAAQ,GAAG,MAAM,IAAI,OAAO,CAAY,CAAC,OAAO,EAAE,EAAE;YACxD,MAAM,YAAY,GAAG,GAAG,EAAE;gBACxB,MAAM,OAAO,GAAG,OAAO;qBACpB,aAAa,EAAE;qBACf,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC;qBAChD,GAAG,EAAE,CAAC;gBACT,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;oBACpB,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACxB,OAAO,CAAC,OAAO,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC,CAAC;YACF,MAAM,QAAQ,GAAG,WAAW,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;YAChD,YAAY,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YAC3C,UAAU,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;SACnD,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,OAAqC,EACrC,OAA+B,EAC/B,EAAE;IACF,MAAM,UAAU,GAAiC,EAAE,CAAC;IACpD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;YAC/B,MAAM,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC5C,CAAC;QACD,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAC"}
|
package/dist/orbite.d.ts
CHANGED
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import type { ServiceMap } from "@libp2p/interface";
|
|
5
|
-
export declare const créerOrbiteTest: ({ n, }: {
|
|
1
|
+
import { OrbitDB } from "@orbitdb/core";
|
|
2
|
+
import { ServicesLibp2pTest } from "./libp2p/index.js";
|
|
3
|
+
export declare const créerOrbitesTest: ({ n, dossier, adresseRelai, }: {
|
|
6
4
|
n: number;
|
|
5
|
+
dossier?: string;
|
|
6
|
+
adresseRelai?: string;
|
|
7
7
|
}) => Promise<{
|
|
8
|
-
orbites: OrbitDB<
|
|
9
|
-
|
|
8
|
+
orbites: OrbitDB<ServicesLibp2pTest>[];
|
|
9
|
+
fermer: () => Promise<void>;
|
|
10
10
|
}>;
|
|
11
|
-
export declare const attendreSync: (bd: Awaited<ReturnType<typeof Database>>) => Promise<void>;
|
|
12
|
-
export type ContrôleurConstellation = {
|
|
13
|
-
type: string;
|
|
14
|
-
address: string;
|
|
15
|
-
adresseBdAccès: string;
|
|
16
|
-
write: string;
|
|
17
|
-
estAutorisé: (id: string) => Promise<boolean>;
|
|
18
|
-
grant: (rôle: "MODÉRATEUR" | "MEMBRE", id: string) => Promise<void>;
|
|
19
|
-
revoke: (_rôle: "MODÉRATEUR" | "MEMBRE", _id: string) => Promise<void>;
|
|
20
|
-
bd: Awaited<ReturnType<typeof Database>>;
|
|
21
|
-
};
|
|
22
|
-
export declare const peutÉcrire: <T extends ServiceMap = ServiceMap>(bd: TypedKeyValue<{
|
|
23
|
-
[clef: string]: number;
|
|
24
|
-
}> | TypedFeed<string> | TypedSet<string>, attendre?: OrbitDB<T>) => Promise<boolean>;
|
package/dist/orbite.js
CHANGED
|
@@ -1,162 +1,37 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Certaines parties de ce fichier proviennent d'OrbitDB et de @orbitdb/quickstart
|
|
3
|
-
|
|
4
|
-
MIT License
|
|
5
|
-
|
|
6
|
-
Copyright (c) 2019 Haja Networks Oy
|
|
7
|
-
Copyright (c) 2024 OrbitDB Community
|
|
8
|
-
|
|
9
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
-
in the Software without restriction, including without limitation the rights
|
|
12
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
-
furnished to do so, subject to the following conditions:
|
|
15
|
-
|
|
16
|
-
The above copyright notice and this permission notice shall be included in all
|
|
17
|
-
copies or substantial portions of the Software.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
-
SOFTWARE.
|
|
26
|
-
*/
|
|
27
|
-
import { once } from "events";
|
|
28
|
-
import { dossierTempo } from "./dossiers.js";
|
|
29
|
-
import { connecterPairs } from "./sfip.js";
|
|
30
|
-
import { isNode, isElectronMain } from "wherearewe";
|
|
31
|
-
import { createHelia } from "helia";
|
|
32
|
-
import { createLibp2p } from "libp2p";
|
|
33
1
|
import { createOrbitDB } from "@orbitdb/core";
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const ipfs = await createHelia({
|
|
46
|
-
libp2p,
|
|
47
|
-
blockstore,
|
|
48
|
-
blockBrokers: [bitswap()],
|
|
49
|
-
});
|
|
50
|
-
const orbitdb = await createOrbitDB({
|
|
51
|
-
ipfs,
|
|
52
|
-
id,
|
|
53
|
-
identity,
|
|
54
|
-
identities,
|
|
55
|
-
directory,
|
|
56
|
-
});
|
|
57
|
-
return orbitdb;
|
|
58
|
-
};
|
|
59
|
-
const stopOrbitDB = async (orbitdb) => {
|
|
60
|
-
await orbitdb.stop();
|
|
61
|
-
await orbitdb.ipfs.stop();
|
|
62
|
-
// @ts-expect-error Je ne sais pas pourquoi
|
|
63
|
-
await orbitdb.ipfs.blockstore.unwrap().unwrap().child.db.close();
|
|
64
|
-
};
|
|
65
|
-
export const créerOrbiteTest = async ({ n = 1, }) => {
|
|
66
|
-
const sfips = [];
|
|
2
|
+
import { dossierTempo } from "./dossiers.js";
|
|
3
|
+
import { créerHéliasTest } from "./hélia.js";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
import { sousDossier } from "./utils.js";
|
|
6
|
+
import { obtenirAdresseRelai } from "./relai/utils.js";
|
|
7
|
+
export const créerOrbitesTest = async ({ n, dossier, adresseRelai, }) => {
|
|
8
|
+
adresseRelai = adresseRelai ?? obtenirAdresseRelai();
|
|
9
|
+
let effacerDossier = () => { };
|
|
10
|
+
if (!dossier) {
|
|
11
|
+
({ dossier, effacer: effacerDossier } = await dossierTempo());
|
|
12
|
+
}
|
|
67
13
|
const orbites = [];
|
|
68
|
-
const {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
fEffacerRacineDossierOrbite();
|
|
86
|
-
}
|
|
87
|
-
catch (e) {
|
|
88
|
-
// Sur Windows, parfois les fichiers de Hélia sont encore en utilisation
|
|
89
|
-
if ((isNode || isElectronMain) && process.platform === "win32") {
|
|
90
|
-
console.log("On ignore ça sur Windows\n", e);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
throw e;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
14
|
+
const { hélias, fermer: fermerHélias } = await créerHéliasTest({
|
|
15
|
+
n,
|
|
16
|
+
dossier,
|
|
17
|
+
adresseRelai,
|
|
18
|
+
});
|
|
19
|
+
let i = 0;
|
|
20
|
+
for (const hélia of hélias) {
|
|
21
|
+
orbites.push(await createOrbitDB({
|
|
22
|
+
ipfs: hélia,
|
|
23
|
+
directory: join(sousDossier({ dossier, i }), "orbite"),
|
|
24
|
+
}));
|
|
25
|
+
i++;
|
|
26
|
+
}
|
|
27
|
+
const fermer = async () => {
|
|
28
|
+
await Promise.all(orbites.map((o) => o.stop()));
|
|
29
|
+
await fermerHélias();
|
|
30
|
+
effacerDossier();
|
|
97
31
|
};
|
|
98
|
-
return {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
await once(bd.events, "update");
|
|
102
|
-
};
|
|
103
|
-
const attendreInvité = (accès, idInvité) => new Promise((résoudre) => {
|
|
104
|
-
const testAutorisé = async () => {
|
|
105
|
-
const autorisé = await accès.estAutorisé(idInvité);
|
|
106
|
-
if (autorisé) {
|
|
107
|
-
résoudre();
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
setTimeout(testAutorisé, 100);
|
|
111
|
-
}
|
|
32
|
+
return {
|
|
33
|
+
orbites,
|
|
34
|
+
fermer,
|
|
112
35
|
};
|
|
113
|
-
testAutorisé();
|
|
114
|
-
});
|
|
115
|
-
export const peutÉcrire = async (bd, attendre) => {
|
|
116
|
-
if (attendre) {
|
|
117
|
-
await attendreInvité(bd.access, attendre.identity.id);
|
|
118
|
-
}
|
|
119
|
-
try {
|
|
120
|
-
if (bd.type === "keyvalue") {
|
|
121
|
-
const bdKV = bd;
|
|
122
|
-
// Important d'avoir une clef unique pour éviter l'interférence entre les tests
|
|
123
|
-
const CLEF = "test" + Math.random().toString();
|
|
124
|
-
const VAL = 123;
|
|
125
|
-
await bdKV.set(CLEF, VAL);
|
|
126
|
-
const val = await bdKV.get(CLEF);
|
|
127
|
-
await bdKV.del(CLEF);
|
|
128
|
-
return val === VAL;
|
|
129
|
-
}
|
|
130
|
-
else if (bd.type === "feed") {
|
|
131
|
-
const VAL = "test";
|
|
132
|
-
await bd.add(VAL);
|
|
133
|
-
const éléments = await bd.all();
|
|
134
|
-
const autorisé = éléments.length === 1 && éléments[0].value === VAL;
|
|
135
|
-
if (éléments.length === 1) {
|
|
136
|
-
await bd.remove(éléments[0].hash);
|
|
137
|
-
}
|
|
138
|
-
return autorisé;
|
|
139
|
-
}
|
|
140
|
-
else if (bd.type === "set") {
|
|
141
|
-
const VAL = "test";
|
|
142
|
-
await bd.add(VAL);
|
|
143
|
-
const éléments = await bd.all();
|
|
144
|
-
const autorisé = éléments.length === 1 && éléments[0].value === VAL;
|
|
145
|
-
if (éléments.length === 1) {
|
|
146
|
-
await bd.del(éléments[0].hash);
|
|
147
|
-
}
|
|
148
|
-
return autorisé;
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
// @ts-expect-error bd.type n'a plus d'options
|
|
152
|
-
throw new Error(`Type de BD ${bd.type} non supporté par ce test.`);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
catch (e) {
|
|
156
|
-
if (e.toString().includes("is not allowed to write to the log")) {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
throw e;
|
|
160
|
-
}
|
|
161
36
|
};
|
|
162
37
|
//# sourceMappingURL=orbite.js.map
|
package/dist/orbite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orbite.js","sourceRoot":"","sources":["../src/orbite.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"orbite.js","sourceRoot":"","sources":["../src/orbite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,aAAa,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,EACrC,CAAC,EACD,OAAO,EACP,YAAY,GAKb,EAGE,EAAE;IACH,YAAY,GAAG,YAAY,IAAI,mBAAmB,EAAE,CAAC;IAErD,IAAI,cAAc,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,YAAY,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,OAAO,GAAkC,EAAE,CAAC;IAClD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,eAAe,CAAC;QAC7D,CAAC;QACD,OAAO;QACP,YAAY;KACb,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,IAAI,CACV,MAAM,aAAa,CAAC;YAClB,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC;SACvD,CAAC,CACH,CAAC;QACF,CAAC,EAAE,CAAC;IACN,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACxB,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAChD,MAAM,YAAY,EAAE,CAAC;QACrB,cAAc,EAAE,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO;QACL,OAAO;QACP,MAAM;KACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -28,27 +28,23 @@ import { createLibp2p } from "libp2p";
|
|
|
28
28
|
import { noise } from "@chainsafe/libp2p-noise";
|
|
29
29
|
import { circuitRelayServer } from "@libp2p/circuit-relay-v2";
|
|
30
30
|
import { webSockets } from "@libp2p/websockets";
|
|
31
|
-
import * as filters from "@libp2p/websockets/filters";
|
|
32
31
|
import { identify } from "@libp2p/identify";
|
|
33
32
|
import { keys } from "@libp2p/crypto";
|
|
34
33
|
import { fromString as uint8ArrayFromString } from "uint8arrays/from-string";
|
|
35
34
|
import { FaultTolerance } from "@libp2p/interface";
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
const privateKey = keys.privateKeyFromProtobuf(encoded);
|
|
35
|
+
import { CLEF_PRIVÉE_RELAI, PORT_DÉFAUT_RELAI } from "./consts.js";
|
|
36
|
+
// produit par: console.log(server.peerId.privateKey.toString('hex'))
|
|
37
|
+
const privateKeyString = process.env.CLEF_PRIVÉE_RELAI || CLEF_PRIVÉE_RELAI;
|
|
38
|
+
const chiffrée = uint8ArrayFromString(privateKeyString, "hex");
|
|
39
|
+
const clefPrivée = keys.privateKeyFromProtobuf(chiffrée);
|
|
42
40
|
const relai = await createLibp2p({
|
|
43
|
-
privateKey,
|
|
41
|
+
privateKey: clefPrivée,
|
|
44
42
|
addresses: {
|
|
45
|
-
listen: [
|
|
43
|
+
listen: [
|
|
44
|
+
`/ip4/0.0.0.0/tcp/${process.env.PORT_DÉFAUT_RELAI || PORT_DÉFAUT_RELAI}/ws`,
|
|
45
|
+
],
|
|
46
46
|
},
|
|
47
|
-
transports: [
|
|
48
|
-
webSockets({
|
|
49
|
-
filter: filters.all,
|
|
50
|
-
}),
|
|
51
|
-
],
|
|
47
|
+
transports: [webSockets()],
|
|
52
48
|
transportManager: {
|
|
53
49
|
faultTolerance: FaultTolerance.NO_FATAL,
|
|
54
50
|
},
|
|
@@ -59,7 +55,6 @@ const relai = await createLibp2p({
|
|
|
59
55
|
relay: circuitRelayServer({
|
|
60
56
|
reservations: {
|
|
61
57
|
maxReservations: 5000,
|
|
62
|
-
reservationTtl: 1000,
|
|
63
58
|
defaultDataLimit: BigInt(1024 * 1024 * 1024),
|
|
64
59
|
},
|
|
65
60
|
}),
|
|
@@ -77,5 +72,5 @@ relai.addEventListener("peer:disconnect", async (event) => {
|
|
|
77
72
|
});
|
|
78
73
|
console.log(relai.peerId.toString());
|
|
79
74
|
console.log("p2p addr: ", relai.getMultiaddrs().map((ma) => ma.toString()));
|
|
80
|
-
//
|
|
81
|
-
//# sourceMappingURL=
|
|
75
|
+
// génère une adresse prédéterminée : /ip4/127.0.0.1/tcp/54321/ws/p2p/12D3KooWAJjbRkp8FPF5MKgMU53aUTxWkqvDrs4zc1VMbwRwfsbE
|
|
76
|
+
//# sourceMappingURL=bin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/relai/bin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;EAwBE;AAEF,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEnE,qEAAqE;AACrE,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,iBAAiB,CAAC;AAE5E,MAAM,QAAQ,GAAG,oBAAoB,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;AAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;AAEzD,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC;IAC/B,UAAU,EAAE,UAAU;IACtB,SAAS,EAAE;QACT,MAAM,EAAE;YACN,oBAAoB,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,iBAAiB,KAAK;SAC5E;KACF;IACD,UAAU,EAAE,CAAC,UAAU,EAAE,CAAC;IAC1B,gBAAgB,EAAE;QAChB,cAAc,EAAE,cAAc,CAAC,QAAQ;KACxC;IACD,oBAAoB,EAAE,CAAC,KAAK,EAAE,CAAC;IAC/B,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC;IACvB,QAAQ,EAAE;QACR,QAAQ,EAAE,QAAQ,EAAE;QACpB,KAAK,EAAE,kBAAkB,CAAC;YACxB,YAAY,EAAE;gBACZ,eAAe,EAAE,IAAI;gBACrB,gBAAgB,EAAE,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;aAC7C;SACF,CAAC;KACH;CACF,CAAC,CAAC;AAEH,KAAK,CAAC,gBAAgB,CAAC,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IACrD,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC;AAEH,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IACvD,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC,CAAC,CAAC;AAEH,KAAK,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IACxD,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;AACrC,OAAO,CAAC,GAAG,CACT,YAAY,EACZ,KAAK,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CACjD,CAAC;AACF,0HAA0H"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const PORT_DÉFAUT_RELAI = 54321;
|
|
2
|
+
export declare const CLEF_PRIVÉE_RELAI = "08011240821cb6bc3d4547fcccb513e82e4d718089f8a166b23ffcd4a436754b6b0774cf07447d1693cd10ce11ef950d7517bad6e9472b41a927cd17fc3fb23f8c70cd99";
|
|
3
|
+
export declare const ID_DÉFAUT_RELAI = "12D3KooWAJjbRkp8FPF5MKgMU53aUTxWkqvDrs4zc1VMbwRwfsbE";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export const PORT_DÉFAUT_RELAI = 54321;
|
|
2
|
+
export const CLEF_PRIVÉE_RELAI = "08011240821cb6bc3d4547fcccb513e82e4d718089f8a166b23ffcd4a436754b6b0774cf07447d1693cd10ce11ef950d7517bad6e9472b41a927cd17fc3fb23f8c70cd99";
|
|
3
|
+
export const ID_DÉFAUT_RELAI = "12D3KooWAJjbRkp8FPF5MKgMU53aUTxWkqvDrs4zc1VMbwRwfsbE";
|
|
4
|
+
//# sourceMappingURL=consts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../src/relai/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAC5B,0IAA0I,CAAC;AAC7I,MAAM,CAAC,MAAM,eAAe,GAC1B,sDAAsD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/relai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|