@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/auth/index.d.ts
CHANGED
|
@@ -49,3 +49,4 @@ export declare const verifyTransaction: (transaction: unknown, publicKey: string
|
|
|
49
49
|
export declare const getPublicKey: (privateKey: string) => string;
|
|
50
50
|
export declare const getPrivateKey: (seed: string) => string;
|
|
51
51
|
export declare const signTransaction: (trx: unknown, keys: string[]) => unknown;
|
|
52
|
+
export { serializeTransaction } from './serializer/transaction';
|
package/dist/browser.esm.js
CHANGED
|
@@ -26856,18 +26856,34 @@ const verifySignature = (message, signature, publicKey) => {
|
|
|
26856
26856
|
return false;
|
|
26857
26857
|
}
|
|
26858
26858
|
};
|
|
26859
|
+
// Serialize a transaction to its binary form for digest calculation.
|
|
26860
|
+
// Alias for transaction.toBuffer() so verifyTransaction mirrors signTransaction's
|
|
26861
|
+
// serialization path exactly (signTransaction calls transaction.toBuffer at line 161).
|
|
26862
|
+
const serializeTrx = (trx) => transaction.toBuffer(trx);
|
|
26859
26863
|
const verifyTransaction = (transaction, publicKey) => {
|
|
26860
26864
|
try {
|
|
26861
26865
|
const pub = PublicKey.fromString(publicKey);
|
|
26862
26866
|
if (!pub)
|
|
26863
26867
|
return false;
|
|
26864
|
-
const serialized = bufferExports.Buffer.from(JSON.stringify(transaction));
|
|
26865
26868
|
const trx = transaction;
|
|
26866
26869
|
if (!trx.signatures || !Array.isArray(trx.signatures))
|
|
26867
26870
|
return false;
|
|
26871
|
+
// Reconstruct the exact digest signTransaction signs over:
|
|
26872
|
+
// Buffer.concat([chain_id, transaction.toBuffer(normalizedTrx)])
|
|
26873
|
+
// signatures are NOT part of the signed digest — signTransaction serializes
|
|
26874
|
+
// BEFORE attaching signatures — so strip them before serializing, otherwise
|
|
26875
|
+
// serializeTransaction() would emit the signatures array and change the digest.
|
|
26876
|
+
const normalizedTrx = normalizeTransactionForBroadcast(trx);
|
|
26877
|
+
// Build a copy without the signatures key, so serializeTransaction() does not
|
|
26878
|
+
// emit the signatures array into the digest (signTransaction serializes pre-signature).
|
|
26879
|
+
const trxWithoutSigs = { ...normalizedTrx };
|
|
26880
|
+
delete trxWithoutSigs.signatures;
|
|
26881
|
+
const chainId = getConfig().get('chain_id') || '';
|
|
26882
|
+
const cid = bufferExports.Buffer.from(chainId, 'hex');
|
|
26883
|
+
const buf = serializeTrx(trxWithoutSigs);
|
|
26868
26884
|
return trx.signatures.some((sig) => {
|
|
26869
26885
|
const signature = Signature.fromHex(sig);
|
|
26870
|
-
return signature.verifyBuffer(
|
|
26886
|
+
return signature.verifyBuffer(bufferExports.Buffer.concat([cid, buf]), pub);
|
|
26871
26887
|
});
|
|
26872
26888
|
}
|
|
26873
26889
|
catch {
|
|
@@ -26912,6 +26928,7 @@ const auth = /*#__PURE__*/Object.freeze({
|
|
|
26912
26928
|
normalizeTransactionForBroadcast: normalizeTransactionForBroadcast,
|
|
26913
26929
|
resolveAuthorityForSerialize: resolveAuthorityForSerialize,
|
|
26914
26930
|
sanitizeAccountUpdatePayload: sanitizeAccountUpdatePayload,
|
|
26931
|
+
serializeTransaction: serializeTransaction,
|
|
26915
26932
|
sign: sign$1,
|
|
26916
26933
|
signTransaction: signTransaction,
|
|
26917
26934
|
toWif: toWif,
|
|
@@ -29720,7 +29737,7 @@ const steem = {
|
|
|
29720
29737
|
memo,
|
|
29721
29738
|
operations,
|
|
29722
29739
|
utils: utils$3,
|
|
29723
|
-
version: '1.0.
|
|
29740
|
+
version: '1.0.20',
|
|
29724
29741
|
config: {
|
|
29725
29742
|
set: (options) => {
|
|
29726
29743
|
// If nodes is provided, extract the first node as url for API
|