Skip to content

Commit

Permalink
fix: migration of link secret (#1444)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <timo@animo.id>
  • Loading branch information
TimoGlastra committed May 1, 2023
1 parent 83cf387 commit 9a43afe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/anoncreds/src/updates/0.3.1-0.4/linkSecret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export async function migrateLinkSecretToV0_4<Agent extends BaseAgent>(agent: Ag
const linkSecretRepository = agent.dependencyManager.resolve(AnonCredsLinkSecretRepository)

agent.config.logger.debug(`Fetching default link secret record from storage`)
const defaultLinkdSecret = await linkSecretRepository.findDefault(agent.context)
const defaultLinkSecret = await linkSecretRepository.findDefault(agent.context)

if (!defaultLinkdSecret) {
if (!defaultLinkSecret) {
// If no default link secret record exists, we create one based on the wallet id and set is as default
agent.config.logger.debug(`No default link secret record found. Creating one based on wallet id.`)

Expand All @@ -35,7 +35,7 @@ export async function migrateLinkSecretToV0_4<Agent extends BaseAgent>(agent: Ag
await linkSecretRepository.save(agent.context, linkSecret)
} else {
agent.config.logger.debug(
`Default link secret record with record id ${defaultLinkdSecret.id} and link secret id ${defaultLinkdSecret.linkSecretId} found. Skipping...`
`Default link secret record with record id ${defaultLinkSecret.id} and link secret id ${defaultLinkSecret.linkSecretId} found. Skipping...`
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export class IndySdkToAskarMigrationUpdater {
for (const row of masterSecrets) {
this.agent.config.logger.debug(`Migrating ${row.name} to the new askar format`)

const isDefault = masterSecrets.length === 0 ?? row.name === this.walletConfig.id
const isDefault = masterSecrets.length === 0 || row.name === this.walletConfig.id

const {
value: { ms },
Expand Down

0 comments on commit 9a43afe

Please sign in to comment.