chore(encryption): lint

This commit is contained in:
Mo
2022-07-05 09:45:45 -05:00
parent 37d765ab21
commit 0cbd98224c
32 changed files with 260 additions and 155 deletions

View File

@@ -22,17 +22,20 @@
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"format": "prettier --write src",
"test": "jest"
},
"devDependencies": {
"@standardnotes/config": "2.4.3",
"@types/jest": "^27.4.1",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/eslint-plugin": "*",
"eslint": "*",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^27.5.1",
"prettier": "*",
"ts-jest": "^27.1.3",
"typescript": "^4.7.4"
"typescript": "*"
},
"dependencies": {
"@standardnotes/common": "^1.23.1",

View File

@@ -1,5 +1,5 @@
import { BackupFileDecryptedContextualPayload, BackupFileEncryptedContextualPayload } from '@standardnotes/models'
import { AnyKeyParamsContent, ProtocolVersion } from '@standardnotes/common'
import { BackupFileDecryptedContextualPayload, BackupFileEncryptedContextualPayload } from '@standardnotes/models'
export type BackupFile = {
version?: ProtocolVersion

View File

@@ -1,35 +1,35 @@
import {
AnyKeyParamsContent,
ContentType,
ProtocolVersion,
leftVersionGreaterThanOrEqualToRight,
compareVersions,
ContentType,
leftVersionGreaterThanOrEqualToRight,
ProtocolVersion,
} from '@standardnotes/common'
import { BackupFile } from './BackupFile'
import { BackupFileType } from './BackupFileType'
import { extendArray } from '@standardnotes/utils'
import { EncryptionService } from '../Service/Encryption/EncryptionService'
import {
PayloadInterface,
DecryptedPayloadInterface,
ItemsKeyContent,
EncryptedPayloadInterface,
isEncryptedPayload,
isDecryptedPayload,
isEncryptedTransferPayload,
EncryptedPayload,
DecryptedPayload,
isDecryptedTransferPayload,
CreateDecryptedItemFromPayload,
ItemsKeyInterface,
CreatePayloadSplit,
DecryptedPayload,
DecryptedPayloadInterface,
EncryptedPayload,
EncryptedPayloadInterface,
isDecryptedPayload,
isDecryptedTransferPayload,
isEncryptedPayload,
isEncryptedTransferPayload,
ItemsKeyContent,
ItemsKeyInterface,
PayloadInterface,
} from '@standardnotes/models'
import { ClientDisplayableError } from '@standardnotes/responses'
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 { extendArray } from '@standardnotes/utils'
import { isItemsKey, SNItemsKey } from '../Keys/ItemsKey/ItemsKey'
import { ContentTypeUsesRootKeyEncryption } from '../Keys/RootKey/Functions'
import { CreateAnyKeyParams } from '../Keys/RootKey/KeyParamsFunctions'
import { SNRootKey } from '../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../Keys/RootKey/RootKeyParams'
import { EncryptionService } from '../Service/Encryption/EncryptionService'
import { BackupFile } from './BackupFile'
import { BackupFileType } from './BackupFileType'
export async function DecryptBackupFile(
file: BackupFile,

View File

@@ -1,14 +1,14 @@
import { ContentType, ProtocolVersion } from '@standardnotes/common'
import {
ConflictStrategy,
ItemsKeyContent,
DecryptedItem,
DecryptedPayloadInterface,
DecryptedItemInterface,
DecryptedPayloadInterface,
HistoryEntryInterface,
ItemsKeyContent,
ItemsKeyInterface,
RootKeyInterface,
} from '@standardnotes/models'
import { ContentType, ProtocolVersion } from '@standardnotes/common'
export function isItemsKey(x: ItemsKeyInterface | RootKeyInterface): x is ItemsKeyInterface {
return x.content_type === ContentType.ItemsKey

View File

@@ -1,4 +1,4 @@
import { DecryptedItemMutator, ItemsKeyMutatorInterface, ItemsKeyContent } from '@standardnotes/models'
import { DecryptedItemMutator, ItemsKeyContent, ItemsKeyMutatorInterface } from '@standardnotes/models'
export class ItemsKeyMutator extends DecryptedItemMutator<ItemsKeyContent> implements ItemsKeyMutatorInterface {
set isDefault(isDefault: boolean) {

View File

@@ -1,5 +1,5 @@
import { ContentType } from '@standardnotes/common'
import { RegisterItemClass, DecryptedItemMutator, ItemsKeyContent } from '@standardnotes/models'
import { DecryptedItemMutator, ItemsKeyContent, RegisterItemClass } from '@standardnotes/models'
import { SNItemsKey } from './ItemsKey'
import { ItemsKeyMutator } from './ItemsKeyMutator'

View File

@@ -1,4 +1,4 @@
import { SNRootKey } from './RootKey'
import { ContentType, ProtocolVersion } from '@standardnotes/common'
import {
DecryptedPayload,
FillItemContentSpecialized,
@@ -7,7 +7,7 @@ import {
RootKeyContentSpecialized,
} from '@standardnotes/models'
import { UuidGenerator } from '@standardnotes/utils'
import { ContentType, ProtocolVersion } from '@standardnotes/common'
import { SNRootKey } from './RootKey'
export function CreateNewRootKey(content: RootKeyContentSpecialized): SNRootKey {
const uuid = UuidGenerator.GenerateUuid()

View File

@@ -1,13 +1,13 @@
import { KeyParamsResponse } from '@standardnotes/responses'
import {
AnyKeyParamsContent,
KeyParamsContent001,
KeyParamsContent002,
KeyParamsContent003,
KeyParamsContent004,
AnyKeyParamsContent,
} from '@standardnotes/common'
import { SNRootKeyParams } from './RootKeyParams'
import { KeyParamsResponse } from '@standardnotes/responses'
import { ProtocolVersionForKeyParams } from './ProtocolVersionForKeyParams'
import { SNRootKeyParams } from './RootKeyParams'
/**
* 001, 002:

View File

@@ -1,6 +1,6 @@
import { V001Algorithm, V002Algorithm } from '../../Algorithm'
import { KeyParamsData } from '@standardnotes/responses'
import { AnyKeyParamsContent, ProtocolVersion } from '@standardnotes/common'
import { KeyParamsData } from '@standardnotes/responses'
import { V001Algorithm, V002Algorithm } from '../../Algorithm'
export function ProtocolVersionForKeyParams(response: KeyParamsData | AnyKeyParamsContent): ProtocolVersion {
if (response.version) {

View File

@@ -1,14 +1,14 @@
import { SNRootKeyParams } from './RootKeyParams'
import { ProtocolVersion } from '@standardnotes/common'
import {
RootKeyInterface,
RootKeyContent,
DecryptedItem,
DecryptedPayloadInterface,
RootKeyContentInStorage,
NamespacedRootKeyInKeychain,
RootKeyContent,
RootKeyContentInStorage,
RootKeyInterface,
} from '@standardnotes/models'
import { ProtocolVersion } from '@standardnotes/common'
import { timingSafeEqual } from '@standardnotes/sncrypto-common'
import { SNRootKeyParams } from './RootKeyParams'
/**
* A root key is a local only construct that houses the key used for the encryption

View File

@@ -1,11 +1,11 @@
import {
AnyKeyParamsContent,
KeyParamsContent001,
KeyParamsContent002,
KeyParamsContent003,
KeyParamsContent004,
AnyKeyParamsContent,
ProtocolVersion,
KeyParamsOrigination,
ProtocolVersion,
} from '@standardnotes/common'
import { RootKeyParamsInterface } from '@standardnotes/models'
import { pickByCopy } from '@standardnotes/utils'

View File

@@ -1,27 +1,27 @@
import { ContentType, KeyParamsOrigination, ProtocolVersion, ProtocolVersionLength } from '@standardnotes/common'
import { Create001KeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { firstHalfOfString, secondHalfOfString, splitString, UuidGenerator } from '@standardnotes/utils'
import { AsynchronousOperator } from '../Operator'
import {
CreateDecryptedItemFromPayload,
ItemsKeyContent,
ItemsKeyInterface,
FillItemContent,
ItemContent,
DecryptedPayload,
DecryptedPayloadInterface,
FillItemContent,
ItemContent,
ItemsKeyContent,
ItemsKeyInterface,
PayloadTimestampDefaults,
} from '@standardnotes/models'
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
import { SNRootKey } from '../../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
import { firstHalfOfString, secondHalfOfString, splitString, UuidGenerator } from '@standardnotes/utils'
import { V001Algorithm } from '../../Algorithm'
import { DecryptedParameters, EncryptedParameters, ErrorDecryptingParameters } from '../../Types/EncryptedParameters'
import { RootKeyEncryptedAuthenticatedData } from '../../Types/RootKeyEncryptedAuthenticatedData'
import { ItemAuthenticatedData } from '../../Types/ItemAuthenticatedData'
import { LegacyAttachedData } from '../../Types/LegacyAttachedData'
import { isItemsKey } from '../../Keys/ItemsKey/ItemsKey'
import { CreateNewRootKey } from '../../Keys/RootKey/Functions'
import { Create001KeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { SNRootKey } from '../../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
import { DecryptedParameters, EncryptedParameters, ErrorDecryptingParameters } from '../../Types/EncryptedParameters'
import { ItemAuthenticatedData } from '../../Types/ItemAuthenticatedData'
import { LegacyAttachedData } from '../../Types/LegacyAttachedData'
import { RootKeyEncryptedAuthenticatedData } from '../../Types/RootKeyEncryptedAuthenticatedData'
import { AsynchronousOperator } from '../Operator'
const NO_IV = '00000000000000000000000000000000'

View File

@@ -1,19 +1,19 @@
import { Create002KeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { SNProtocolOperator001 } from '../001/Operator001'
import { SNRootKey } from '../../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
import { UuidGenerator } from '@standardnotes/utils'
import { V002Algorithm } from '../../Algorithm'
import * as Common from '@standardnotes/common'
import * as Models from '@standardnotes/models'
import { ItemContent, PayloadTimestampDefaults } from '@standardnotes/models'
import * as Utils from '@standardnotes/utils'
import { DecryptedParameters, EncryptedParameters, ErrorDecryptingParameters } from '../../Types/EncryptedParameters'
import { RootKeyEncryptedAuthenticatedData } from '../../Types/RootKeyEncryptedAuthenticatedData'
import { ItemAuthenticatedData } from '../../Types/ItemAuthenticatedData'
import { LegacyAttachedData } from '../../Types/LegacyAttachedData'
import { UuidGenerator } from '@standardnotes/utils'
import { V002Algorithm } from '../../Algorithm'
import { isItemsKey } from '../../Keys/ItemsKey/ItemsKey'
import { CreateNewRootKey } from '../../Keys/RootKey/Functions'
import { ItemContent, PayloadTimestampDefaults } from '@standardnotes/models'
import { Create002KeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { SNRootKey } from '../../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
import { DecryptedParameters, EncryptedParameters, ErrorDecryptingParameters } from '../../Types/EncryptedParameters'
import { ItemAuthenticatedData } from '../../Types/ItemAuthenticatedData'
import { LegacyAttachedData } from '../../Types/LegacyAttachedData'
import { RootKeyEncryptedAuthenticatedData } from '../../Types/RootKeyEncryptedAuthenticatedData'
import { SNProtocolOperator001 } from '../001/Operator001'
/**
* @deprecated

View File

@@ -1,19 +1,19 @@
import { splitString, UuidGenerator } from '@standardnotes/utils'
import { ContentType, KeyParamsOrigination, ProtocolVersion } from '@standardnotes/common'
import {
CreateDecryptedItemFromPayload,
DecryptedPayload,
FillItemContent,
ItemsKeyContent,
ItemsKeyInterface,
FillItemContent,
PayloadTimestampDefaults,
} from '@standardnotes/models'
import { SNRootKey } from '../../Keys/RootKey/RootKey'
import { splitString, UuidGenerator } from '@standardnotes/utils'
import { V003Algorithm } from '../../Algorithm'
import { Create003KeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { SNProtocolOperator002 } from '../002/Operator002'
import { ContentType, KeyParamsOrigination, ProtocolVersion } from '@standardnotes/common'
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
import { CreateNewRootKey } from '../../Keys/RootKey/Functions'
import { Create003KeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { SNRootKey } from '../../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
import { SNProtocolOperator002 } from '../002/Operator002'
/**
* @legacy

View File

@@ -1,6 +1,5 @@
import { ContentType, KeyParamsOrigination, ProtocolVersion } from '@standardnotes/common'
import { Create004KeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { SynchronousOperator } from '../Operator'
import * as Models from '@standardnotes/models'
import {
CreateDecryptedItemFromPayload,
FillItemContent,
@@ -10,17 +9,18 @@ import {
PayloadTimestampDefaults,
} from '@standardnotes/models'
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
import * as Utils from '@standardnotes/utils'
import { V004Algorithm } from '../../Algorithm'
import { isItemsKey } from '../../Keys/ItemsKey/ItemsKey'
import { ContentTypeUsesRootKeyEncryption, CreateNewRootKey } from '../../Keys/RootKey/Functions'
import { Create004KeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { SNRootKey } from '../../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
import { V004Algorithm } from '../../Algorithm'
import * as Models from '@standardnotes/models'
import * as Utils from '@standardnotes/utils'
import { ContentTypeUsesRootKeyEncryption, CreateNewRootKey } from '../../Keys/RootKey/Functions'
import { DecryptedParameters, EncryptedParameters, ErrorDecryptingParameters } from '../../Types/EncryptedParameters'
import { RootKeyEncryptedAuthenticatedData } from '../../Types/RootKeyEncryptedAuthenticatedData'
import { ItemAuthenticatedData } from '../../Types/ItemAuthenticatedData'
import { LegacyAttachedData } from '../../Types/LegacyAttachedData'
import { isItemsKey } from '../../Keys/ItemsKey/ItemsKey'
import { RootKeyEncryptedAuthenticatedData } from '../../Types/RootKeyEncryptedAuthenticatedData'
import { SynchronousOperator } from '../Operator'
type V004StringComponents = [version: string, nonce: string, ciphertext: string, authenticatedData: string]

View File

@@ -1,10 +1,10 @@
import { ProtocolVersion } from '@standardnotes/common'
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
import { SNProtocolOperator001 } from '../Operator/001/Operator001'
import { SNProtocolOperator002 } from '../Operator/002/Operator002'
import { SNProtocolOperator003 } from '../Operator/003/Operator003'
import { SNProtocolOperator004 } from '../Operator/004/Operator004'
import { AsynchronousOperator, SynchronousOperator } from '../Operator/Operator'
import { ProtocolVersion } from '@standardnotes/common'
export function createOperatorForVersion(
version: ProtocolVersion,

View File

@@ -1,12 +1,12 @@
import { ItemsKeyInterface, RootKeyInterface } from '@standardnotes/models'
import { KeyParamsOrigination } from '@standardnotes/common'
import * as Models from '@standardnotes/models'
import { ItemsKeyInterface, RootKeyInterface } from '@standardnotes/models'
import { SNRootKey } from '../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../Keys/RootKey/RootKeyParams'
import { KeyParamsOrigination } from '@standardnotes/common'
import { DecryptedParameters, EncryptedParameters, ErrorDecryptingParameters } from '../Types/EncryptedParameters'
import { RootKeyEncryptedAuthenticatedData } from '../Types/RootKeyEncryptedAuthenticatedData'
import { ItemAuthenticatedData } from '../Types/ItemAuthenticatedData'
import { LegacyAttachedData } from '../Types/LegacyAttachedData'
import { RootKeyEncryptedAuthenticatedData } from '../Types/RootKeyEncryptedAuthenticatedData'
/**w
* An operator is responsible for performing crypto operations, such as generating keys

View File

@@ -1,5 +1,5 @@
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
import { ProtocolVersion, ProtocolVersionLatest } from '@standardnotes/common'
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
import { createOperatorForVersion } from './Functions'
import { AsynchronousOperator, SynchronousOperator } from './Operator'

View File

@@ -1,5 +1,3 @@
import { isAsyncOperator } from './Functions'
import { OperatorManager } from './OperatorManager'
import * as Models from '@standardnotes/models'
import {
DecryptedParameters,
@@ -7,6 +5,8 @@ import {
encryptedParametersFromPayload,
ErrorDecryptingParameters,
} from '../Types/EncryptedParameters'
import { isAsyncOperator } from './Functions'
import { OperatorManager } from './OperatorManager'
export async function encryptPayload(
payload: Models.DecryptedPayloadInterface,

View File

@@ -1,35 +1,5 @@
import { BackupFile } from '../../Backups/BackupFile'
import { CreateAnyKeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { DecryptBackupFile } from '../../Backups/BackupFileDecryptor'
import { EncryptionProvider } from './EncryptionProvider'
import { findDefaultItemsKey } from '../Functions'
import { ItemsEncryptionService } from '../Items/ItemsEncryption'
import { KeyMode } from '../RootKey/KeyMode'
import { OperatorManager } from '../../Operator/OperatorManager'
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
import { SNRootKey } from '../../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
import { V001Algorithm, V002Algorithm } from '../../Algorithm'
import * as Common from '@standardnotes/common'
import {
CreateEncryptionSplitWithKeyLookup,
FindPayloadInDecryptionSplit,
FindPayloadInEncryptionSplit,
} from '../../Split/EncryptionSplit'
import * as Models from '@standardnotes/models'
import * as RootKeyEncryption from '../RootKey/RootKeyEncryption'
import * as Services from '@standardnotes/services'
import * as Utils from '@standardnotes/utils'
import {
DecryptedParameters,
EncryptedParameters,
ErrorDecryptingParameters,
isErrorDecryptingParameters,
encryptedParametersFromPayload,
} from '../../Types/EncryptedParameters'
import { RootKeyEncryptedAuthenticatedData } from '../../Types/RootKeyEncryptedAuthenticatedData'
import { ItemAuthenticatedData } from '../../Types/ItemAuthenticatedData'
import { LegacyAttachedData } from '../../Types/LegacyAttachedData'
import {
CreateDecryptedBackupFileContextPayload,
CreateEncryptedBackupFileContextPayload,
@@ -38,12 +8,42 @@ import {
isEncryptedPayload,
RootKeyInterface,
} from '@standardnotes/models'
import { SplitPayloadsByEncryptionType } from '../../Split/Functions'
import { ClientDisplayableError } from '@standardnotes/responses'
import { isNotUndefined } from '@standardnotes/utils'
import * as Services from '@standardnotes/services'
import { DiagnosticInfo } from '@standardnotes/services'
import { KeyedEncryptionSplit } from '../../Split/KeyedEncryptionSplit'
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
import * as Utils from '@standardnotes/utils'
import { isNotUndefined } from '@standardnotes/utils'
import { V001Algorithm, V002Algorithm } from '../../Algorithm'
import { BackupFile } from '../../Backups/BackupFile'
import { DecryptBackupFile } from '../../Backups/BackupFileDecryptor'
import { CreateAnyKeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { SNRootKey } from '../../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
import { OperatorManager } from '../../Operator/OperatorManager'
import {
CreateEncryptionSplitWithKeyLookup,
FindPayloadInDecryptionSplit,
FindPayloadInEncryptionSplit,
} from '../../Split/EncryptionSplit'
import { SplitPayloadsByEncryptionType } from '../../Split/Functions'
import { KeyedDecryptionSplit } from '../../Split/KeyedDecryptionSplit'
import { KeyedEncryptionSplit } from '../../Split/KeyedEncryptionSplit'
import {
DecryptedParameters,
EncryptedParameters,
encryptedParametersFromPayload,
ErrorDecryptingParameters,
isErrorDecryptingParameters,
} from '../../Types/EncryptedParameters'
import { ItemAuthenticatedData } from '../../Types/ItemAuthenticatedData'
import { LegacyAttachedData } from '../../Types/LegacyAttachedData'
import { RootKeyEncryptedAuthenticatedData } from '../../Types/RootKeyEncryptedAuthenticatedData'
import { findDefaultItemsKey } from '../Functions'
import { ItemsEncryptionService } from '../Items/ItemsEncryption'
import { KeyMode } from '../RootKey/KeyMode'
import * as RootKeyEncryption from '../RootKey/RootKeyEncryption'
import { EncryptionProvider } from './EncryptionProvider'
export enum EncryptionServiceEvent {
RootKeyStatusChanged = 'RootKeyStatusChanged',

View File

@@ -1,19 +1,19 @@
import { ContentType, ProtocolVersion } from '@standardnotes/common'
import { findDefaultItemsKey } from '../Functions'
import { OperatorManager } from '../../Operator/OperatorManager'
import { StandardException } from '../../StandardException'
import * as OperatorWrapper from '../../Operator/OperatorWrapper'
import * as Models from '@standardnotes/models'
import { isEncryptedPayload } from '@standardnotes/models'
import * as Services from '@standardnotes/services'
import { DiagnosticInfo } from '@standardnotes/services'
import { Uuids } from '@standardnotes/utils'
import { OperatorManager } from '../../Operator/OperatorManager'
import * as OperatorWrapper from '../../Operator/OperatorWrapper'
import { StandardException } from '../../StandardException'
import {
DecryptedParameters,
EncryptedParameters,
ErrorDecryptingParameters,
isErrorDecryptingParameters,
} from '../../Types/EncryptedParameters'
import { isEncryptedPayload } from '@standardnotes/models'
import { DiagnosticInfo } from '@standardnotes/services'
import { Uuids } from '@standardnotes/utils'
import { findDefaultItemsKey } from '../Functions'
export class ItemsEncryptionService extends Services.AbstractService {
private removeItemsObserver!: () => void

View File

@@ -1,32 +1,32 @@
import { CreateAnyKeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { findDefaultItemsKey } from '../Functions'
import { KeyMode } from './KeyMode'
import { OperatorManager } from '../../Operator/OperatorManager'
import { SNRootKey } from '../../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
import { UuidGenerator } from '@standardnotes/utils'
import * as Common from '@standardnotes/common'
import * as Models from '@standardnotes/models'
import * as OperatorWrapper from '../../Operator/OperatorWrapper'
import {
DecryptedPayload,
FillItemContentSpecialized,
ItemsKeyContent,
ItemsKeyContentSpecialized,
NamespacedRootKeyInKeychain,
PayloadTimestampDefaults,
RootKeyContent,
RootKeyInterface,
} from '@standardnotes/models'
import * as Services from '@standardnotes/services'
import { UuidGenerator } from '@standardnotes/utils'
import { ItemsKeyMutator } from '../../Keys/ItemsKey/ItemsKeyMutator'
import { CreateNewRootKey } from '../../Keys/RootKey/Functions'
import { CreateAnyKeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
import { SNRootKey } from '../../Keys/RootKey/RootKey'
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
import { OperatorManager } from '../../Operator/OperatorManager'
import * as OperatorWrapper from '../../Operator/OperatorWrapper'
import {
DecryptedParameters,
EncryptedParameters,
ErrorDecryptingParameters,
isErrorDecryptingParameters,
} from '../../Types/EncryptedParameters'
import { ItemsKeyMutator } from '../../Keys/ItemsKey/ItemsKeyMutator'
import { CreateNewRootKey } from '../../Keys/RootKey/Functions'
import {
DecryptedPayload,
FillItemContentSpecialized,
ItemsKeyContent,
ItemsKeyContentSpecialized,
PayloadTimestampDefaults,
RootKeyContent,
RootKeyInterface,
NamespacedRootKeyInKeychain,
} from '@standardnotes/models'
import { findDefaultItemsKey } from '../Functions'
import { KeyMode } from './KeyMode'
export enum RootKeyServiceEvent {
RootKeyStatusChanged = 'RootKeyStatusChanged',

View File

@@ -1,4 +1,4 @@
import { Uuid, ProtocolVersion } from '@standardnotes/common'
import { ProtocolVersion, Uuid } from '@standardnotes/common'
export type ItemAuthenticatedData = {
u: Uuid

View File

@@ -1,3 +1,4 @@
export * from './Algorithm'
export * from './Backups/BackupFile'
export * from './Backups/BackupFileDecryptor'
export * from './Backups/BackupFileType'
@@ -32,10 +33,9 @@ export * from './Split/EncryptionTypeSplit'
export * from './Split/Functions'
export * from './Split/KeyedDecryptionSplit'
export * from './Split/KeyedEncryptionSplit'
export * from './StandardException'
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'

106
yarn.lock
View File

@@ -6554,12 +6554,14 @@ __metadata:
"@standardnotes/utils": ^1.6.12
"@types/jest": ^27.4.1
"@types/node": ^18.0.0
"@typescript-eslint/eslint-plugin": ^5.30.0
"@typescript-eslint/eslint-plugin": "*"
eslint: "*"
eslint-plugin-prettier: ^4.2.1
jest: ^27.5.1
prettier: "*"
reflect-metadata: ^0.1.13
ts-jest: ^27.1.3
typescript: ^4.7.4
typescript: "*"
languageName: unknown
linkType: soft
@@ -9118,6 +9120,29 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/eslint-plugin@npm:*":
version: 5.30.5
resolution: "@typescript-eslint/eslint-plugin@npm:5.30.5"
dependencies:
"@typescript-eslint/scope-manager": 5.30.5
"@typescript-eslint/type-utils": 5.30.5
"@typescript-eslint/utils": 5.30.5
debug: ^4.3.4
functional-red-black-tree: ^1.0.1
ignore: ^5.2.0
regexpp: ^3.2.0
semver: ^7.3.7
tsutils: ^3.21.0
peerDependencies:
"@typescript-eslint/parser": ^5.0.0
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
peerDependenciesMeta:
typescript:
optional: true
checksum: cf763fb091dcdfd6c25843251a220b654ca83968b17266e0f343771f489085c6afc4e41fcf2187b4c72c4d12a787070c64b5e5367069460f95a8174573f48905
languageName: node
linkType: hard
"@typescript-eslint/eslint-plugin@npm:^5.12.1, @typescript-eslint/eslint-plugin@npm:^5.15.0, @typescript-eslint/eslint-plugin@npm:^5.20.0, @typescript-eslint/eslint-plugin@npm:^5.5.0":
version: 5.30.0
resolution: "@typescript-eslint/eslint-plugin@npm:5.30.0"
@@ -9212,6 +9237,16 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/scope-manager@npm:5.30.5":
version: 5.30.5
resolution: "@typescript-eslint/scope-manager@npm:5.30.5"
dependencies:
"@typescript-eslint/types": 5.30.5
"@typescript-eslint/visitor-keys": 5.30.5
checksum: 509bee6d62cca1716e8f4792d9180c189974992ba13d8103ca04423a64006cf184c4b2c606d55c776305458140c798a3a9a414d07a60790b83dd714f56c457b0
languageName: node
linkType: hard
"@typescript-eslint/type-utils@npm:5.30.0":
version: 5.30.0
resolution: "@typescript-eslint/type-utils@npm:5.30.0"
@@ -9244,6 +9279,22 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/type-utils@npm:5.30.5":
version: 5.30.5
resolution: "@typescript-eslint/type-utils@npm:5.30.5"
dependencies:
"@typescript-eslint/utils": 5.30.5
debug: ^4.3.4
tsutils: ^3.21.0
peerDependencies:
eslint: "*"
peerDependenciesMeta:
typescript:
optional: true
checksum: 080cc1231729c34b778395658374e32d034474056f9b777dbc89d20d15eb93d93d0959328ad47c2a6623d40c6552364ababadce439842a944bce001f55b731b3
languageName: node
linkType: hard
"@typescript-eslint/types@npm:5.30.0":
version: 5.30.0
resolution: "@typescript-eslint/types@npm:5.30.0"
@@ -9258,6 +9309,13 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/types@npm:5.30.5":
version: 5.30.5
resolution: "@typescript-eslint/types@npm:5.30.5"
checksum: c70420618cb875d4e964a20a3fa4cf40cb97a8ad3123e24860e3d829edf3b081c77fa1fe25644700499d27e44aee5783abc7765deee61e2ef59a928db96b2175
languageName: node
linkType: hard
"@typescript-eslint/typescript-estree@npm:5.30.0":
version: 5.30.0
resolution: "@typescript-eslint/typescript-estree@npm:5.30.0"
@@ -9294,6 +9352,24 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/typescript-estree@npm:5.30.5":
version: 5.30.5
resolution: "@typescript-eslint/typescript-estree@npm:5.30.5"
dependencies:
"@typescript-eslint/types": 5.30.5
"@typescript-eslint/visitor-keys": 5.30.5
debug: ^4.3.4
globby: ^11.1.0
is-glob: ^4.0.3
semver: ^7.3.7
tsutils: ^3.21.0
peerDependenciesMeta:
typescript:
optional: true
checksum: 19dce426c826cddd4aadf2fa15be943c6ad7d2038685cc2665749486a5f44a47819aab5d260b54f8a4babf6acf2500e9f62e709d61fce337b12d5468ff285277
languageName: node
linkType: hard
"@typescript-eslint/utils@npm:5.30.0, @typescript-eslint/utils@npm:^5.13.0":
version: 5.30.0
resolution: "@typescript-eslint/utils@npm:5.30.0"
@@ -9326,6 +9402,22 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/utils@npm:5.30.5":
version: 5.30.5
resolution: "@typescript-eslint/utils@npm:5.30.5"
dependencies:
"@types/json-schema": ^7.0.9
"@typescript-eslint/scope-manager": 5.30.5
"@typescript-eslint/types": 5.30.5
"@typescript-eslint/typescript-estree": 5.30.5
eslint-scope: ^5.1.1
eslint-utils: ^3.0.0
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
checksum: 12f68cb34a150d39708f4e09a54964360f29589885cd50f119a2061660011752ec72eff3d90111f0e597575d32aae7250a6e2c730a84963e5e30352759d5f1f4
languageName: node
linkType: hard
"@typescript-eslint/visitor-keys@npm:5.30.0":
version: 5.30.0
resolution: "@typescript-eslint/visitor-keys@npm:5.30.0"
@@ -9346,6 +9438,16 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/visitor-keys@npm:5.30.5":
version: 5.30.5
resolution: "@typescript-eslint/visitor-keys@npm:5.30.5"
dependencies:
"@typescript-eslint/types": 5.30.5
eslint-visitor-keys: ^3.3.0
checksum: c0de9ae48378eec2682b860a059518bed213ea29575aad538d8d2f8137875e7279e375a7f23d38c1c183466fdd9cf1ca1db4ed5a1d374968f9460d83e48b2437
languageName: node
linkType: hard
"@uiw/react-codemirror@npm:4.5.1":
version: 4.5.1
resolution: "@uiw/react-codemirror@npm:4.5.1"