diff --git a/packages/services/src/Domain/Encryption/UseCase/TypeA/DecryptPayloadWithKeyLookup.ts b/packages/services/src/Domain/Encryption/UseCase/TypeA/DecryptPayloadWithKeyLookup.ts index 2745b05b2..17b1af7cc 100644 --- a/packages/services/src/Domain/Encryption/UseCase/TypeA/DecryptPayloadWithKeyLookup.ts +++ b/packages/services/src/Domain/Encryption/UseCase/TypeA/DecryptPayloadWithKeyLookup.ts @@ -10,12 +10,14 @@ import { import { DecryptTypeAPayload } from './DecryptPayload' import { RootKeyManager } from '../../../RootKeyManager/RootKeyManager' import { KeySystemKeyManagerInterface } from '../../../KeySystem/KeySystemKeyManagerInterface' +import { LoggerInterface } from '@standardnotes/utils' export class DecryptTypeAPayloadWithKeyLookup { constructor( private operators: EncryptionOperatorsInterface, private keySystemKeyManager: KeySystemKeyManagerInterface, private rootKeyManager: RootKeyManager, + private logger: LoggerInterface, ) {} async executeOne( @@ -24,7 +26,11 @@ export class DecryptTypeAPayloadWithKeyLookup { let key: RootKeyInterface | KeySystemRootKeyInterface | undefined if (ContentTypeUsesKeySystemRootKeyEncryption(payload.content_type)) { if (!payload.key_system_identifier) { - throw Error('Key system root key encrypted payload is missing key_system_identifier') + this.logger.error('Payload is missing key system identifier', payload) + return { + uuid: payload.uuid, + errorDecrypting: true, + } } key = this.keySystemKeyManager.getPrimaryKeySystemRootKey(payload.key_system_identifier) } else { diff --git a/packages/snjs/lib/Application/Application.ts b/packages/snjs/lib/Application/Application.ts index 205b1e464..aab54fbfc 100644 --- a/packages/snjs/lib/Application/Application.ts +++ b/packages/snjs/lib/Application/Application.ts @@ -225,6 +225,9 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli this.dependencies = new Dependencies(this.options) + const logger = this.dependencies.get(TYPES.Logger) + logger.setLevel('error') + this.registerServiceObservers() RegisterApplicationServicesEvents(this.dependencies, this.events) diff --git a/packages/snjs/lib/Application/Dependencies/Dependencies.ts b/packages/snjs/lib/Application/Dependencies/Dependencies.ts index 3a6376dbc..1e05dc9ef 100644 --- a/packages/snjs/lib/Application/Dependencies/Dependencies.ts +++ b/packages/snjs/lib/Application/Dependencies/Dependencies.ts @@ -770,6 +770,7 @@ export class Dependencies { this.get(TYPES.EncryptionOperators), this.get(TYPES.KeySystemKeyManager), this.get(TYPES.RootKeyManager), + this.get(TYPES.Logger), ) })