Skip to content

Commit

Permalink
fix: merge issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ieow committed Dec 16, 2024
1 parent 5c24c46 commit 49d2251
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 30 deletions.
64 changes: 54 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"@toruslabs/http-helpers": "^7.0.0",
"@toruslabs/metadata-helpers": "^6.0.0",
"@toruslabs/openlogin-utils": "^8.2.1",
"@toruslabs/torus.js": "15.2.0-alpha.0",
"@toruslabs/session-manager": "^3.1.0",
"@toruslabs/torus.js": "15.2.0-alpha.0",
"@toruslabs/tss-client": "^3.3.0-alpha.0",
"@toruslabs/tss-frost-client": "^1.0.0-alpha.0",
"@toruslabs/tss-frost-common": "^1.0.1",
Expand Down
5 changes: 2 additions & 3 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import type {
UX_MODE_TYPE,
} from "@toruslabs/customauth";
import { TorusKey } from "@toruslabs/torus.js";
import { Client } from "@toruslabs/tss-client";
import { PointHex } from "@toruslabs/tss-client";
import { Client, PointHex } from "@toruslabs/tss-client";
// TODO: move the types to a base class for both dkls and frost in future
import type { tssLib as TssDklsLib } from "@toruslabs/tss-dkls-lib";
import type { tssLib as TssFrostLibEd25519 } from "@toruslabs/tss-frost-lib";
Expand Down Expand Up @@ -552,7 +551,7 @@ export type RemoteDklsSignParams = {
curve: SupportedCurve;
};

export type RemoteFrostSignParams = {
export type ICustomFrostSignParams = {
sessionId: string;
signatures: string[];
tssCommits: PointHex[];
Expand Down
21 changes: 5 additions & 16 deletions src/mpcCoreKit.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import {
BNString,
EncryptedMessage,
FactorEnc,
KeyType,
ONE_KEY_DELETE_NONCE,
Point,
secp256k1,
SHARE_DELETED,
ShareStore,
StringifiedType,
} from "@tkey/common-types";
import { BNString, KeyType, ONE_KEY_DELETE_NONCE, Point, secp256k1, SHARE_DELETED, ShareStore, StringifiedType } from "@tkey/common-types";
import { CoreError } from "@tkey/core";
import { ShareSerializationModule } from "@tkey/share-serialization";
import { TorusStorageLayer } from "@tkey/storage-layer-torus";
Expand Down Expand Up @@ -775,7 +764,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit, IMPCContext {
nodeIndexesReturned: participatingServerDKGIndexes,
} = generateTSSEndpoints(torusNodeTSSEndpoints, parties, clientIndex, nodeIndexes);

const factor = Point.fromSEC1(secp256k1, this.state.remoteClient.remoteFactorPub);
const factor = Point.fromSEC1(secp256k1, this.state.remoteClient?.remoteFactorPub);
const factorEnc = this.tKey.getFactorEncs(factor);

// Compute account nonce only supported for secp256k1
Expand Down Expand Up @@ -1207,7 +1196,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit, IMPCContext {
factorKey: "",
tssShareIndex: tssShareIndex as number,
tssPubKey: Buffer.from(tssPubKey).toString("hex"),
signatures: this.signatures,
signatures: await this.getSessionSignatures(),
userInfo,
remoteClientState: this.state.remoteClient,
};
Expand Down Expand Up @@ -1360,7 +1349,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit, IMPCContext {

// skip input share store if factor key is not present
// tkey will be at state initalized
if (!factorKey) {
if (!result.factorKey) {
return;
}

Expand Down Expand Up @@ -1695,7 +1684,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit, IMPCContext {
const factorPub = Point.fromSEC1(secp256k1, this.state.remoteClient.remoteFactorPub);
const params: ICustomFrostSignParams = {
sessionId: session,
signatures: this.signatures,
signatures: await this.getSessionSignatures(),
tssCommits: this.tKey.getTSSCommits().map((commit) => pointToHex(commit)),
factorEnc: this.tKey.getFactorEncs(factorPub),
serverXCoords,
Expand Down

0 comments on commit 49d2251

Please sign in to comment.