@leofcoin/peernet 1.1.56 → 1.1.58
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/.esdoc.json +10 -10
- package/.eslintrc.json +24 -24
- package/.gitattributes +2 -2
- package/.travis.yml +27 -27
- package/BREAKING_CHANGES.md +34 -34
- package/LICENSE +21 -21
- package/README.md +72 -72
- package/deploy.js +8 -8
- package/exports/browser/browser-store.js +4 -3
- package/exports/browser/identity.d.ts +18 -0
- package/exports/browser/{index-9c85cd32.js → index-8868bdd8.js} +1 -1
- package/exports/browser/messages/chat.d.ts +1 -1
- package/exports/browser/messages/data-response.d.ts +1 -1
- package/exports/browser/messages/dht-response.d.ts +1 -1
- package/exports/browser/messages/dht.d.ts +1 -1
- package/exports/browser/messages/peer-response.d.ts +1 -1
- package/exports/browser/messages/peer.d.ts +1 -1
- package/exports/browser/messages/peernet.d.ts +1 -1
- package/exports/browser/messages/ps.d.ts +1 -1
- package/exports/browser/messages/request.d.ts +1 -1
- package/exports/browser/messages/response.d.ts +1 -1
- package/exports/browser/{messages-b66f5393.js → messages-eb6e5c71.js} +174 -174
- package/exports/browser/{peernet-2797014a.js → peernet-87ea02a4.js} +1402 -1334
- package/exports/browser/peernet.d.ts +43 -23
- package/exports/browser/peernet.js +1 -1
- package/exports/{messages-dc960cb3.js → messages-b9a32987.js} +173 -173
- package/exports/peernet.js +305 -251
- package/exports/src/prompts/password.js +3 -3
- package/exports/store.js +15 -14
- package/exports/types/identity.d.ts +18 -0
- package/exports/types/messages/chat.d.ts +1 -1
- package/exports/types/messages/data-response.d.ts +1 -1
- package/exports/types/messages/dht-response.d.ts +1 -1
- package/exports/types/messages/dht.d.ts +1 -1
- package/exports/types/messages/peer-response.d.ts +1 -1
- package/exports/types/messages/peer.d.ts +1 -1
- package/exports/types/messages/peernet.d.ts +1 -1
- package/exports/types/messages/ps.d.ts +1 -1
- package/exports/types/messages/request.d.ts +1 -1
- package/exports/types/messages/response.d.ts +1 -1
- package/exports/types/peernet.d.ts +43 -23
- package/index.html +19 -19
- package/package.json +70 -69
- package/rollup.config.js +76 -69
- package/src/dht/dht.ts +141 -141
- package/src/discovery/peer-discovery.js +75 -75
- package/src/errors/errors.js +12 -12
- package/src/handlers/data.js +11 -11
- package/src/handlers/message.js +34 -34
- package/src/identity.ts +101 -94
- package/src/messages/chat.js +14 -14
- package/src/messages/data-response.js +14 -14
- package/src/messages/data.js +18 -18
- package/src/messages/dht-response.js +14 -14
- package/src/messages/dht.js +22 -22
- package/src/messages/file-link.js +18 -18
- package/src/messages/file.js +18 -18
- package/src/messages/peer-response.js +14 -14
- package/src/messages/peer.js +13 -13
- package/src/messages/peernet.js +14 -14
- package/src/messages/ps.js +13 -13
- package/src/messages/request.js +14 -14
- package/src/messages/response.js +14 -14
- package/src/messages.js +13 -13
- package/src/peer-info.js +9 -9
- package/src/peernet.ts +848 -753
- package/src/prompts/password/node.js +5 -5
- package/src/proto/chat-message.proto.js +6 -6
- package/src/proto/data-response.proto.js +4 -4
- package/src/proto/data.proto.js +4 -4
- package/src/proto/dht-response.proto.js +4 -4
- package/src/proto/dht.proto.js +4 -4
- package/src/proto/file-link.proto.js +5 -5
- package/src/proto/file.proto.js +5 -5
- package/src/proto/peer-response.proto.js +3 -3
- package/src/proto/peer.proto.js +3 -3
- package/src/proto/peernet.proto.js +7 -7
- package/src/proto/ps.proto.js +4 -4
- package/src/proto/request.proto.js +4 -4
- package/src/proto/response.proto.js +3 -3
- package/src/types.ts +27 -27
- package/src/utils/utils.js +78 -78
- package/test/client.js +14 -14
- package/test/codec.js +56 -56
- package/test/hash.js +13 -13
- package/test/index.js +3 -3
- package/test/lastBlock.js +7 -7
- package/test/messages.js +26 -26
- package/test/peernet.js +17 -17
- package/test.js +64 -64
- package/test2.js +9 -9
- package/test3.js +15 -15
- package/test4.js +7 -7
- package/tsconfig.json +12 -12
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
|
|
3
|
-
var node = async () => {
|
|
4
|
-
const answers = await inquirer.prompt({type: 'password', name: 'password', message: 'Enter password'});
|
|
5
|
-
return answers.password
|
|
3
|
+
var node = async () => {
|
|
4
|
+
const answers = await inquirer.prompt({type: 'password', name: 'password', message: 'Enter password'});
|
|
5
|
+
return answers.password
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export { node as default };
|
package/exports/store.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { join } from 'path';
|
|
2
2
|
import { homedir } from 'os';
|
|
3
|
-
import {
|
|
4
|
-
import { mkdirp } from 'mkdirp';
|
|
3
|
+
import { readdir, mkdir } from 'fs/promises';
|
|
5
4
|
import { ClassicLevel } from 'classic-level';
|
|
6
5
|
|
|
7
6
|
const encode = (string) => {
|
|
@@ -76,16 +75,18 @@ class KeyValue {
|
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
const init = (root, home = true) => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
const init = async (root, home = true) => {
|
|
79
|
+
let _root = root;
|
|
80
|
+
if (home)
|
|
81
|
+
_root = join(homedir(), root);
|
|
82
|
+
if (readdir)
|
|
83
|
+
try {
|
|
84
|
+
await readdir(_root);
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
await mkdir(_root, { recursive: true });
|
|
88
|
+
}
|
|
89
|
+
return _root;
|
|
89
90
|
};
|
|
90
91
|
|
|
91
92
|
class Store {
|
|
@@ -93,9 +94,9 @@ class Store {
|
|
|
93
94
|
name;
|
|
94
95
|
root;
|
|
95
96
|
version;
|
|
96
|
-
|
|
97
|
+
async init(name, root, version) {
|
|
97
98
|
this.name = name;
|
|
98
|
-
this.root = init(root);
|
|
99
|
+
this.root = await init(root);
|
|
99
100
|
this.version = version;
|
|
100
101
|
this.db = new ClassicLevel(join(this.root, this.name), { valueEncoding: 'view' });
|
|
101
102
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default class Identity {
|
|
2
|
+
#private;
|
|
3
|
+
network: any;
|
|
4
|
+
id: string;
|
|
5
|
+
selectedAccount: string;
|
|
6
|
+
constructor(network: string);
|
|
7
|
+
get accounts(): Promise<[[name: string, externalAddress: string, internalAddress: string]]>;
|
|
8
|
+
getAccounts(): Promise<[[name: string, externalAddress: string, internalAddress: string]]>;
|
|
9
|
+
load(password?: string): Promise<void>;
|
|
10
|
+
selectAccount(account: string): Promise<void> | Promise<IDBValidKey> | Promise<any[]>;
|
|
11
|
+
sign(hash: Uint8Array): any;
|
|
12
|
+
lock(password: string): void;
|
|
13
|
+
unlock(password: string): void;
|
|
14
|
+
export(password: string): Promise<any>;
|
|
15
|
+
import(password: any, encrypted: base58String): Promise<void>;
|
|
16
|
+
exportQR(password: string): Promise<string>;
|
|
17
|
+
importQR(image: File | Blob, password: string): Promise<void>;
|
|
18
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const ChatMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/
|
|
1
|
+
declare const ChatMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/exports/codec-format-interface.js").default;
|
|
2
2
|
export default class ChatMessage extends ChatMessage_base {
|
|
3
3
|
constructor(buffer: any);
|
|
4
4
|
get messageName(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const DataMessageResponse_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/
|
|
1
|
+
declare const DataMessageResponse_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/exports/codec-format-interface.js").default;
|
|
2
2
|
export default class DataMessageResponse extends DataMessageResponse_base {
|
|
3
3
|
constructor(data: any);
|
|
4
4
|
get messageName(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const DHTMessageResponse_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/
|
|
1
|
+
declare const DHTMessageResponse_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/exports/codec-format-interface.js").default;
|
|
2
2
|
export default class DHTMessageResponse extends DHTMessageResponse_base {
|
|
3
3
|
constructor(data: any);
|
|
4
4
|
get messageName(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const DHTMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/
|
|
1
|
+
declare const DHTMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/exports/codec-format-interface.js").default;
|
|
2
2
|
/**
|
|
3
3
|
* @example `
|
|
4
4
|
new DHTMessage(hash, store)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const PeerMessageResponse_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/
|
|
1
|
+
declare const PeerMessageResponse_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/exports/codec-format-interface.js").default;
|
|
2
2
|
export default class PeerMessageResponse extends PeerMessageResponse_base {
|
|
3
3
|
constructor(data: any);
|
|
4
4
|
get messageName(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const PeerMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/
|
|
1
|
+
declare const PeerMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/exports/codec-format-interface.js").default;
|
|
2
2
|
export default class PeerMessage extends PeerMessage_base {
|
|
3
3
|
constructor(data: any);
|
|
4
4
|
get messageName(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const PeernetMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/
|
|
1
|
+
declare const PeernetMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/exports/codec-format-interface.js").default;
|
|
2
2
|
export default class PeernetMessage extends PeernetMessage_base {
|
|
3
3
|
constructor(buffer: any);
|
|
4
4
|
get messageName(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const PsMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/
|
|
1
|
+
declare const PsMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/exports/codec-format-interface.js").default;
|
|
2
2
|
export default class PsMessage extends PsMessage_base {
|
|
3
3
|
constructor(buffer: any);
|
|
4
4
|
get messageName(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const RequestMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/
|
|
1
|
+
declare const RequestMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/exports/codec-format-interface.js").default;
|
|
2
2
|
export default class RequestMessage extends RequestMessage_base {
|
|
3
3
|
constructor(data: any);
|
|
4
4
|
get messageName(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const ResponseMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/
|
|
1
|
+
declare const ResponseMessage_base: typeof import("../../node_modules/@leofcoin/codec-format-interface/exports/codec-format-interface.js").default;
|
|
2
2
|
export default class ResponseMessage extends ResponseMessage_base {
|
|
3
3
|
constructor(data: any);
|
|
4
4
|
get messageName(): string;
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
2
|
+
import "@vandeurenglenn/debug";
|
|
3
|
+
import PubSub from "@vandeurenglenn/little-pubsub";
|
|
4
|
+
import PeerDiscovery from "./discovery/peer-discovery.js";
|
|
5
|
+
import DHT from "./dht/dht.js";
|
|
6
|
+
import MessageHandler from "./handlers/message.js";
|
|
7
|
+
import LeofcoinStorageClass from "@leofcoin/storage";
|
|
8
|
+
import Identity from "./identity.js";
|
|
9
|
+
import swarm from "@netpeer/p2pt-swarm";
|
|
10
|
+
import P2PTPeer from "@netpeer/p2pt-swarm/peer";
|
|
11
|
+
declare global {
|
|
12
|
+
var LeofcoinStorage: typeof LeofcoinStorageClass;
|
|
13
|
+
var peernet: Peernet;
|
|
14
|
+
var pubsub: PubSub;
|
|
15
|
+
var globalSub: PubSub;
|
|
16
|
+
var blockStore: LeofcoinStorageClass;
|
|
17
|
+
var transactionStore: LeofcoinStorageClass;
|
|
18
|
+
var messageStore: LeofcoinStorageClass;
|
|
19
|
+
var dataStore: LeofcoinStorageClass;
|
|
20
|
+
var walletStore: LeofcoinStorageClass;
|
|
21
|
+
var chainStore: LeofcoinStorageClass;
|
|
22
|
+
}
|
|
10
23
|
/**
|
|
11
24
|
* @access public
|
|
12
25
|
* @example
|
|
@@ -54,10 +67,14 @@ export default class Peernet {
|
|
|
54
67
|
*/
|
|
55
68
|
constructor(options: any, password: any);
|
|
56
69
|
get id(): string;
|
|
57
|
-
get
|
|
70
|
+
get selectedAccount(): string;
|
|
71
|
+
get accounts(): Promise<[
|
|
72
|
+
[name: string, externalAddress: string, internalAddress: string]
|
|
73
|
+
]>;
|
|
58
74
|
get defaultStores(): string[];
|
|
75
|
+
selectAccount(account: string): Promise<void> | Promise<IDBValidKey> | Promise<any[]>;
|
|
59
76
|
addProto(name: any, proto: any): void;
|
|
60
|
-
addCodec(codec: any):
|
|
77
|
+
addCodec(codec: any): void;
|
|
61
78
|
addStore(name: any, prefix: any, root: any, isPrivate?: boolean): Promise<void>;
|
|
62
79
|
/**
|
|
63
80
|
* @see MessageHandler
|
|
@@ -74,7 +91,7 @@ export default class Peernet {
|
|
|
74
91
|
/**
|
|
75
92
|
* @return {String} id - peerId
|
|
76
93
|
*/
|
|
77
|
-
getConnection(id: any):
|
|
94
|
+
getConnection(id: any): P2PTPeer;
|
|
78
95
|
/**
|
|
79
96
|
* @private
|
|
80
97
|
*
|
|
@@ -83,7 +100,10 @@ export default class Peernet {
|
|
|
83
100
|
*
|
|
84
101
|
* @return {Promise} instance of Peernet
|
|
85
102
|
*/
|
|
86
|
-
_init(options:
|
|
103
|
+
_init(options: {
|
|
104
|
+
storePrefix?: string;
|
|
105
|
+
root?: string;
|
|
106
|
+
}, password: string): Promise<Peernet>;
|
|
87
107
|
start(): Promise<void>;
|
|
88
108
|
addRequestHandler(name: any, method: any): void;
|
|
89
109
|
sendMessage(peer: any, id: any, data: any): Promise<void>;
|
|
@@ -111,13 +131,13 @@ export default class Peernet {
|
|
|
111
131
|
providersFor(hash: string, store?: undefined): Promise<import("./dht/dht.js").DHTProviderMapValue>;
|
|
112
132
|
get block(): {
|
|
113
133
|
get: (hash: string) => Promise<any>;
|
|
114
|
-
put: (hash: string, data: Uint8Array) => Promise<any>;
|
|
115
|
-
has: (hash: string) => Promise<any>;
|
|
134
|
+
put: (hash: string, data: Uint8Array) => Promise<void | any[] | IDBValidKey>;
|
|
135
|
+
has: (hash: string) => Promise<boolean | any[]>;
|
|
116
136
|
};
|
|
117
137
|
get transaction(): {
|
|
118
138
|
get: (hash: string) => Promise<any>;
|
|
119
|
-
put: (hash: string, data: Uint8Array) => Promise<any>;
|
|
120
|
-
has: (hash: string) => Promise<any>;
|
|
139
|
+
put: (hash: string, data: Uint8Array) => Promise<void | any[] | IDBValidKey>;
|
|
140
|
+
has: (hash: string) => Promise<boolean | any[]>;
|
|
121
141
|
};
|
|
122
142
|
requestData(hash: any, store: any): any;
|
|
123
143
|
get message(): {
|
|
@@ -133,12 +153,12 @@ export default class Peernet {
|
|
|
133
153
|
* @param {String} hash
|
|
134
154
|
* @param {Buffer} message
|
|
135
155
|
*/
|
|
136
|
-
put: (hash: any, message: any) => Promise<any>;
|
|
156
|
+
put: (hash: any, message: any) => Promise<void | any[] | IDBValidKey>;
|
|
137
157
|
/**
|
|
138
158
|
* @param {String} hash
|
|
139
159
|
* @return {Boolean}
|
|
140
160
|
*/
|
|
141
|
-
has: (hash: any) => Promise<any>;
|
|
161
|
+
has: (hash: any) => Promise<boolean | any[]>;
|
|
142
162
|
};
|
|
143
163
|
get data(): {
|
|
144
164
|
/**
|
|
@@ -153,12 +173,12 @@ export default class Peernet {
|
|
|
153
173
|
* @param {String} hash
|
|
154
174
|
* @param {Buffer} data
|
|
155
175
|
*/
|
|
156
|
-
put: (hash: any, data: any) => Promise<any>;
|
|
176
|
+
put: (hash: any, data: any) => Promise<void | any[] | IDBValidKey>;
|
|
157
177
|
/**
|
|
158
178
|
* @param {String} hash
|
|
159
179
|
* @return {Boolean}
|
|
160
180
|
*/
|
|
161
|
-
has: (hash: any) => Promise<any>;
|
|
181
|
+
has: (hash: any) => Promise<boolean | any[]>;
|
|
162
182
|
};
|
|
163
183
|
get folder(): {
|
|
164
184
|
/**
|
|
@@ -173,12 +193,12 @@ export default class Peernet {
|
|
|
173
193
|
* @param {String} hash
|
|
174
194
|
* @param {Buffer} data
|
|
175
195
|
*/
|
|
176
|
-
put: (hash: any, data: any) => Promise<any>;
|
|
196
|
+
put: (hash: any, data: any) => Promise<void | any[] | IDBValidKey>;
|
|
177
197
|
/**
|
|
178
198
|
* @param {String} hash
|
|
179
199
|
* @return {Boolean}
|
|
180
200
|
*/
|
|
181
|
-
has: (hash: any) => Promise<any>;
|
|
201
|
+
has: (hash: any) => Promise<boolean | any[]>;
|
|
182
202
|
};
|
|
183
203
|
addFolder(files: any): Promise<any>;
|
|
184
204
|
ls(hash: any, options: any): Promise<any[]>;
|
|
@@ -203,7 +223,7 @@ export default class Peernet {
|
|
|
203
223
|
* @param {Buffer} data
|
|
204
224
|
* @param {String} storeName - storeName to access
|
|
205
225
|
*/
|
|
206
|
-
put(hash: string, data: Uint8Array, storeName?: string | LeofcoinStorageClass): Promise<any>;
|
|
226
|
+
put(hash: string, data: Uint8Array, storeName?: string | LeofcoinStorageClass): Promise<void | any[] | IDBValidKey>;
|
|
207
227
|
/**
|
|
208
228
|
* @param {String} hash
|
|
209
229
|
* @return {Boolean}
|
package/index.html
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en" dir="ltr">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title></title>
|
|
6
|
-
</head>
|
|
7
|
-
<body>
|
|
8
|
-
<!-- <script src="./dist/browser/peernet.js">
|
|
9
|
-
</script> -->
|
|
10
|
-
|
|
11
|
-
<script type="module">
|
|
12
|
-
import './exports/browser/peernet.js';
|
|
13
|
-
(async () => {
|
|
14
|
-
const peernet = await new Peernet({network: 'leofcoin:peach', networkVersion: 'peach'})
|
|
15
|
-
peernet.addRequestHandler('lastBlock', () => new peernet.protos['peernet-response']({response: new TextEncoder().encode(100)}))
|
|
16
|
-
})()
|
|
17
|
-
</script>
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" dir="ltr">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title></title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<!-- <script src="./dist/browser/peernet.js">
|
|
9
|
+
</script> -->
|
|
10
|
+
|
|
11
|
+
<script type="module">
|
|
12
|
+
import './exports/browser/peernet.js';
|
|
13
|
+
(async () => {
|
|
14
|
+
const peernet = await new Peernet({network: 'leofcoin:peach', networkVersion: 'peach'})
|
|
15
|
+
peernet.addRequestHandler('lastBlock', () => new peernet.protos['peernet-response']({response: new TextEncoder().encode(100)}))
|
|
16
|
+
})()
|
|
17
|
+
</script>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,69 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@leofcoin/peernet",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "src/peernet.js",
|
|
6
|
-
"exports": {
|
|
7
|
-
".": {
|
|
8
|
-
"import": "./exports/peernet.js",
|
|
9
|
-
"require": "./exports/commonjs/peernet.js",
|
|
10
|
-
"types": "./exports/types/peernet.d.ts"
|
|
11
|
-
},
|
|
12
|
-
"./browser": "./exports/browser/peernet.js"
|
|
13
|
-
},
|
|
14
|
-
"type": "module",
|
|
15
|
-
"engines": {
|
|
16
|
-
"node": ">=19.0.0"
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "rollup -c",
|
|
20
|
-
"watch": "rollup -c -w",
|
|
21
|
-
"set-flags": "set NODE_OPTIONS=--openssl-legacy-provider",
|
|
22
|
-
"test": "npm run set-flags && node test/index.js",
|
|
23
|
-
"server": "discovery-swarm-webrtc --port=4000",
|
|
24
|
-
"demo": "jsproject --serve ./ --port 6868",
|
|
25
|
-
"lint": "./node_modules/.bin/eslint src/**/**.js --fix"
|
|
26
|
-
},
|
|
27
|
-
"keywords": [],
|
|
28
|
-
"author": "",
|
|
29
|
-
"license": "MIT",
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@leofcoin/codec-format-interface": "^1.6.0",
|
|
32
|
-
"@leofcoin/codecs": "^1.0.0",
|
|
33
|
-
"@leofcoin/generate-account": "^2.0.0",
|
|
34
|
-
"@leofcoin/identity-utils": "^1.0.2",
|
|
35
|
-
"@leofcoin/multi-wallet": "^3.1.
|
|
36
|
-
"@leofcoin/peernet-swarm": "^1.1.0",
|
|
37
|
-
"@leofcoin/storage": "^3.0.0",
|
|
38
|
-
"@netpeer/p2pt-swarm": "^1.3.2",
|
|
39
|
-
"@types/node": "^18.11.18",
|
|
40
|
-
"@vandeurenglenn/base32": "^1.1.0",
|
|
41
|
-
"@vandeurenglenn/base58": "^1.1.0",
|
|
42
|
-
"@vandeurenglenn/debug": "^1.0.0",
|
|
43
|
-
"@vandeurenglenn/is-hex": "^1.0.0",
|
|
44
|
-
"@vandeurenglenn/little-pubsub": "^1.3.1",
|
|
45
|
-
"events": "^3.3.0",
|
|
46
|
-
"inquirer": "^9.1.4",
|
|
47
|
-
"multi-signature": "^1.3.1",
|
|
48
|
-
"qr-scanner": "^1.4.2",
|
|
49
|
-
"qrcode": "^1.5.1",
|
|
50
|
-
"socket-request-client": "^1.5.0",
|
|
51
|
-
"socket-request-server": "^1.5.0"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@rollup/plugin-commonjs": "^24.0.1",
|
|
55
|
-
"@rollup/plugin-json": "^6.0.0",
|
|
56
|
-
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
57
|
-
"@rollup/plugin-wasm": "^6.1.1",
|
|
58
|
-
"@types/bs58check": "^2.1.0",
|
|
59
|
-
"@types/
|
|
60
|
-
"@types/
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"eslint
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"rollup
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@leofcoin/peernet",
|
|
3
|
+
"version": "1.1.58",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "src/peernet.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./exports/peernet.js",
|
|
9
|
+
"require": "./exports/commonjs/peernet.js",
|
|
10
|
+
"types": "./exports/types/peernet.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"./browser": "./exports/browser/peernet.js"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=19.0.0"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "rollup -c",
|
|
20
|
+
"watch": "rollup -c -w",
|
|
21
|
+
"set-flags": "set NODE_OPTIONS=--openssl-legacy-provider",
|
|
22
|
+
"test": "npm run set-flags && node test/index.js",
|
|
23
|
+
"server": "discovery-swarm-webrtc --port=4000",
|
|
24
|
+
"demo": "jsproject --serve ./ --port 6868",
|
|
25
|
+
"lint": "./node_modules/.bin/eslint src/**/**.js --fix"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [],
|
|
28
|
+
"author": "",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@leofcoin/codec-format-interface": "^1.6.0",
|
|
32
|
+
"@leofcoin/codecs": "^1.0.0",
|
|
33
|
+
"@leofcoin/generate-account": "^2.0.0",
|
|
34
|
+
"@leofcoin/identity-utils": "^1.0.2",
|
|
35
|
+
"@leofcoin/multi-wallet": "^3.1.4",
|
|
36
|
+
"@leofcoin/peernet-swarm": "^1.1.0",
|
|
37
|
+
"@leofcoin/storage": "^3.0.0",
|
|
38
|
+
"@netpeer/p2pt-swarm": "^1.3.2",
|
|
39
|
+
"@types/node": "^18.11.18",
|
|
40
|
+
"@vandeurenglenn/base32": "^1.1.0",
|
|
41
|
+
"@vandeurenglenn/base58": "^1.1.0",
|
|
42
|
+
"@vandeurenglenn/debug": "^1.0.0",
|
|
43
|
+
"@vandeurenglenn/is-hex": "^1.0.0",
|
|
44
|
+
"@vandeurenglenn/little-pubsub": "^1.3.1",
|
|
45
|
+
"events": "^3.3.0",
|
|
46
|
+
"inquirer": "^9.1.4",
|
|
47
|
+
"multi-signature": "^1.3.1",
|
|
48
|
+
"qr-scanner": "^1.4.2",
|
|
49
|
+
"qrcode": "^1.5.1",
|
|
50
|
+
"socket-request-client": "^1.5.0",
|
|
51
|
+
"socket-request-server": "^1.5.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@rollup/plugin-commonjs": "^24.0.1",
|
|
55
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
56
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
57
|
+
"@rollup/plugin-wasm": "^6.1.1",
|
|
58
|
+
"@types/bs58check": "^2.1.0",
|
|
59
|
+
"@types/qrcode": "^1.5.2",
|
|
60
|
+
"@types/secp256k1": "^4.0.3",
|
|
61
|
+
"@types/varint": "^6.0.1",
|
|
62
|
+
"browserify": "^17.0.0",
|
|
63
|
+
"eslint": "^8.29.0",
|
|
64
|
+
"eslint-plugin-unicorn": "^45.0.1",
|
|
65
|
+
"node-stdlib-browser": "^1.2.0",
|
|
66
|
+
"rollup": "^3.12.0",
|
|
67
|
+
"rollup-plugin-modify": "^3.0.0",
|
|
68
|
+
"webpack-cli": "^5.0.1"
|
|
69
|
+
}
|
|
70
|
+
}
|
package/rollup.config.js
CHANGED
|
@@ -1,69 +1,76 @@
|
|
|
1
|
-
import resolve, { nodeResolve } from
|
|
2
|
-
import commonjs from
|
|
3
|
-
import json from
|
|
4
|
-
import wasm from
|
|
5
|
-
import rimraf from
|
|
6
|
-
import typescript from
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
1
|
+
import resolve, { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
2
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
3
|
+
import json from "@rollup/plugin-json";
|
|
4
|
+
import wasm from "@rollup/plugin-wasm";
|
|
5
|
+
import rimraf from "rimraf";
|
|
6
|
+
import typescript from "@rollup/plugin-typescript";
|
|
7
|
+
import modify from "rollup-plugin-modify";
|
|
8
|
+
|
|
9
|
+
rimraf.sync("./exports/**");
|
|
10
|
+
|
|
11
|
+
export default [
|
|
12
|
+
{
|
|
13
|
+
input: [
|
|
14
|
+
"./src/peernet.ts",
|
|
15
|
+
"./node_modules/@leofcoin/storage/exports/browser-store.js",
|
|
16
|
+
],
|
|
17
|
+
output: {
|
|
18
|
+
format: "es",
|
|
19
|
+
dir: "./exports/browser",
|
|
20
|
+
},
|
|
21
|
+
plugins: [
|
|
22
|
+
json(),
|
|
23
|
+
wasm(),
|
|
24
|
+
modify({
|
|
25
|
+
"@netpeer/p2pt-swarm": "@netpeer/p2pt-swarm/browser",
|
|
26
|
+
}),
|
|
27
|
+
resolve({
|
|
28
|
+
browser: true,
|
|
29
|
+
preferBuiltins: false,
|
|
30
|
+
mainFields: ["browser", "module", "main"],
|
|
31
|
+
}),
|
|
32
|
+
commonjs({
|
|
33
|
+
mainFields: ["browser", "module", "main"],
|
|
34
|
+
}),
|
|
35
|
+
|
|
36
|
+
typescript({ compilerOptions: { outDir: "./exports/browser" } }),
|
|
37
|
+
],
|
|
38
|
+
external: ["./prompts/password.js"],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
input: [
|
|
42
|
+
"./src/peernet.ts",
|
|
43
|
+
"./node_modules/@leofcoin/storage/exports/store.js",
|
|
44
|
+
],
|
|
45
|
+
output: {
|
|
46
|
+
format: "es",
|
|
47
|
+
dir: "./exports",
|
|
48
|
+
},
|
|
49
|
+
plugins: [
|
|
50
|
+
modify({
|
|
51
|
+
"@netpeer/p2pt-swarm": "@netpeer/p2pt-swarm",
|
|
52
|
+
}),
|
|
53
|
+
typescript({
|
|
54
|
+
compilerOptions: {
|
|
55
|
+
outDir: "./exports",
|
|
56
|
+
declarationDir: "./exports/types",
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
],
|
|
60
|
+
external: ["./prompts/password.js"],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
input: ["./src/prompts/password/browser.js"],
|
|
64
|
+
output: {
|
|
65
|
+
format: "es",
|
|
66
|
+
file: "./exports/browser/src/prompts/password.js",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
input: ["./src/prompts/password/node.js"],
|
|
71
|
+
output: {
|
|
72
|
+
format: "es",
|
|
73
|
+
file: "./exports/src/prompts/password.js",
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
];
|