Files
standardnotes-app-web/packages/snjs/lib/Migrations/Versions/2_0_15.ts
2023-07-04 07:31:50 -05:00

22 lines
652 B
TypeScript

import { ApplicationStage } from '@standardnotes/services'
import { Migration } from '@Lib/Migrations/Migration'
export class Migration2_0_15 extends Migration {
static override version(): string {
return '2.0.15'
}
protected registerStageHandlers(): void {
this.registerStageHandler(ApplicationStage.LoadedDatabase_12, async () => {
await this.createNewDefaultItemsKeyIfNecessary()
this.markDone()
})
}
private async createNewDefaultItemsKeyIfNecessary() {
if (this.services.encryptionService.needsNewRootKeyBasedItemsKey()) {
await this.services.encryptionService.createNewDefaultItemsKey()
}
}
}