@leofcoin/peernet 0.18.4 → 0.18.5
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/{client-bcc5fcc2.js → client-f1b87adc.js} +1 -1
- package/exports/browser/{index-d7584e0e.js → index-48e510d0.js} +2 -2
- package/exports/browser/{index-b1a03d93.js → index-54cdabb4.js} +1 -1
- package/exports/browser/{messages-bc8f619c.js → messages-a77b03b5.js} +1 -1
- package/exports/browser/{peernet-0418c064.js → peernet-1582ad5b.js} +10 -7
- package/exports/browser/peernet.js +1 -1
- package/exports/store.js +6 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as base58$1, i as index$1, a as index$2, c as index$3, d as index$4, e as createRIPEMD160, f as createHMAC, g as createSHA512, h as createKeccak } from './peernet-
|
|
1
|
+
import { b as base58$1, i as index$1, a as index$2, c as index$3, d as index$4, e as createRIPEMD160, f as createHMAC, g as createSHA512, h as createKeccak } from './peernet-1582ad5b.js';
|
|
2
2
|
import './value-40634404.js';
|
|
3
3
|
|
|
4
4
|
const randombytes = strength => crypto.getRandomValues(new Uint8Array(strength));
|
|
@@ -1395,10 +1395,14 @@ const addCodec = (codecInput) => {
|
|
|
1395
1395
|
if (!globalThis.peernetCodecs[name])
|
|
1396
1396
|
globalThis.peernetCodecs[name] = {
|
|
1397
1397
|
hashAlg,
|
|
1398
|
-
codec: parseInt(codec, 16)
|
|
1398
|
+
codec: isNaN(codec) ? parseInt(codec, 16) : codec
|
|
1399
1399
|
};
|
|
1400
1400
|
};
|
|
1401
|
-
const getCodec = (name) =>
|
|
1401
|
+
const getCodec = (name) => {
|
|
1402
|
+
if (typeof name === 'number')
|
|
1403
|
+
return name;
|
|
1404
|
+
return getCodecByName(name).codec;
|
|
1405
|
+
};
|
|
1402
1406
|
const getCodecName = (codec) => {
|
|
1403
1407
|
return Object.keys(globalThis.peernetCodecs).reduce((p, c) => {
|
|
1404
1408
|
const item = globalThis.peernetCodecs[c];
|
|
@@ -2146,7 +2150,7 @@ class MessageHandler {
|
|
|
2146
2150
|
let identity = await walletStore.get('identity');
|
|
2147
2151
|
identity = JSON.parse(identity);
|
|
2148
2152
|
if (!globalThis.MultiWallet) {
|
|
2149
|
-
const importee = await import(/* webpackChunkName: "multi-wallet" */ './index-
|
|
2153
|
+
const importee = await import(/* webpackChunkName: "multi-wallet" */ './index-54cdabb4.js');
|
|
2150
2154
|
globalThis.MultiWallet = importee.default;
|
|
2151
2155
|
}
|
|
2152
2156
|
const wallet = new MultiWallet(this.network);
|
|
@@ -2334,7 +2338,6 @@ class LeofcoinStorage {
|
|
|
2334
2338
|
async size() {
|
|
2335
2339
|
let size = 0;
|
|
2336
2340
|
const query = await this.db.iterate();
|
|
2337
|
-
console.log(query);
|
|
2338
2341
|
for await (const item of query) {
|
|
2339
2342
|
size += item.value ? item.value.length : item[1].length;
|
|
2340
2343
|
}
|
|
@@ -2472,7 +2475,7 @@ class Peernet {
|
|
|
2472
2475
|
this.root = options.root;
|
|
2473
2476
|
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
|
|
2474
2477
|
// FolderMessageResponse
|
|
2475
|
-
} = await import(/* webpackChunkName: "messages" */ './messages-
|
|
2478
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-a77b03b5.js');
|
|
2476
2479
|
/**
|
|
2477
2480
|
* proto Object containing protos
|
|
2478
2481
|
* @type {Object}
|
|
@@ -2520,7 +2523,7 @@ class Peernet {
|
|
|
2520
2523
|
}
|
|
2521
2524
|
}
|
|
2522
2525
|
else {
|
|
2523
|
-
const importee = await import(/* webpackChunkName: "generate-account" */ './index-
|
|
2526
|
+
const importee = await import(/* webpackChunkName: "generate-account" */ './index-48e510d0.js');
|
|
2524
2527
|
const generateAccount = importee.default;
|
|
2525
2528
|
const { identity, accounts, config } = await generateAccount(this.network);
|
|
2526
2529
|
// await accountStore.put('config', JSON.stringify(config));
|
|
@@ -2549,7 +2552,7 @@ class Peernet {
|
|
|
2549
2552
|
* @see DataHandler
|
|
2550
2553
|
*/
|
|
2551
2554
|
pubsub.subscribe('peer:data', dataHandler);
|
|
2552
|
-
const importee = await import('./client-
|
|
2555
|
+
const importee = await import('./client-f1b87adc.js');
|
|
2553
2556
|
/**
|
|
2554
2557
|
* @access public
|
|
2555
2558
|
* @type {PeernetClient}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as default } from './peernet-
|
|
1
|
+
export { P as default } from './peernet-1582ad5b.js';
|
|
2
2
|
import './value-40634404.js';
|
package/exports/store.js
CHANGED
|
@@ -179,8 +179,12 @@ class Store {
|
|
|
179
179
|
return value.uint8Array
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
toUint8Array(buffer) {
|
|
183
|
+
return Buffer.isBuffer(buffer) ? new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / Uint8Array.BYTES_PER_ELEMENT) : buffer
|
|
184
|
+
}
|
|
185
|
+
|
|
182
186
|
async get(key) {
|
|
183
|
-
return this.db.get(this.toKeyPath(key))
|
|
187
|
+
return this.toUint8Array(await this.db.get(this.toKeyPath(key)))
|
|
184
188
|
}
|
|
185
189
|
|
|
186
190
|
async put(key, value) {
|
|
@@ -198,7 +202,7 @@ class Store {
|
|
|
198
202
|
async values(limit = -1) {
|
|
199
203
|
const values = [];
|
|
200
204
|
for await (const value of this.db.values({limit})) {
|
|
201
|
-
values.push(value);
|
|
205
|
+
values.push(this.toUint8Array(value));
|
|
202
206
|
}
|
|
203
207
|
return values
|
|
204
208
|
}
|