Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
lwin-kyaw committed Mar 13, 2024
1 parent bff7a50 commit 861acf6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
5 changes: 0 additions & 5 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,3 @@ export interface SessionData {
export interface TkeyLocalStoreData {
factorKey: string;
}

// TODO: remove when tkey/service-provider-torus with updated with latest version of torus.js
// make given properties in the interface, optional
export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
export type ServiceProviderLoginResponse = Optional<TorusAggregateLoginResponse, "userInfo"> | Optional<TorusLoginResponse, "userInfo">;
12 changes: 2 additions & 10 deletions src/mpcCoreKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import {
InitParams,
MPCKeyDetails,
OauthLoginParams,
ServiceProviderLoginResponse,
SessionData,
SubVerifierDetailsParams,
UserInfo,
Expand Down Expand Up @@ -398,7 +397,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
prefetchTssPubs.push(this.tkey.serviceProvider.getTSSPubKey("default", i));
}
// oAuth login.
let loginResponse: ServiceProviderLoginResponse;
let loginResponse: TorusKey;
if (!idTokenLoginParams.subVerifier) {
// single verifier login.
loginResponse = await (this.tKey.serviceProvider as TorusServiceProvider).customAuthInstance.getTorusKey(
Expand Down Expand Up @@ -1165,14 +1164,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
this.providerProxy = null;
}

private _getOAuthKey(result: ServiceProviderLoginResponse): string {
// TODO: change param type to TorusKey after tkey/service-provider-torus update
// this is the temporary fix before updating the tKey/servie-provider-torus with [email protected]
// torus.js@v12.2.0 added new property to the TorusKey metadata interface (serverTimeOffset)
const torusKey: TorusKey = {
...result,
metadata: { ...result.metadata, serverTimeOffset: this.options.serverTimeOffset },
};
private _getOAuthKey(result: TorusKey): string {
return TorusUtils.getPostboxKey(result);
}

Expand Down

0 comments on commit 861acf6

Please sign in to comment.