1- import { BNString , KeyType , ONE_KEY_DELETE_NONCE , Point , secp256k1 , SHARE_DELETED , ShareStore , StringifiedType } from "@tkey/common-types" ;
1+ import {
2+ BNString ,
3+ KEY_NOT_FOUND ,
4+ KeyType ,
5+ ONE_KEY_DELETE_NONCE ,
6+ Point ,
7+ secp256k1 ,
8+ SHARE_DELETED ,
9+ ShareStore ,
10+ StringifiedType ,
11+ } from "@tkey/common-types" ;
212import { CoreError } from "@tkey/core" ;
313import { ShareSerializationModule } from "@tkey/share-serialization" ;
414import { TorusStorageLayer } from "@tkey/storage-layer-torus" ;
@@ -612,7 +622,6 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
612622
613623 const hashedFactorPub = getPubKeyPoint ( hashedFactorKey , factorKeyCurve ) ;
614624 await this . deleteFactor ( hashedFactorPub , hashedFactorKey ) ;
615- await this . deleteMetadataShareBackup ( hashedFactorKey ) ;
616625
617626 // only recovery factor = true
618627 let backupFactorKey ;
@@ -1169,7 +1178,6 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
11691178
11701179 this . updateState ( { tssShareIndex, tssPubKey, factorKey } ) ;
11711180
1172-
11731181 if ( this . sessionManager && this . sessionId ) {
11741182 const payload : SessionData = {
11751183 postBoxKey : this . state . postBoxKey ,
@@ -1184,7 +1192,6 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
11841192 } else {
11851193 await this . createSession ( ) ;
11861194 }
1187-
11881195 }
11891196
11901197 private checkReady ( ) {
@@ -1294,7 +1301,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
12941301 private async getFactorKeyMetadata ( factorKey : BN ) : Promise < ShareStore > {
12951302 this . checkReady ( ) ;
12961303 const factorKeyMetadata = await this . tKey ?. readMetadata < StringifiedType > ( factorKey ) ;
1297- if ( ! factorKeyMetadata || factorKeyMetadata . message === " KEY_NOT_FOUND" ) {
1304+ if ( ! factorKeyMetadata || factorKeyMetadata . message === KEY_NOT_FOUND || factorKeyMetadata . message === SHARE_DELETED ) {
12981305 throw CoreKitError . noMetadataFound ( ) ;
12991306 }
13001307 return ShareStore . fromJSON ( factorKeyMetadata ) ;
0 commit comments