@steemit/steem-js 1.0.6 → 1.0.7
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/api/rpc-auth.d.ts +2 -6
- package/dist/browser.esm.js +53 -23
- package/dist/browser.esm.js.map +1 -1
- package/dist/index.cjs +50 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -3
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2562 -164
- 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/umd.d.ts +1 -0
- package/package.json +1 -1
package/dist/api/rpc-auth.d.ts
CHANGED
|
@@ -17,11 +17,7 @@ interface SignedRequest {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
* Signing constant used to reserve opcode space and prevent cross-protocol attacks.
|
|
22
|
-
* Output of `sha256('steem_jsonrpc_auth')`.
|
|
23
|
-
*/
|
|
24
|
-
export declare const K: Buffer<ArrayBuffer>;
|
|
20
|
+
export declare const K: Buffer;
|
|
25
21
|
/**
|
|
26
22
|
* Sign a JSON RPC Request.
|
|
27
23
|
*/
|
|
@@ -38,6 +34,6 @@ export declare function validate(request: SignedRequest, verify: (message: Buffe
|
|
|
38
34
|
declare const _default: {
|
|
39
35
|
sign: typeof sign;
|
|
40
36
|
validate: typeof validate;
|
|
41
|
-
K: Buffer<
|
|
37
|
+
readonly K: Buffer<ArrayBufferLike>;
|
|
42
38
|
};
|
|
43
39
|
export default _default;
|
package/dist/browser.esm.js
CHANGED
|
@@ -23,26 +23,9 @@
|
|
|
23
23
|
})();
|
|
24
24
|
// Define utilExports in global scope for replace plugin (utilExports.format -> utilExports.format)
|
|
25
25
|
var utilExports = typeof globalThis !== 'undefined' ? (globalThis.utilExports || (globalThis.utilExports = {})) : (typeof window !== 'undefined' ? (window.utilExports || (window.utilExports = {})) : {});
|
|
26
|
-
//
|
|
27
|
-
// The inject plugin will replace Buffer references with
|
|
28
|
-
|
|
29
|
-
(function() {
|
|
30
|
-
if (typeof Buffer === 'undefined') {
|
|
31
|
-
try {
|
|
32
|
-
var bufferModule = typeof require !== 'undefined' ? require('buffer') : null;
|
|
33
|
-
if (bufferModule && bufferModule.Buffer) {
|
|
34
|
-
var Buffer = bufferModule.Buffer;
|
|
35
|
-
var g = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
36
|
-
g.Buffer = Buffer;
|
|
37
|
-
if (typeof globalThis !== 'undefined') {
|
|
38
|
-
globalThis.Buffer = Buffer;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
} catch(e) {
|
|
42
|
-
// Buffer will be available from the bundled code
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
})();
|
|
26
|
+
// Buffer will be set in src/index.ts after importing buffer module
|
|
27
|
+
// The inject plugin will replace Buffer references with buffer.Buffer in the code
|
|
28
|
+
|
|
46
29
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
47
30
|
|
|
48
31
|
function getDefaultExportFromCjs (x) {
|
|
@@ -17496,8 +17479,39 @@ function randomBytes(size) {
|
|
|
17496
17479
|
/**
|
|
17497
17480
|
* Signing constant used to reserve opcode space and prevent cross-protocol attacks.
|
|
17498
17481
|
* Output of `sha256('steem_jsonrpc_auth')`.
|
|
17482
|
+
* Using lazy initialization to avoid Buffer dependency issues in UMD builds.
|
|
17499
17483
|
*/
|
|
17500
|
-
|
|
17484
|
+
let _K = null;
|
|
17485
|
+
function getK() {
|
|
17486
|
+
if (!_K) {
|
|
17487
|
+
_K = bufferExports.Buffer.from('3b3b081e46ea808d5a96b08c4bc5003f5e15767090f344faab531ec57565136b', 'hex');
|
|
17488
|
+
}
|
|
17489
|
+
return _K;
|
|
17490
|
+
}
|
|
17491
|
+
// Create a Proxy to make K behave like a Buffer but with lazy initialization
|
|
17492
|
+
// This avoids executing Buffer.from() at module load time when Buffer may not be available in UMD builds
|
|
17493
|
+
new Proxy({}, {
|
|
17494
|
+
get(_target, prop) {
|
|
17495
|
+
const k = getK();
|
|
17496
|
+
const value = k[prop];
|
|
17497
|
+
if (typeof value === 'function') {
|
|
17498
|
+
return value.bind(k);
|
|
17499
|
+
}
|
|
17500
|
+
return value;
|
|
17501
|
+
},
|
|
17502
|
+
has(_target, prop) {
|
|
17503
|
+
const k = getK();
|
|
17504
|
+
return prop in k;
|
|
17505
|
+
},
|
|
17506
|
+
ownKeys(_target) {
|
|
17507
|
+
const k = getK();
|
|
17508
|
+
return Object.keys(k);
|
|
17509
|
+
},
|
|
17510
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
17511
|
+
const k = getK();
|
|
17512
|
+
return Object.getOwnPropertyDescriptor(k, prop);
|
|
17513
|
+
}
|
|
17514
|
+
});
|
|
17501
17515
|
/**
|
|
17502
17516
|
* Create request hash to be signed.
|
|
17503
17517
|
*
|
|
@@ -17519,7 +17533,7 @@ function hashMessage(timestamp, account, method, params, nonce) {
|
|
|
17519
17533
|
]);
|
|
17520
17534
|
const firstHash = bufferExports.Buffer.from(sha256$2(firstInput));
|
|
17521
17535
|
// Second hash: sha256(K + firstHash + nonce)
|
|
17522
|
-
const secondInput = bufferExports.Buffer.concat([
|
|
17536
|
+
const secondInput = bufferExports.Buffer.concat([getK(), firstHash, nonce]);
|
|
17523
17537
|
return bufferExports.Buffer.from(sha256$2(secondInput));
|
|
17524
17538
|
}
|
|
17525
17539
|
/**
|
|
@@ -17613,7 +17627,6 @@ async function validate(request, verify) {
|
|
|
17613
17627
|
|
|
17614
17628
|
const rpcAuth = /*#__PURE__*/Object.freeze({
|
|
17615
17629
|
__proto__: null,
|
|
17616
|
-
K: K,
|
|
17617
17630
|
sign: sign$2,
|
|
17618
17631
|
validate: validate
|
|
17619
17632
|
});
|
|
@@ -28916,6 +28929,23 @@ const steem = {
|
|
|
28916
28929
|
if (typeof setApi === 'function') {
|
|
28917
28930
|
setApi(api);
|
|
28918
28931
|
}
|
|
28932
|
+
// Make Buffer available globally for browser builds (ESM and UMD)
|
|
28933
|
+
// Browser doesn't have native Buffer, so we use the buffer polyfill package
|
|
28934
|
+
if (typeof window !== 'undefined' || typeof globalThis !== 'undefined') {
|
|
28935
|
+
try {
|
|
28936
|
+
// BufferPolyfill is imported from 'buffer' package (polyfill for browser)
|
|
28937
|
+
// Expose it globally so code can use Buffer directly
|
|
28938
|
+
if (typeof globalThis !== 'undefined' && typeof globalThis.Buffer === 'undefined') {
|
|
28939
|
+
globalThis.Buffer = bufferExports.Buffer;
|
|
28940
|
+
}
|
|
28941
|
+
if (typeof window !== 'undefined' && typeof window.Buffer === 'undefined') {
|
|
28942
|
+
window.Buffer = bufferExports.Buffer;
|
|
28943
|
+
}
|
|
28944
|
+
}
|
|
28945
|
+
catch {
|
|
28946
|
+
// Buffer should be available from the inject plugin transformation
|
|
28947
|
+
}
|
|
28948
|
+
}
|
|
28919
28949
|
|
|
28920
28950
|
export { doubleSha256, generateKeyPair, hmacSha256, ripemd160, sha256, sign, steem, verify };
|
|
28921
28951
|
//# sourceMappingURL=browser.esm.js.map
|