refactor: root key manager (#2344)

This commit is contained in:
Mo
2023-07-04 07:31:50 -05:00
committed by GitHub
parent b4a90025c4
commit b06999d25b
56 changed files with 1400 additions and 1231 deletions

View File

@@ -207,13 +207,13 @@ export class BaseMigration extends Migration {
this.services.challengeService.addChallengeObserver(challenge, {
onNonvalidatedSubmit: async (challengeResponse) => {
const password = challengeResponse.values[0].value as string
const accountParams = this.services.protocolService.createKeyParams(rawAccountParams)
const rootKey = await this.services.protocolService.computeRootKey(password, accountParams)
const accountParams = this.services.encryptionService.createKeyParams(rawAccountParams)
const rootKey = await this.services.encryptionService.computeRootKey(password, accountParams)
/** TS can't detect we returned early above if itemToDecrypt is null */
assert(itemToDecrypt)
const decryptedPayload = await this.services.protocolService.decryptSplitSingle({
const decryptedPayload = await this.services.encryptionService.decryptSplitSingle({
usesRootKey: {
items: [itemToDecrypt],
key: rootKey,