gun-eth 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +14 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -314,7 +314,7 @@ Gun.chain.batchVerify = async function (nodeIds, dataArray) {
|
|
314
314
|
for (let i = 0; i < nodeIds.length; i++) {
|
315
315
|
const dataString = JSON.stringify(dataArray[i]);
|
316
316
|
const contentHash = ethers.keccak256(ethers.toUtf8Bytes(dataString));
|
317
|
-
const isVerified = await
|
317
|
+
const isVerified = await verifyOnChain(nodeIds[i], contentHash);
|
318
318
|
results.push({
|
319
319
|
nodeId: nodeIds[i],
|
320
320
|
isVerified: isVerified,
|
@@ -323,3 +323,16 @@ Gun.chain.batchVerify = async function (nodeIds, dataArray) {
|
|
323
323
|
|
324
324
|
return results;
|
325
325
|
};
|
326
|
+
|
327
|
+
// Aggiungi questa funzione per la verifica singola
|
328
|
+
Gun.chain.verifyOnly = async function (nodeId, data) {
|
329
|
+
try {
|
330
|
+
const dataString = JSON.stringify(data);
|
331
|
+
const contentHash = ethers.keccak256(ethers.toUtf8Bytes(dataString));
|
332
|
+
const isVerified = await verifyOnChain(nodeId, contentHash);
|
333
|
+
return isVerified;
|
334
|
+
} catch (error) {
|
335
|
+
console.error("Errore durante la verifica:", error);
|
336
|
+
return null;
|
337
|
+
}
|
338
|
+
};
|