@steemit/steem-js 1.0.19 → 1.1.0
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/README.md +0 -2
- package/dist/api/types.d.ts +32 -29
- package/dist/auth/ecc/index.d.ts +0 -1
- package/dist/auth/ecc/src/index.d.ts +0 -1
- package/dist/auth/index.d.ts +1 -0
- package/dist/browser.esm.js +22 -5
- package/dist/browser.esm.js.map +1 -1
- package/dist/index.cjs +22 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +22 -5
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +22 -5
- 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/dist/types/protocol.d.ts +271 -0
- package/package.json +1 -1
- package/dist/auth/ecc/src/key_utils.d.ts +0 -10
package/dist/index.cjs
CHANGED
|
@@ -14247,7 +14247,7 @@ function recoverPubKey(curve, e, signature, i) {
|
|
|
14247
14247
|
const Q = curve.recoverPubKey(msgBuffer, sigObj, i);
|
|
14248
14248
|
return Q;
|
|
14249
14249
|
}
|
|
14250
|
-
catch
|
|
14250
|
+
catch {
|
|
14251
14251
|
// Fallback to manual implementation if elliptic's method fails
|
|
14252
14252
|
const G = curve.g;
|
|
14253
14253
|
// A set LSB signifies that the y-coordinate is odd
|
|
@@ -14267,7 +14267,7 @@ function recoverPubKey(curve, e, signature, i) {
|
|
|
14267
14267
|
try {
|
|
14268
14268
|
R = curve.curve.pointFromX(xHexPadded, isYOdd);
|
|
14269
14269
|
}
|
|
14270
|
-
catch
|
|
14270
|
+
catch {
|
|
14271
14271
|
// If hex string fails, try with Buffer
|
|
14272
14272
|
const xBuffer = x.toArrayLike(Buffer, 'be', 32);
|
|
14273
14273
|
R = curve.curve.pointFromX(xBuffer, isYOdd);
|
|
@@ -23548,18 +23548,34 @@ const verifySignature = (message, signature, publicKey) => {
|
|
|
23548
23548
|
return false;
|
|
23549
23549
|
}
|
|
23550
23550
|
};
|
|
23551
|
+
// Serialize a transaction to its binary form for digest calculation.
|
|
23552
|
+
// Alias for transaction.toBuffer() so verifyTransaction mirrors signTransaction's
|
|
23553
|
+
// serialization path exactly (signTransaction calls transaction.toBuffer at line 161).
|
|
23554
|
+
const serializeTrx = (trx) => transaction.toBuffer(trx);
|
|
23551
23555
|
const verifyTransaction = (transaction, publicKey) => {
|
|
23552
23556
|
try {
|
|
23553
23557
|
const pub = PublicKey.fromString(publicKey);
|
|
23554
23558
|
if (!pub)
|
|
23555
23559
|
return false;
|
|
23556
|
-
const serialized = Buffer.from(JSON.stringify(transaction));
|
|
23557
23560
|
const trx = transaction;
|
|
23558
23561
|
if (!trx.signatures || !Array.isArray(trx.signatures))
|
|
23559
23562
|
return false;
|
|
23563
|
+
// Reconstruct the exact digest signTransaction signs over:
|
|
23564
|
+
// Buffer.concat([chain_id, transaction.toBuffer(normalizedTrx)])
|
|
23565
|
+
// signatures are NOT part of the signed digest — signTransaction serializes
|
|
23566
|
+
// BEFORE attaching signatures — so strip them before serializing, otherwise
|
|
23567
|
+
// serializeTransaction() would emit the signatures array and change the digest.
|
|
23568
|
+
const normalizedTrx = normalizeTransactionForBroadcast(trx);
|
|
23569
|
+
// Build a copy without the signatures key, so serializeTransaction() does not
|
|
23570
|
+
// emit the signatures array into the digest (signTransaction serializes pre-signature).
|
|
23571
|
+
const trxWithoutSigs = { ...normalizedTrx };
|
|
23572
|
+
delete trxWithoutSigs.signatures;
|
|
23573
|
+
const chainId = getConfig().get('chain_id') || '';
|
|
23574
|
+
const cid = Buffer.from(chainId, 'hex');
|
|
23575
|
+
const buf = serializeTrx(trxWithoutSigs);
|
|
23560
23576
|
return trx.signatures.some((sig) => {
|
|
23561
23577
|
const signature = Signature.fromHex(sig);
|
|
23562
|
-
return signature.verifyBuffer(
|
|
23578
|
+
return signature.verifyBuffer(Buffer.concat([cid, buf]), pub);
|
|
23563
23579
|
});
|
|
23564
23580
|
}
|
|
23565
23581
|
catch {
|
|
@@ -23604,6 +23620,7 @@ var auth = /*#__PURE__*/Object.freeze({
|
|
|
23604
23620
|
normalizeTransactionForBroadcast: normalizeTransactionForBroadcast,
|
|
23605
23621
|
resolveAuthorityForSerialize: resolveAuthorityForSerialize,
|
|
23606
23622
|
sanitizeAccountUpdatePayload: sanitizeAccountUpdatePayload,
|
|
23623
|
+
serializeTransaction: serializeTransaction,
|
|
23607
23624
|
sign: sign$1,
|
|
23608
23625
|
signTransaction: signTransaction,
|
|
23609
23626
|
toWif: toWif,
|
|
@@ -26412,7 +26429,7 @@ const steem = {
|
|
|
26412
26429
|
memo,
|
|
26413
26430
|
operations,
|
|
26414
26431
|
utils: utils$3,
|
|
26415
|
-
version: '1.0
|
|
26432
|
+
version: '1.1.0',
|
|
26416
26433
|
config: {
|
|
26417
26434
|
set: (options) => {
|
|
26418
26435
|
// If nodes is provided, extract the first node as url for API
|