feat(signature): export signature files

This commit is contained in:
enes 2024-11-15 18:04:40 +01:00
parent 9551750cbe
commit cdf26b6614

View File

@ -1,3 +1,4 @@
import axios from 'axios'
import { MARK_TYPE_CONFIG } from '../components/getMarkComponents.tsx' import { MARK_TYPE_CONFIG } from '../components/getMarkComponents.tsx'
import { NostrController } from '../controllers/NostrController.ts' import { NostrController } from '../controllers/NostrController.ts'
import store from '../store/store.ts' import store from '../store/store.ts'
@ -50,11 +51,22 @@ export const getZipWithFiles = async (
m.value && m.value &&
encryptionKey encryptionKey
) { ) {
// TODO // Save the original file
// extract draw with proper values const encryptedArrayBuffer = await axios.get(m.value, {
// save both pdf with marking and original hash files for signature responseType: 'arraybuffer'
// ... })
const link = m.value.split('/')
zip.file(
`blossom/encrypted/${link[link.length - 1]}`,
new Blob([encryptedArrayBuffer.data])
)
const decrypted = await fetchAndDecrypt(m.value, encryptionKey) const decrypted = await fetchAndDecrypt(m.value, encryptionKey)
// Save decrypted
zip.file(
`blossom/decrypted/${link[link.length - 1]}.json`,
new Blob([decrypted])
)
marks[i].value = decrypted marks[i].value = decrypted
} }
} catch (error) { } catch (error) {