mirror of
https://github.com/standardnotes/app
synced 2026-01-16 19:04:58 -05:00
chore: fix tests accessing crypto
This commit is contained in:
@@ -34,6 +34,7 @@ import { UserClientInterface } from '../User/UserClientInterface'
|
||||
import { SessionsClientInterface } from '../Session/SessionsClientInterface'
|
||||
import { HomeServerServiceInterface } from '../HomeServer/HomeServerServiceInterface'
|
||||
import { User } from '@standardnotes/responses'
|
||||
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
|
||||
|
||||
export interface ApplicationInterface {
|
||||
deinit(mode: DeinitMode, source: DeinitSource): void
|
||||
@@ -92,6 +93,7 @@ export interface ApplicationInterface {
|
||||
syncOptions?: SyncOptions,
|
||||
): Promise<void>
|
||||
|
||||
get crypto(): PureCryptoInterface
|
||||
get features(): FeaturesClientInterface
|
||||
get componentManager(): ComponentManagerInterface
|
||||
get items(): ItemManagerInterface
|
||||
|
||||
@@ -111,6 +111,7 @@ import { GetRevision } from '@Lib/Domain/UseCase/GetRevision/GetRevision'
|
||||
import { DeleteRevision } from '@Lib/Domain/UseCase/DeleteRevision/DeleteRevision'
|
||||
import { GetAuthenticatorAuthenticationResponse } from '@Lib/Domain/UseCase/GetAuthenticatorAuthenticationResponse/GetAuthenticatorAuthenticationResponse'
|
||||
import { GetAuthenticatorAuthenticationOptions } from '@Lib/Domain/UseCase/GetAuthenticatorAuthenticationOptions/GetAuthenticatorAuthenticationOptions'
|
||||
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
|
||||
|
||||
/** How often to automatically sync, in milliseconds */
|
||||
const DEFAULT_AUTO_SYNC_INTERVAL = 30_000
|
||||
@@ -283,6 +284,10 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
this.defineInternalEventHandlers()
|
||||
}
|
||||
|
||||
get crypto(): PureCryptoInterface {
|
||||
return this.options.crypto
|
||||
}
|
||||
|
||||
get subscriptions(): ExternalServices.SubscriptionManagerInterface {
|
||||
return this.subscriptionManager
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('004 protocol operations', function () {
|
||||
|
||||
it('generates random key', async function () {
|
||||
const length = 96
|
||||
const key = await application.encryptionService.crypto.generateRandomKey(length)
|
||||
const key = await application.crypto.generateRandomKey(length)
|
||||
expect(key.length).to.equal(length / 4)
|
||||
})
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ export function registerUserToApplication({ application, email, password, epheme
|
||||
}
|
||||
|
||||
export async function setOldVersionPasscode({ application, passcode, version }) {
|
||||
const identifier = await application.encryptionService.crypto.generateUUID()
|
||||
const identifier = await application.crypto.generateUUID()
|
||||
const operator = application.encryptionService.operators.operatorForVersion(version)
|
||||
const key = await operator.createRootKey(identifier, passcode, KeyParamsOrigination.PasscodeCreate)
|
||||
await application.encryptionService.setNewRootKeyWrapper(key)
|
||||
|
||||
Reference in New Issue
Block a user