internal: incomplete vault systems behind feature flag (#2340)

This commit is contained in:
Mo
2023-06-30 09:01:56 -05:00
committed by GitHub
parent d16e401bb9
commit b032eb9c9b
638 changed files with 20321 additions and 4813 deletions

View File

@@ -6,4 +6,9 @@ export interface ContextPayload<C extends ItemContent = ItemContent> {
content_type: ContentType
content: C | string | undefined
deleted: boolean
user_uuid?: string
key_system_identifier?: string | undefined
shared_vault_uuid?: string | undefined
last_edited_by_uuid?: string
}

View File

@@ -5,7 +5,7 @@ export interface FilteredServerItem extends ServerItemResponse {
__passed_filter__: true
}
export function CreateFilteredServerItem(item: ServerItemResponse): FilteredServerItem {
function CreateFilteredServerItem(item: ServerItemResponse): FilteredServerItem {
return {
...item,
__passed_filter__: true,

View File

@@ -19,6 +19,8 @@ export function CreateEncryptedBackupFileContextPayload(
updated_at_timestamp: fromPayload.updated_at_timestamp,
updated_at: fromPayload.updated_at,
uuid: fromPayload.uuid,
key_system_identifier: fromPayload.key_system_identifier,
shared_vault_uuid: fromPayload.shared_vault_uuid,
}
}
@@ -35,5 +37,7 @@ export function CreateDecryptedBackupFileContextPayload(
updated_at_timestamp: fromPayload.updated_at_timestamp,
updated_at: fromPayload.updated_at,
uuid: fromPayload.uuid,
key_system_identifier: fromPayload.key_system_identifier,
shared_vault_uuid: fromPayload.shared_vault_uuid,
}
}

View File

@@ -3,6 +3,7 @@ import { ItemContent } from '../Content/ItemContent'
import { DecryptedPayloadInterface, DeletedPayloadInterface, EncryptedPayloadInterface } from '../Payload'
import { useBoolean } from '@standardnotes/utils'
import { EncryptedTransferPayload, isEncryptedTransferPayload } from '../TransferPayload'
import { PersistentSignatureData } from '../../Runtime/Encryption/PersistentSignatureData'
export function isEncryptedLocalStoragePayload(
p: LocalStorageEncryptedContextualPayload | LocalStorageDecryptedContextualPayload,
@@ -25,6 +26,7 @@ export interface LocalStorageEncryptedContextualPayload extends ContextPayload {
updated_at_timestamp: number
updated_at: Date
waitingForKey: boolean
signatureData?: PersistentSignatureData
}
export interface LocalStorageDecryptedContextualPayload<C extends ItemContent = ItemContent> extends ContextPayload {
@@ -36,6 +38,7 @@ export interface LocalStorageDecryptedContextualPayload<C extends ItemContent =
duplicate_of?: string
updated_at_timestamp: number
updated_at: Date
signatureData?: PersistentSignatureData
}
export interface LocalStorageDeletedContextualPayload extends ContextPayload {
@@ -47,6 +50,7 @@ export interface LocalStorageDeletedContextualPayload extends ContextPayload {
duplicate_of?: string
updated_at_timestamp: number
updated_at: Date
signatureData?: PersistentSignatureData
}
export function CreateEncryptedLocalStorageContextPayload(
@@ -68,6 +72,11 @@ export function CreateEncryptedLocalStorageContextPayload(
updated_at: fromPayload.updated_at,
uuid: fromPayload.uuid,
waitingForKey: fromPayload.waitingForKey,
user_uuid: fromPayload.user_uuid,
key_system_identifier: fromPayload.key_system_identifier,
shared_vault_uuid: fromPayload.shared_vault_uuid,
last_edited_by_uuid: fromPayload.last_edited_by_uuid,
signatureData: fromPayload.signatureData,
}
}
@@ -85,6 +94,11 @@ export function CreateDecryptedLocalStorageContextPayload(
updated_at: fromPayload.updated_at,
uuid: fromPayload.uuid,
dirty: useBoolean(fromPayload.dirty, false),
user_uuid: fromPayload.user_uuid,
key_system_identifier: fromPayload.key_system_identifier,
shared_vault_uuid: fromPayload.shared_vault_uuid,
last_edited_by_uuid: fromPayload.last_edited_by_uuid,
signatureData: fromPayload.signatureData,
}
}
@@ -102,5 +116,10 @@ export function CreateDeletedLocalStorageContextPayload(
updated_at_timestamp: fromPayload.updated_at_timestamp,
updated_at: fromPayload.updated_at,
uuid: fromPayload.uuid,
user_uuid: fromPayload.user_uuid,
key_system_identifier: fromPayload.key_system_identifier,
shared_vault_uuid: fromPayload.shared_vault_uuid,
last_edited_by_uuid: fromPayload.last_edited_by_uuid,
signatureData: fromPayload.signatureData,
}
}

View File

@@ -29,6 +29,8 @@ export function CreateEncryptedServerSyncPushPayload(
enc_item_key: fromPayload.enc_item_key,
items_key_id: fromPayload.items_key_id,
auth_hash: fromPayload.auth_hash,
key_system_identifier: fromPayload.key_system_identifier,
shared_vault_uuid: fromPayload.shared_vault_uuid,
}
}
@@ -45,5 +47,7 @@ export function CreateDeletedServerSyncPushPayload(
updated_at: fromPayload.updated_at,
uuid: fromPayload.uuid,
content: undefined,
key_system_identifier: fromPayload.key_system_identifier,
shared_vault_uuid: fromPayload.shared_vault_uuid,
}
}

View File

@@ -16,6 +16,11 @@ export interface ServerSyncSavedContextualPayload {
updated_at_timestamp: number
updated_at: Date
uuid: string
key_system_identifier: string | undefined
shared_vault_uuid: string | undefined
user_uuid: string
duplicate_of?: string
last_edited_by_uuid?: string
}
export function CreateServerSyncSavedPayload(from: FilteredServerItem): ServerSyncSavedContextualPayload {
@@ -27,5 +32,10 @@ export function CreateServerSyncSavedPayload(from: FilteredServerItem): ServerSy
updated_at_timestamp: from.updated_at_timestamp,
updated_at: from.updated_at,
uuid: from.uuid,
key_system_identifier: from.key_system_identifier,
shared_vault_uuid: from.shared_vault_uuid,
user_uuid: from.user_uuid,
duplicate_of: from.duplicate_of,
last_edited_by_uuid: from.last_edited_by_uuid,
}
}

View File

@@ -0,0 +1,4 @@
import { ConflictParams } from '@standardnotes/responses'
import { FilteredServerItem } from './FilteredServerItem'
export type TrustedConflictParams = ConflictParams<FilteredServerItem>