@simplito/privmx-webendpoint 2.6.4 → 2.7.1
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/CONTRIBUTING.md +86 -0
- package/README.md +97 -7
- package/assets/driver-web-context.js +1 -1
- package/assets/e2ee-worker.js +1 -1
- package/assets/endpoint-wasm-module.js +3 -3
- package/assets/endpoint-wasm-module.wasm +0 -0
- package/assets/rms-processor.js +1 -0
- package/build-manifest.sh +6 -0
- package/{FinalizationHelper.js → dist/FinalizationHelper.js} +1 -1
- package/dist/ServerTypes.d.ts +7 -0
- package/{Types.d.ts → dist/Types.d.ts} +97 -10
- package/{Types.js → dist/Types.js} +17 -32
- package/{api → dist/api}/Api.d.ts +2 -0
- package/{api → dist/api}/Api.js +18 -1
- package/{api → dist/api}/ConnectionNative.js +1 -1
- package/{api → dist/api}/CryptoApiNative.js +1 -2
- package/{api → dist/api}/InboxApiNative.d.ts +21 -2
- package/{api → dist/api}/KvdbApiNative.d.ts +19 -2
- package/dist/api/NativeError.d.ts +13 -0
- package/dist/api/NativeError.js +20 -0
- package/{api → dist/api}/StoreApiNative.d.ts +19 -2
- package/dist/api/StreamApiNative.d.ts +72 -0
- package/dist/api/StreamApiNative.js +142 -0
- package/{api → dist/api}/ThreadApiNative.d.ts +19 -2
- package/dist/assets/e2ee-worker.js +1 -0
- package/dist/bundle/privmx-endpoint-web.js +2 -0
- package/dist/bundle/privmx-endpoint-web.js.LICENSE.txt +30 -0
- package/dist/bundle/rms-processor.js +1 -0
- package/{extra → dist/extra}/PrivmxClient.d.ts +9 -9
- package/{extra → dist/extra}/PrivmxClient.js +12 -12
- package/{extra → dist/extra}/PublicConnection.d.ts +2 -2
- package/{extra → dist/extra}/PublicConnection.js +2 -2
- package/{extra → dist/extra}/__tests__/connectionEventManager.test.js +1 -3
- package/{extra → dist/extra}/__tests__/customEventManager.test.js +1 -3
- package/{extra → dist/extra}/__tests__/userEventManager.test.js +2 -6
- package/{extra → dist/extra}/__tests__/utils.test.js +18 -18
- package/{extra → dist/extra}/events.js +32 -12
- package/{extra → dist/extra}/files.d.ts +5 -5
- package/{extra → dist/extra}/files.js +11 -11
- package/{extra → dist/extra}/generics.d.ts +1 -1
- package/{extra → dist/extra}/inbox.d.ts +1 -1
- package/{extra → dist/extra}/inbox.js +2 -2
- package/{extra → dist/extra}/index.d.ts +7 -7
- package/{extra → dist/extra}/managers.js +1 -1
- package/{extra → dist/extra}/utils.js +9 -9
- package/{index.d.ts → dist/index.d.ts} +3 -2
- package/{index.js → dist/index.js} +4 -1
- package/{service → dist/service}/Connection.js +13 -6
- package/{service → dist/service}/CryptoApi.js +2 -8
- package/{service → dist/service}/EndpointFactory.d.ts +11 -0
- package/{service → dist/service}/EndpointFactory.js +45 -10
- package/{service → dist/service}/EventApi.js +9 -5
- package/dist/service/EventDispatcher.d.ts +15 -0
- package/dist/service/EventDispatcher.js +25 -0
- package/{service → dist/service}/EventQueue.d.ts +4 -4
- package/{service → dist/service}/EventQueue.js +5 -9
- package/{service → dist/service}/ExtKey.d.ts +10 -10
- package/{service → dist/service}/ExtKey.js +10 -10
- package/{service → dist/service}/InboxApi.js +7 -11
- package/{service → dist/service}/KvdbApi.js +12 -7
- package/{service → dist/service}/StoreApi.js +10 -15
- package/dist/service/StreamApi.d.ts +237 -0
- package/dist/service/StreamApi.js +442 -0
- package/{service → dist/service}/ThreadApi.js +6 -7
- package/{service → dist/service}/UserVerifierInterface.d.ts +2 -2
- package/dist/service/UserVerifierInterface.js +2 -0
- package/dist/service/WebRtcInterface.d.ts +58 -0
- package/dist/service/WebRtcInterface.js +8 -0
- package/{service → dist/service}/index.d.ts +3 -2
- package/{service → dist/service}/index.js +5 -3
- package/dist/webStreams/CryptoUtils.d.ts +24 -0
- package/dist/webStreams/CryptoUtils.js +58 -0
- package/dist/webStreams/KeyStore.d.ts +9 -0
- package/dist/webStreams/KeyStore.js +29 -0
- package/dist/webStreams/Logger.d.ts +7 -0
- package/dist/webStreams/Logger.js +25 -0
- package/dist/webStreams/PeerConnectionsManager.d.ts +20 -0
- package/dist/webStreams/PeerConnectionsManager.js +92 -0
- package/dist/webStreams/Queue.d.ts +19 -0
- package/dist/webStreams/Queue.js +70 -0
- package/dist/webStreams/Utils.d.ts +20 -0
- package/dist/webStreams/Utils.js +211 -0
- package/dist/webStreams/WebRtcClient.d.ts +85 -0
- package/dist/webStreams/WebRtcClient.js +437 -0
- package/dist/webStreams/WebRtcClientTypes.d.ts +64 -0
- package/dist/webStreams/WebRtcClientTypes.js +2 -0
- package/dist/webStreams/WebRtcConfig.d.ts +20 -0
- package/dist/webStreams/WebRtcConfig.js +53 -0
- package/dist/webStreams/WebRtcInterfaceImpl.d.ts +28 -0
- package/dist/webStreams/WebRtcInterfaceImpl.js +85 -0
- package/dist/webStreams/WebWorkerHelper copy.d.ts +0 -0
- package/dist/webStreams/WebWorkerHelper copy.js +17 -0
- package/dist/webStreams/WebWorkerHelper.d.ts +18 -0
- package/dist/webStreams/WebWorkerHelper.js +69 -0
- package/dist/webStreams/audio/ActiveSpeakerDetector.d.ts +38 -0
- package/dist/webStreams/audio/ActiveSpeakerDetector.js +64 -0
- package/dist/webStreams/audio/LocalAudioLevelMeter.d.ts +12 -0
- package/dist/webStreams/audio/LocalAudioLevelMeter.js +101 -0
- package/dist/webStreams/types/ApiTypes.d.ts +74 -0
- package/dist/webStreams/types/ApiTypes.js +2 -0
- package/dist/webStreams/types/BaseServerTypes.d.ts +10 -0
- package/dist/webStreams/types/BaseServerTypes.js +2 -0
- package/dist/webStreams/types/MediaServerWebSocketApiTypes.d.ts +255 -0
- package/dist/webStreams/types/MediaServerWebSocketApiTypes.js +2 -0
- package/dist/webStreams/types/SignalingReceiverTypes.d.ts +13 -0
- package/dist/webStreams/types/SignalingReceiverTypes.js +2 -0
- package/dist/webStreams/types/SignalingSenderTypes.d.ts +24 -0
- package/dist/webStreams/types/SignalingSenderTypes.js +2 -0
- package/dist/webStreams/types/StreamsApiTypes.d.ts +144 -0
- package/dist/webStreams/types/StreamsApiTypes.js +2 -0
- package/dist/webStreams/worker/WorkerEvents.d.ts +11 -0
- package/dist/webStreams/worker/WorkerEvents.js +2 -0
- package/dist/webStreams/worker/worker.d.ts +13 -0
- package/dist/webStreams/worker/worker.js +202 -0
- package/package.json +46 -15
- package/assets/endpoint-wasm-module.worker.js +0 -1
- package/assets/privmx-endpoint-web.js +0 -2
- package/bundle/privmx-endpoint-web.js +0 -2
- package/bundle/privmx-endpoint-web.js.LICENSE.txt +0 -10
- /package/{FinalizationHelper.d.ts → dist/FinalizationHelper.d.ts} +0 -0
- /package/{extra/generics.js → dist/ServerTypes.js} +0 -0
- /package/{api → dist/api}/ApiStatic.d.ts +0 -0
- /package/{api → dist/api}/ApiStatic.js +0 -0
- /package/{api → dist/api}/BaseNative.d.ts +0 -0
- /package/{api → dist/api}/BaseNative.js +0 -0
- /package/{api → dist/api}/ConnectionNative.d.ts +0 -0
- /package/{api → dist/api}/CryptoApiNative.d.ts +0 -0
- /package/{api → dist/api}/EventApiNative.d.ts +0 -0
- /package/{api → dist/api}/EventApiNative.js +0 -0
- /package/{api → dist/api}/EventQueueNative.d.ts +0 -0
- /package/{api → dist/api}/EventQueueNative.js +0 -0
- /package/{api → dist/api}/ExtKeyNative.d.ts +0 -0
- /package/{api → dist/api}/ExtKeyNative.js +0 -0
- /package/{api → dist/api}/IdGenerator.d.ts +0 -0
- /package/{api → dist/api}/IdGenerator.js +0 -0
- /package/{api → dist/api}/InboxApiNative.js +0 -0
- /package/{api → dist/api}/KvdbApiNative.js +0 -0
- /package/{api → dist/api}/StoreApiNative.js +0 -0
- /package/{api → dist/api}/ThreadApiNative.js +0 -0
- /package/{bundle.d.ts → dist/bundle.d.ts} +0 -0
- /package/{bundle.js → dist/bundle.js} +0 -0
- /package/{extra → dist/extra}/__mocks__/constants.d.ts +0 -0
- /package/{extra → dist/extra}/__mocks__/constants.js +0 -0
- /package/{extra → dist/extra}/__mocks__/mockContainerSubscriber.d.ts +0 -0
- /package/{extra → dist/extra}/__mocks__/mockContainerSubscriber.js +0 -0
- /package/{extra → dist/extra}/__mocks__/mockEventQueue.d.ts +0 -0
- /package/{extra → dist/extra}/__mocks__/mockEventQueue.js +0 -0
- /package/{extra → dist/extra}/__mocks__/utils.d.ts +0 -0
- /package/{extra → dist/extra}/__mocks__/utils.js +0 -0
- /package/{extra → dist/extra}/__tests__/connectionEventManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/customEventManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/eventsManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/eventsManager.test.js +0 -0
- /package/{extra → dist/extra}/__tests__/inboxEventManager.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/inboxEventManager.js +0 -0
- /package/{extra → dist/extra}/__tests__/storeEventManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/storeEventManager.test.js +0 -0
- /package/{extra → dist/extra}/__tests__/threadEventManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/threadEventManager.test.js +0 -0
- /package/{extra → dist/extra}/__tests__/userEventManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/utils.test.d.ts +0 -0
- /package/{extra → dist/extra}/events.d.ts +0 -0
- /package/{service/UserVerifierInterface.js → dist/extra/generics.js} +0 -0
- /package/{extra → dist/extra}/index.js +0 -0
- /package/{extra → dist/extra}/managers.d.ts +0 -0
- /package/{extra → dist/extra}/subscriptions.d.ts +0 -0
- /package/{extra → dist/extra}/subscriptions.js +0 -0
- /package/{extra → dist/extra}/utils.d.ts +0 -0
- /package/{service → dist/service}/BaseApi.d.ts +0 -0
- /package/{service → dist/service}/BaseApi.js +0 -0
- /package/{service → dist/service}/Connection.d.ts +0 -0
- /package/{service → dist/service}/CryptoApi.d.ts +0 -0
- /package/{service → dist/service}/EventApi.d.ts +0 -0
- /package/{service → dist/service}/InboxApi.d.ts +0 -0
- /package/{service → dist/service}/KvdbApi.d.ts +0 -0
- /package/{service → dist/service}/StoreApi.d.ts +0 -0
- /package/{service → dist/service}/ThreadApi.d.ts +0 -0
|
@@ -20,9 +20,9 @@ class EventApi extends BaseApi_1.BaseApi {
|
|
|
20
20
|
}
|
|
21
21
|
// /**
|
|
22
22
|
// * Creates an instance of 'EventApi'.
|
|
23
|
-
// *
|
|
23
|
+
// *
|
|
24
24
|
// * @param connection instance of 'Connection'
|
|
25
|
-
// *
|
|
25
|
+
// *
|
|
26
26
|
// * @return EventApi object
|
|
27
27
|
// */
|
|
28
28
|
// static EventApi create(core::Connection& connection);
|
|
@@ -40,7 +40,7 @@ class EventApi extends BaseApi_1.BaseApi {
|
|
|
40
40
|
}
|
|
41
41
|
// /**
|
|
42
42
|
// * Subscribe for the custom events on the given channel.
|
|
43
|
-
// *
|
|
43
|
+
// *
|
|
44
44
|
// * @param {string} contextId ID of the Context
|
|
45
45
|
// * @param {string} channelName name of the Channel
|
|
46
46
|
// */
|
|
@@ -49,7 +49,7 @@ class EventApi extends BaseApi_1.BaseApi {
|
|
|
49
49
|
// }
|
|
50
50
|
// /**
|
|
51
51
|
// * Unsubscribe from the custom events on the given channel.
|
|
52
|
-
// *
|
|
52
|
+
// *
|
|
53
53
|
// * @param {string} contextId ID of the Context
|
|
54
54
|
// * @param {string} channelName name of the Channel
|
|
55
55
|
// */
|
|
@@ -79,7 +79,11 @@ class EventApi extends BaseApi_1.BaseApi {
|
|
|
79
79
|
* @param {string} selectorId ID of the selector
|
|
80
80
|
*/
|
|
81
81
|
async buildSubscriptionQuery(channelName, selectorType, selectorId) {
|
|
82
|
-
return this.native.buildSubscriptionQuery(this.servicePtr, [
|
|
82
|
+
return this.native.buildSubscriptionQuery(this.servicePtr, [
|
|
83
|
+
channelName,
|
|
84
|
+
selectorType,
|
|
85
|
+
selectorId,
|
|
86
|
+
]);
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
89
|
exports.EventApi = EventApi;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StreamHandle } from "../Types";
|
|
2
|
+
export interface StateChangeEvent {
|
|
3
|
+
streamHandle: StreamHandle;
|
|
4
|
+
state: RTCPeerConnectionState;
|
|
5
|
+
}
|
|
6
|
+
export interface StateChangeFilter {
|
|
7
|
+
streamHandle: StreamHandle;
|
|
8
|
+
}
|
|
9
|
+
export type StateChangeListener = (event: StateChangeEvent) => void;
|
|
10
|
+
export declare class StateChangeDispatcher {
|
|
11
|
+
private listeners;
|
|
12
|
+
addOnStateChangeListener(filter: StateChangeFilter, listener: StateChangeListener): void;
|
|
13
|
+
removeOnStateChangeListener(filter: StateChangeFilter): void;
|
|
14
|
+
emit(event: StateChangeEvent): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StateChangeDispatcher = void 0;
|
|
4
|
+
class StateChangeDispatcher {
|
|
5
|
+
listeners = new Set();
|
|
6
|
+
addOnStateChangeListener(filter, listener) {
|
|
7
|
+
const entry = { filter, listener };
|
|
8
|
+
this.listeners.add(entry);
|
|
9
|
+
}
|
|
10
|
+
removeOnStateChangeListener(filter) {
|
|
11
|
+
for (const value of this.listeners.values()) {
|
|
12
|
+
if (value.filter === filter) {
|
|
13
|
+
this.listeners.delete(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
emit(event) {
|
|
18
|
+
for (const { filter, listener } of this.listeners) {
|
|
19
|
+
if (filter.streamHandle === event.streamHandle) {
|
|
20
|
+
listener(event);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.StateChangeDispatcher = StateChangeDispatcher;
|
|
@@ -8,12 +8,12 @@ This software is Licensed under the PrivMX Free License.
|
|
|
8
8
|
See the License for the specific language governing permissions and
|
|
9
9
|
limitations under the License.
|
|
10
10
|
*/
|
|
11
|
-
import { BaseApi } from
|
|
12
|
-
import { EventQueueNative } from
|
|
13
|
-
import { Event } from
|
|
11
|
+
import { BaseApi } from "./BaseApi";
|
|
12
|
+
import { EventQueueNative } from "../api/EventQueueNative";
|
|
13
|
+
import { Event } from "../Types";
|
|
14
14
|
export declare class EventQueue extends BaseApi {
|
|
15
15
|
private native;
|
|
16
|
-
private
|
|
16
|
+
private deferedPromise;
|
|
17
17
|
constructor(native: EventQueueNative, ptr: number);
|
|
18
18
|
waitEvent(): Promise<Event>;
|
|
19
19
|
emitBreakEvent(): Promise<void>;
|
|
@@ -14,21 +14,17 @@ exports.EventQueue = void 0;
|
|
|
14
14
|
const BaseApi_1 = require("./BaseApi");
|
|
15
15
|
class EventQueue extends BaseApi_1.BaseApi {
|
|
16
16
|
native;
|
|
17
|
-
|
|
17
|
+
deferedPromise;
|
|
18
18
|
constructor(native, ptr) {
|
|
19
19
|
super(ptr);
|
|
20
20
|
this.native = native;
|
|
21
21
|
}
|
|
22
22
|
async waitEvent() {
|
|
23
|
-
if (this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
return await this.native.waitEvent(this.servicePtr, []);
|
|
28
|
-
}
|
|
29
|
-
finally {
|
|
30
|
-
this.isPending = false;
|
|
23
|
+
if (!this.deferedPromise) {
|
|
24
|
+
this.deferedPromise = this.native.waitEvent(this.servicePtr, []);
|
|
25
|
+
this.deferedPromise.finally(() => (this.deferedPromise = null));
|
|
31
26
|
}
|
|
27
|
+
return this.deferedPromise;
|
|
32
28
|
}
|
|
33
29
|
async emitBreakEvent() {
|
|
34
30
|
return this.native.emitBreakEvent(this.servicePtr, []);
|
|
@@ -8,20 +8,20 @@ export declare class ExtKey extends BaseApi {
|
|
|
8
8
|
* Creates ExtKey from given seed.
|
|
9
9
|
* @param {Uint8Array} seed the seed used to generate Key
|
|
10
10
|
* @returns {ExtKey} object
|
|
11
|
-
|
|
11
|
+
*/
|
|
12
12
|
static fromSeed(seed: Uint8Array): Promise<ExtKey>;
|
|
13
13
|
/**
|
|
14
14
|
* Decodes ExtKey from Base58 format.
|
|
15
15
|
*
|
|
16
16
|
* @param {string} base58 the ExtKey in Base58
|
|
17
17
|
* @returns {ExtKey} object
|
|
18
|
-
|
|
18
|
+
*/
|
|
19
19
|
static fromBase58(base58: string): Promise<ExtKey>;
|
|
20
20
|
/**
|
|
21
21
|
* Generates a new ExtKey.
|
|
22
22
|
*
|
|
23
23
|
* @returns {ExtKey} object
|
|
24
|
-
|
|
24
|
+
*/
|
|
25
25
|
static generateRandom(): Promise<ExtKey>;
|
|
26
26
|
/**
|
|
27
27
|
* //doc-gen:ignore
|
|
@@ -48,37 +48,37 @@ export declare class ExtKey extends BaseApi {
|
|
|
48
48
|
* Converts ExtKey to Base58 string.
|
|
49
49
|
*
|
|
50
50
|
* @returns {string} ExtKey in Base58 format
|
|
51
|
-
|
|
51
|
+
*/
|
|
52
52
|
getPrivatePartAsBase58(): Promise<string>;
|
|
53
53
|
/**
|
|
54
54
|
* Converts the public part of ExtKey to Base58 string.
|
|
55
55
|
*
|
|
56
56
|
* @returns {string} ExtKey in Base58 format
|
|
57
|
-
|
|
57
|
+
*/
|
|
58
58
|
getPublicPartAsBase58(): Promise<string>;
|
|
59
59
|
/**
|
|
60
60
|
* Extracts ECC PrivateKey.
|
|
61
61
|
*
|
|
62
62
|
* @returns {string} ECC key in WIF format
|
|
63
|
-
|
|
63
|
+
*/
|
|
64
64
|
getPrivateKey(): Promise<string>;
|
|
65
65
|
/**
|
|
66
66
|
* Extracts ECC PublicKey.
|
|
67
67
|
*
|
|
68
68
|
* @returns {string} ECC key in BASE58DER format
|
|
69
|
-
|
|
69
|
+
*/
|
|
70
70
|
getPublicKey(): Promise<string>;
|
|
71
71
|
/**
|
|
72
72
|
* Extracts raw ECC PrivateKey.
|
|
73
73
|
*
|
|
74
74
|
* @returns {Uint8Array} ECC PrivateKey
|
|
75
|
-
|
|
75
|
+
*/
|
|
76
76
|
getPrivateEncKey(): Promise<Uint8Array>;
|
|
77
77
|
/**
|
|
78
78
|
* Extracts ECC PublicKey Address.
|
|
79
79
|
*
|
|
80
80
|
* @returns {string} ECC Address in BASE58 format
|
|
81
|
-
|
|
81
|
+
*/
|
|
82
82
|
getPublicKeyAsBase58Address(): Promise<string>;
|
|
83
83
|
/**
|
|
84
84
|
* Gets the chain code of Extended Key.
|
|
@@ -98,6 +98,6 @@ export declare class ExtKey extends BaseApi {
|
|
|
98
98
|
* Checks if ExtKey is Private.
|
|
99
99
|
*
|
|
100
100
|
* @returns {boolean} true if ExtKey is private
|
|
101
|
-
|
|
101
|
+
*/
|
|
102
102
|
isPrivate(): Promise<boolean>;
|
|
103
103
|
}
|
|
@@ -16,7 +16,7 @@ class ExtKey extends BaseApi_1.BaseApi {
|
|
|
16
16
|
* Creates ExtKey from given seed.
|
|
17
17
|
* @param {Uint8Array} seed the seed used to generate Key
|
|
18
18
|
* @returns {ExtKey} object
|
|
19
|
-
|
|
19
|
+
*/
|
|
20
20
|
static async fromSeed(seed) {
|
|
21
21
|
const ptr = await ExtKeyNative_1.ExtKeyNative.fromSeed([seed]);
|
|
22
22
|
const native = new ExtKeyNative_1.ExtKeyNative(ApiStatic_1.ApiStatic.getInstance());
|
|
@@ -30,7 +30,7 @@ class ExtKey extends BaseApi_1.BaseApi {
|
|
|
30
30
|
*
|
|
31
31
|
* @param {string} base58 the ExtKey in Base58
|
|
32
32
|
* @returns {ExtKey} object
|
|
33
|
-
|
|
33
|
+
*/
|
|
34
34
|
static async fromBase58(base58) {
|
|
35
35
|
const ptr = await ExtKeyNative_1.ExtKeyNative.fromBase58([base58]);
|
|
36
36
|
const native = new ExtKeyNative_1.ExtKeyNative(ApiStatic_1.ApiStatic.getInstance());
|
|
@@ -43,7 +43,7 @@ class ExtKey extends BaseApi_1.BaseApi {
|
|
|
43
43
|
* Generates a new ExtKey.
|
|
44
44
|
*
|
|
45
45
|
* @returns {ExtKey} object
|
|
46
|
-
|
|
46
|
+
*/
|
|
47
47
|
static async generateRandom() {
|
|
48
48
|
const ptr = await ExtKeyNative_1.ExtKeyNative.generateRandom([]);
|
|
49
49
|
const native = new ExtKeyNative_1.ExtKeyNative(ApiStatic_1.ApiStatic.getInstance());
|
|
@@ -93,7 +93,7 @@ class ExtKey extends BaseApi_1.BaseApi {
|
|
|
93
93
|
* Converts ExtKey to Base58 string.
|
|
94
94
|
*
|
|
95
95
|
* @returns {string} ExtKey in Base58 format
|
|
96
|
-
|
|
96
|
+
*/
|
|
97
97
|
async getPrivatePartAsBase58() {
|
|
98
98
|
return this.native.getPrivatePartAsBase58(this.servicePtr, []);
|
|
99
99
|
}
|
|
@@ -101,7 +101,7 @@ class ExtKey extends BaseApi_1.BaseApi {
|
|
|
101
101
|
* Converts the public part of ExtKey to Base58 string.
|
|
102
102
|
*
|
|
103
103
|
* @returns {string} ExtKey in Base58 format
|
|
104
|
-
|
|
104
|
+
*/
|
|
105
105
|
async getPublicPartAsBase58() {
|
|
106
106
|
return this.native.getPublicPartAsBase58(this.servicePtr, []);
|
|
107
107
|
}
|
|
@@ -109,7 +109,7 @@ class ExtKey extends BaseApi_1.BaseApi {
|
|
|
109
109
|
* Extracts ECC PrivateKey.
|
|
110
110
|
*
|
|
111
111
|
* @returns {string} ECC key in WIF format
|
|
112
|
-
|
|
112
|
+
*/
|
|
113
113
|
async getPrivateKey() {
|
|
114
114
|
return this.native.getPrivateKey(this.servicePtr, []);
|
|
115
115
|
}
|
|
@@ -117,7 +117,7 @@ class ExtKey extends BaseApi_1.BaseApi {
|
|
|
117
117
|
* Extracts ECC PublicKey.
|
|
118
118
|
*
|
|
119
119
|
* @returns {string} ECC key in BASE58DER format
|
|
120
|
-
|
|
120
|
+
*/
|
|
121
121
|
async getPublicKey() {
|
|
122
122
|
return this.native.getPublicKey(this.servicePtr, []);
|
|
123
123
|
}
|
|
@@ -125,7 +125,7 @@ class ExtKey extends BaseApi_1.BaseApi {
|
|
|
125
125
|
* Extracts raw ECC PrivateKey.
|
|
126
126
|
*
|
|
127
127
|
* @returns {Uint8Array} ECC PrivateKey
|
|
128
|
-
|
|
128
|
+
*/
|
|
129
129
|
async getPrivateEncKey() {
|
|
130
130
|
return this.native.getPrivateEncKey(this.servicePtr, []);
|
|
131
131
|
}
|
|
@@ -133,7 +133,7 @@ class ExtKey extends BaseApi_1.BaseApi {
|
|
|
133
133
|
* Extracts ECC PublicKey Address.
|
|
134
134
|
*
|
|
135
135
|
* @returns {string} ECC Address in BASE58 format
|
|
136
|
-
|
|
136
|
+
*/
|
|
137
137
|
async getPublicKeyAsBase58Address() {
|
|
138
138
|
return this.native.getPublicKeyAsBase58Address(this.servicePtr, []);
|
|
139
139
|
}
|
|
@@ -159,7 +159,7 @@ class ExtKey extends BaseApi_1.BaseApi {
|
|
|
159
159
|
* Checks if ExtKey is Private.
|
|
160
160
|
*
|
|
161
161
|
* @returns {boolean} true if ExtKey is private
|
|
162
|
-
|
|
162
|
+
*/
|
|
163
163
|
async isPrivate() {
|
|
164
164
|
return this.native.isPrivate(this.servicePtr, []);
|
|
165
165
|
}
|
|
@@ -172,11 +172,7 @@ class InboxApi extends BaseApi_1.BaseApi {
|
|
|
172
172
|
* @returns {number} file handle
|
|
173
173
|
*/
|
|
174
174
|
async createFileHandle(publicMeta, privateMeta, fileSize) {
|
|
175
|
-
return this.native.createFileHandle(this.servicePtr, [
|
|
176
|
-
publicMeta,
|
|
177
|
-
privateMeta,
|
|
178
|
-
fileSize,
|
|
179
|
-
]);
|
|
175
|
+
return this.native.createFileHandle(this.servicePtr, [publicMeta, privateMeta, fileSize]);
|
|
180
176
|
}
|
|
181
177
|
/**
|
|
182
178
|
* Sends a file's data chunk to an Inbox.
|
|
@@ -188,11 +184,7 @@ class InboxApi extends BaseApi_1.BaseApi {
|
|
|
188
184
|
* @param {Uint8Array} dataChunk - file chunk to send
|
|
189
185
|
*/
|
|
190
186
|
async writeToFile(inboxHandle, inboxFileHandle, dataChunk) {
|
|
191
|
-
return this.native.writeToFile(this.servicePtr, [
|
|
192
|
-
inboxHandle,
|
|
193
|
-
inboxFileHandle,
|
|
194
|
-
dataChunk,
|
|
195
|
-
]);
|
|
187
|
+
return this.native.writeToFile(this.servicePtr, [inboxHandle, inboxFileHandle, dataChunk]);
|
|
196
188
|
}
|
|
197
189
|
/**
|
|
198
190
|
* Opens a file to read.
|
|
@@ -281,7 +273,11 @@ class InboxApi extends BaseApi_1.BaseApi {
|
|
|
281
273
|
* @param {string} selectorId ID of the selector
|
|
282
274
|
*/
|
|
283
275
|
async buildSubscriptionQuery(eventType, selectorType, selectorId) {
|
|
284
|
-
return this.native.buildSubscriptionQuery(this.servicePtr, [
|
|
276
|
+
return this.native.buildSubscriptionQuery(this.servicePtr, [
|
|
277
|
+
eventType,
|
|
278
|
+
selectorType,
|
|
279
|
+
selectorId,
|
|
280
|
+
]);
|
|
285
281
|
}
|
|
286
282
|
}
|
|
287
283
|
exports.InboxApi = InboxApi;
|
|
@@ -151,7 +151,7 @@ class KvdbApi extends BaseApi_1.BaseApi {
|
|
|
151
151
|
publicMeta,
|
|
152
152
|
privateMeta,
|
|
153
153
|
data,
|
|
154
|
-
version || 0
|
|
154
|
+
version || 0,
|
|
155
155
|
]);
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
@@ -171,10 +171,7 @@ class KvdbApi extends BaseApi_1.BaseApi {
|
|
|
171
171
|
* @returns {Map<string, boolean>} map with the statuses of deletion for every key
|
|
172
172
|
*/
|
|
173
173
|
async deleteEntries(kvdbId, keys) {
|
|
174
|
-
return this.native.deleteEntries(this.servicePtr, [
|
|
175
|
-
kvdbId,
|
|
176
|
-
keys,
|
|
177
|
-
]);
|
|
174
|
+
return this.native.deleteEntries(this.servicePtr, [kvdbId, keys]);
|
|
178
175
|
}
|
|
179
176
|
// /**
|
|
180
177
|
// * Subscribes for the KVDB module main events.
|
|
@@ -227,7 +224,11 @@ class KvdbApi extends BaseApi_1.BaseApi {
|
|
|
227
224
|
* @param {string} selectorId ID of the selector
|
|
228
225
|
*/
|
|
229
226
|
async buildSubscriptionQuery(eventType, selectorType, selectorId) {
|
|
230
|
-
return this.native.buildSubscriptionQuery(this.servicePtr, [
|
|
227
|
+
return this.native.buildSubscriptionQuery(this.servicePtr, [
|
|
228
|
+
eventType,
|
|
229
|
+
selectorType,
|
|
230
|
+
selectorId,
|
|
231
|
+
]);
|
|
231
232
|
}
|
|
232
233
|
/**
|
|
233
234
|
* Generate subscription Query for the KVDB events for single KvdbEntry.
|
|
@@ -236,7 +237,11 @@ class KvdbApi extends BaseApi_1.BaseApi {
|
|
|
236
237
|
* @param {string} kvdbEntryKey Key of Kvdb Entry
|
|
237
238
|
*/
|
|
238
239
|
async buildSubscriptionQueryForSelectedEntry(eventType, kvdbId, kvdbEntryKey) {
|
|
239
|
-
return this.native.buildSubscriptionQueryForSelectedEntry(this.servicePtr, [
|
|
240
|
+
return this.native.buildSubscriptionQueryForSelectedEntry(this.servicePtr, [
|
|
241
|
+
eventType,
|
|
242
|
+
kvdbId,
|
|
243
|
+
kvdbEntryKey,
|
|
244
|
+
]);
|
|
240
245
|
}
|
|
241
246
|
}
|
|
242
247
|
exports.KvdbApi = KvdbApi;
|
|
@@ -37,7 +37,7 @@ class StoreApi extends BaseApi_1.BaseApi {
|
|
|
37
37
|
managers,
|
|
38
38
|
publicMeta,
|
|
39
39
|
privateMeta,
|
|
40
|
-
policies
|
|
40
|
+
policies,
|
|
41
41
|
]);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
@@ -64,7 +64,7 @@ class StoreApi extends BaseApi_1.BaseApi {
|
|
|
64
64
|
version,
|
|
65
65
|
force,
|
|
66
66
|
forceGenerateNewKey,
|
|
67
|
-
policies
|
|
67
|
+
policies,
|
|
68
68
|
]);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
@@ -110,7 +110,7 @@ class StoreApi extends BaseApi_1.BaseApi {
|
|
|
110
110
|
publicMeta,
|
|
111
111
|
privateMeta,
|
|
112
112
|
size,
|
|
113
|
-
randomWriteSupport
|
|
113
|
+
randomWriteSupport,
|
|
114
114
|
]);
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
@@ -123,12 +123,7 @@ class StoreApi extends BaseApi_1.BaseApi {
|
|
|
123
123
|
* @returns {number} handle to write file data
|
|
124
124
|
*/
|
|
125
125
|
async updateFile(fileId, publicMeta, privateMeta, size) {
|
|
126
|
-
return this.native.updateFile(this.servicePtr, [
|
|
127
|
-
fileId,
|
|
128
|
-
publicMeta,
|
|
129
|
-
privateMeta,
|
|
130
|
-
size,
|
|
131
|
-
]);
|
|
126
|
+
return this.native.updateFile(this.servicePtr, [fileId, publicMeta, privateMeta, size]);
|
|
132
127
|
}
|
|
133
128
|
/**
|
|
134
129
|
* Update metadata of an existing file in a Store.
|
|
@@ -138,11 +133,7 @@ class StoreApi extends BaseApi_1.BaseApi {
|
|
|
138
133
|
* @param {Uint8Array} privateMeta private file metadata
|
|
139
134
|
*/
|
|
140
135
|
async updateFileMeta(fileId, publicMeta, privateMeta) {
|
|
141
|
-
return this.native.updateFileMeta(this.servicePtr, [
|
|
142
|
-
fileId,
|
|
143
|
-
publicMeta,
|
|
144
|
-
privateMeta,
|
|
145
|
-
]);
|
|
136
|
+
return this.native.updateFileMeta(this.servicePtr, [fileId, publicMeta, privateMeta]);
|
|
146
137
|
}
|
|
147
138
|
/**
|
|
148
139
|
* Writes a file data.
|
|
@@ -276,7 +267,11 @@ class StoreApi extends BaseApi_1.BaseApi {
|
|
|
276
267
|
* @param {string} selectorId ID of the selector
|
|
277
268
|
*/
|
|
278
269
|
async buildSubscriptionQuery(eventType, selectorType, selectorId) {
|
|
279
|
-
return this.native.buildSubscriptionQuery(this.servicePtr, [
|
|
270
|
+
return this.native.buildSubscriptionQuery(this.servicePtr, [
|
|
271
|
+
eventType,
|
|
272
|
+
selectorType,
|
|
273
|
+
selectorId,
|
|
274
|
+
]);
|
|
280
275
|
}
|
|
281
276
|
}
|
|
282
277
|
exports.StoreApi = StoreApi;
|