Compare commits
3 Commits
d78dc14a2b
...
77019896e5
| Author | SHA1 | Date | |
|---|---|---|---|
| 77019896e5 | |||
| 81025dca42 | |||
| 6dd8ce730f |
@ -78,8 +78,6 @@ function getMultipleObjects(db, storeName, keys) {
|
|||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
async function scanMissingData(processesToScan) {
|
async function scanMissingData(processesToScan) {
|
||||||
console.log("[Service Worker] 🚀 Scanning with DIRECT DB ACCESS...");
|
|
||||||
|
|
||||||
let db;
|
let db;
|
||||||
try {
|
try {
|
||||||
db = await openDB();
|
db = await openDB();
|
||||||
@ -103,7 +101,6 @@ async function scanMissingData(processesToScan) {
|
|||||||
if (!process || !process.states) continue;
|
if (!process || !process.states) continue;
|
||||||
|
|
||||||
const firstState = process.states[0];
|
const firstState = process.states[0];
|
||||||
// Sécurisation : on vérifie que firstState existe
|
|
||||||
if (!firstState) continue;
|
if (!firstState) continue;
|
||||||
|
|
||||||
const processId = firstState.commited_in;
|
const processId = firstState.commited_in;
|
||||||
@ -112,7 +109,6 @@ async function scanMissingData(processesToScan) {
|
|||||||
if (state.state_id === EMPTY32BYTES) continue;
|
if (state.state_id === EMPTY32BYTES) continue;
|
||||||
|
|
||||||
for (const [field, hash] of Object.entries(state.pcd_commitment)) {
|
for (const [field, hash] of Object.entries(state.pcd_commitment)) {
|
||||||
// On ignore les données publiques ou les rôles
|
|
||||||
if (
|
if (
|
||||||
(state.public_data && state.public_data[field] !== undefined) ||
|
(state.public_data && state.public_data[field] !== undefined) ||
|
||||||
field === "roles"
|
field === "roles"
|
||||||
@ -144,7 +140,6 @@ async function scanMissingData(processesToScan) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Si on a trouvé la donnée, on est sûr de ne pas avoir besoin de la télécharger
|
|
||||||
if (toDownload.has(hash)) {
|
if (toDownload.has(hash)) {
|
||||||
toDownload.delete(hash);
|
toDownload.delete(hash);
|
||||||
}
|
}
|
||||||
@ -154,13 +149,17 @@ async function scanMissingData(processesToScan) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// On ferme la connexion BDD pour libérer les ressources
|
// On ferme la connexion BDD
|
||||||
db.close();
|
db.close();
|
||||||
|
|
||||||
console.log("[Service Worker] Scan complete:", {
|
// ✅ LOG PERTINENT UNIQUEMENT : On n'affiche que si on a trouvé quelque chose
|
||||||
|
if (toDownload.size > 0 || diffsToCreate.length > 0) {
|
||||||
|
console.log("[Service Worker] 🔄 Scan found items:", {
|
||||||
toDownload: toDownload.size,
|
toDownload: toDownload.size,
|
||||||
diffsToCreate: diffsToCreate.length,
|
diffsToCreate: diffsToCreate.length,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
toDownload: Array.from(toDownload),
|
toDownload: Array.from(toDownload),
|
||||||
diffsToCreate: diffsToCreate,
|
diffsToCreate: diffsToCreate,
|
||||||
|
|||||||
@ -143,7 +143,6 @@ export class Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
navigator.serviceWorker.addEventListener("message", async (event) => {
|
navigator.serviceWorker.addEventListener("message", async (event) => {
|
||||||
// ✅ SIMPLIFICATION : Plus besoin de gérer les "DB_REQUEST"
|
|
||||||
await this.handleServiceWorkerMessage(event.data);
|
await this.handleServiceWorkerMessage(event.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -207,8 +206,6 @@ export class Database {
|
|||||||
// SERVICE WORKER MESSAGE HANDLERS
|
// SERVICE WORKER MESSAGE HANDLERS
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
// ✅ NETTOYAGE : handleDatabaseRequest() a été supprimé
|
|
||||||
|
|
||||||
private async handleServiceWorkerMessage(message: any) {
|
private async handleServiceWorkerMessage(message: any) {
|
||||||
switch (message.type) {
|
switch (message.type) {
|
||||||
case "TO_DOWNLOAD":
|
case "TO_DOWNLOAD":
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
import * as Comlink from 'comlink';
|
import * as Comlink from "comlink";
|
||||||
import { ApiReturn, Device, Member, MerkleProofResult, Process, ProcessState, SecretsStore, UserDiff } from '../../pkg/sdk_client';
|
import {
|
||||||
import { BackUp } from '../types/index';
|
ApiReturn,
|
||||||
import { APP_CONFIG } from '../config/constants';
|
Device,
|
||||||
import { NetworkService } from './core/network.service';
|
Member,
|
||||||
import type { CoreBackend } from '../workers/core.worker';
|
MerkleProofResult,
|
||||||
|
Process,
|
||||||
|
ProcessState,
|
||||||
|
SecretsStore,
|
||||||
|
UserDiff,
|
||||||
|
} from "../../pkg/sdk_client";
|
||||||
|
import { BackUp } from "../types/index";
|
||||||
|
import { APP_CONFIG } from "../config/constants";
|
||||||
|
import { NetworkService } from "./core/network.service";
|
||||||
|
import type { CoreBackend } from "../workers/core.worker";
|
||||||
|
import Database from "./database.service";
|
||||||
|
|
||||||
export default class Services {
|
export default class Services {
|
||||||
private static instance: Services;
|
private static instance: Services;
|
||||||
@ -21,8 +31,8 @@ export default class Services {
|
|||||||
|
|
||||||
// Initialisation du Core Worker
|
// Initialisation du Core Worker
|
||||||
this.workerInstance = new Worker(
|
this.workerInstance = new Worker(
|
||||||
new URL('../workers/core.worker.ts', import.meta.url),
|
new URL("../workers/core.worker.ts", import.meta.url),
|
||||||
{ type: 'module' }
|
{ type: "module" }
|
||||||
);
|
);
|
||||||
this.coreWorker = Comlink.wrap<CoreBackend>(this.workerInstance);
|
this.coreWorker = Comlink.wrap<CoreBackend>(this.workerInstance);
|
||||||
}
|
}
|
||||||
@ -41,12 +51,13 @@ export default class Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async init(): Promise<void> {
|
public async init(): Promise<void> {
|
||||||
console.log('[Services] 🚀 Démarrage Proxy...');
|
console.log("[Services] 🚀 Démarrage Proxy...");
|
||||||
|
|
||||||
// 1. Initialiser le Core Worker
|
// 1. Initialiser le Core Worker
|
||||||
await this.coreWorker.init();
|
await this.coreWorker.init();
|
||||||
|
// 2. Initialiser la Database ici (Main Thread) pour lancer le SW
|
||||||
// 2. Configurer les Callbacks (Le worker pilote le main thread pour le réseau)
|
await Database.getInstance();
|
||||||
|
// 3. Configurer les Callbacks (Le worker pilote le main thread pour le réseau)
|
||||||
await this.coreWorker.setCallbacks(
|
await this.coreWorker.setCallbacks(
|
||||||
Comlink.proxy(this.handleWorkerNotification.bind(this)), // notifier
|
Comlink.proxy(this.handleWorkerNotification.bind(this)), // notifier
|
||||||
Comlink.proxy(this.handleWorkerNetworkSend.bind(this)), // networkSender
|
Comlink.proxy(this.handleWorkerNetworkSend.bind(this)), // networkSender
|
||||||
@ -57,7 +68,9 @@ export default class Services {
|
|||||||
// 3. Initialiser le Réseau (Network Worker via Proxy)
|
// 3. Initialiser le Réseau (Network Worker via Proxy)
|
||||||
await this.networkService.initRelays();
|
await this.networkService.initRelays();
|
||||||
|
|
||||||
console.log('[Services] ✅ Proxy connecté au CoreWorker et NetworkService.');
|
console.log(
|
||||||
|
"[Services] ✅ Proxy connecté au CoreWorker et NetworkService."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
@ -85,155 +98,345 @@ export default class Services {
|
|||||||
// ==========================================
|
// ==========================================
|
||||||
public async dispatchToWorker(flag: string, content: string, url: string) {
|
public async dispatchToWorker(flag: string, content: string, url: string) {
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
case 'Handshake': await this.coreWorker.handleHandshakeMsg(url, content); break;
|
case "Handshake":
|
||||||
case 'NewTx': await this.coreWorker.parseNewTx(content); break;
|
await this.coreWorker.handleHandshakeMsg(url, content);
|
||||||
case 'Cipher': await this.coreWorker.parseCipher(content); break;
|
break;
|
||||||
case 'Commit': await this.coreWorker.handleCommitError(content); break;
|
case "NewTx":
|
||||||
|
await this.coreWorker.parseNewTx(content);
|
||||||
|
break;
|
||||||
|
case "Cipher":
|
||||||
|
await this.coreWorker.parseCipher(content);
|
||||||
|
break;
|
||||||
|
case "Commit":
|
||||||
|
await this.coreWorker.handleCommitError(content);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// PROXY - PROPERTIES PUBLIC
|
// PROXY - PROPERTIES PUBLIC
|
||||||
// ==========================================
|
// ==========================================
|
||||||
public async getDevice1() { return await this.coreWorker.getDevice1(); }
|
public async getDevice1() {
|
||||||
public async getDevice2Ready() { return await this.coreWorker.getDevice2Ready(); }
|
return await this.coreWorker.getDevice1();
|
||||||
|
}
|
||||||
|
public async getDevice2Ready() {
|
||||||
|
return await this.coreWorker.getDevice2Ready();
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: getSdkClient renvoie null car l'objet WASM n'est pas transférable hors du worker.
|
// NOTE: getSdkClient renvoie null car l'objet WASM n'est pas transférable hors du worker.
|
||||||
// Toute la logique utilisant le client doit être dans le worker.
|
// Toute la logique utilisant le client doit être dans le worker.
|
||||||
public get sdkClient() { return null; }
|
public get sdkClient() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public async setProcessId(id: string | null) { return await this.coreWorker.setProcessId(id); }
|
public async setProcessId(id: string | null) {
|
||||||
public async setStateId(id: string | null) { return await this.coreWorker.setStateId(id); }
|
return await this.coreWorker.setProcessId(id);
|
||||||
public async getProcessId() { return await this.coreWorker.getProcessId(); }
|
}
|
||||||
public async getStateId() { return await this.coreWorker.getStateId(); }
|
public async setStateId(id: string | null) {
|
||||||
public async resetState() { return await this.coreWorker.resetState(); }
|
return await this.coreWorker.setStateId(id);
|
||||||
|
}
|
||||||
|
public async getProcessId() {
|
||||||
|
return await this.coreWorker.getProcessId();
|
||||||
|
}
|
||||||
|
public async getStateId() {
|
||||||
|
return await this.coreWorker.getStateId();
|
||||||
|
}
|
||||||
|
public async resetState() {
|
||||||
|
return await this.coreWorker.resetState();
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// PROXY - NETWORK PROXY
|
// PROXY - NETWORK PROXY
|
||||||
// ==========================================
|
// ==========================================
|
||||||
public async connectAllRelays() { await this.networkService.connectAllRelays(); }
|
public async connectAllRelays() {
|
||||||
public async addWebsocketConnection(url: string) { await this.networkService.addWebsocketConnection(url); }
|
await this.networkService.connectAllRelays();
|
||||||
public getAllRelays() { return this.networkService.getAllRelays(); }
|
}
|
||||||
public updateRelay(url: string, sp: string) { this.networkService.updateRelay(url, sp); }
|
public async addWebsocketConnection(url: string) {
|
||||||
public getSpAddress(url: string) { return this.networkService.getAllRelays()[url]; }
|
await this.networkService.addWebsocketConnection(url);
|
||||||
|
}
|
||||||
|
public getAllRelays() {
|
||||||
|
return this.networkService.getAllRelays();
|
||||||
|
}
|
||||||
|
public updateRelay(url: string, sp: string) {
|
||||||
|
this.networkService.updateRelay(url, sp);
|
||||||
|
}
|
||||||
|
public getSpAddress(url: string) {
|
||||||
|
return this.networkService.getAllRelays()[url];
|
||||||
|
}
|
||||||
// Délégation directe au NetworkService
|
// Délégation directe au NetworkService
|
||||||
public printAllRelays() {
|
public printAllRelays() {
|
||||||
// Si NetworkService ne l'expose pas directement dans sa version proxy, on l'ajoute ou on log ici
|
// Si NetworkService ne l'expose pas directement dans sa version proxy, on l'ajoute ou on log ici
|
||||||
console.log('Relays:', this.networkService.getAllRelays());
|
console.log("Relays:", this.networkService.getAllRelays());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// PROXY - WALLET
|
// PROXY - WALLET
|
||||||
// ==========================================
|
// ==========================================
|
||||||
public async isPaired() { return await this.coreWorker.isPaired(); }
|
public async isPaired() {
|
||||||
public async getAmount() { return await this.coreWorker.getAmount(); }
|
return await this.coreWorker.isPaired();
|
||||||
public async getDeviceAddress() { return await this.coreWorker.getDeviceAddress(); }
|
}
|
||||||
public async dumpDeviceFromMemory() { return await this.coreWorker.dumpDeviceFromMemory(); }
|
public async getAmount() {
|
||||||
public async dumpNeuteredDevice() { return await this.coreWorker.dumpNeuteredDevice(); }
|
return await this.coreWorker.getAmount();
|
||||||
public async getPairingProcessId() { return await this.coreWorker.getPairingProcessId(); }
|
}
|
||||||
public async getDeviceFromDatabase() { return await this.coreWorker.getDeviceFromDatabase(); }
|
public async getDeviceAddress() {
|
||||||
public async restoreDevice(d: Device) { await this.coreWorker.restoreDevice(d); }
|
return await this.coreWorker.getDeviceAddress();
|
||||||
public async pairDevice(pid: string, list: string[]) { await this.coreWorker.pairDevice(pid, list); }
|
}
|
||||||
public async unpairDevice() { await this.coreWorker.unpairDevice(); }
|
public async dumpDeviceFromMemory() {
|
||||||
public async saveDeviceInDatabase(d: Device) { await this.coreWorker.saveDeviceInDatabase(d); }
|
return await this.coreWorker.dumpDeviceFromMemory();
|
||||||
public async createNewDevice() { return await this.coreWorker.createNewDevice(); }
|
}
|
||||||
public async dumpWallet() { return await this.coreWorker.dumpWallet(); }
|
public async dumpNeuteredDevice() {
|
||||||
public async getMemberFromDevice() { return await this.coreWorker.getMemberFromDevice(); }
|
return await this.coreWorker.dumpNeuteredDevice();
|
||||||
|
}
|
||||||
|
public async getPairingProcessId() {
|
||||||
|
return await this.coreWorker.getPairingProcessId();
|
||||||
|
}
|
||||||
|
public async getDeviceFromDatabase() {
|
||||||
|
return await this.coreWorker.getDeviceFromDatabase();
|
||||||
|
}
|
||||||
|
public async restoreDevice(d: Device) {
|
||||||
|
await this.coreWorker.restoreDevice(d);
|
||||||
|
}
|
||||||
|
public async pairDevice(pid: string, list: string[]) {
|
||||||
|
await this.coreWorker.pairDevice(pid, list);
|
||||||
|
}
|
||||||
|
public async unpairDevice() {
|
||||||
|
await this.coreWorker.unpairDevice();
|
||||||
|
}
|
||||||
|
public async saveDeviceInDatabase(d: Device) {
|
||||||
|
await this.coreWorker.saveDeviceInDatabase(d);
|
||||||
|
}
|
||||||
|
public async createNewDevice() {
|
||||||
|
return await this.coreWorker.createNewDevice();
|
||||||
|
}
|
||||||
|
public async dumpWallet() {
|
||||||
|
return await this.coreWorker.dumpWallet();
|
||||||
|
}
|
||||||
|
public async getMemberFromDevice() {
|
||||||
|
return await this.coreWorker.getMemberFromDevice();
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// PROXY - PROCESS
|
// PROXY - PROCESS
|
||||||
// ==========================================
|
// ==========================================
|
||||||
public async getProcess(id: string) { return await this.coreWorker.getProcess(id); }
|
public async getProcess(id: string) {
|
||||||
public async getProcesses() { return await this.coreWorker.getProcesses(); }
|
return await this.coreWorker.getProcess(id);
|
||||||
public async restoreProcessesFromDB() { await this.coreWorker.restoreProcessesFromDB(); }
|
}
|
||||||
public async getLastCommitedState(p: Process) { return await this.coreWorker.getLastCommitedState(p); }
|
public async getProcesses() {
|
||||||
public async getUncommitedStates(p: Process) { return await this.coreWorker.getUncommitedStates(p); }
|
return await this.coreWorker.getProcesses();
|
||||||
public async getStateFromId(p: Process, id: string) { return await this.coreWorker.getStateFromId(p, id); }
|
}
|
||||||
public async getRoles(p: Process) { return await this.coreWorker.getRoles(p); }
|
public async restoreProcessesFromDB() {
|
||||||
public async getLastCommitedStateIndex(p: Process) { return await this.coreWorker.getLastCommitedStateIndex(p); }
|
await this.coreWorker.restoreProcessesFromDB();
|
||||||
public async batchSaveProcessesToDb(p: Record<string, Process>) { return await this.coreWorker.batchSaveProcessesToDb(p); }
|
}
|
||||||
|
public async getLastCommitedState(p: Process) {
|
||||||
|
return await this.coreWorker.getLastCommitedState(p);
|
||||||
|
}
|
||||||
|
public async getUncommitedStates(p: Process) {
|
||||||
|
return await this.coreWorker.getUncommitedStates(p);
|
||||||
|
}
|
||||||
|
public async getStateFromId(p: Process, id: string) {
|
||||||
|
return await this.coreWorker.getStateFromId(p, id);
|
||||||
|
}
|
||||||
|
public async getRoles(p: Process) {
|
||||||
|
return await this.coreWorker.getRoles(p);
|
||||||
|
}
|
||||||
|
public async getLastCommitedStateIndex(p: Process) {
|
||||||
|
return await this.coreWorker.getLastCommitedStateIndex(p);
|
||||||
|
}
|
||||||
|
public async batchSaveProcessesToDb(p: Record<string, Process>) {
|
||||||
|
return await this.coreWorker.batchSaveProcessesToDb(p);
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// PROXY - CRYPTO
|
// PROXY - CRYPTO
|
||||||
// ==========================================
|
// ==========================================
|
||||||
public async decodeValue(val: number[]) { return await this.coreWorker.decodeValue(val); }
|
public async decodeValue(val: number[]) {
|
||||||
public async hexToBlob(hex: string) { return await this.coreWorker.hexToBlob(hex); }
|
return await this.coreWorker.decodeValue(val);
|
||||||
public async hexToUInt8Array(hex: string) { return await this.coreWorker.hexToUInt8Array(hex); }
|
}
|
||||||
public async blobToHex(blob: Blob) { return await this.coreWorker.blobToHex(blob); }
|
public async hexToBlob(hex: string) {
|
||||||
public async getHashForFile(c: string, l: string, f: any) { return await this.coreWorker.getHashForFile(c, l, f); }
|
return await this.coreWorker.hexToBlob(hex);
|
||||||
public async getMerkleProofForFile(s: ProcessState, a: string) { return await this.coreWorker.getMerkleProofForFile(s, a); }
|
}
|
||||||
public async validateMerkleProof(p: MerkleProofResult, h: string) { return await this.coreWorker.validateMerkleProof(p, h); }
|
public async hexToUInt8Array(hex: string) {
|
||||||
|
return await this.coreWorker.hexToUInt8Array(hex);
|
||||||
|
}
|
||||||
|
public async blobToHex(blob: Blob) {
|
||||||
|
return await this.coreWorker.blobToHex(blob);
|
||||||
|
}
|
||||||
|
public async getHashForFile(c: string, l: string, f: any) {
|
||||||
|
return await this.coreWorker.getHashForFile(c, l, f);
|
||||||
|
}
|
||||||
|
public async getMerkleProofForFile(s: ProcessState, a: string) {
|
||||||
|
return await this.coreWorker.getMerkleProofForFile(s, a);
|
||||||
|
}
|
||||||
|
public async validateMerkleProof(p: MerkleProofResult, h: string) {
|
||||||
|
return await this.coreWorker.validateMerkleProof(p, h);
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// PROXY - MEMBERS
|
// PROXY - MEMBERS
|
||||||
// ==========================================
|
// ==========================================
|
||||||
public async getAllMembers() { return await this.coreWorker.getAllMembers(); }
|
public async getAllMembers() {
|
||||||
public async getAllMembersSorted() { return await this.coreWorker.getAllMembersSorted(); }
|
return await this.coreWorker.getAllMembers();
|
||||||
public async ensureMembersAvailable() { await this.coreWorker.ensureMembersAvailable(); }
|
}
|
||||||
public async getAddressesForMemberId(memberId: string) { return await this.coreWorker.getAddressesForMemberId(memberId); }
|
public async getAllMembersSorted() {
|
||||||
public async compareMembers(mA: string[], mB: string[]) { return await this.coreWorker.compareMembers(mA, mB); }
|
return await this.coreWorker.getAllMembersSorted();
|
||||||
|
}
|
||||||
|
public async ensureMembersAvailable() {
|
||||||
|
await this.coreWorker.ensureMembersAvailable();
|
||||||
|
}
|
||||||
|
public async getAddressesForMemberId(memberId: string) {
|
||||||
|
return await this.coreWorker.getAddressesForMemberId(memberId);
|
||||||
|
}
|
||||||
|
public async compareMembers(mA: string[], mB: string[]) {
|
||||||
|
return await this.coreWorker.compareMembers(mA, mB);
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// PROXY - UTILS
|
// PROXY - UTILS
|
||||||
// ==========================================
|
// ==========================================
|
||||||
public async createFaucetMessage() { return await this.coreWorker.createFaucetMessage(); }
|
public async createFaucetMessage() {
|
||||||
public async isChildRole(parent: any, child: any) { return await this.coreWorker.isChildRole(parent, child); }
|
return await this.coreWorker.createFaucetMessage();
|
||||||
|
}
|
||||||
|
public async isChildRole(parent: any, child: any) {
|
||||||
|
return await this.coreWorker.isChildRole(parent, child);
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// PROXY - LOGIQUE METIER & API
|
// PROXY - LOGIQUE METIER & API
|
||||||
// ==========================================
|
// ==========================================
|
||||||
public async getMyProcesses() { return await this.coreWorker.getMyProcesses(); }
|
public async getMyProcesses() {
|
||||||
public async ensureConnections(p: Process, sId?: string) { await this.coreWorker.ensureConnections(p, sId || null); }
|
return await this.coreWorker.getMyProcesses();
|
||||||
public async connectAddresses(addr: string[]) { return await this.coreWorker.connectAddresses(addr); }
|
}
|
||||||
|
public async ensureConnections(p: Process, sId?: string) {
|
||||||
|
await this.coreWorker.ensureConnections(p, sId || null);
|
||||||
|
}
|
||||||
|
public async connectAddresses(addr: string[]) {
|
||||||
|
return await this.coreWorker.connectAddresses(addr);
|
||||||
|
}
|
||||||
|
|
||||||
public async createPairingProcess(name: string, pairWith: string[]) { return await this.coreWorker.createPairingProcess(name, pairWith); }
|
public async createPairingProcess(name: string, pairWith: string[]) {
|
||||||
public async createProcess(priv: any, pub: any, roles: any) { return await this.coreWorker.createProcess(priv, pub, roles); }
|
return await this.coreWorker.createPairingProcess(name, pairWith);
|
||||||
public async updateProcess(pid: string, newData: any, priv: string[], roles: any) { return await this.coreWorker.updateProcess(pid, newData, priv, roles); }
|
}
|
||||||
|
public async createProcess(priv: any, pub: any, roles: any) {
|
||||||
|
return await this.coreWorker.createProcess(priv, pub, roles);
|
||||||
|
}
|
||||||
|
public async updateProcess(
|
||||||
|
pid: string,
|
||||||
|
newData: any,
|
||||||
|
priv: string[],
|
||||||
|
roles: any
|
||||||
|
) {
|
||||||
|
return await this.coreWorker.updateProcess(pid, newData, priv, roles);
|
||||||
|
}
|
||||||
|
|
||||||
public async createPrdUpdate(pid: string, sid: string) { return await this.coreWorker.createPrdUpdate(pid, sid); }
|
public async createPrdUpdate(pid: string, sid: string) {
|
||||||
public async createPrdResponse(pid: string, sid: string) { return await this.coreWorker.createPrdResponse(pid, sid); }
|
return await this.coreWorker.createPrdUpdate(pid, sid);
|
||||||
public async approveChange(pid: string, sid: string) { return await this.coreWorker.approveChange(pid, sid); }
|
}
|
||||||
public async rejectChange(pid: string, sid: string) { return await this.coreWorker.rejectChange(pid, sid); }
|
public async createPrdResponse(pid: string, sid: string) {
|
||||||
public async requestDataFromPeers(pid: string, sids: string[], roles: any) { await this.coreWorker.requestDataFromPeers(pid, sids, roles); }
|
return await this.coreWorker.createPrdResponse(pid, sid);
|
||||||
|
}
|
||||||
|
public async approveChange(pid: string, sid: string) {
|
||||||
|
return await this.coreWorker.approveChange(pid, sid);
|
||||||
|
}
|
||||||
|
public async rejectChange(pid: string, sid: string) {
|
||||||
|
return await this.coreWorker.rejectChange(pid, sid);
|
||||||
|
}
|
||||||
|
public async requestDataFromPeers(pid: string, sids: string[], roles: any) {
|
||||||
|
await this.coreWorker.requestDataFromPeers(pid, sids, roles);
|
||||||
|
}
|
||||||
|
|
||||||
public async resetDevice() { await this.coreWorker.resetDevice(); }
|
public async resetDevice() {
|
||||||
public async handleApiReturn(res: ApiReturn) { await this.coreWorker.handleApiReturn(res); }
|
await this.coreWorker.resetDevice();
|
||||||
public async saveDiffsToDb(diffs: UserDiff[]) { await this.coreWorker.saveDiffsToDb(diffs); }
|
}
|
||||||
public async handleCommitError(res: string) { await this.coreWorker.handleCommitError(res); }
|
public async handleApiReturn(res: ApiReturn) {
|
||||||
|
await this.coreWorker.handleApiReturn(res);
|
||||||
|
}
|
||||||
|
public async saveDiffsToDb(diffs: UserDiff[]) {
|
||||||
|
await this.coreWorker.saveDiffsToDb(diffs);
|
||||||
|
}
|
||||||
|
public async handleCommitError(res: string) {
|
||||||
|
await this.coreWorker.handleCommitError(res);
|
||||||
|
}
|
||||||
|
|
||||||
public async rolesContainsUs(roles: any) { return await this.coreWorker.rolesContainsUs(roles); }
|
public async rolesContainsUs(roles: any) {
|
||||||
public async getSecretForAddress(addr: string) { return await this.coreWorker.getSecretForAddress(addr); }
|
return await this.coreWorker.rolesContainsUs(roles);
|
||||||
public async getAllDiffs() { return await this.coreWorker.getAllDiffs(); }
|
}
|
||||||
public async getDiffByValue(val: string) { return await this.coreWorker.getDiffByValue(val); }
|
public async getSecretForAddress(addr: string) {
|
||||||
public async getAllSecrets() { return await this.coreWorker.getAllSecrets(); }
|
return await this.coreWorker.getSecretForAddress(addr);
|
||||||
|
}
|
||||||
|
public async getAllDiffs() {
|
||||||
|
return await this.coreWorker.getAllDiffs();
|
||||||
|
}
|
||||||
|
public async getDiffByValue(val: string) {
|
||||||
|
return await this.coreWorker.getDiffByValue(val);
|
||||||
|
}
|
||||||
|
public async getAllSecrets() {
|
||||||
|
return await this.coreWorker.getAllSecrets();
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// PROXY - STORAGE & DB
|
// PROXY - STORAGE & DB
|
||||||
// ==========================================
|
// ==========================================
|
||||||
public async saveBlobToDb(h: string, d: Blob) { await this.coreWorker.saveBlobToDb(h, d); }
|
public async saveBlobToDb(h: string, d: Blob) {
|
||||||
public async getBlobFromDb(h: string) { return await this.coreWorker.getBlobFromDb(h); }
|
await this.coreWorker.saveBlobToDb(h, d);
|
||||||
public async fetchValueFromStorage(h: string) { return await this.coreWorker.fetchValueFromStorage(h); }
|
}
|
||||||
public async saveDataToStorage(s: string[], h: string, d: Blob, ttl: number | null) { return await this.coreWorker.saveDataToStorage(s, h, d, ttl); }
|
public async getBlobFromDb(h: string) {
|
||||||
|
return await this.coreWorker.getBlobFromDb(h);
|
||||||
|
}
|
||||||
|
public async fetchValueFromStorage(h: string) {
|
||||||
|
return await this.coreWorker.fetchValueFromStorage(h);
|
||||||
|
}
|
||||||
|
public async saveDataToStorage(
|
||||||
|
s: string[],
|
||||||
|
h: string,
|
||||||
|
d: Blob,
|
||||||
|
ttl: number | null
|
||||||
|
) {
|
||||||
|
return await this.coreWorker.saveDataToStorage(s, h, d, ttl);
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// PROXY - HELPERS UI & DATA
|
// PROXY - HELPERS UI & DATA
|
||||||
// ==========================================
|
// ==========================================
|
||||||
public async getProcessName(p: Process) { return await this.coreWorker.getProcessName(p); }
|
public async getProcessName(p: Process) {
|
||||||
public async getPublicData(p: Process) { return await this.coreWorker.getPublicData(p); }
|
return await this.coreWorker.getProcessName(p);
|
||||||
public async getNotifications() { return await this.coreWorker.getNotifications(); }
|
}
|
||||||
public async setNotifications(n: any[]) { await this.coreWorker.setNotifications(n); }
|
public async getPublicData(p: Process) {
|
||||||
|
return await this.coreWorker.getPublicData(p);
|
||||||
|
}
|
||||||
|
public async getNotifications() {
|
||||||
|
return await this.coreWorker.getNotifications();
|
||||||
|
}
|
||||||
|
public async setNotifications(n: any[]) {
|
||||||
|
await this.coreWorker.setNotifications(n);
|
||||||
|
}
|
||||||
|
|
||||||
public async parseCipher(msg: string) { await this.coreWorker.parseCipher(msg); }
|
public async parseCipher(msg: string) {
|
||||||
public async parseNewTx(msg: string) { await this.coreWorker.parseNewTx(msg); }
|
await this.coreWorker.parseCipher(msg);
|
||||||
public async updateMemberPublicName(pid: string, name: string) { return await this.coreWorker.updateMemberPublicName(pid, name); }
|
}
|
||||||
|
public async parseNewTx(msg: string) {
|
||||||
|
await this.coreWorker.parseNewTx(msg);
|
||||||
|
}
|
||||||
|
public async updateMemberPublicName(pid: string, name: string) {
|
||||||
|
return await this.coreWorker.updateMemberPublicName(pid, name);
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// PROXY - BACKUP & DECRYPT
|
// PROXY - BACKUP & DECRYPT
|
||||||
// ==========================================
|
// ==========================================
|
||||||
public async importJSON(b: BackUp) { await this.coreWorker.importJSON(b); }
|
public async importJSON(b: BackUp) {
|
||||||
public async restoreSecretsFromBackUp(s: SecretsStore) { await this.coreWorker.restoreSecretsFromBackUp(s); }
|
await this.coreWorker.importJSON(b);
|
||||||
public async restoreSecretsFromDB() { await this.coreWorker.restoreSecretsFromDB(); }
|
}
|
||||||
public async createBackUp() { return await this.coreWorker.createBackUp(); }
|
public async restoreSecretsFromBackUp(s: SecretsStore) {
|
||||||
|
await this.coreWorker.restoreSecretsFromBackUp(s);
|
||||||
public async decryptAttribute(pid: string, s: ProcessState, attr: string) { return await this.coreWorker.decryptAttribute(pid, s, attr); }
|
}
|
||||||
|
public async restoreSecretsFromDB() {
|
||||||
|
await this.coreWorker.restoreSecretsFromDB();
|
||||||
|
}
|
||||||
|
public async createBackUp() {
|
||||||
|
return await this.coreWorker.createBackUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async decryptAttribute(pid: string, s: ProcessState, attr: string) {
|
||||||
|
return await this.coreWorker.decryptAttribute(pid, s, attr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user