@eotl/core
Version:
Assortment of data structures, Vue.js components, and utilities across EOTL apps and sites.
156 lines (155 loc) • 6.72 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const Account = require("./Account-CRSRrcCP.cjs");
const Daemon = require("./Daemon-Co4jKUpP.cjs");
const simpleSignedRecords = require("@eotl/simple-signed-records");
const store = require("./store.cjs");
const authSsr = require("./authSsr-Aa_pi4mF.cjs");
const vue = require("vue");
const _pluginVue_exportHelper = require("./_plugin-vue_export-helper-DM9IkUGy.cjs");
const Gateway = require("./Gateway-Dq5B_SC_.cjs");
const Invites = require("./Invites-B124T5od.cjs");
const Restore = require("./Restore-B0ZhkG3q.cjs");
const _sfc_main = {
components: { Daemon: Daemon.Daemon },
data: function() {
const store$1 = store.useEotlCore();
const authSsr$1 = authSsr.useAuthSsr();
return {
store: store$1,
authSsr: authSsr$1,
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 = Account.naclUtilExports.decodeBase64(this.authSsr.identity.secretKey);
const publicKey = Account.naclUtilExports.decodeBase64(this.authSsr.identity.publicKey);
let signedData = simpleSignedRecords.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 = Account.naclUtilExports.decodeBase64(this.authSsr.identity.secretKey);
let publicKey = Account.naclUtilExports.decodeBase64(this.authSsr.identity.publicKey);
console.log(record);
let postData = simpleSignedRecords.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__ */ vue.createElementVNode("h2", null, "Debug", -1);
const _hoisted_2 = /* @__PURE__ */ vue.createElementVNode("p", null, "This page is for various debugging of requests SSR and otherwise for development and support.", -1);
const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("hr", { class: "thick" }, null, -1);
const _hoisted_4 = /* @__PURE__ */ vue.createElementVNode("h3", null, "Simple Signed Records", -1);
const _hoisted_5 = { class: "mb-5" };
const _hoisted_6 = /* @__PURE__ */ vue.createElementVNode("h4", null, "Test Data", -1);
const _hoisted_7 = /* @__PURE__ */ vue.createElementVNode("p", null, "Send generic test data as an SSR for backend testing", -1);
const _hoisted_8 = { class: "mb-5" };
const _hoisted_9 = /* @__PURE__ */ vue.createElementVNode("h4", null, "Account", -1);
const _hoisted_10 = /* @__PURE__ */ vue.createElementVNode("br", null, null, -1);
const _hoisted_11 = /* @__PURE__ */ vue.createElementVNode("br", null, null, -1);
const _hoisted_12 = { class: "mb-5" };
const _hoisted_13 = /* @__PURE__ */ vue.createElementVNode("h4", null, "Admin Cert", -1);
const _hoisted_14 = /* @__PURE__ */ vue.createElementVNode("hr", { class: "thick" }, null, -1);
const _hoisted_15 = /* @__PURE__ */ vue.createElementVNode("h2", null, "Server", -1);
const _hoisted_16 = /* @__PURE__ */ vue.createElementVNode("p", null, [
/* @__PURE__ */ vue.createTextVNode("The following is use of "),
/* @__PURE__ */ vue.createElementVNode("code", null, "<Daemon/>"),
/* @__PURE__ */ vue.createTextVNode(" Vue component.")
], -1);
const _hoisted_17 = /* @__PURE__ */ vue.createElementVNode("div", { class: "mb-5" }, null, -1);
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_Daemon = vue.resolveComponent("Daemon");
return vue.openBlock(), vue.createElementBlock("div", null, [
_hoisted_1,
_hoisted_2,
_hoisted_3,
_hoisted_4,
vue.createElementVNode("div", _hoisted_5, [
vue.createElementVNode("button", {
onClick: _cache[0] || (_cache[0] = (...args) => $options.generateIdentity && $options.generateIdentity(...args)),
class: "btn mr-2"
}, " Generate Identity "),
vue.createElementVNode("button", {
onClick: _cache[1] || (_cache[1] = (...args) => $options.getAdminCert && $options.getAdminCert(...args)),
class: "btn mr-2"
}, " Get Admin Certificate "),
_hoisted_6,
_hoisted_7,
vue.withDirectives(vue.createElementVNode("input", {
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.formURL = $event),
class: ""
}, null, 512), [
[vue.vModelText, _ctx.formURL]
]),
vue.createElementVNode("button", {
onClick: _cache[3] || (_cache[3] = (...args) => $options.sendTest && $options.sendTest(...args)),
class: "btn"
}, " Send Test ")
]),
vue.createElementVNode("div", _hoisted_8, [
_hoisted_9,
vue.createElementVNode("p", null, [
vue.createTextVNode(" Identity: " + vue.toDisplayString(_ctx.authSsr.identity.publicKey), 1),
_hoisted_10,
vue.createTextVNode(" Account: " + vue.toDisplayString(_ctx.authSsr.identity.secretKey), 1),
_hoisted_11,
vue.createTextVNode(" Account Recovery Words: ")
]),
vue.createElementVNode("code", null, vue.toDisplayString(_ctx.authSsr.identity.words.join(" ")), 1)
]),
vue.createElementVNode("div", _hoisted_12, [
_hoisted_13,
vue.createElementVNode("code", null, vue.toDisplayString(_ctx.adminCert), 1)
]),
_hoisted_14,
_hoisted_15,
_hoisted_16,
vue.createVNode(_component_Daemon, { api: "https://inventory.eotl.supply/api/info" }),
_hoisted_17
]);
}
const Debug = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render]]);
exports.Account = Account.Account;
exports.Gateway = Gateway.default;
exports.Invites = Invites.default;
exports.Restore = Restore.default;
exports.Debug = Debug;
//# sourceMappingURL=views.cjs.map