Skip to content

Commit c6efed0

Browse files
committed
disable saving key pairs to storage
1 parent 67df929 commit c6efed0

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/utils/libp2p/libp2p.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
import { noise } from "@chainsafe/libp2p-noise";
22
import { circuitRelayTransport } from "@libp2p/circuit-relay-v2";
33
import { identify } from "@libp2p/identify";
4-
import { keychain } from "@libp2p/keychain";
5-
import { defaultLogger } from "@libp2p/logger";
4+
// import { keychain } from "@libp2p/keychain";
5+
// import { defaultLogger } from "@libp2p/logger";
66
import { mplex } from "@libp2p/mplex";
77
import { webRTC } from "@libp2p/webrtc";
88
import { webSockets } from "@libp2p/websockets";
99
import * as filters from "@libp2p/websockets/filters";
1010
import { multiaddr } from "@multiformats/multiaddr";
11-
import { LevelDatastore } from "datastore-level";
12-
import { Key } from "interface-datastore";
11+
// import { LevelDatastore } from "datastore-level";
12+
// import { Key } from "interface-datastore";
1313
import { createLibp2p } from "libp2p";
1414
import { createHa } from "./ha";
1515

1616
export async function createNode() {
17-
const selfKey = new Key("/pkcs8/self");
18-
const datastore = new LevelDatastore(`libp2p/data`);
19-
const chain = keychain()({
20-
datastore: datastore,
21-
logger: defaultLogger()
22-
});
23-
let peerId;
24-
if (await datastore.has(selfKey)) {
25-
peerId = await chain.exportPeerId("self");
26-
}
17+
// const selfKey = new Key("/pkcs8/self");
18+
// const datastore = new LevelDatastore(`libp2p/data`);
19+
// const chain = keychain()({
20+
// datastore: datastore,
21+
// logger: defaultLogger()
22+
// });
23+
// let peerId;
24+
// if (await datastore.has(selfKey)) {
25+
// peerId = await chain.exportPeerId("self");
26+
// }
2727
const node = await createLibp2p({
28-
peerId: peerId,
28+
// peerId: peerId,
2929
addresses: {
3030
listen: ["/webrtc"]
3131
},
@@ -51,9 +51,9 @@ export async function createNode() {
5151
minConnections: 0
5252
}
5353
});
54-
if (chain != null && !(await datastore.has(selfKey))) {
55-
await chain.importPeer("self", node.peerId);
56-
}
54+
// if (chain != null && !(await datastore.has(selfKey))) {
55+
// await chain.importPeer("self", node.peerId);
56+
// }
5757
return node;
5858
}
5959

0 commit comments

Comments
 (0)