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

@@ -44,7 +44,7 @@ describe('account recovery', function () {
application = await context.signout()
expect(await application.protocolService.getRootKey()).to.not.be.ok
expect(await application.encryptionService.getRootKey()).to.not.be.ok
await application.signInWithRecoveryCodes.execute({
recoveryCodes: generatedRecoveryCodes.getValue(),
@@ -52,7 +52,7 @@ describe('account recovery', function () {
password: context.password,
})
expect(await application.protocolService.getRootKey()).to.be.ok
expect(await application.encryptionService.getRootKey()).to.be.ok
})
it('should automatically generate new recovery code after recovery sign in', async () => {
@@ -96,7 +96,7 @@ describe('account recovery', function () {
application = await context.signout()
expect(await application.protocolService.getRootKey()).to.not.be.ok
expect(await application.encryptionService.getRootKey()).to.not.be.ok
await application.signInWithRecoveryCodes.execute({
recoveryCodes: generatedRecoveryCodes.getValue(),
@@ -104,7 +104,7 @@ describe('account recovery', function () {
password: 'foobar',
})
expect(await application.protocolService.getRootKey()).to.not.be.ok
expect(await application.encryptionService.getRootKey()).to.not.be.ok
})
it('should not allow to sign in with invalid recovery code', async () => {
@@ -112,7 +112,7 @@ describe('account recovery', function () {
application = await context.signout()
expect(await application.protocolService.getRootKey()).to.not.be.ok
expect(await application.encryptionService.getRootKey()).to.not.be.ok
await application.signInWithRecoveryCodes.execute({
recoveryCodes: 'invalid recovery code',
@@ -120,13 +120,13 @@ describe('account recovery', function () {
password: context.paswword,
})
expect(await application.protocolService.getRootKey()).to.not.be.ok
expect(await application.encryptionService.getRootKey()).to.not.be.ok
})
it('should not allow to sign in with recovery code if user has none', async () => {
application = await context.signout()
expect(await application.protocolService.getRootKey()).to.not.be.ok
expect(await application.encryptionService.getRootKey()).to.not.be.ok
await application.signInWithRecoveryCodes.execute({
recoveryCodes: 'foo bar',
@@ -134,6 +134,6 @@ describe('account recovery', function () {
password: context.paswword,
})
expect(await application.protocolService.getRootKey()).to.not.be.ok
expect(await application.encryptionService.getRootKey()).to.not.be.ok
})
})