refactor: key rotation (#2383)

This commit is contained in:
Mo
2023-08-04 09:25:28 -05:00
committed by GitHub
parent a7f266bb68
commit 494436bdb6
65 changed files with 1354 additions and 1232 deletions

View File

@@ -87,7 +87,7 @@ const EditVaultModal: FunctionComponent<Props> = ({ onCloseDialog, existingVault
const isChangingPasswordType = vault.keyPasswordType !== passwordType
const isChangingKeyStorageMode = vault.keyStorageMode !== keyStorageMode
const getPasswordTypeParams = (): ChangeVaultKeyOptionsDTO['newPasswordType'] => {
const getPasswordTypeParams = (): ChangeVaultKeyOptionsDTO['newPasswordOptions'] => {
if (!isChangingPasswordType) {
throw new Error('Password type is not changing')
}
@@ -108,9 +108,9 @@ const EditVaultModal: FunctionComponent<Props> = ({ onCloseDialog, existingVault
}
if (isChangingPasswordType || isChangingKeyStorageMode) {
await application.vaults.changeVaultOptions({
await application.vaults.changeVaultKeyOptions({
vault,
newPasswordType: isChangingPasswordType ? getPasswordTypeParams() : undefined,
newPasswordOptions: isChangingPasswordType ? getPasswordTypeParams() : undefined,
newStorageMode: isChangingKeyStorageMode ? keyStorageMode : undefined,
})
}

View File

@@ -17,7 +17,7 @@ import {
SyncOpStatus,
SyncServiceInterface,
User,
UserClientInterface,
UserServiceInterface,
UserRequestType,
} from '@standardnotes/snjs'
@@ -41,7 +41,7 @@ describe('ApplicationEventObserver', () => {
let sessionManager: SessionsClientInterface
let subscriptionManager: SubscriptionManagerInterface
let toastService: ToastServiceInterface
let userService: UserClientInterface
let userService: UserServiceInterface
const createObserver = () =>
new ApplicationEventObserver(
@@ -94,7 +94,7 @@ describe('ApplicationEventObserver', () => {
toastService.showToast = jest.fn().mockReturnValue('1')
toastService.hideToast = jest.fn()
userService = {} as jest.Mocked<UserClientInterface>
userService = {} as jest.Mocked<UserServiceInterface>
userService.submitUserRequest = jest.fn().mockReturnValue(true)
})

View File

@@ -10,7 +10,7 @@ import {
SessionsClientInterface,
SubscriptionManagerInterface,
SyncServiceInterface,
UserClientInterface,
UserServiceInterface,
} from '@standardnotes/snjs'
import { ToastType } from '@standardnotes/toast'
@@ -37,7 +37,7 @@ export class ApplicationEventObserver implements EventObserverInterface {
private sessionManager: SessionsClientInterface,
private subscriptionManager: SubscriptionManagerInterface,
private toastService: ToastServiceInterface,
private userService: UserClientInterface,
private userService: UserServiceInterface,
) {}
async handle(event: ApplicationEvent): Promise<void> {