fix: encryption exports (#1205)

* fix: encryptio exports

* fix: imports

* fix: items key mutator import
This commit is contained in:
Karol Sójko
2022-07-05 11:31:22 +02:00
committed by GitHub
parent d311ce40b9
commit 945248d7d3
12 changed files with 53 additions and 46 deletions

View File

@@ -7,17 +7,3 @@ export type BackupFile = {
auth_params?: AnyKeyParamsContent
items: (BackupFileDecryptedContextualPayload | BackupFileEncryptedContextualPayload)[]
}
export enum BackupFileType {
Encrypted = 'Encrypted',
/**
* Generated when an export is made from an application with no account and no passcode. The
* items are encrypted, but the items keys are not.
*/
EncryptedWithNonEncryptedItemsKey = 'EncryptedWithNonEncryptedItemsKey',
FullyDecrypted = 'FullyDecrypted',
Corrupt = 'Corrupt',
}

View File

@@ -5,7 +5,8 @@ import {
leftVersionGreaterThanOrEqualToRight,
compareVersions,
} from '@standardnotes/common'
import { BackupFile, BackupFileType } from './BackupFile'
import { BackupFile } from './BackupFile'
import { BackupFileType } from './BackupFileType'
import { extendArray } from '@standardnotes/utils'
import { EncryptionService } from '../Service/Encryption/EncryptionService'
import {
@@ -28,7 +29,7 @@ import { CreateAnyKeyParams } from '../Keys/RootKey/KeyParamsFunctions'
import { SNRootKeyParams } from '../Keys/RootKey/RootKeyParams'
import { SNRootKey } from '../Keys/RootKey/RootKey'
import { ContentTypeUsesRootKeyEncryption } from '../Keys/RootKey/Functions'
import { isItemsKey, SNItemsKey } from '../Keys/ItemsKey'
import { isItemsKey, SNItemsKey } from '../Keys/ItemsKey/ItemsKey'
export async function DecryptBackupFile(
file: BackupFile,

View File

@@ -0,0 +1,13 @@
export enum BackupFileType {
Encrypted = 'Encrypted',
/**
* Generated when an export is made from an application with no account and no passcode. The
* items are encrypted, but the items keys are not.
*/
EncryptedWithNonEncryptedItemsKey = 'EncryptedWithNonEncryptedItemsKey',
FullyDecrypted = 'FullyDecrypted',
Corrupt = 'Corrupt',
}

View File

@@ -1,3 +0,0 @@
export * from './ItemsKey'
export * from './ItemsKeyMutator'
export * from './Registration'

View File

@@ -20,7 +20,7 @@ import { DecryptedParameters, EncryptedParameters, ErrorDecryptingParameters } f
import { RootKeyEncryptedAuthenticatedData } from '../../Types/RootKeyEncryptedAuthenticatedData'
import { ItemAuthenticatedData } from '../../Types/ItemAuthenticatedData'
import { LegacyAttachedData } from '../../Types/LegacyAttachedData'
import { isItemsKey } from '../../Keys/ItemsKey'
import { isItemsKey } from '../../Keys/ItemsKey/ItemsKey'
import { CreateNewRootKey } from '../../Keys/RootKey/Functions'
const NO_IV = '00000000000000000000000000000000'

View File

@@ -11,7 +11,7 @@ import { DecryptedParameters, EncryptedParameters, ErrorDecryptingParameters } f
import { RootKeyEncryptedAuthenticatedData } from '../../Types/RootKeyEncryptedAuthenticatedData'
import { ItemAuthenticatedData } from '../../Types/ItemAuthenticatedData'
import { LegacyAttachedData } from '../../Types/LegacyAttachedData'
import { isItemsKey } from '../../Keys/ItemsKey'
import { isItemsKey } from '../../Keys/ItemsKey/ItemsKey'
import { CreateNewRootKey } from '../../Keys/RootKey/Functions'
import { ItemContent, PayloadTimestampDefaults } from '@standardnotes/models'

View File

@@ -1,7 +1,7 @@
import { ContentType, ProtocolVersion } from '@standardnotes/common'
import { DecryptedPayload, ItemContent, ItemsKeyContent, PayloadTimestampDefaults } from '@standardnotes/models'
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
import { SNItemsKey } from '../../Keys/ItemsKey'
import { SNItemsKey } from '../../Keys/ItemsKey/ItemsKey'
import { ItemAuthenticatedData } from '../../Types/ItemAuthenticatedData'
import { SNProtocolOperator004 } from './Operator004'

View File

@@ -20,7 +20,7 @@ import { DecryptedParameters, EncryptedParameters, ErrorDecryptingParameters } f
import { RootKeyEncryptedAuthenticatedData } from '../../Types/RootKeyEncryptedAuthenticatedData'
import { ItemAuthenticatedData } from '../../Types/ItemAuthenticatedData'
import { LegacyAttachedData } from '../../Types/LegacyAttachedData'
import { isItemsKey } from '../../Keys/ItemsKey'
import { isItemsKey } from '../../Keys/ItemsKey/ItemsKey'
type V004StringComponents = [version: string, nonce: string, ciphertext: string, authenticatedData: string]

View File

@@ -1,9 +0,0 @@
export * from './001/Operator001'
export * from './002/Operator002'
export * from './003/Operator003'
export * from './004/Operator004'
export * from './Operator'
export * from '../Types/EncryptedParameters'
export * from '../Types/ItemAuthenticatedData'
export * from '../Types/LegacyAttachedData'
export * from '../Types/RootKeyEncryptedAuthenticatedData'

View File

@@ -15,7 +15,7 @@ import {
ErrorDecryptingParameters,
isErrorDecryptingParameters,
} from '../../Types/EncryptedParameters'
import { ItemsKeyMutator } from '../../Keys/ItemsKey'
import { ItemsKeyMutator } from '../../Keys/ItemsKey/ItemsKeyMutator'
import { CreateNewRootKey } from '../../Keys/RootKey/Functions'
import {
DecryptedPayload,

View File

@@ -1,3 +0,0 @@
export * from '../Backups/BackupFile'
export * from './Encryption/EncryptionService'
export * from './RootKey/KeyMode'

View File

@@ -1,15 +1,37 @@
export * from './Algorithm'
export * from './Split/EncryptionSplit'
export * from './Split/EncryptionTypeSplit'
export * from './Operator'
export * from './Backups/BackupFile'
export * from './Backups/BackupFileDecryptor'
export * from './Backups/BackupFileType'
export * from './Keys/ItemsKey/ItemsKey'
export * from './Keys/ItemsKey/ItemsKeyMutator'
export * from './Keys/ItemsKey/Registration'
export * from './Keys/RootKey/Functions'
export * from './Keys/RootKey/KeyParamsFunctions'
export * from './Keys/RootKey/ProtocolVersionForKeyParams'
export * from './Keys/RootKey/RootKey'
export * from './Keys/RootKey/RootKeyParams'
export * from './Keys/RootKey/Functions'
export * from './Service'
export * from './Service/Encryption/EncryptionProvider'
export * from './Split/EncryptionSplit'
export * from './Workspace/PrivateWorkspace'
export * from './Keys/ItemsKey'
export * from './Keys/RootKey/ValidKeyParamsKeys'
export * from './Keys/Utils/DecryptItemsKey'
export * from './Keys/Utils/KeyRecoveryStrings'
export * from './Operator/001/Operator001'
export * from './Operator/002/Operator002'
export * from './Operator/003/Operator003'
export * from './Operator/004/Operator004'
export * from './Operator/Functions'
export * from './Operator/Operator'
export * from './Operator/OperatorManager'
export * from './Operator/OperatorWrapper'
export * from './Service/Encryption/EncryptionProvider'
export * from './Service/Encryption/EncryptionService'
export * from './Service/Functions'
export * from './Service/Items/ItemsEncryption'
export * from './Service/RootKey/KeyMode'
export * from './Service/RootKey/RootKeyEncryption'
export * from './Split/EncryptionSplit'
export * from './Split/EncryptionTypeSplit'
export * from './Types/EncryptedParameters'
export * from './Types/ItemAuthenticatedData'
export * from './Types/LegacyAttachedData'
export * from './Types/RootKeyEncryptedAuthenticatedData'
export * from './Workspace/PrivateWorkspace'
export * from './Algorithm'
export * from './StandardException'