@simplito/privmx-webendpoint
Version:
PrivMX Web Endpoint library
125 lines (122 loc) • 4.68 kB
TypeScript
/*!
PrivMX Web Endpoint.
Copyright © 2024 Simplito sp. z o.o.
This file is part of the PrivMX Platform (https://privmx.dev).
This software is Licensed under the PrivMX Free License.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { PKIVerificationOptions } from "../Types";
import { Connection } from "./Connection";
import { CryptoApi } from "./CryptoApi";
import { EventApi } from "./EventApi";
import { EventQueue } from "./EventQueue";
import { InboxApi } from "./InboxApi";
import { KvdbApi } from "./KvdbApi";
import { StoreApi } from "./StoreApi";
import { StreamApi } from "./StreamApi";
import { ThreadApi } from "./ThreadApi";
/**
* Contains static factory methods - generators for Connection and APIs.
*/
export declare class EndpointFactory {
private static api;
private static eventQueueInstance;
private static assetsBasePath;
/**
* Load the Endpoint's WASM assets and initialize the Endpoint library.
*
* @param {string} [assetsBasePath] base path/url to the Endpoint's WebAssembly assets (like: endpoint-wasm-module.js, driver-web-context.js and others)
*/
static setup(assetsBasePath?: string): Promise<void>;
private static resolveAssetsBasePath;
private static normalizeBasePath;
private static buildAssetUrl;
private static loadScript;
/**
* //doc-gen:ignore
*/
private static init;
/**
* Gets the EventQueue instance.
*
* @returns {EventQueue} instance of EventQueue
*/
static getEventQueue(): Promise<EventQueue>;
private static generateDefaultPKIVerificationOptions;
/**
* Connects to the platform backend.
*
* @param {string} userPrivKey user's private key
* @param {string} solutionId ID of the Solution
* @param {string} bridgeUrl the Bridge Server URL
* @param {PKIVerificationOptions} [verificationOptions] PrivMX Bridge server instance verification options using a PKI server
* @returns {Connection} instance of Connection
*/
static connect(userPrivKey: string, solutionId: string, bridgeUrl: string, verificationOptions?: PKIVerificationOptions): Promise<Connection>;
/**
* Connects to the Platform backend as a guest user.
*
* @param {string} solutionId ID of the Solution
* @param {string} bridgeUrl the Bridge Server URL
* @param {PKIVerificationOptions} [verificationOptions] PrivMX Bridge server instance verification options using a PKI server
* @returns {Connection} instance of Connection
*/
static connectPublic(solutionId: string, bridgeUrl: string, verificationOptions?: PKIVerificationOptions): Promise<Connection>;
/**
* Creates an instance of the Thread API.
*
* @param {Connection} connection instance of Connection
*
* @returns {ThreadApi} instance of ThreadApi
*/
static createThreadApi(connection: Connection): Promise<ThreadApi>;
/**
* Creates an instance of the Store API.
*
* @param {Connection} connection instance of Connection
*
* @returns {StoreApi} instance of StoreApi
*/
static createStoreApi(connection: Connection): Promise<StoreApi>;
/**
* Creates an instance of the Inbox API.
*
* @param {Connection} connection instance of Connection
* @param {ThreadApi} threadApi instance of ThreadApi
* @param {StoreApi} storeApi instance of StoreApi
* @returns {InboxApi} instance of InboxApi
*/
static createInboxApi(connection: Connection, threadApi: ThreadApi, storeApi: StoreApi): Promise<InboxApi>;
/**
* Creates an instance of the Kvdb API.
*
* @param {Connection} connection instance of Connection
*
* @returns {KvdbApi} instance of KvdbApi
*/
static createKvdbApi(connection: Connection): Promise<KvdbApi>;
/**
* Creates an instance of the Crypto API.
*
* @returns {CryptoApi} instance of CryptoApi
*/
static createCryptoApi(): Promise<CryptoApi>;
/**
* Creates an instance of 'EventApi'.
*
* @param connection instance of 'Connection'
*
* @returns {EventApi} instance of EventApi
*/
static createEventApi(connection: Connection): Promise<EventApi>;
/**
* Creates an instance of the Stream API.
*
* @param {Connection} connection instance of Connection
* @param {EventApi} eventApi instance of EventApi
* @param {StoreApi} storeApi instance of StoreApi
* @returns {StreamApi} instance of StreamApi
*/
static createStreamApi(connection: Connection, eventApi: EventApi): Promise<StreamApi>;
}