refactor: extract payload pack/unpack pipeline into @cryptgeon/shared

This commit is contained in:
2026-09-12 10:01:49 +02:00
parent 77b7ae1de6
commit 82900adef8
7 changed files with 133 additions and 60 deletions
@@ -1,5 +1,5 @@
<script lang="ts">
import { deriveKey, hexToBytes, decrypt, decode, decompress, info, get as apiGet, type FileDTO } from '@cryptgeon/shared'
import { deriveKey, hexToBytes, decode, info, get as apiGet, unpackContent, type FileDTO } from '@cryptgeon/shared'
import { onMount } from 'svelte'
import { t } from 'svelte-intl-precompile'
@@ -69,8 +69,7 @@
key = hexToBytes(password!)
}
const decrypted = decrypt(serverNote.data, key)
const content = decode(decompress(decrypted)) as any
const content = unpackContent(serverNote.data, key)
switch (content.type) {
case 'text':