@hive-p2p/server 1.0.62 → 1.0.64
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/core/arbiter.mjs +1 -1
- package/core/crypto-codex.mjs +1 -1
- package/core/node-services.mjs +1 -1
- package/core/topologist.mjs +1 -1
- package/package.json +1 -1
- package/services/cryptos.mjs +10 -3
package/core/arbiter.mjs
CHANGED
|
@@ -115,7 +115,7 @@ export class Arbiter {
|
|
|
115
115
|
try {
|
|
116
116
|
const { pubkey, signature, signatureStart } = message;
|
|
117
117
|
const signedData = serialized.subarray(0, signatureStart);
|
|
118
|
-
const signatureValid = await this.cryptoCodex.verifySignature(pubkey,
|
|
118
|
+
const signatureValid = await this.cryptoCodex.verifySignature(pubkey, signedData, signature);
|
|
119
119
|
if (!signatureValid) throw new Error('Gossip signature invalid');
|
|
120
120
|
this.adjustTrust(from, TRUST_VALUES.VALID_SIGNATURE, 'Gossip signature valid');
|
|
121
121
|
return true;
|
package/core/crypto-codex.mjs
CHANGED
|
@@ -170,7 +170,7 @@ export class CryptoCodex {
|
|
|
170
170
|
/** @param {Uint8Array} publicKey @param {Uint8Array} dataToVerify @param {Uint8Array} signature */
|
|
171
171
|
async verifySignature(publicKey, dataToVerify, signature) {
|
|
172
172
|
if (this.AVOID_CRYPTO) return true;
|
|
173
|
-
return ed25519.verifyAsync(
|
|
173
|
+
return ed25519.verifyAsync(signature, dataToVerify, publicKey);
|
|
174
174
|
}
|
|
175
175
|
/** @param {Uint8Array} bufferView */
|
|
176
176
|
readBufferHeader(bufferView, readAssociatedId = true) {
|
package/core/node-services.mjs
CHANGED
|
@@ -68,7 +68,7 @@ export class NodeServices {
|
|
|
68
68
|
|
|
69
69
|
const { signatureStart, pubkey, signature } = message;
|
|
70
70
|
const signedData = d.subarray(0, signatureStart);
|
|
71
|
-
if (!await this.cryptoCodex.verifySignature(pubkey,
|
|
71
|
+
if (!await this.cryptoCodex.verifySignature(pubkey, signedData, signature)) return;
|
|
72
72
|
|
|
73
73
|
remoteId = route[0];
|
|
74
74
|
this.peerStore.digestPeerNeighbors(remoteId, neighborsList); // Update known store
|
package/core/topologist.mjs
CHANGED
|
@@ -187,7 +187,7 @@ export class Topologist {
|
|
|
187
187
|
|
|
188
188
|
const { signatureStart, pubkey, signature } = message;
|
|
189
189
|
const signedData = d.subarray(0, signatureStart);
|
|
190
|
-
if (!await this.cryptoCodex.verifySignature(pubkey,
|
|
190
|
+
if (!await this.cryptoCodex.verifySignature(pubkey, signedData, signature)) return;
|
|
191
191
|
|
|
192
192
|
remoteId = route[0];
|
|
193
193
|
this.peerStore.digestPeerNeighbors(remoteId, neighborsList); // Update known store
|
package/package.json
CHANGED
package/services/cryptos.mjs
CHANGED
|
@@ -2,14 +2,21 @@ import { Converter } from './converter.mjs';
|
|
|
2
2
|
const IS_BROWSER = typeof window !== 'undefined';
|
|
3
3
|
|
|
4
4
|
// ED25519 EXPOSURE NODEJS/BROWSER COMPATIBLE ---------------------------------
|
|
5
|
-
const [ed_, {sha512}] = await Promise.all([
|
|
5
|
+
/*const [ed_, {sha512}] = await Promise.all([
|
|
6
6
|
import(IS_BROWSER ? '../libs/ed25519-custom.min.js' : '@noble/ed25519'),
|
|
7
7
|
import(IS_BROWSER ? '../libs/ed25519-custom.min.js' : '@noble/hashes/sha2.js')
|
|
8
|
+
]);*/
|
|
9
|
+
/** @type {import('@noble/ed25519')} */
|
|
10
|
+
//const ed25519 = ed_.default || ed_;
|
|
11
|
+
//ed25519.hashes.sha512 = sha512;
|
|
12
|
+
//export { ed25519, sha512 };
|
|
13
|
+
|
|
14
|
+
const [ed_] = await Promise.all([
|
|
15
|
+
import(IS_BROWSER ? '../libs/ed25519-custom.min.js' : '@noble/ed25519'),
|
|
8
16
|
]);
|
|
9
17
|
/** @type {import('@noble/ed25519')} */
|
|
10
18
|
const ed25519 = ed_.default || ed_;
|
|
11
|
-
ed25519
|
|
12
|
-
export { ed25519, sha512 };
|
|
19
|
+
export { ed25519 };
|
|
13
20
|
|
|
14
21
|
//-----------------------------------------------------------------------------
|
|
15
22
|
|