Skip to content

Commit

Permalink
add migrate seed phrase
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Feb 11, 2025
1 parent 29c5e78 commit 49ec966
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions main/wallet-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,23 @@ class WalletBackend {
return { seedIsNew: isNew }
}

/**
* @param {string} service
*/
async maybeMigrateSeedPhrase (service) {
try {
await keytar.getPassword(service, 'seed')
return
} catch {}
let seed
try {
seed = await keytar.getPassword('station-wallet-0x', 'seed')
} catch {}
if (seed) {
await keytar.setPassword(service, 'seed', seed)
}
}

/**
* @returns {Promise<WalletSeed>}
*/
Expand All @@ -109,6 +126,7 @@ class WalletBackend {
if (!this.disableKeytar) {
log.info('Reading the seed phrase from the keychain...')
try {
await this.maybeMigrateSeedPhrase(service)
seed = await keytar.getPassword(service, 'seed')
} catch (err) {
throw new Error(
Expand Down

0 comments on commit 49ec966

Please sign in to comment.