This commit is contained in:
2026-09-06 18:34:07 +02:00
parent 062054f450
commit e0d22283c8
14 changed files with 474 additions and 30 deletions
@@ -1,7 +1,7 @@
<script lang="ts">
import {
deriveKey, generateKey, encrypt, randomBytes,
bytesToHex, encode,
bytesToHex, encode, compress,
create as apiCreate,
type FileDTO, type ServerNote
} from '@cryptgeon/shared'
@@ -131,7 +131,12 @@
inner = encode({ type: 'text', data: textContent })
}
const data = encrypt(inner, key)
const originalSize =inner.byteLength
const compressed = compress(inner)
const compresseedSize= compressed.byteLength
console.debug({originalSize, compresseedSize, ratio: originalSize/compresseedSize})
const data = encrypt(compress(inner), key)
const extra = customPassword
? encode({ salt: salt!, N: 32768, r: 8, p: 1 })
: new Uint8Array()
@@ -281,4 +286,4 @@
transform: rotate(360deg);
}
}
</style>
</style>
@@ -1,5 +1,5 @@
<script lang="ts">
import { deriveKey, hexToBytes, decrypt, decode, info, get as apiGet, type FileDTO } from '@cryptgeon/shared'
import { deriveKey, hexToBytes, decrypt, decode, decompress, info, get as apiGet, type FileDTO } from '@cryptgeon/shared'
import { onMount } from 'svelte'
import { t } from 'svelte-intl-precompile'
@@ -69,8 +69,8 @@
key = hexToBytes(password!)
}
const decrypted = decrypt(serverNote.data, key)
const content = decode(decrypted) as any
const decrypted = decrypt(serverNote.data, key)
const content = decode(decompress(decrypted)) as any
switch (content.type) {
case 'text':