Skip to content

Commit 03523d2

Browse files
committed
fix: rename variable
1 parent 49f86e2 commit 03523d2

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

tkey-mpc-web/tkey-mpc-react-bitcoin-example/src/App.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ function App() {
7575
if (sessionId) {
7676
const signingParams: any = await sessionManager!.authorizeSession();
7777
uiConsole("signingParams", signingParams);
78-
// signingParams["ecPublicKey"] = Buffer.from(signingParams.ecPublicKey.padStart(64, "0"), "hex");
7978

8079
const factorKeyMetadata = await tKey.storageLayer.getMetadata<{
8180
message: string;
@@ -239,13 +238,13 @@ function App() {
239238
const { tssShare: tssShare2, tssIndex: tssShare2Index } = await tKey.getTSSShare(factorKey);
240239

241240
// 4. derive tss pub key, tss pubkey is implicitly formed using the dkgPubKey and the userShare (as well as userTSSIndex)
242-
let tssPubKey = tKey.getTSSPub()
241+
let tssPubKeyPoint = tKey.getTSSPub()
243242
// const tssPubKey = getTSSPubKey(tssShare1PubKey, tssShare2PubKey, tssShare2Index);
244243
// console.log("tssPub", tssPubKey);
245244

246-
const TSSPubKey = Buffer.from(`${tssPubKey.x.toString(16, 64)}${tssPubKey.y.toString(16, 64)}`, "hex");
245+
const tssPubKey = Buffer.from(`${tssPubKeyPoint.x.toString(16, 64)}${tssPubKeyPoint.y.toString(16, 64)}`, "hex");
247246

248-
const prefixedTSSPubKey = Buffer.from(`04${TSSPubKey.toString("hex")}`, "hex");
247+
const prefixedTSSPubKey = Buffer.from(`04${tssPubKey.toString("hex")}`, "hex");
249248
const ECPubKey = ECPair.fromPublicKey(prefixedTSSPubKey, { network: testnet , compressed: true});
250249
const { address: btcAddress } = p2pkh({ pubkey: ECPubKey.publicKey, network: testnet });
251250

@@ -264,7 +263,6 @@ function App() {
264263

265264
const nodeDetails = await tKey.serviceProvider.getTSSNodeDetails()
266265

267-
const tsspubhex = Buffer.from(TSSPubKey).toString("hex");
268266
const signingParams : SigningParams = {
269267
oAuthShare: OAuthShare.toString("hex"),
270268
factorKey: factorKey.toString("hex"),
@@ -273,7 +271,7 @@ function App() {
273271
tssNonce,
274272
tssShare2 : tssShare2.toString("hex"),
275273
tssShare2Index,
276-
compressedTSSPubKey: tsspubhex,
274+
tssPubKey: tssPubKey.toString("hex"),
277275
signatures,
278276
userInfo: loginResponse!.userInfo,
279277
nodeDetails,

tkey-mpc-web/tkey-mpc-react-bitcoin-example/src/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type SigningParams = {
2424
tssNonce: number;
2525
tssShare2: string;
2626
tssShare2Index: number;
27-
compressedTSSPubKey: string;
27+
tssPubKey: string;
2828
signatures: string[];
2929
userInfo: any;
3030
nodeDetails: any;
@@ -63,7 +63,7 @@ export const generateTSSEndpoints = (tssNodeEndpoints: string[], parties: number
6363

6464
export const setupWeb3 = async (loginReponse: any, signingParams: SigningParams) => {
6565
try {
66-
const { tssNonce, tssShare2, tssShare2Index, compressedTSSPubKey, signatures, ecPublicKey, nodeDetails } = signingParams;
66+
const { tssNonce, tssShare2, tssShare2Index, tssPubKey, signatures, ecPublicKey, nodeDetails } = signingParams;
6767
const tssShare2BN = new BN(tssShare2, 16);
6868

6969
const { verifier, verifierId } = loginReponse.userInfo;
@@ -107,7 +107,7 @@ export const setupWeb3 = async (loginReponse: any, signingParams: SigningParams)
107107
endpoints,
108108
sockets,
109109
share,
110-
Buffer.from(compressedTSSPubKey, "hex").toString("base64"),
110+
Buffer.from(tssPubKey, "hex").toString("base64"),
111111
true,
112112
tssImportUrl
113113
);
@@ -129,8 +129,8 @@ export const setupWeb3 = async (loginReponse: any, signingParams: SigningParams)
129129
return Promise.resolve(sigBuffer);
130130
};
131131

132-
if (!compressedTSSPubKey) {
133-
throw new Error(`compressedTSSPubKey does not exist ${compressedTSSPubKey}`);
132+
if (!tssPubKey) {
133+
throw new Error(`compressedTSSPubKey does not exist ${tssPubKey}`);
134134
}
135135

136136
const toAsyncSigner = (signer: Signer): SignerAsync => {

0 commit comments

Comments
 (0)