gun-eth 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +21 -0
- package/package.json +1 -1
package/index.js
CHANGED
@@ -13,6 +13,27 @@ const SHINE_OPTIMISM_SEPOLIA = SHINE.address;
|
|
13
13
|
|
14
14
|
let SHINE_CONTRACT_ADDRESS;
|
15
15
|
|
16
|
+
let customToken = "";
|
17
|
+
|
18
|
+
Gun.chain.setToken = function (token) {
|
19
|
+
if (typeof token === "string" && token.length > 0) {
|
20
|
+
customToken = token;
|
21
|
+
console.log("Token impostato con successo:", token);
|
22
|
+
} else {
|
23
|
+
console.error("Token non valido. Deve essere una stringa non vuota.");
|
24
|
+
}
|
25
|
+
return this;
|
26
|
+
};
|
27
|
+
|
28
|
+
ctx.on("put", function (msg) {
|
29
|
+
const to = this.to;
|
30
|
+
// Usa il token personalizzato
|
31
|
+
msg.headers = {
|
32
|
+
token: customToken,
|
33
|
+
};
|
34
|
+
to.next(msg); // passa al prossimo middleware
|
35
|
+
});
|
36
|
+
|
16
37
|
// Aggiungi il metodo alla catena di Gun
|
17
38
|
Gun.chain.verifySignature = async function (message, signature) {
|
18
39
|
try {
|