gun-eth 1.4.30 → 1.4.32
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/gun-eth.cjs.js +16 -12626
- package/dist/gun-eth.cjs.js.map +1 -1
- package/dist/gun-eth.esm.js +1368 -9
- package/dist/gun-eth.esm.js.map +1 -1
- package/dist/gun-eth.min.js +1 -9
- package/dist/gun-eth.min.js.map +1 -1
- package/dist/gun-eth.mjs +16 -12626
- package/dist/gun-eth.mjs.map +1 -1
- package/package.json +2 -2
- package/src/index.js +8 -8
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "gun-eth",
|
3
|
-
"version": "1.4.
|
3
|
+
"version": "1.4.32",
|
4
4
|
"description": "A GunDB plugin for Ethereum, and Web3",
|
5
5
|
"main": "dist/gun-eth.cjs.js",
|
6
6
|
"module": "dist/gun-eth.mjs",
|
@@ -58,7 +58,7 @@
|
|
58
58
|
"@types/mocha": "^10.0.1",
|
59
59
|
"chai": "^4.2.0",
|
60
60
|
"cross-env": "^7.0.3",
|
61
|
-
"ethers": "^6.
|
61
|
+
"ethers": "^6.13.4",
|
62
62
|
"gun": "^0.2020.1239",
|
63
63
|
"hardhat": "^2.17.0",
|
64
64
|
"hardhat-gas-reporter": "^1.0.8",
|
package/src/index.js
CHANGED
@@ -64,7 +64,7 @@ export function generateRandomId() {
|
|
64
64
|
*/
|
65
65
|
export function generatePassword(signature) {
|
66
66
|
try {
|
67
|
-
const signatureBytes = ethers.
|
67
|
+
const signatureBytes = ethers.toUtf8Bytes(signature);
|
68
68
|
const hash = ethers.keccak256(signatureBytes);
|
69
69
|
console.log("Generated password:", hash);
|
70
70
|
return hash;
|
@@ -117,7 +117,7 @@ export const getSigner = async () => {
|
|
117
117
|
chainId: LOCAL_CONFIG.CHAIN_ID,
|
118
118
|
name: "localhost"
|
119
119
|
});
|
120
|
-
return new
|
120
|
+
return new Wallet(privateKey, provider);
|
121
121
|
} else if (
|
122
122
|
typeof window !== "undefined" &&
|
123
123
|
typeof window.ethereum !== "undefined"
|
@@ -138,8 +138,8 @@ export const getSigner = async () => {
|
|
138
138
|
*/
|
139
139
|
export function deriveStealthAddress(sharedSecret, spendingPublicKey) {
|
140
140
|
try {
|
141
|
-
const sharedSecretBytes = ethers.
|
142
|
-
const spendingPublicKeyBytes = ethers.
|
141
|
+
const sharedSecretBytes = ethers.toUtf8Bytes(sharedSecret);
|
142
|
+
const spendingPublicKeyBytes = ethers.toUtf8Bytes(spendingPublicKey);
|
143
143
|
|
144
144
|
const stealthPrivateKey = ethers.keccak256(
|
145
145
|
ethers.concat([
|
@@ -148,7 +148,7 @@ export function deriveStealthAddress(sharedSecret, spendingPublicKey) {
|
|
148
148
|
])
|
149
149
|
);
|
150
150
|
|
151
|
-
const stealthWallet = new
|
151
|
+
const stealthWallet = new Wallet(stealthPrivateKey);
|
152
152
|
|
153
153
|
console.log("Debug deriveStealthAddress:", {
|
154
154
|
sharedSecretHex: stealthPrivateKey,
|
@@ -336,7 +336,7 @@ Gun.chain.proof = function (chain, nodeId, data, callback) {
|
|
336
336
|
console.log(`Using ${targetChain} configuration:`, chainConfig);
|
337
337
|
|
338
338
|
// Usa gli indirizzi dalla configurazione
|
339
|
-
const contract = new Contract(
|
339
|
+
const contract = new ethers.Contract(
|
340
340
|
chainConfig.PROOF_OF_INTEGRITY_ADDRESS,
|
341
341
|
PROOF_OF_INTEGRITY_ABI,
|
342
342
|
signer
|
@@ -352,7 +352,7 @@ Gun.chain.proof = function (chain, nodeId, data, callback) {
|
|
352
352
|
signer
|
353
353
|
);
|
354
354
|
const [isValid, timestamp, updater] = await contract.verifyData(
|
355
|
-
toUtf8Bytes(nodeId),
|
355
|
+
ethers.toUtf8Bytes(nodeId),
|
356
356
|
contentHash
|
357
357
|
);
|
358
358
|
console.log("Verification result:", { isValid, timestamp, updater });
|
@@ -450,7 +450,7 @@ Gun.chain.proof = function (chain, nodeId, data, callback) {
|
|
450
450
|
// Case 2: User passes only text (data)
|
451
451
|
const newNodeId = generateRandomId();
|
452
452
|
const dataString = JSON.stringify(data);
|
453
|
-
const contentHash = keccak256(toUtf8Bytes(dataString));
|
453
|
+
const contentHash = ethers.keccak256(ethers.toUtf8Bytes(dataString));
|
454
454
|
|
455
455
|
gun
|
456
456
|
.get(newNodeId)
|