@steemit/steem-js 1.0.19 → 1.0.20
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/dist/auth/index.d.ts +1 -0
- package/dist/browser.esm.js +20 -3
- package/dist/browser.esm.js.map +1 -1
- package/dist/index.cjs +20 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +20 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -26542,18 +26542,34 @@
|
|
|
26542
26542
|
return false;
|
|
26543
26543
|
}
|
|
26544
26544
|
};
|
|
26545
|
+
// Serialize a transaction to its binary form for digest calculation.
|
|
26546
|
+
// Alias for transaction.toBuffer() so verifyTransaction mirrors signTransaction's
|
|
26547
|
+
// serialization path exactly (signTransaction calls transaction.toBuffer at line 161).
|
|
26548
|
+
const serializeTrx = (trx) => transaction.toBuffer(trx);
|
|
26545
26549
|
const verifyTransaction = (transaction, publicKey) => {
|
|
26546
26550
|
try {
|
|
26547
26551
|
const pub = PublicKey.fromString(publicKey);
|
|
26548
26552
|
if (!pub)
|
|
26549
26553
|
return false;
|
|
26550
|
-
const serialized = buffer.Buffer.from(JSON.stringify(transaction));
|
|
26551
26554
|
const trx = transaction;
|
|
26552
26555
|
if (!trx.signatures || !Array.isArray(trx.signatures))
|
|
26553
26556
|
return false;
|
|
26557
|
+
// Reconstruct the exact digest signTransaction signs over:
|
|
26558
|
+
// Buffer.concat([chain_id, transaction.toBuffer(normalizedTrx)])
|
|
26559
|
+
// signatures are NOT part of the signed digest — signTransaction serializes
|
|
26560
|
+
// BEFORE attaching signatures — so strip them before serializing, otherwise
|
|
26561
|
+
// serializeTransaction() would emit the signatures array and change the digest.
|
|
26562
|
+
const normalizedTrx = normalizeTransactionForBroadcast(trx);
|
|
26563
|
+
// Build a copy without the signatures key, so serializeTransaction() does not
|
|
26564
|
+
// emit the signatures array into the digest (signTransaction serializes pre-signature).
|
|
26565
|
+
const trxWithoutSigs = { ...normalizedTrx };
|
|
26566
|
+
delete trxWithoutSigs.signatures;
|
|
26567
|
+
const chainId = getConfig().get('chain_id') || '';
|
|
26568
|
+
const cid = buffer.Buffer.from(chainId, 'hex');
|
|
26569
|
+
const buf = serializeTrx(trxWithoutSigs);
|
|
26554
26570
|
return trx.signatures.some((sig) => {
|
|
26555
26571
|
const signature = Signature.fromHex(sig);
|
|
26556
|
-
return signature.verifyBuffer(
|
|
26572
|
+
return signature.verifyBuffer(buffer.Buffer.concat([cid, buf]), pub);
|
|
26557
26573
|
});
|
|
26558
26574
|
}
|
|
26559
26575
|
catch {
|
|
@@ -26598,6 +26614,7 @@
|
|
|
26598
26614
|
normalizeTransactionForBroadcast: normalizeTransactionForBroadcast,
|
|
26599
26615
|
resolveAuthorityForSerialize: resolveAuthorityForSerialize,
|
|
26600
26616
|
sanitizeAccountUpdatePayload: sanitizeAccountUpdatePayload,
|
|
26617
|
+
serializeTransaction: serializeTransaction,
|
|
26601
26618
|
sign: sign$1,
|
|
26602
26619
|
signTransaction: signTransaction,
|
|
26603
26620
|
toWif: toWif,
|
|
@@ -29419,7 +29436,7 @@
|
|
|
29419
29436
|
operations,
|
|
29420
29437
|
utils: utils$n,
|
|
29421
29438
|
...crypto$1,
|
|
29422
|
-
version: '1.0.
|
|
29439
|
+
version: '1.0.20',
|
|
29423
29440
|
config: {
|
|
29424
29441
|
set: (options) => {
|
|
29425
29442
|
// If nodes is provided, extract the first node as url for API
|