mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
signature: download storedObject document in the vuejs app
This commit is contained in:
parent
9192883217
commit
bbfd0caf10
@ -3,14 +3,56 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
import { ref, Ref } from "vue";
|
import { ref, Ref } from "vue";
|
||||||
|
|
||||||
const msg: Ref<string> = ref('world !');
|
//import { build_download_info_link, download_and_decrypt_doc } from "ChillDocStoreAssets/vuejs/StoredObjectButton/helpers.js";
|
||||||
|
import {
|
||||||
|
build_download_info_link,
|
||||||
|
download_and_decrypt_doc,
|
||||||
|
} from "../StoredObjectButton/helpers";
|
||||||
|
|
||||||
|
const msg: Ref<string> = ref("world !");
|
||||||
|
|
||||||
//console.log('signature', window.signature);
|
//console.log('signature', window.signature);
|
||||||
|
|
||||||
|
const signature = {
|
||||||
|
id: 1,
|
||||||
|
storedObject: {
|
||||||
|
filename: "pKNlhCrQDCRsAuC8vYHDKa",
|
||||||
|
keyInfos: {
|
||||||
|
alg: "A256CBC",
|
||||||
|
ext: true,
|
||||||
|
k: "_VihnD41-VDHlpS-ouwtbMPnu-OXVdtA7ENQWWtAQYM",
|
||||||
|
key_ops: ["encrypt", "decrypt"],
|
||||||
|
kty: "oct",
|
||||||
|
},
|
||||||
|
iv: [
|
||||||
|
86, 231, 83, 148, 117, 107, 149, 173, 130, 19, 105, 194, 224, 145, 8, 48,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
zones: [{ page: 1, origin: [0, 0], x: 10, y: 10 }],
|
||||||
|
};
|
||||||
|
|
||||||
|
const urlInfo = build_download_info_link(signature.storedObject.filename);
|
||||||
|
|
||||||
|
async function download_and_open(): Promise<Blob> {
|
||||||
|
let raw;
|
||||||
|
try {
|
||||||
|
raw = await download_and_decrypt_doc(
|
||||||
|
urlInfo,
|
||||||
|
signature.storedObject.keyInfos,
|
||||||
|
new Uint8Array(signature.storedObject.iv)
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.error("error while downloading and decrypting document", e);
|
||||||
|
throw e;
|
||||||
|
};
|
||||||
|
return raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
download_and_open();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { createApp } from "vue";
|
import { createApp } from "vue";
|
||||||
// import { _createI18n } from "ChillMainAssets/vuejs/_js/i18n";
|
// import { _createI18n } from "ChillMainAssets/vuejs/_js/i18n";
|
||||||
// import { appMessages } from "ChillMainAssets/vuejs/HomepageWidget/js/i18n";
|
// import { appMessages } from "ChillMainAssets/vuejs/HomepageWidget/js/i18n";
|
||||||
//import { store } from "ChillDocStoreAssets/vuejs/DocumentSignature/store";
|
|
||||||
import App from "./App.vue";
|
import App from "./App.vue";
|
||||||
|
|
||||||
//const i18n = _createI18n(appMessages);
|
//const i18n = _createI18n(appMessages);
|
||||||
@ -9,7 +8,6 @@ import App from "./App.vue";
|
|||||||
const app = createApp({
|
const app = createApp({
|
||||||
template: `<app></app>`,
|
template: `<app></app>`,
|
||||||
})
|
})
|
||||||
//.use(store)
|
|
||||||
//.use(i18n)
|
//.use(i18n)
|
||||||
.component("app", App)
|
.component("app", App)
|
||||||
.mount("#document-signature");
|
.mount("#document-signature");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user