Compare commits

..

No commits in common. "f7b912940134698bb9273b9e2daea162d1927088" and "96ee5b03e6dd73eeb41ed10861447fce579ce88d" have entirely different histories.

4 changed files with 6 additions and 3 deletions

View File

@ -66,6 +66,7 @@ export class WalletService {
throw new Error(`[WalletService] Échec: ${e}`); throw new Error(`[WalletService] Échec: ${e}`);
} }
} }
// -------------------------
public async saveDeviceInDatabase(device: Device): Promise<void> { public async saveDeviceInDatabase(device: Device): Promise<void> {
await this.db.saveDevice(device); await this.db.saveDevice(device);

View File

@ -516,6 +516,7 @@ export class IframeController {
// Nous appelons handleApiReturn ici, comme avant. // Nous appelons handleApiReturn ici, comme avant.
await services.handleApiReturn(res); await services.handleApiReturn(res);
// --- FIN DE LA MODIFICATION ---
window.parent.postMessage( window.parent.postMessage(
{ {

View File

@ -37,8 +37,6 @@ export default class Services {
// Utilisation de la config // Utilisation de la config
this.networkService = new NetworkService(APP_CONFIG.URLS.BOOTSTRAP); this.networkService = new NetworkService(APP_CONFIG.URLS.BOOTSTRAP);
this.cryptoService = new CryptoService(this.sdkService); this.cryptoService = new CryptoService(this.sdkService);
this.walletService = new WalletService(this.sdkService, null as any);
this.processService = new ProcessService(this.sdkService, null as any);
} }
public static async getInstance(): Promise<Services> { public static async getInstance(): Promise<Services> {
@ -698,7 +696,7 @@ export default class Services {
const dev = await this.walletService.getDeviceFromDatabase(); const dev = await this.walletService.getDeviceFromDatabase();
if (dev && dev.pairing_process_commitment === pid) { if (dev && dev.pairing_process_commitment === pid) {
const last = updated.current_process.states[updated.current_process.states.length - 1]; const last = updated.current_process.states[updated.current_process.states.length - 1];
// if (last?.public_data['pairedAddresses']) await this.confirmPairing(); if (last?.public_data['pairedAddresses']) await this.confirmPairing();
} }
} }

View File

@ -3,6 +3,7 @@ import axios, { AxiosResponse } from 'axios';
export async function storeData(servers: string[], key: string, value: Blob, ttl: number | null): Promise<AxiosResponse | null> { export async function storeData(servers: string[], key: string, value: Blob, ttl: number | null): Promise<AxiosResponse | null> {
for (const server of servers) { for (const server of servers) {
try { try {
// --- DÉBUT DE LA CORRECTION ---
// 1. On vérifie d'abord si la donnée existe en appelant le bon service // 1. On vérifie d'abord si la donnée existe en appelant le bon service
// On passe 'server' au lieu de 'url' pour que testData construise la bonne URL // On passe 'server' au lieu de 'url' pour que testData construise la bonne URL
const dataExists = await testData(server, key); const dataExists = await testData(server, key);
@ -13,6 +14,7 @@ export async function storeData(servers: string[], key: string, value: Blob, ttl
} else { } else {
console.log('Data not stored for server, proceeding to POST:', key, server); console.log('Data not stored for server, proceeding to POST:', key, server);
} }
// --- FIN DE LA CORRECTION ---
// Construction de l'URL pour le POST (stockage) // Construction de l'URL pour le POST (stockage)
@ -110,6 +112,7 @@ interface TestResponse {
value: boolean; value: boolean;
} }
// --- FONCTION testData CORRIGÉE ---
// Elle prend 'server' au lieu de 'url' et construit sa propre URL '/test/...' // Elle prend 'server' au lieu de 'url' et construit sa propre URL '/test/...'
export async function testData(server: string, key: string): Promise<boolean> { export async function testData(server: string, key: string): Promise<boolean> {
try { try {