Skip to content

Commit

Permalink
fix: extraction abstract key split
Browse files Browse the repository at this point in the history
  • Loading branch information
Karol Sójko committed Jul 5, 2022
1 parent 03497cb commit 85ab5b9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
23 changes: 23 additions & 0 deletions packages/encryption/src/Domain/Split/AbstractKeySplit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {
DecryptedPayloadInterface,
EncryptedPayloadInterface,
ItemsKeyInterface,
RootKeyInterface,
} from '@standardnotes/models'

export interface AbstractKeySplit<T = EncryptedPayloadInterface | DecryptedPayloadInterface> {
usesRootKey?: {
items: T[]
key: RootKeyInterface
}
usesItemsKey?: {
items: T[]
key: ItemsKeyInterface
}
usesRootKeyWithKeyLookup?: {
items: T[]
}
usesItemsKeyWithKeyLookup?: {
items: T[]
}
}
20 changes: 1 addition & 19 deletions packages/encryption/src/Domain/Split/EncryptionSplit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T = EncryptedPayloadInterface | DecryptedPayloadInterface> {
usesRootKey?: {
items: T[]
key: RootKeyInterface
}
usesItemsKey?: {
items: T[]
key: ItemsKeyInterface
}
usesRootKeyWithKeyLookup?: {
items: T[]
}
usesItemsKeyWithKeyLookup?: {
items: T[]
}
}

export type KeyedEncryptionSplit = AbstractKeySplit<DecryptedPayloadInterface>
export type KeyedDecryptionSplit = AbstractKeySplit<EncryptedPayloadInterface>

Expand Down
1 change: 1 addition & 0 deletions packages/encryption/src/Domain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 85ab5b9

Please sign in to comment.