Add getBlobFromDb

This commit is contained in:
NicolasCantu 2025-02-13 10:21:44 +01:00
parent 422fa2469b
commit 57684eba6b

View File

@ -929,7 +929,7 @@ export default class Services {
if (state_ids.includes(state.state_id)) {
for (const [field, hash] of Object.entries(state.pcd_commitment)) {
// get the encrypted value with the field name
const value = state.encrypted_pcd[field];
const value = await getBlobFromDb(hash);
await storeData(storages, hash, value, null);
}
}
@ -949,6 +949,15 @@ export default class Services {
}
}
public async getBlobFromDb(hash: string): Promise<Blob> {
const db = await Database.getInstance();
try {
return await db.getObject('data', hash);
} catch (e) {
throw new Error(`Failed to save process: ${e}`);
}
}
public async saveDataToStorage(hash: string, data: string, ttl: number | null) {
const storages = [STORAGEURL];