@ -988,11 +988,6 @@ export async function importFromMnemonic(
) : Promise < void > {
const mne : string = mnemonic . trim ( ) . toLowerCase ( ) ;
// Check if this is Test User #0
const TEST_USER_0_MNEMONIC =
"rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage" ;
const isTestUser0 = mne === TEST_USER_0_MNEMONIC ;
// Derive address and keys from mnemonic
const [ address , privateHex , publicHex ] = deriveAddress ( mne , derivationPath ) ;
@ -1007,90 +1002,6 @@ export async function importFromMnemonic(
// Save the new identity
await saveNewIdentity ( newId , mne , derivationPath ) ;
// Set up Test User #0 specific settings
if ( isTestUser0 ) {
// Set up Test User #0 specific settings with enhanced error handling
const platformService = await getPlatformService ( ) ;
try {
// First, ensure the DID-specific settings record exists
await platformService . insertNewDidIntoSettings ( newId . did ) ;
// Then update with Test User #0 specific settings
await platformService . updateDidSpecificSettings ( newId . did , {
firstName : "User Zero" ,
isRegistered : true ,
} ) ;
// Verify the settings were saved correctly
const verificationResult = await platformService . dbQuery (
"SELECT firstName, isRegistered FROM settings WHERE accountDid = ?" ,
[ newId . did ] ,
) ;
if ( verificationResult ? . values ? . length ) {
const settings = verificationResult . values [ 0 ] ;
const firstName = settings [ 0 ] ;
const isRegistered = settings [ 1 ] ;
logger . debug (
"[importFromMnemonic] Test User #0 settings verification" ,
{
did : newId.did ,
firstName ,
isRegistered ,
expectedFirstName : "User Zero" ,
expectedIsRegistered : true ,
} ,
) ;
// If settings weren't saved correctly, try individual updates
if ( firstName !== "User Zero" || isRegistered !== 1 ) {
logger . warn (
"[importFromMnemonic] Test User #0 settings not saved correctly, retrying with individual updates" ,
) ;
await platformService . dbExec (
"UPDATE settings SET firstName = ? WHERE accountDid = ?" ,
[ "User Zero" , newId . did ] ,
) ;
await platformService . dbExec (
"UPDATE settings SET isRegistered = ? WHERE accountDid = ?" ,
[ 1 , newId . did ] ,
) ;
// Verify again
const retryResult = await platformService . dbQuery (
"SELECT firstName, isRegistered FROM settings WHERE accountDid = ?" ,
[ newId . did ] ,
) ;
if ( retryResult ? . values ? . length ) {
const retrySettings = retryResult . values [ 0 ] ;
logger . debug (
"[importFromMnemonic] Test User #0 settings after retry" ,
{
firstName : retrySettings [ 0 ] ,
isRegistered : retrySettings [ 1 ] ,
} ,
) ;
}
}
} else {
logger . error (
"[importFromMnemonic] Failed to verify Test User #0 settings - no record found" ,
) ;
}
} catch ( error ) {
logger . error (
"[importFromMnemonic] Error setting up Test User #0 settings:" ,
error ,
) ;
// Don't throw - allow the import to continue even if settings fail
}
}
}
/ * *