From 85ab5b914a0fe178c52b130644fb8f36648f1b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20S=C3=B3jko?= Date: Tue, 5 Jul 2022 12:38:34 +0200 Subject: [PATCH] fix: extraction abstract key split --- .../src/Domain/Split/AbstractKeySplit.ts | 23 +++++++++++++++++++ .../src/Domain/Split/EncryptionSplit.ts | 20 +--------------- packages/encryption/src/Domain/index.ts | 1 + 3 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 packages/encryption/src/Domain/Split/AbstractKeySplit.ts diff --git a/packages/encryption/src/Domain/Split/AbstractKeySplit.ts b/packages/encryption/src/Domain/Split/AbstractKeySplit.ts new file mode 100644 index 000000000..59a46b008 --- /dev/null +++ b/packages/encryption/src/Domain/Split/AbstractKeySplit.ts @@ -0,0 +1,23 @@ +import { + DecryptedPayloadInterface, + EncryptedPayloadInterface, + ItemsKeyInterface, + RootKeyInterface, +} from '@standardnotes/models' + +export interface AbstractKeySplit { + usesRootKey?: { + items: T[] + key: RootKeyInterface + } + usesItemsKey?: { + items: T[] + key: ItemsKeyInterface + } + usesRootKeyWithKeyLookup?: { + items: T[] + } + usesItemsKeyWithKeyLookup?: { + items: T[] + } +} diff --git a/packages/encryption/src/Domain/Split/EncryptionSplit.ts b/packages/encryption/src/Domain/Split/EncryptionSplit.ts index 197c2bfb1..6db0e39ad 100644 --- a/packages/encryption/src/Domain/Split/EncryptionSplit.ts +++ b/packages/encryption/src/Domain/Split/EncryptionSplit.ts @@ -2,29 +2,11 @@ import { Uuid } from '@standardnotes/common' import { DecryptedPayloadInterface, EncryptedPayloadInterface, - ItemsKeyInterface, PayloadInterface, - RootKeyInterface, } from '@standardnotes/models' +import { AbstractKeySplit } from './AbstractKeySplit' import { EncryptionTypeSplit } from './EncryptionTypeSplit' -export interface AbstractKeySplit { - usesRootKey?: { - items: T[] - key: RootKeyInterface - } - usesItemsKey?: { - items: T[] - key: ItemsKeyInterface - } - usesRootKeyWithKeyLookup?: { - items: T[] - } - usesItemsKeyWithKeyLookup?: { - items: T[] - } -} - export type KeyedEncryptionSplit = AbstractKeySplit export type KeyedDecryptionSplit = AbstractKeySplit diff --git a/packages/encryption/src/Domain/index.ts b/packages/encryption/src/Domain/index.ts index fe100a4a5..990c5e8e1 100644 --- a/packages/encryption/src/Domain/index.ts +++ b/packages/encryption/src/Domain/index.ts @@ -26,6 +26,7 @@ export * from './Service/Functions' export * from './Service/Items/ItemsEncryption' export * from './Service/RootKey/KeyMode' export * from './Service/RootKey/RootKeyEncryption' +export * from './Split/AbstractKeySplit' export * from './Split/EncryptionSplit' export * from './Split/EncryptionTypeSplit' export * from './Split/Functions'