UNPKG

@eotl/core

Version:

Assortment of data structures, Vue.js components, and utilities across EOTL apps and sites.

157 lines (156 loc) 6.48 kB
import { n as naclUtilExports } from "./Account-BbY3T8-e.js"; import { A } from "./Account-BbY3T8-e.js"; import { D as Daemon } from "./Daemon-C64IN2y0.js"; import { ssr } from "@eotl/simple-signed-records"; import { useEotlCore } from "./store.js"; import { u as useAuthSsr } from "./authSsr-BedulHkH.js"; import { resolveComponent, openBlock, createElementBlock, createElementVNode, withDirectives, vModelText, createTextVNode, toDisplayString, createVNode } from "vue"; import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js"; import { default as default2 } from "./Gateway-_ClOWupz.js"; import { default as default3 } from "./Invites-fFnUULpP.js"; import { default as default4 } from "./Restore-C3Mp2xKw.js"; const _sfc_main = { components: { Daemon }, data: function() { const store = useEotlCore(); const authSsr = useAuthSsr(); return { store, authSsr, adminCert: "None", formURL: "", formData: { note: "Hello my name is Franzi. This is just a test.", size: "medium", weight: "heavy", speed: "immediate", dest_address: "Torstrasse 120", dest_city: "Berlin" } }; }, methods: { generateIdentity() { console.log("generateIdentity"); }, getAdminCert() { const record = {}; const validSeconds = 15778800; const secretKey = naclUtilExports.decodeBase64(this.authSsr.identity.secretKey); const publicKey = naclUtilExports.decodeBase64(this.authSsr.identity.publicKey); let signedData = ssr.sign({ record, keypair: { secretKey, publicKey }, validSeconds }); const adminCert = btoa(JSON.stringify(signedData)); this.adminCert = adminCert; this.authSsr.account.cert = adminCert; }, sendTest() { const record = this.formData; const validSeconds = 15778800; let secretKey = naclUtilExports.decodeBase64(this.authSsr.identity.secretKey); let publicKey = naclUtilExports.decodeBase64(this.authSsr.identity.publicKey); console.log(record); let postData = ssr.sign({ record, keypair: { secretKey, publicKey }, validSeconds }); fetch(this.store.config.api + "/" + this.formURL, { method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json" }, body: JSON.stringify(postData) }).then((response) => response.json()).then((data) => { console.log("sending test succeeded", data); }).catch((err) => { console.log("sending test failed", err); }); } } }; const _hoisted_1 = /* @__PURE__ */ createElementVNode("h2", null, "Debug", -1); const _hoisted_2 = /* @__PURE__ */ createElementVNode("p", null, "This page is for various debugging of requests SSR and otherwise for development and support.", -1); const _hoisted_3 = /* @__PURE__ */ createElementVNode("hr", { class: "thick" }, null, -1); const _hoisted_4 = /* @__PURE__ */ createElementVNode("h3", null, "Simple Signed Records", -1); const _hoisted_5 = { class: "mb-5" }; const _hoisted_6 = /* @__PURE__ */ createElementVNode("h4", null, "Test Data", -1); const _hoisted_7 = /* @__PURE__ */ createElementVNode("p", null, "Send generic test data as an SSR for backend testing", -1); const _hoisted_8 = { class: "mb-5" }; const _hoisted_9 = /* @__PURE__ */ createElementVNode("h4", null, "Account", -1); const _hoisted_10 = /* @__PURE__ */ createElementVNode("br", null, null, -1); const _hoisted_11 = /* @__PURE__ */ createElementVNode("br", null, null, -1); const _hoisted_12 = { class: "mb-5" }; const _hoisted_13 = /* @__PURE__ */ createElementVNode("h4", null, "Admin Cert", -1); const _hoisted_14 = /* @__PURE__ */ createElementVNode("hr", { class: "thick" }, null, -1); const _hoisted_15 = /* @__PURE__ */ createElementVNode("h2", null, "Server", -1); const _hoisted_16 = /* @__PURE__ */ createElementVNode("p", null, [ /* @__PURE__ */ createTextVNode("The following is use of "), /* @__PURE__ */ createElementVNode("code", null, "<Daemon/>"), /* @__PURE__ */ createTextVNode(" Vue component.") ], -1); const _hoisted_17 = /* @__PURE__ */ createElementVNode("div", { class: "mb-5" }, null, -1); function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_Daemon = resolveComponent("Daemon"); return openBlock(), createElementBlock("div", null, [ _hoisted_1, _hoisted_2, _hoisted_3, _hoisted_4, createElementVNode("div", _hoisted_5, [ createElementVNode("button", { onClick: _cache[0] || (_cache[0] = (...args) => $options.generateIdentity && $options.generateIdentity(...args)), class: "btn mr-2" }, " Generate Identity "), createElementVNode("button", { onClick: _cache[1] || (_cache[1] = (...args) => $options.getAdminCert && $options.getAdminCert(...args)), class: "btn mr-2" }, " Get Admin Certificate "), _hoisted_6, _hoisted_7, withDirectives(createElementVNode("input", { "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.formURL = $event), class: "" }, null, 512), [ [vModelText, _ctx.formURL] ]), createElementVNode("button", { onClick: _cache[3] || (_cache[3] = (...args) => $options.sendTest && $options.sendTest(...args)), class: "btn" }, " Send Test ") ]), createElementVNode("div", _hoisted_8, [ _hoisted_9, createElementVNode("p", null, [ createTextVNode(" Identity: " + toDisplayString(_ctx.authSsr.identity.publicKey), 1), _hoisted_10, createTextVNode(" Account: " + toDisplayString(_ctx.authSsr.identity.secretKey), 1), _hoisted_11, createTextVNode(" Account Recovery Words: ") ]), createElementVNode("code", null, toDisplayString(_ctx.authSsr.identity.words.join(" ")), 1) ]), createElementVNode("div", _hoisted_12, [ _hoisted_13, createElementVNode("code", null, toDisplayString(_ctx.adminCert), 1) ]), _hoisted_14, _hoisted_15, _hoisted_16, createVNode(_component_Daemon, { api: "https://inventory.eotl.supply/api/info" }), _hoisted_17 ]); } const Debug = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { A as Account, Debug, default2 as Gateway, default3 as Invites, default4 as Restore }; //# sourceMappingURL=views.js.map