chore: fix ContentType usage (#2353)
* chore: fix ContentType usage * chore: fix specs
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { ContentType, ProtocolVersion } from '@standardnotes/common'
|
||||
import { ProtocolVersion } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
import {
|
||||
ConflictStrategy,
|
||||
DecryptedItem,
|
||||
@@ -10,7 +11,7 @@ import {
|
||||
} from '@standardnotes/models'
|
||||
|
||||
export function isItemsKey(x: unknown): x is ItemsKeyInterface {
|
||||
return (x as ItemsKeyInterface).content_type === ContentType.ItemsKey
|
||||
return (x as ItemsKeyInterface).content_type === ContentType.TYPES.ItemsKey
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { DecryptedItemMutator, ItemsKeyContent, RegisterItemClass } from '@standardnotes/models'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
import { SNItemsKey } from './ItemsKey'
|
||||
import { ItemsKeyMutator } from './ItemsKeyMutator'
|
||||
|
||||
RegisterItemClass(ContentType.ItemsKey, SNItemsKey, ItemsKeyMutator as unknown as DecryptedItemMutator<ItemsKeyContent>)
|
||||
RegisterItemClass(
|
||||
ContentType.TYPES.ItemsKey,
|
||||
SNItemsKey,
|
||||
ItemsKeyMutator as unknown as DecryptedItemMutator<ItemsKeyContent>,
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ContentType, ProtocolVersion } from '@standardnotes/common'
|
||||
import { ProtocolVersion } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
import {
|
||||
ConflictStrategy,
|
||||
DecryptedItem,
|
||||
@@ -10,7 +11,7 @@ import {
|
||||
} from '@standardnotes/models'
|
||||
|
||||
export function isKeySystemItemsKey(x: unknown): x is KeySystemItemsKeyInterface {
|
||||
return (x as KeySystemItemsKeyInterface).content_type === ContentType.KeySystemItemsKey
|
||||
return (x as KeySystemItemsKeyInterface).content_type === ContentType.TYPES.KeySystemItemsKey
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { DecryptedItemMutator, KeySystemItemsKeyContent, RegisterItemClass } from '@standardnotes/models'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
import { KeySystemItemsKey } from './KeySystemItemsKey'
|
||||
import { KeySystemItemsKeyMutator } from './KeySystemItemsKeyMutator'
|
||||
|
||||
RegisterItemClass(
|
||||
ContentType.KeySystemItemsKey,
|
||||
ContentType.TYPES.KeySystemItemsKey,
|
||||
KeySystemItemsKey,
|
||||
KeySystemItemsKeyMutator as unknown as DecryptedItemMutator<KeySystemItemsKeyContent>,
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ContentType, ProtocolVersion } from '@standardnotes/common'
|
||||
import { ProtocolVersion } from '@standardnotes/common'
|
||||
import {
|
||||
DecryptedPayload,
|
||||
FillItemContentSpecialized,
|
||||
@@ -9,13 +9,14 @@ import {
|
||||
} from '@standardnotes/models'
|
||||
import { UuidGenerator } from '@standardnotes/utils'
|
||||
import { SNRootKey } from './RootKey'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
export function CreateNewRootKey<K extends RootKeyInterface>(content: RootKeyContentSpecialized): K {
|
||||
const uuid = UuidGenerator.GenerateUuid()
|
||||
|
||||
const payload = new DecryptedPayload<RootKeyContent>({
|
||||
uuid: uuid,
|
||||
content_type: ContentType.RootKey,
|
||||
content_type: ContentType.TYPES.RootKey,
|
||||
content: FillRootKeyContent(content),
|
||||
...PayloadTimestampDefaults(),
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ContentType, KeyParamsOrigination, ProtocolVersion, ProtocolVersionLength } from '@standardnotes/common'
|
||||
import { KeyParamsOrigination, ProtocolVersion, ProtocolVersionLength } from '@standardnotes/common'
|
||||
import {
|
||||
CreateDecryptedItemFromPayload,
|
||||
DecryptedPayload,
|
||||
@@ -32,6 +32,7 @@ import { PublicKeySet } from '../Types/PublicKeySet'
|
||||
import { AsymmetricDecryptResult } from '../Types/AsymmetricDecryptResult'
|
||||
import { AsymmetricSignatureVerificationDetachedResult } from '../Types/AsymmetricSignatureVerificationDetachedResult'
|
||||
import { AsyncOperatorInterface } from '../OperatorInterface/AsyncOperatorInterface'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
const NO_IV = '00000000000000000000000000000000'
|
||||
|
||||
@@ -71,7 +72,7 @@ export class SNProtocolOperator001 implements OperatorInterface, AsyncOperatorIn
|
||||
public createItemsKey(): ItemsKeyInterface {
|
||||
const payload = new DecryptedPayload({
|
||||
uuid: UuidGenerator.GenerateUuid(),
|
||||
content_type: ContentType.ItemsKey,
|
||||
content_type: ContentType.TYPES.ItemsKey,
|
||||
content: this.generateNewItemsKeyContent(),
|
||||
...PayloadTimestampDefaults(),
|
||||
})
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as Common from '@standardnotes/common'
|
||||
import * as Models from '@standardnotes/models'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
import { ItemContent, PayloadTimestampDefaults } from '@standardnotes/models'
|
||||
import * as Utils from '@standardnotes/utils'
|
||||
import { UuidGenerator } from '@standardnotes/utils'
|
||||
@@ -44,7 +45,7 @@ export class SNProtocolOperator002 extends SNProtocolOperator001 {
|
||||
public override createItemsKey(): Models.ItemsKeyInterface {
|
||||
const payload = new Models.DecryptedPayload({
|
||||
uuid: UuidGenerator.GenerateUuid(),
|
||||
content_type: Common.ContentType.ItemsKey,
|
||||
content_type: ContentType.TYPES.ItemsKey,
|
||||
content: this.generateNewItemsKeyContent(),
|
||||
...PayloadTimestampDefaults(),
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ContentType, KeyParamsOrigination, ProtocolVersion } from '@standardnotes/common'
|
||||
import { KeyParamsOrigination, ProtocolVersion } from '@standardnotes/common'
|
||||
import {
|
||||
CreateDecryptedItemFromPayload,
|
||||
DecryptedPayload,
|
||||
@@ -14,6 +14,7 @@ import { CreateNewRootKey } from '../../Keys/RootKey/Functions'
|
||||
import { Create003KeyParams } from '../../Keys/RootKey/KeyParamsFunctions'
|
||||
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
|
||||
import { SNProtocolOperator002 } from '../002/Operator002'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
/**
|
||||
* @legacy
|
||||
@@ -46,7 +47,7 @@ export class SNProtocolOperator003 extends SNProtocolOperator002 {
|
||||
const content = this.generateNewItemsKeyContent()
|
||||
const payload = new DecryptedPayload({
|
||||
uuid: UuidGenerator.GenerateUuid(),
|
||||
content_type: ContentType.ItemsKey,
|
||||
content_type: ContentType.TYPES.ItemsKey,
|
||||
content: FillItemContent(content),
|
||||
...PayloadTimestampDefaults(),
|
||||
})
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { ContentType, ProtocolVersion } from '@standardnotes/common'
|
||||
import { ProtocolVersion } from '@standardnotes/common'
|
||||
import { DecryptedPayload, ItemContent, ItemsKeyContent, PayloadTimestampDefaults } from '@standardnotes/models'
|
||||
import { SNItemsKey } from '../../Keys/ItemsKey/ItemsKey'
|
||||
import { SNProtocolOperator004 } from './Operator004'
|
||||
import { getMockedCrypto } from './MockedCrypto'
|
||||
import { deconstructEncryptedPayloadString } from './V004AlgorithmHelpers'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
describe('operator 004', () => {
|
||||
const crypto = getMockedCrypto()
|
||||
@@ -31,7 +32,7 @@ describe('operator 004', () => {
|
||||
it('should generateEncryptedParameters', () => {
|
||||
const payload = {
|
||||
uuid: '123',
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
content: { foo: 'bar' } as unknown as jest.Mocked<ItemContent>,
|
||||
...PayloadTimestampDefaults(),
|
||||
} as jest.Mocked<DecryptedPayload>
|
||||
@@ -39,7 +40,7 @@ describe('operator 004', () => {
|
||||
const key = new SNItemsKey(
|
||||
new DecryptedPayload<ItemsKeyContent>({
|
||||
uuid: 'key-456',
|
||||
content_type: ContentType.ItemsKey,
|
||||
content_type: ContentType.TYPES.ItemsKey,
|
||||
content: {
|
||||
itemsKey: 'secret',
|
||||
version: ProtocolVersion.V004,
|
||||
@@ -56,7 +57,7 @@ describe('operator 004', () => {
|
||||
key_system_identifier: undefined,
|
||||
shared_vault_uuid: undefined,
|
||||
content: '004:random-string:<e>{"foo"|"bar"}<e>:base64-{"u"|"123","v"|"004"}:base64-{}',
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
enc_item_key: '004:random-string:<e>random-string<e>:base64-{"u"|"123","v"|"004"}:base64-{}',
|
||||
version: '004',
|
||||
})
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
RootKeyInterface,
|
||||
KeySystemRootKeyParamsInterface,
|
||||
} from '@standardnotes/models'
|
||||
import { ContentType, KeyParamsOrigination, ProtocolVersion } from '@standardnotes/common'
|
||||
import { KeyParamsOrigination, ProtocolVersion } from '@standardnotes/common'
|
||||
import { HexString, PkcKeyPair, PureCryptoInterface, Utf8String } from '@standardnotes/sncrypto-common'
|
||||
import { V004Algorithm } from '../../Algorithm'
|
||||
import { SNRootKeyParams } from '../../Keys/RootKey/RootKeyParams'
|
||||
@@ -48,6 +48,7 @@ import { AsymmetricSignatureVerificationDetachedResult } from '../Types/Asymmetr
|
||||
import { AsymmetricSignatureVerificationDetachedUseCase } from './UseCase/Asymmetric/AsymmetricSignatureVerificationDetached'
|
||||
import { DeriveKeySystemRootKeyUseCase } from './UseCase/KeySystem/DeriveKeySystemRootKey'
|
||||
import { SyncOperatorInterface } from '../OperatorInterface/SyncOperatorInterface'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
export class SNProtocolOperator004 implements OperatorInterface, SyncOperatorInterface {
|
||||
constructor(protected readonly crypto: PureCryptoInterface) {}
|
||||
@@ -76,7 +77,7 @@ export class SNProtocolOperator004 implements OperatorInterface, SyncOperatorInt
|
||||
public createItemsKey(): ItemsKeyInterface {
|
||||
const payload = new DecryptedPayload({
|
||||
uuid: UuidGenerator.GenerateUuid(),
|
||||
content_type: ContentType.ItemsKey,
|
||||
content_type: ContentType.TYPES.ItemsKey,
|
||||
content: this.generateNewItemsKeyContent(),
|
||||
key_system_identifier: undefined,
|
||||
shared_vault_uuid: undefined,
|
||||
|
||||
@@ -10,7 +10,8 @@ import {
|
||||
} from '@standardnotes/models'
|
||||
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
|
||||
import { V004Algorithm } from '../../../../Algorithm'
|
||||
import { ContentType, ProtocolVersion } from '@standardnotes/common'
|
||||
import { ProtocolVersion } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
export class CreateKeySystemItemsKeyUseCase {
|
||||
constructor(private readonly crypto: PureCryptoInterface) {}
|
||||
@@ -31,7 +32,7 @@ export class CreateKeySystemItemsKeyUseCase {
|
||||
|
||||
const transferPayload: DecryptedTransferPayload = {
|
||||
uuid: dto.uuid,
|
||||
content_type: ContentType.KeySystemItemsKey,
|
||||
content_type: ContentType.TYPES.KeySystemItemsKey,
|
||||
key_system_identifier: dto.keySystemIdentifier,
|
||||
shared_vault_uuid: dto.sharedVaultUuid,
|
||||
content: content,
|
||||
|
||||
@@ -12,7 +12,8 @@ import {
|
||||
PayloadTimestampDefaults,
|
||||
KeySystemRootKeyParamsInterface,
|
||||
} from '@standardnotes/models'
|
||||
import { ContentType, ProtocolVersion } from '@standardnotes/common'
|
||||
import { ProtocolVersion } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
export class DeriveKeySystemRootKeyUseCase {
|
||||
constructor(private readonly crypto: PureCryptoInterface) {}
|
||||
@@ -44,7 +45,7 @@ export class DeriveKeySystemRootKeyUseCase {
|
||||
|
||||
const payload = new DecryptedPayload<KeySystemRootKeyContent>({
|
||||
uuid: uuid,
|
||||
content_type: ContentType.KeySystemRootKey,
|
||||
content_type: ContentType.TYPES.KeySystemRootKey,
|
||||
content: FillItemContentSpecialized(content),
|
||||
...PayloadTimestampDefaults(),
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CreateAnyKeyParams } from '../../../../Keys/RootKey/KeyParamsFunctions'
|
||||
import { AnyKeyParamsContent, ContentType, ProtocolVersion } from '@standardnotes/common'
|
||||
import { AnyKeyParamsContent, ProtocolVersion } from '@standardnotes/common'
|
||||
import { GenerateAuthenticatedDataUseCase } from './GenerateAuthenticatedData'
|
||||
import {
|
||||
DecryptedPayloadInterface,
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
RootKeyInterface,
|
||||
} from '@standardnotes/models'
|
||||
import { KeySystemItemsKey } from '../../../../Keys/KeySystemItemsKey/KeySystemItemsKey'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
describe('generate authenticated data use case', () => {
|
||||
let usecase: GenerateAuthenticatedDataUseCase
|
||||
@@ -19,7 +20,7 @@ describe('generate authenticated data use case', () => {
|
||||
it('should include key params if payload being encrypted is an items key', () => {
|
||||
const payload = {
|
||||
uuid: '123',
|
||||
content_type: ContentType.ItemsKey,
|
||||
content_type: ContentType.TYPES.ItemsKey,
|
||||
} as jest.Mocked<DecryptedPayloadInterface>
|
||||
|
||||
const keyParams = CreateAnyKeyParams({
|
||||
@@ -42,7 +43,7 @@ describe('generate authenticated data use case', () => {
|
||||
it('should include root key params if payload is a key system items key', () => {
|
||||
const payload = {
|
||||
uuid: '123',
|
||||
content_type: ContentType.KeySystemItemsKey,
|
||||
content_type: ContentType.TYPES.KeySystemItemsKey,
|
||||
shared_vault_uuid: 'shared-vault-uuid-123',
|
||||
key_system_identifier: 'key-system-identifier-123',
|
||||
} as jest.Mocked<DecryptedPayloadInterface>
|
||||
@@ -52,7 +53,7 @@ describe('generate authenticated data use case', () => {
|
||||
keyParams: {
|
||||
seed: 'seed-123',
|
||||
},
|
||||
content_type: ContentType.KeySystemRootKey,
|
||||
content_type: ContentType.TYPES.KeySystemRootKey,
|
||||
token: '123',
|
||||
} as jest.Mocked<KeySystemRootKeyInterface>
|
||||
|
||||
@@ -70,7 +71,7 @@ describe('generate authenticated data use case', () => {
|
||||
it('should include key system identifier and shared vault uuid', () => {
|
||||
const payload = {
|
||||
uuid: '123',
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
shared_vault_uuid: 'shared-vault-uuid-123',
|
||||
key_system_identifier: 'key-system-identifier-123',
|
||||
} as jest.Mocked<DecryptedPayloadInterface>
|
||||
@@ -78,7 +79,7 @@ describe('generate authenticated data use case', () => {
|
||||
const itemsKey = {
|
||||
creationTimestamp: 123,
|
||||
keyVersion: ProtocolVersion.V004,
|
||||
content_type: ContentType.KeySystemItemsKey,
|
||||
content_type: ContentType.TYPES.KeySystemItemsKey,
|
||||
} as jest.Mocked<KeySystemItemsKey>
|
||||
|
||||
const authenticatedData = usecase.execute(payload, itemsKey)
|
||||
@@ -94,11 +95,11 @@ describe('generate authenticated data use case', () => {
|
||||
it('should include only uuid and version if non-keysystem item with items key', () => {
|
||||
const payload = {
|
||||
uuid: '123',
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
} as jest.Mocked<DecryptedPayloadInterface>
|
||||
|
||||
const itemsKey = {
|
||||
content_type: ContentType.ItemsKey,
|
||||
content_type: ContentType.TYPES.ItemsKey,
|
||||
} as jest.Mocked<ItemsKeyInterface>
|
||||
|
||||
const authenticatedData = usecase.execute(payload, itemsKey)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { PkcKeyPair, PureCryptoInterface } from '@standardnotes/sncrypto-common'
|
||||
import { getMockedCrypto } from '../../MockedCrypto'
|
||||
import { GenerateDecryptedParametersUseCase } from './GenerateDecryptedParameters'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { DecryptedPayloadInterface, ItemsKeyInterface } from '@standardnotes/models'
|
||||
import { GenerateEncryptedParametersUseCase } from './GenerateEncryptedParameters'
|
||||
import { EncryptedInputParameters, EncryptedOutputParameters } from '../../../../Types/EncryptedParameters'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
describe('generate decrypted parameters usecase', () => {
|
||||
let crypto: PureCryptoInterface
|
||||
@@ -18,7 +18,7 @@ describe('generate decrypted parameters usecase', () => {
|
||||
itemsKey = {
|
||||
uuid: 'items-key-id',
|
||||
itemsKey: 'items-key',
|
||||
content_type: ContentType.ItemsKey,
|
||||
content_type: ContentType.TYPES.ItemsKey,
|
||||
} as jest.Mocked<ItemsKeyInterface>
|
||||
})
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('generate decrypted parameters usecase', () => {
|
||||
content: {
|
||||
text: plaintext,
|
||||
},
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
} as unknown as jest.Mocked<DecryptedPayloadInterface>
|
||||
|
||||
const encryptedParametersUsecase = new GenerateEncryptedParametersUseCase(crypto)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PkcKeyPair, PureCryptoInterface } from '@standardnotes/sncrypto-common'
|
||||
import { getMockedCrypto } from '../../MockedCrypto'
|
||||
import { AnyKeyParamsContent, ContentType, ProtocolVersion } from '@standardnotes/common'
|
||||
import { AnyKeyParamsContent, ProtocolVersion } from '@standardnotes/common'
|
||||
import { GenerateEncryptedParametersUseCase } from './GenerateEncryptedParameters'
|
||||
import {
|
||||
DecryptedPayloadInterface,
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
import { deconstructEncryptedPayloadString } from '../../V004AlgorithmHelpers'
|
||||
import { ParseConsistentBase64JsonPayloadUseCase } from '../Utils/ParseConsistentBase64JsonPayload'
|
||||
import { SymmetricItemAdditionalData } from '../../../../Types/EncryptionAdditionalData'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
describe('generate encrypted parameters usecase', () => {
|
||||
let crypto: PureCryptoInterface
|
||||
@@ -29,20 +30,20 @@ describe('generate encrypted parameters usecase', () => {
|
||||
title: 'title',
|
||||
text: 'text',
|
||||
},
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
} as unknown as jest.Mocked<DecryptedPayloadInterface>
|
||||
|
||||
const itemsKey = {
|
||||
uuid: 'items-key-id',
|
||||
itemsKey: 'items-key',
|
||||
content_type: ContentType.ItemsKey,
|
||||
content_type: ContentType.TYPES.ItemsKey,
|
||||
} as jest.Mocked<ItemsKeyInterface>
|
||||
|
||||
const result = usecase.execute(decrypted, itemsKey)
|
||||
|
||||
expect(result).toEqual({
|
||||
uuid: '123',
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
items_key_id: 'items-key-id',
|
||||
content: expect.any(String),
|
||||
enc_item_key: expect.any(String),
|
||||
@@ -57,7 +58,7 @@ describe('generate encrypted parameters usecase', () => {
|
||||
content: {
|
||||
foo: 'bar',
|
||||
},
|
||||
content_type: ContentType.ItemsKey,
|
||||
content_type: ContentType.TYPES.ItemsKey,
|
||||
} as unknown as jest.Mocked<DecryptedPayloadInterface>
|
||||
|
||||
const rootKey = {
|
||||
@@ -66,7 +67,7 @@ describe('generate encrypted parameters usecase', () => {
|
||||
keyParams: {
|
||||
content: {} as jest.Mocked<AnyKeyParamsContent>,
|
||||
},
|
||||
content_type: ContentType.RootKey,
|
||||
content_type: ContentType.TYPES.RootKey,
|
||||
} as jest.Mocked<RootKeyInterface>
|
||||
|
||||
const result = usecase.execute(decrypted, rootKey)
|
||||
@@ -80,13 +81,13 @@ describe('generate encrypted parameters usecase', () => {
|
||||
content: {
|
||||
foo: 'bar',
|
||||
},
|
||||
content_type: ContentType.KeySystemItemsKey,
|
||||
content_type: ContentType.TYPES.KeySystemItemsKey,
|
||||
} as unknown as jest.Mocked<DecryptedPayloadInterface>
|
||||
|
||||
const rootKey = {
|
||||
uuid: 'items-key-id',
|
||||
itemsKey: 'items-key',
|
||||
content_type: ContentType.KeySystemRootKey,
|
||||
content_type: ContentType.TYPES.KeySystemRootKey,
|
||||
} as jest.Mocked<KeySystemRootKeyInterface>
|
||||
|
||||
const result = usecase.execute(decrypted, rootKey)
|
||||
@@ -111,13 +112,13 @@ describe('generate encrypted parameters usecase', () => {
|
||||
title: 'title',
|
||||
text: 'text',
|
||||
},
|
||||
content_type: ContentType.Note,
|
||||
content_type: ContentType.TYPES.Note,
|
||||
} as unknown as jest.Mocked<DecryptedPayloadInterface>
|
||||
|
||||
const itemsKey = {
|
||||
uuid: 'items-key-id',
|
||||
itemsKey: 'items-key',
|
||||
content_type: ContentType.ItemsKey,
|
||||
content_type: ContentType.TYPES.ItemsKey,
|
||||
} as jest.Mocked<ItemsKeyInterface>
|
||||
|
||||
const result = usecase.execute(decrypted, itemsKey, signingKeyPair)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { ContentType, ProtocolVersion } from '@standardnotes/common'
|
||||
import { ProtocolVersion } from '@standardnotes/common'
|
||||
import { EncryptedPayloadInterface, DecryptedPayloadInterface, PersistentSignatureData } from '@standardnotes/models'
|
||||
import { DecryptedParameters } from './DecryptedParameters'
|
||||
|
||||
export type EncryptedOutputParameters = {
|
||||
uuid: string
|
||||
content: string
|
||||
content_type: ContentType
|
||||
content_type: string
|
||||
items_key_id: string | undefined
|
||||
enc_item_key: string
|
||||
version: ProtocolVersion
|
||||
|
||||
Reference in New Issue
Block a user