btc-wallet 0.5.96-beta → 0.5.98-beta
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/index.js +26 -3
- package/dist/index.js.map +2 -2
- package/esm/index.js +26 -3
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3980,8 +3980,31 @@ function signMessage(message) {
|
|
|
3980
3980
|
const { signMessage: signMessage2, getPublicKey } = getBtcProvider();
|
|
3981
3981
|
const publicKey = yield getPublicKey();
|
|
3982
3982
|
const signature = yield signMessage2(message);
|
|
3983
|
-
const
|
|
3984
|
-
|
|
3983
|
+
const signatureBuffer = Buffer.from(signature, "base64");
|
|
3984
|
+
let signatureWithoutPrefix;
|
|
3985
|
+
if (signatureBuffer.length === 65) {
|
|
3986
|
+
signatureWithoutPrefix = signatureBuffer.subarray(1);
|
|
3987
|
+
} else if (signatureBuffer.length === 64) {
|
|
3988
|
+
signatureWithoutPrefix = signatureBuffer;
|
|
3989
|
+
} else {
|
|
3990
|
+
throw new Error(`Invalid signature length: ${signatureBuffer.length}`);
|
|
3991
|
+
}
|
|
3992
|
+
const signatureBase58 = import_bs582.default.encode(signatureWithoutPrefix);
|
|
3993
|
+
const publicKeyBuffer = Buffer.from(publicKey, "hex");
|
|
3994
|
+
let uncompressedPublicKey;
|
|
3995
|
+
if (publicKeyBuffer.length === 33) {
|
|
3996
|
+
const decompressed = ecc.pointCompress(publicKeyBuffer, false);
|
|
3997
|
+
if (!decompressed) {
|
|
3998
|
+
throw new Error("Failed to decompress public key");
|
|
3999
|
+
}
|
|
4000
|
+
uncompressedPublicKey = decompressed;
|
|
4001
|
+
} else if (publicKeyBuffer.length === 65) {
|
|
4002
|
+
uncompressedPublicKey = publicKeyBuffer;
|
|
4003
|
+
} else {
|
|
4004
|
+
throw new Error(`Invalid public key length: ${publicKeyBuffer.length}`);
|
|
4005
|
+
}
|
|
4006
|
+
const publicKeyWithoutPrefix = uncompressedPublicKey.subarray(1);
|
|
4007
|
+
const publicKeyBase58 = import_bs582.default.encode(publicKeyWithoutPrefix);
|
|
3985
4008
|
return {
|
|
3986
4009
|
signature,
|
|
3987
4010
|
publicKey,
|
|
@@ -5434,7 +5457,7 @@ function getGroup(state) {
|
|
|
5434
5457
|
|
|
5435
5458
|
// src/index.ts
|
|
5436
5459
|
var getVersion = () => {
|
|
5437
|
-
return "0.5.
|
|
5460
|
+
return "0.5.98-beta";
|
|
5438
5461
|
};
|
|
5439
5462
|
if (typeof window !== "undefined") {
|
|
5440
5463
|
window.__BTC_WALLET_VERSION = getVersion();
|