Add fetchValueFromStorage

This commit is contained in:
Sosthene 2024-12-17 23:58:33 +01:00
parent ceccbb0df3
commit f400139052

View File

@ -546,14 +546,24 @@ export default class Services {
if (state.merkle_root === "") {
continue;
}
if (!state.encrypted_pcd) {
console.warn('Empty encrypted pcd, skipping...');
continue;
}
for (const [field, hash] of Object.entries(state.pcd_commitment)) {
// get the encrypted value with the field name
const value = state.encrypted_pcd[field];
await storeData(storages, hash, value, null);
}
}
}
public async fetchValueFromStorage(hash: string): Promise<any | null> {
const storages = [storageUrl];
return await retrieveData(storages, hash);
}
public async saveDiffs(diffs: UserDiff[]) {
const db = await Database.getInstance();
try {