starknet 9.4.0 → 9.4.1
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.global.js +14 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [9.4.1](https://github.com/starknet-io/starknet.js/compare/v9.4.0...v9.4.1) (2026-03-02)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- implement requested modifications ([d1e4a19](https://github.com/starknet-io/starknet.js/commit/d1e4a1900886d27e41855f22e320ce174129bb1b))
|
|
6
|
+
|
|
1
7
|
# [9.4.0](https://github.com/starknet-io/starknet.js/compare/v9.3.0...v9.4.0) (2026-02-06)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -6788,6 +6788,20 @@ declare function signatureToDecimalArray(sig?: Signature): ArraySignatureType;
|
|
|
6788
6788
|
* ```
|
|
6789
6789
|
*/
|
|
6790
6790
|
declare function signatureToHexArray(sig?: Signature): ArraySignatureType;
|
|
6791
|
+
/**
|
|
6792
|
+
* Calculate the shared secret using ECDH key agreement protocol with a given private key and a full public key.
|
|
6793
|
+
* @param {BigNumberish} privateKey - a Starknet 252 bits private key.
|
|
6794
|
+
* @param {BigNumberish} fullPublicKey - a 520 bit number, representing the full public key related to `privateKey`, which can be obtained by `getFullPublicKey` function. This number needs to start with '0x04' to indicate that it's a full public key, and the remaining 128 bytes represent the x and y coordinates of the public key point on the elliptic curve (64 bytes for x and 64 bytes for y).
|
|
6795
|
+
* @returns {string} an hex string of a 256 bit number, representing the shared secret calculated by ECDH key agreement protocol using `privateKey` and `fullPublicKey`.
|
|
6796
|
+
* @example
|
|
6797
|
+
* ```typescript
|
|
6798
|
+
* const myPrivateKey = "0x67d0bd238e266b6defbb1ad4de4cf1dde2dc55b3518596e0bae29e439165596";
|
|
6799
|
+
* const bobFullPublicKey = "0x0402d6b3ff569186d67a2ff0b8548328798d3500c16191f6c021f929134d48a15405f9fc5a11467b96a59b8fce3c0c919c337f11337c815bb9d0dc42bac7ac42a9";
|
|
6800
|
+
* const result = stark.getSharedSecret(myPrivateKey, bobFullPublicKey);
|
|
6801
|
+
* // result = "0x020619d1a277a5bc51aac6ab0c22d97e414d4bee9711a2d0aa421997f5efd68bab"
|
|
6802
|
+
* ```
|
|
6803
|
+
*/
|
|
6804
|
+
declare function getSharedSecret(privateKey: BigNumberish, fullPublicKey: BigNumberish): string;
|
|
6791
6805
|
/**
|
|
6792
6806
|
* Returns a resource bounds with zero values and no overhead.
|
|
6793
6807
|
* @returns {ResourceBoundsBN} A resource bounds with zero values and no overhead.
|
|
@@ -6970,6 +6984,7 @@ declare const index$1_compressProgram: typeof compressProgram;
|
|
|
6970
6984
|
declare const index$1_decompressProgram: typeof decompressProgram;
|
|
6971
6985
|
declare const index$1_formatSignature: typeof formatSignature;
|
|
6972
6986
|
declare const index$1_getFullPublicKey: typeof getFullPublicKey;
|
|
6987
|
+
declare const index$1_getSharedSecret: typeof getSharedSecret;
|
|
6973
6988
|
declare const index$1_intDAM: typeof intDAM;
|
|
6974
6989
|
declare const index$1_randomAddress: typeof randomAddress;
|
|
6975
6990
|
declare const index$1_resourceBoundsToBigInt: typeof resourceBoundsToBigInt;
|
|
@@ -6984,7 +6999,7 @@ declare const index$1_toTransactionVersion: typeof toTransactionVersion;
|
|
|
6984
6999
|
declare const index$1_v3Details: typeof v3Details;
|
|
6985
7000
|
declare const index$1_zeroResourceBounds: typeof zeroResourceBounds;
|
|
6986
7001
|
declare namespace index$1 {
|
|
6987
|
-
export { index$1_ZeroFeeEstimate as ZeroFeeEstimate, index$1_compressProgram as compressProgram, index$1_decompressProgram as decompressProgram, index$1_formatSignature as formatSignature, index$1_getFullPublicKey as getFullPublicKey, index$1_intDAM as intDAM, index$1_randomAddress as randomAddress, index$1_resourceBoundsToBigInt as resourceBoundsToBigInt, index$1_resourceBoundsToEstimateFeeResponse as resourceBoundsToEstimateFeeResponse, index$1_resourceBoundsToHexString as resourceBoundsToHexString, index$1_signatureToDecimalArray as signatureToDecimalArray, index$1_signatureToHexArray as signatureToHexArray, index$1_toFeeVersion as toFeeVersion, index$1_toOverheadOverallFee as toOverheadOverallFee, index$1_toOverheadResourceBounds as toOverheadResourceBounds, index$1_toTransactionVersion as toTransactionVersion, index$1_v3Details as v3Details, index$1_zeroResourceBounds as zeroResourceBounds };
|
|
7002
|
+
export { index$1_ZeroFeeEstimate as ZeroFeeEstimate, index$1_compressProgram as compressProgram, index$1_decompressProgram as decompressProgram, index$1_formatSignature as formatSignature, index$1_getFullPublicKey as getFullPublicKey, index$1_getSharedSecret as getSharedSecret, index$1_intDAM as intDAM, index$1_randomAddress as randomAddress, index$1_resourceBoundsToBigInt as resourceBoundsToBigInt, index$1_resourceBoundsToEstimateFeeResponse as resourceBoundsToEstimateFeeResponse, index$1_resourceBoundsToHexString as resourceBoundsToHexString, index$1_signatureToDecimalArray as signatureToDecimalArray, index$1_signatureToHexArray as signatureToHexArray, index$1_toFeeVersion as toFeeVersion, index$1_toOverheadOverallFee as toOverheadOverallFee, index$1_toOverheadResourceBounds as toOverheadResourceBounds, index$1_toTransactionVersion as toTransactionVersion, index$1_v3Details as v3Details, index$1_zeroResourceBounds as zeroResourceBounds };
|
|
6988
7003
|
}
|
|
6989
7004
|
|
|
6990
7005
|
/**
|
package/dist/index.global.js
CHANGED
|
@@ -4648,7 +4648,7 @@ ${indent}}` : "}";
|
|
|
4648
4648
|
return true;
|
|
4649
4649
|
return false;
|
|
4650
4650
|
}
|
|
4651
|
-
function
|
|
4651
|
+
function getSharedSecret3(privateA, publicB, isCompressed = true) {
|
|
4652
4652
|
if (isProbPub(privateA))
|
|
4653
4653
|
throw new Error("first arg must be private key");
|
|
4654
4654
|
if (!isProbPub(publicB))
|
|
@@ -4776,7 +4776,7 @@ ${indent}}` : "}";
|
|
|
4776
4776
|
return {
|
|
4777
4777
|
CURVE: CURVE2,
|
|
4778
4778
|
getPublicKey: getPublicKey2,
|
|
4779
|
-
getSharedSecret:
|
|
4779
|
+
getSharedSecret: getSharedSecret3,
|
|
4780
4780
|
sign: sign2,
|
|
4781
4781
|
verify: verify2,
|
|
4782
4782
|
ProjectivePoint: Point2,
|
|
@@ -10063,6 +10063,7 @@ ${indent}}` : "}";
|
|
|
10063
10063
|
decompressProgram: () => decompressProgram,
|
|
10064
10064
|
formatSignature: () => formatSignature,
|
|
10065
10065
|
getFullPublicKey: () => getFullPublicKey,
|
|
10066
|
+
getSharedSecret: () => getSharedSecret2,
|
|
10066
10067
|
intDAM: () => intDAM,
|
|
10067
10068
|
randomAddress: () => randomAddress,
|
|
10068
10069
|
resourceBoundsToBigInt: () => resourceBoundsToBigInt,
|
|
@@ -14286,6 +14287,17 @@ ${indent}}` : "}";
|
|
|
14286
14287
|
function signatureToHexArray(sig) {
|
|
14287
14288
|
return bigNumberishArrayToHexadecimalStringArray(formatSignature(sig));
|
|
14288
14289
|
}
|
|
14290
|
+
function getSharedSecret2(privateKey, fullPublicKey) {
|
|
14291
|
+
const privK = toHex(privateKey);
|
|
14292
|
+
const fullPubKHex = removeHexPrefix(toHex(fullPublicKey)).padStart(130, "0");
|
|
14293
|
+
if (fullPubKHex.length !== 130 || !fullPubKHex.startsWith("04")) {
|
|
14294
|
+
throw new Error(
|
|
14295
|
+
"fullPublicKey must be an uncompressed public key (starting with 04, 65 bytes total)"
|
|
14296
|
+
);
|
|
14297
|
+
}
|
|
14298
|
+
const sharedSecret = buf2hex(esm_exports4.getSharedSecret(privK, fullPubKHex));
|
|
14299
|
+
return addHexPrefix(sharedSecret);
|
|
14300
|
+
}
|
|
14289
14301
|
function zeroResourceBounds() {
|
|
14290
14302
|
return toOverheadResourceBounds(ZeroFeeEstimate(), false);
|
|
14291
14303
|
}
|