@leofcoin/peernet 1.1.61 → 1.1.63
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/exports/browser/{index-5cd0a662.js → index-d76c4d54.js} +1 -1
- package/exports/browser/{messages-638774c5.js → messages-87375bf7.js} +1 -1
- package/exports/browser/{peernet-61545c25.js → peernet-5c083379.js} +19 -9
- package/exports/browser/peernet.js +1 -1
- package/exports/peernet.js +7 -3
- package/package.json +1 -1
- package/src/handlers/data.js +7 -3
|
@@ -11761,9 +11761,13 @@ var index$2 = {
|
|
|
11761
11761
|
class BasicInterface {
|
|
11762
11762
|
#encoded;
|
|
11763
11763
|
#decoded;
|
|
11764
|
-
keys;
|
|
11765
11764
|
name;
|
|
11766
11765
|
#proto;
|
|
11766
|
+
get keys() {
|
|
11767
|
+
// handles proto keys
|
|
11768
|
+
// protokey -> key
|
|
11769
|
+
return Object.keys(this.#proto).map((key) => (key.endsWith('?') ? key.split('?')[0] : key));
|
|
11770
|
+
}
|
|
11767
11771
|
get encoded() {
|
|
11768
11772
|
if (!this.#encoded)
|
|
11769
11773
|
this.#encoded = this.encode();
|
|
@@ -11782,7 +11786,6 @@ class BasicInterface {
|
|
|
11782
11786
|
}
|
|
11783
11787
|
set proto(value) {
|
|
11784
11788
|
this.#proto = value;
|
|
11785
|
-
this.keys = Object.keys(value);
|
|
11786
11789
|
}
|
|
11787
11790
|
get proto() {
|
|
11788
11791
|
return this.#proto;
|
|
@@ -11828,7 +11831,7 @@ class BasicInterface {
|
|
|
11828
11831
|
}
|
|
11829
11832
|
fromString(string) {
|
|
11830
11833
|
const array = string.split(',');
|
|
11831
|
-
const arrayLike = array.map(string => Number(string));
|
|
11834
|
+
const arrayLike = array.map((string) => Number(string));
|
|
11832
11835
|
return this.decode(Uint8Array.from(arrayLike));
|
|
11833
11836
|
}
|
|
11834
11837
|
fromHex(string) {
|
|
@@ -11848,7 +11851,10 @@ class BasicInterface {
|
|
|
11848
11851
|
toHex() {
|
|
11849
11852
|
if (!this.encoded)
|
|
11850
11853
|
this.encode();
|
|
11851
|
-
return toHex$2(this.encoded
|
|
11854
|
+
return toHex$2(this.encoded
|
|
11855
|
+
.toString()
|
|
11856
|
+
.split(',')
|
|
11857
|
+
.map((number) => Number(number)));
|
|
11852
11858
|
}
|
|
11853
11859
|
/**
|
|
11854
11860
|
* @return {String} encoded
|
|
@@ -12718,9 +12724,13 @@ class MessageHandler {
|
|
|
12718
12724
|
const dataHandler = async (message) => {
|
|
12719
12725
|
if (!message) return
|
|
12720
12726
|
|
|
12721
|
-
|
|
12722
|
-
|
|
12723
|
-
|
|
12727
|
+
try {
|
|
12728
|
+
const { data, id, from, peer } = message;
|
|
12729
|
+
const proto = await protoFor(data);
|
|
12730
|
+
peernet._protoHandler({ id, proto }, peernet.connections[from] || peer, from);
|
|
12731
|
+
} catch (error) {
|
|
12732
|
+
console.error(error);
|
|
12733
|
+
}
|
|
12724
12734
|
};
|
|
12725
12735
|
|
|
12726
12736
|
const dhtError = (proto) => {
|
|
@@ -27073,7 +27083,7 @@ class Identity {
|
|
|
27073
27083
|
this.selectedAccount = new TextDecoder().decode(selected);
|
|
27074
27084
|
}
|
|
27075
27085
|
else {
|
|
27076
|
-
const importee = await import(/* webpackChunkName: "generate-account" */ './index-
|
|
27086
|
+
const importee = await import(/* webpackChunkName: "generate-account" */ './index-d76c4d54.js');
|
|
27077
27087
|
const { identity, accounts } = await importee.default(password, this.network);
|
|
27078
27088
|
await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
|
|
27079
27089
|
await globalThis.walletStore.put('version', String(1));
|
|
@@ -27265,7 +27275,7 @@ class Peernet {
|
|
|
27265
27275
|
this.root = options.root;
|
|
27266
27276
|
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
|
|
27267
27277
|
// FolderMessageResponse
|
|
27268
|
-
} = await import(/* webpackChunkName: "messages" */ './messages-
|
|
27278
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-87375bf7.js');
|
|
27269
27279
|
/**
|
|
27270
27280
|
* proto Object containing protos
|
|
27271
27281
|
* @type {Object}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as default } from './peernet-
|
|
1
|
+
export { P as default } from './peernet-5c083379.js';
|
|
2
2
|
import './value-4e80eeeb.js';
|
package/exports/peernet.js
CHANGED
|
@@ -292,9 +292,13 @@ class MessageHandler {
|
|
|
292
292
|
const dataHandler = async (message) => {
|
|
293
293
|
if (!message) return
|
|
294
294
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
295
|
+
try {
|
|
296
|
+
const { data, id, from, peer } = message;
|
|
297
|
+
const proto = await protoFor(data);
|
|
298
|
+
peernet._protoHandler({ id, proto }, peernet.connections[from] || peer, from);
|
|
299
|
+
} catch (error) {
|
|
300
|
+
console.error(error);
|
|
301
|
+
}
|
|
298
302
|
};
|
|
299
303
|
|
|
300
304
|
const dhtError = (proto) => {
|
package/package.json
CHANGED
package/src/handlers/data.js
CHANGED
|
@@ -3,9 +3,13 @@ import { protoFor } from './../utils/utils.js'
|
|
|
3
3
|
const dataHandler = async (message) => {
|
|
4
4
|
if (!message) return
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
try {
|
|
7
|
+
const { data, id, from, peer } = message
|
|
8
|
+
const proto = await protoFor(data)
|
|
9
|
+
peernet._protoHandler({ id, proto }, peernet.connections[from] || peer, from)
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error(error)
|
|
12
|
+
}
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
export default dataHandler
|