@leofcoin/peernet 1.1.54 → 1.1.56
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-ff6a68c3.js → index-9c85cd32.js} +1 -1
- package/exports/browser/{messages-7a0e14b4.js → messages-b66f5393.js} +1 -1
- package/exports/browser/{peernet-9d77bc59.js → peernet-2797014a.js} +861 -780
- package/exports/browser/peernet.d.ts +1 -1
- package/exports/browser/peernet.js +1 -1
- package/exports/peernet.js +10 -8
- package/exports/types/peernet.d.ts +1 -1
- package/package.json +3 -3
- package/src/identity.ts +10 -6
- package/src/peernet.ts +1 -1
- package/tsconfig.json +1 -1
- package/exports/browser/identity.d.ts +0 -15
- package/exports/types/identity.d.ts +0 -15
|
@@ -221,6 +221,6 @@ export default class Peernet {
|
|
|
221
221
|
* @param {Method} cb
|
|
222
222
|
*/
|
|
223
223
|
subscribe(topic: string, callback: Function): Promise<void>;
|
|
224
|
-
removePeer(peer: any): Promise<
|
|
224
|
+
removePeer(peer: any): Promise<boolean>;
|
|
225
225
|
get Buffer(): BufferConstructor;
|
|
226
226
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as default } from './peernet-
|
|
1
|
+
export { P as default } from './peernet-2797014a.js';
|
|
2
2
|
import './value-4e80eeeb.js';
|
package/exports/peernet.js
CHANGED
|
@@ -5,7 +5,7 @@ import LeofcoinStorageClass from '@leofcoin/storage';
|
|
|
5
5
|
import { utils } from '@leofcoin/codecs';
|
|
6
6
|
import MultiWallet from '@leofcoin/multi-wallet';
|
|
7
7
|
import base58 from '@vandeurenglenn/base58';
|
|
8
|
-
import { decrypt
|
|
8
|
+
import { decrypt } from '@leofcoin/identity-utils';
|
|
9
9
|
import QrScanner from 'qr-scanner';
|
|
10
10
|
import qrcode from 'qrcode';
|
|
11
11
|
|
|
@@ -359,15 +359,17 @@ class Identity {
|
|
|
359
359
|
sign(hash) {
|
|
360
360
|
return this.#wallet.sign(hash.subarray(0, 32));
|
|
361
361
|
}
|
|
362
|
+
lock(password) {
|
|
363
|
+
this.#wallet.lock(password);
|
|
364
|
+
}
|
|
365
|
+
unlock(password) {
|
|
366
|
+
this.#wallet.unlock(password);
|
|
367
|
+
}
|
|
362
368
|
async export(password) {
|
|
363
|
-
|
|
364
|
-
const encypted = await encrypt(password, multiWIF);
|
|
365
|
-
return base58.encode(encypted);
|
|
369
|
+
return this.#wallet.export(password);
|
|
366
370
|
}
|
|
367
371
|
async import(password, encrypted) {
|
|
368
|
-
this.#wallet
|
|
369
|
-
const decrypted = await decrypt(password, base58.decode(encrypted));
|
|
370
|
-
await this.#wallet.fromMultiWif(decrypted);
|
|
372
|
+
await this.#wallet.import(password, encrypted);
|
|
371
373
|
}
|
|
372
374
|
async exportQR(password) {
|
|
373
375
|
const exported = await this.export(password);
|
|
@@ -778,7 +780,7 @@ class Peernet {
|
|
|
778
780
|
}
|
|
779
781
|
async requestData(hash, store) {
|
|
780
782
|
const providers = await this.providersFor(hash);
|
|
781
|
-
if (!providers || Object.keys(providers).length === 0)
|
|
783
|
+
if (!providers || providers && Object.keys(providers).length === 0)
|
|
782
784
|
throw nothingFoundError(hash);
|
|
783
785
|
debug(`found ${Object.keys(providers).length} provider(s) for ${hash}`);
|
|
784
786
|
// get closest peer on earth
|
|
@@ -221,6 +221,6 @@ export default class Peernet {
|
|
|
221
221
|
* @param {Method} cb
|
|
222
222
|
*/
|
|
223
223
|
subscribe(topic: string, callback: Function): Promise<void>;
|
|
224
|
-
removePeer(peer: any): Promise<
|
|
224
|
+
removePeer(peer: any): Promise<boolean>;
|
|
225
225
|
get Buffer(): BufferConstructor;
|
|
226
226
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/peernet",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.56",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/peernet.js",
|
|
6
6
|
"exports": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@leofcoin/codec-format-interface": "^1.6.0",
|
|
32
32
|
"@leofcoin/codecs": "^1.0.0",
|
|
33
33
|
"@leofcoin/generate-account": "^2.0.0",
|
|
34
|
-
"@leofcoin/identity-utils": "^1.0.
|
|
35
|
-
"@leofcoin/multi-wallet": "^3.0
|
|
34
|
+
"@leofcoin/identity-utils": "^1.0.2",
|
|
35
|
+
"@leofcoin/multi-wallet": "^3.1.0",
|
|
36
36
|
"@leofcoin/peernet-swarm": "^1.1.0",
|
|
37
37
|
"@leofcoin/storage": "^3.0.0",
|
|
38
38
|
"@netpeer/p2pt-swarm": "^1.3.2",
|
package/src/identity.ts
CHANGED
|
@@ -67,16 +67,20 @@ export default class Identity {
|
|
|
67
67
|
return this.#wallet.sign(hash.subarray(0, 32))
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
lock(password: string) {
|
|
71
|
+
this.#wallet.lock(password)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
unlock(password: string) {
|
|
75
|
+
this.#wallet.unlock(password)
|
|
76
|
+
}
|
|
77
|
+
|
|
70
78
|
async export(password: string) {
|
|
71
|
-
|
|
72
|
-
const encypted = await encrypt(password, multiWIF)
|
|
73
|
-
return base58.encode(encypted)
|
|
79
|
+
return this.#wallet.export(password)
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
async import(password, encrypted: base58String) {
|
|
77
|
-
this.#wallet
|
|
78
|
-
const decrypted = await decrypt(password, base58.decode(encrypted))
|
|
79
|
-
await this.#wallet.fromMultiWif(decrypted)
|
|
83
|
+
await this.#wallet.import(password, encrypted)
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
async exportQR(password: string) {
|
package/src/peernet.ts
CHANGED
|
@@ -473,7 +473,7 @@ export default class Peernet {
|
|
|
473
473
|
|
|
474
474
|
async requestData(hash, store) {
|
|
475
475
|
const providers = await this.providersFor(hash)
|
|
476
|
-
if (!providers || Object.keys(providers).length === 0) throw nothingFoundError(hash)
|
|
476
|
+
if (!providers || providers && Object.keys(providers).length === 0) throw nothingFoundError(hash)
|
|
477
477
|
debug(`found ${Object.keys(providers).length} provider(s) for ${hash}`)
|
|
478
478
|
// get closest peer on earth
|
|
479
479
|
const closestPeer: DHTProvider = Object.values(providers)[0];
|
package/tsconfig.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import MultiWallet from '@leofcoin/multi-wallet';
|
|
2
|
-
export default class Identity {
|
|
3
|
-
#private;
|
|
4
|
-
network: MultiWallet.network;
|
|
5
|
-
id: 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
|
-
sign(hash: Uint8Array): any;
|
|
11
|
-
export(password: string): Promise<string>;
|
|
12
|
-
import(password: any, encrypted: base58String): Promise<void>;
|
|
13
|
-
exportQR(password: string): Promise<any>;
|
|
14
|
-
importQR(image: File | Blob, password: string): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import MultiWallet from '@leofcoin/multi-wallet';
|
|
2
|
-
export default class Identity {
|
|
3
|
-
#private;
|
|
4
|
-
network: MultiWallet.network;
|
|
5
|
-
id: 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
|
-
sign(hash: Uint8Array): any;
|
|
11
|
-
export(password: string): Promise<string>;
|
|
12
|
-
import(password: any, encrypted: base58String): Promise<void>;
|
|
13
|
-
exportQR(password: string): Promise<any>;
|
|
14
|
-
importQR(image: File | Blob, password: string): Promise<void>;
|
|
15
|
-
}
|