@@ -43,7 +43,7 @@ import {
4343import { decodeToken } from "./utils" ;
4444
4545export class Web3Auth extends SafeEventEmitter < Web3AuthSfaEvents > implements IWeb3Auth {
46- readonly coreOptions : Omit < Web3AuthOptions , "storage" > & { storage : IAsyncStorage | IStorage | ISecureStore } ;
46+ readonly coreOptions : Omit < Web3AuthOptions , "storage" > & { storage : IAsyncStorage | IStorage | ISecureStore ; sessionKey ?: string } ;
4747
4848 readonly connectedAdapterName = WALLET_ADAPTERS . SFA ;
4949
@@ -73,7 +73,7 @@ export class Web3Auth extends SafeEventEmitter<Web3AuthSfaEvents> implements IWe
7373
7474 private plugins : Record < string , IPlugin > = { } ;
7575
76- constructor ( options : Web3AuthOptions ) {
76+ constructor ( options : Web3AuthOptions & { sessionKey ?: string } ) {
7777 super ( ) ;
7878 if ( ! options . clientId ) throw WalletInitializationError . invalidParams ( "Please provide a valid clientId in constructor" ) ;
7979 if ( ! options . privateKeyProvider ) throw WalletInitializationError . invalidParams ( "Please provide a valid privateKeyProvider in constructor" ) ;
@@ -126,7 +126,9 @@ export class Web3Auth extends SafeEventEmitter<Web3AuthSfaEvents> implements IWe
126126 throw WalletInitializationError . invalidParams ( "provider should have chainConfig and should be initialized with chainId and chainNamespace" ) ;
127127 }
128128
129- const storageKey = `${ this . baseStorageKey } _${ this . coreOptions . chainConfig . chainNamespace === CHAIN_NAMESPACES . SOLANA ? "solana" : "eip" } _${ this . coreOptions . usePnPKey ? "pnp" : "core_kit" } ` ;
129+ const storageKey =
130+ this . coreOptions . sessionKey ||
131+ `${ this . baseStorageKey } _${ this . coreOptions . chainConfig . chainNamespace === CHAIN_NAMESPACES . SOLANA ? "solana" : "eip" } _${ this . coreOptions . usePnPKey ? "pnp" : "core_kit" } ` ;
130132 this . currentStorage = new AsyncStorage ( storageKey , this . coreOptions . storage ) ;
131133 this . nodeDetails = fetchLocalConfig ( this . coreOptions . web3AuthNetwork , KEY_TYPE . SECP256K1 ) ;
132134 this . authInstance = new Torus ( {
0 commit comments