health-check.js: single-key form with contextual software, standards and security fields (section 19)
This commit is contained in:
1 parent
8b528c1578
commit
e4d7e74cf2
1 file changed
+265
-127
+265
-127
@@ -1,23 +1,41 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const form = document.querySelector("#health-check-form");
|
const form = document.querySelector("#health-check-form");
|
||||||
const keyChecks = document.querySelector("#key-checks");
|
const keySelect = document.querySelector("#key-select");
|
||||||
|
const keyCheck = document.querySelector("#key-check");
|
||||||
|
const walletSoftwareSelect = document.querySelector("#wallet-software");
|
||||||
|
const softwareHelp = document.querySelector("#software-help");
|
||||||
const toolChecks = document.querySelector("#tool-checks");
|
const toolChecks = document.querySelector("#tool-checks");
|
||||||
const securityChecks = document.querySelector("#security-checks");
|
const securityChecks = document.querySelector("#security-checks");
|
||||||
|
const nextCheckPreview = document.querySelector("#next-check-preview");
|
||||||
const reviewPanel = document.querySelector("#review-panel");
|
const reviewPanel = document.querySelector("#review-panel");
|
||||||
const reviewSummary = document.querySelector("#review-summary");
|
const reviewSummary = document.querySelector("#review-summary");
|
||||||
const saveButton = document.querySelector("#save-check");
|
const saveButton = document.querySelector("#save-check");
|
||||||
const saveStatus = document.querySelector("#save-status");
|
const saveStatus = document.querySelector("#save-status");
|
||||||
|
|
||||||
|
const CLOUD_KEY_NUMBER = 3;
|
||||||
|
const KEY_PRODUCTS = { 1: "SeedSigner", 2: "Blockstream Jade", 3: "Nunchuk" };
|
||||||
|
const WALLET_SOFTWARE = ["Sparrow Wallet", "Nunchuk"];
|
||||||
const generalStatuses = [
|
const generalStatuses = [
|
||||||
["IKKJE_VURDERT", "Not assessed"],
|
["IKKJE_VURDERT", "Not assessed"],
|
||||||
["OK", "OK"],
|
["OK", "OK"],
|
||||||
["PROBLEM", "Problem"],
|
["PROBLEM", "Problem"],
|
||||||
];
|
];
|
||||||
|
const verificationStatuses = [
|
||||||
|
["OK", "OK"],
|
||||||
|
["PROBLEM", "Problem"],
|
||||||
|
];
|
||||||
const booleanOptions = [["", "Not assessed"], ["1", "Yes"], ["0", "No"]];
|
const booleanOptions = [["", "Not assessed"], ["1", "Yes"], ["0", "No"]];
|
||||||
const productNames = ["SeedSigner", "Blockstream Jade", "Nunchuk", "Sparrow Wallet"];
|
const securityStatuses = ["SECURE", "PATCHED", "VULNERABLE", "COMPROMISED"];
|
||||||
const securityStatuses = ["TRYGG", "PATCHA", "SÅRBAR", "KOMPROMITTERT"];
|
|
||||||
let keyProfiles = [];
|
let keyProfiles = [];
|
||||||
|
|
||||||
|
function emptyState(text) {
|
||||||
|
const message = document.createElement("p");
|
||||||
|
message.className = "empty-state";
|
||||||
|
message.textContent = text;
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
function makeField(labelText, name, control) {
|
function makeField(labelText, name, control) {
|
||||||
const label = document.createElement("label");
|
const label = document.createElement("label");
|
||||||
label.className = "field";
|
label.className = "field";
|
||||||
@@ -28,14 +46,14 @@ function makeField(labelText, name, control) {
|
|||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeSelect(options, name, includeBlank = false) {
|
function makeSelect(options, name, placeholder = "") {
|
||||||
const select = document.createElement("select");
|
const select = document.createElement("select");
|
||||||
select.name = name;
|
select.name = name;
|
||||||
if (includeBlank) {
|
if (placeholder) {
|
||||||
const placeholder = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
placeholder.value = "";
|
option.value = "";
|
||||||
placeholder.textContent = "Select a status";
|
option.textContent = placeholder;
|
||||||
select.append(placeholder);
|
select.append(option);
|
||||||
}
|
}
|
||||||
for (const [value, label] of options) {
|
for (const [value, label] of options) {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
@@ -76,60 +94,148 @@ function makeCard(title, subtitle) {
|
|||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
function productPrefix(kind, product) {
|
function productSlug(product) {
|
||||||
return `${kind}_${product.toLowerCase().replaceAll(" ", "_")}_`;
|
return product.toLowerCase().replaceAll(" ", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderKeyChecks(keys) {
|
function selectedKey() {
|
||||||
keyChecks.replaceChildren();
|
const keyId = Number(keySelect.value);
|
||||||
for (const key of keys) {
|
return keyProfiles.find((key) => key.id === keyId) || null;
|
||||||
const card = makeCard(`Key ${key.key_number}: ${key.name}`, key.type === "cloud" ? "Cloud key — report the result of your manual check." : "Hardware key — record the result of your manual check.");
|
}
|
||||||
const prefix = `key_${key.id}_`;
|
|
||||||
card.append(makeField("Availability", `${prefix}available`, makeSelect(booleanOptions)));
|
|
||||||
|
|
||||||
|
function expectedProducts() {
|
||||||
|
const key = selectedKey();
|
||||||
|
const software = walletSoftwareSelect.value;
|
||||||
|
if (!key || !WALLET_SOFTWARE.includes(software)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return [...new Set([KEY_PRODUCTS[key.key_number], software])];
|
||||||
|
}
|
||||||
|
|
||||||
|
function expectedProviders() {
|
||||||
|
const key = selectedKey();
|
||||||
|
if (!key) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (key.key_number === CLOUD_KEY_NUMBER) {
|
||||||
|
return ["Nunchuk"];
|
||||||
|
}
|
||||||
|
return [KEY_PRODUCTS[key.key_number], "Sparrow Wallet", "Nunchuk"];
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderKeySelect() {
|
||||||
|
for (const key of keyProfiles) {
|
||||||
|
const option = document.createElement("option");
|
||||||
|
option.value = String(key.id);
|
||||||
|
option.textContent = `Key ${key.key_number}: ${key.name}`;
|
||||||
|
keySelect.append(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderKeyCheck() {
|
||||||
|
const key = selectedKey();
|
||||||
|
keyCheck.replaceChildren();
|
||||||
|
if (!key) {
|
||||||
|
keyCheck.append(emptyState("Select a key to record its checks."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const card = makeCard(
|
||||||
|
`Key ${key.key_number}: ${key.name}`,
|
||||||
|
key.type === "cloud"
|
||||||
|
? "Cloud key — report the result of your manual check."
|
||||||
|
: "Hardware key — record the result of your manual check.",
|
||||||
|
);
|
||||||
|
const available = makeSelect(booleanOptions, "available");
|
||||||
|
card.append(makeField("Availability", "available", available));
|
||||||
|
|
||||||
|
const details = document.createElement("div");
|
||||||
|
details.className = "form-stack";
|
||||||
if (key.type === "hardware") {
|
if (key.type === "hardware") {
|
||||||
card.append(makeField("Hardware works", `${prefix}hardware_works`, makeSelect(booleanOptions)));
|
details.append(makeField("Hardware works", "hardware_works", makeSelect(booleanOptions, "hardware_works")));
|
||||||
card.append(makeField("Firmware version", `${prefix}firmware_version`, makeTextInput(`${prefix}firmware_version`, 100)));
|
details.append(makeField("Firmware version", "firmware_version", makeTextInput("firmware_version", 100)));
|
||||||
card.append(makeField("Seed backup status", `${prefix}seed_backup_status`, makeSelect(generalStatuses)));
|
details.append(makeField(
|
||||||
card.append(makeField("Backup verified as intact and matching the device", `${prefix}seed_backup_verified`, makeSelect(booleanOptions)));
|
"Seed backup intact and matching the device",
|
||||||
|
"seed_backup_verified",
|
||||||
|
makeSelect(verificationStatuses, "seed_backup_verified", "Select a status"),
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
card.append(makeField("Cloud health check", `${prefix}cloud_health_status`, makeSelect(generalStatuses)));
|
details.append(makeField("Cloud health check", "cloud_health_status", makeSelect(generalStatuses, "cloud_health_status")));
|
||||||
card.append(makeField("Provider operational", `${prefix}cloud_provider_operational`, makeSelect(booleanOptions)));
|
details.append(makeField("Provider operational", "cloud_provider_operational", makeSelect(booleanOptions, "cloud_provider_operational")));
|
||||||
|
}
|
||||||
|
details.append(makeField(
|
||||||
|
"Address path verified",
|
||||||
|
"address_path_verified",
|
||||||
|
makeSelect(verificationStatuses, "address_path_verified", "Select a status"),
|
||||||
|
));
|
||||||
|
details.append(makeField("Address path", "address_path", makeTextInput("address_path", 200)));
|
||||||
|
card.append(details);
|
||||||
|
card.append(makeField("Key notes", "key_comments", makeTextarea("key_comments")));
|
||||||
|
keyCheck.append(card);
|
||||||
|
|
||||||
|
available.addEventListener("change", () => {
|
||||||
|
details.hidden = available.value === "0";
|
||||||
|
syncRequiredFields();
|
||||||
|
});
|
||||||
|
syncRequiredFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
card.append(makeField("Address verified", `${prefix}address_verified`, makeSelect(booleanOptions)));
|
function syncRequiredFields() {
|
||||||
card.append(makeField("Derivation height", `${prefix}derivation_height`, makeTextInput(`${prefix}derivation_height`, 100)));
|
const key = selectedKey();
|
||||||
card.append(makeField("Address path verified", `${prefix}address_path_verified`, makeSelect(booleanOptions)));
|
const availability = form.querySelector('[name="available"]');
|
||||||
card.append(makeField("Address path", `${prefix}address_path`, makeTextInput(`${prefix}address_path`, 200)));
|
const required = Boolean(key) && availability !== null && availability.value === "1";
|
||||||
card.append(makeField("Key notes", `${prefix}comments`, makeTextarea(`${prefix}comments`)));
|
for (const name of ["seed_backup_verified", "address_path_verified"]) {
|
||||||
keyChecks.append(card);
|
const select = form.querySelector(`[name="${name}"]`);
|
||||||
|
if (select) {
|
||||||
|
select.required = required;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function lockWalletSoftware() {
|
||||||
|
const key = selectedKey();
|
||||||
|
const isCloud = Boolean(key) && key.key_number === CLOUD_KEY_NUMBER;
|
||||||
|
const sparrow = walletSoftwareSelect.querySelector('option[value="Sparrow Wallet"]');
|
||||||
|
sparrow.disabled = isCloud;
|
||||||
|
if (isCloud) {
|
||||||
|
walletSoftwareSelect.value = "Nunchuk";
|
||||||
|
softwareHelp.textContent = "Nunchuk is the only wallet software available for the cloud key.";
|
||||||
|
} else {
|
||||||
|
softwareHelp.textContent = "Record the version of the software you selected for this key.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderToolChecks() {
|
function renderToolChecks() {
|
||||||
toolChecks.replaceChildren();
|
toolChecks.replaceChildren();
|
||||||
for (const product of productNames) {
|
const products = expectedProducts();
|
||||||
const card = makeCard(product, "Record support status and the product version checked.");
|
if (!products.length) {
|
||||||
const prefix = productPrefix("tool", product);
|
toolChecks.append(emptyState("Select a key and software to see the products to check."));
|
||||||
card.append(makeField("BIP327 status", `${prefix}bip327_status`, makeSelect(generalStatuses)));
|
return;
|
||||||
card.append(makeField("SLIP39 status", `${prefix}slip39_status`, makeSelect(generalStatuses)));
|
}
|
||||||
card.append(makeField("Version checked", `${prefix}version`, makeTextInput(`${prefix}version`, 100)));
|
for (const product of products) {
|
||||||
const checkedAt = document.createElement("input");
|
const slug = productSlug(product);
|
||||||
checkedAt.type = "date";
|
const card = makeCard(product, "Record the support status for this submission.");
|
||||||
card.append(makeField("Date checked", `${prefix}checked_at`, checkedAt));
|
card.append(makeField("BIP327 status", `tool_${slug}_bip327_status`, makeSelect(generalStatuses, `tool_${slug}_bip327_status`)));
|
||||||
card.append(makeField("Notes or source", `${prefix}notes`, makeTextarea(`${prefix}notes`)));
|
card.append(makeField("SLIP39 status", `tool_${slug}_slip39_status`, makeSelect(generalStatuses, `tool_${slug}_slip39_status`)));
|
||||||
toolChecks.append(card);
|
toolChecks.append(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderSecurityChecks() {
|
function renderSecurityChecks() {
|
||||||
securityChecks.replaceChildren();
|
securityChecks.replaceChildren();
|
||||||
for (const product of productNames) {
|
const providers = expectedProviders();
|
||||||
const card = makeCard(product, "Enter the result of external research; do not include credentials or secrets.");
|
if (!providers.length) {
|
||||||
const prefix = productPrefix("security", product);
|
securityChecks.append(emptyState("Select a key to see the providers to check."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
const options = securityStatuses.map((status) => [status, status]);
|
const options = securityStatuses.map((status) => [status, status]);
|
||||||
card.append(makeField("Security status", `${prefix}status`, makeSelect(options, "", true)));
|
for (const provider of providers) {
|
||||||
card.append(makeField("Comment", `${prefix}comments`, makeTextarea("", 1000)));
|
const slug = productSlug(provider);
|
||||||
|
const card = makeCard(provider, "Enter the result of external research; do not include credentials or secrets.");
|
||||||
|
const status = makeSelect(options, `security_${slug}_status`, "Select a status");
|
||||||
|
status.required = true;
|
||||||
|
card.append(makeField("Security status", `security_${slug}_status`, status));
|
||||||
|
card.append(makeField("Comment", `security_${slug}_comments`, makeTextarea(`security_${slug}_comments`, 1000)));
|
||||||
securityChecks.append(card);
|
securityChecks.append(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,53 +247,38 @@ function formatLocalDate(date) {
|
|||||||
return `${year}-${month}-${day}`;
|
return `${year}-${month}-${day}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSuggestedDates() {
|
function nextCheckDate(value) {
|
||||||
const checkedAt = document.querySelector("#checked-at");
|
if (!value) {
|
||||||
const dueDate = document.querySelector("#next-check-due");
|
return "";
|
||||||
checkedAt.value = formatLocalDate(new Date());
|
}
|
||||||
dueDate.dataset.suggested = "true";
|
const [year, month, day] = value.split("-").map(Number);
|
||||||
suggestDueDate();
|
|
||||||
checkedAt.addEventListener("change", suggestDueDate);
|
|
||||||
dueDate.addEventListener("input", () => {
|
|
||||||
dueDate.dataset.suggested = "false";
|
|
||||||
});
|
|
||||||
|
|
||||||
function suggestDueDate() {
|
|
||||||
if (dueDate.dataset.suggested !== "false" && checkedAt.value) {
|
|
||||||
const [year, month, day] = checkedAt.value.split("-").map(Number);
|
|
||||||
const date = new Date(year, month - 1, day);
|
const date = new Date(year, month - 1, day);
|
||||||
date.setFullYear(date.getFullYear() + 1);
|
date.setFullYear(date.getFullYear() + 1);
|
||||||
dueDate.value = formatLocalDate(date);
|
if (date.getMonth() !== month - 1) {
|
||||||
}
|
// 29 February has no equivalent in a non-leap year, so clamp to 28 February.
|
||||||
|
date.setDate(0);
|
||||||
}
|
}
|
||||||
|
return formatLocalDate(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildReview() {
|
function updateDuePreview() {
|
||||||
const data = new FormData(form);
|
const due = nextCheckDate(document.querySelector("#checked-at").value);
|
||||||
const missing = [];
|
nextCheckPreview.textContent = due
|
||||||
const problems = [];
|
? `Next check due: ${due} (one calendar year after the check date).`
|
||||||
for (const select of form.querySelectorAll("select")) {
|
: "Next check due is calculated automatically as one calendar year after the check date.";
|
||||||
const fieldLabel = select.closest(".field")?.querySelector("span");
|
|
||||||
const label = fieldLabel?.textContent || select.name;
|
|
||||||
const value = data.get(select.name);
|
|
||||||
if (value === "" || value === "IKKJE_VURDERT") {
|
|
||||||
missing.push(label);
|
|
||||||
} else if (value === "PROBLEM" || value === "0" || value === "SÅRBAR" || value === "KOMPROMITTERT") {
|
|
||||||
problems.push(`${label}: ${value}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fragment = document.createDocumentFragment();
|
function setCheckDate() {
|
||||||
appendSummaryList(fragment, "Needs assessment", missing.length ? missing : ["None"]);
|
const checkedAt = document.querySelector("#checked-at");
|
||||||
appendSummaryList(fragment, "Results requiring follow-up", problems.length ? problems : ["None"]);
|
checkedAt.value = formatLocalDate(new Date());
|
||||||
const dates = document.createElement("p");
|
updateDuePreview();
|
||||||
dates.textContent = `Check date: ${data.get("checked_at")} · Next check due: ${data.get("next_check_due")}`;
|
checkedAt.addEventListener("change", updateDuePreview);
|
||||||
fragment.append(dates);
|
}
|
||||||
reviewSummary.replaceChildren(fragment);
|
|
||||||
reviewPanel.hidden = false;
|
function resetReview() {
|
||||||
|
reviewPanel.hidden = true;
|
||||||
saveStatus.textContent = "";
|
saveStatus.textContent = "";
|
||||||
saveButton.disabled = false;
|
saveButton.disabled = true;
|
||||||
reviewPanel.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendSummaryList(parent, title, items) {
|
function appendSummaryList(parent, title, items) {
|
||||||
@@ -202,6 +293,40 @@ function appendSummaryList(parent, title, items) {
|
|||||||
parent.append(heading, list);
|
parent.append(heading, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildReview() {
|
||||||
|
const data = new FormData(form);
|
||||||
|
const missing = [];
|
||||||
|
const problems = [];
|
||||||
|
for (const select of form.querySelectorAll("select")) {
|
||||||
|
if (select.closest("[hidden]")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const fieldLabel = select.closest(".field")?.querySelector("span");
|
||||||
|
const label = fieldLabel?.textContent || select.name;
|
||||||
|
const value = data.get(select.name);
|
||||||
|
if (value === "" || value === "IKKJE_VURDERT") {
|
||||||
|
missing.push(label);
|
||||||
|
} else if (value === "PROBLEM" || value === "0" || value === "VULNERABLE" || value === "COMPROMISED") {
|
||||||
|
problems.push(`${label}: ${value}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const fragment = document.createDocumentFragment();
|
||||||
|
appendSummaryList(fragment, "Needs assessment", missing.length ? missing : ["None"]);
|
||||||
|
appendSummaryList(fragment, "Results requiring follow-up", problems.length ? problems : ["None"]);
|
||||||
|
const key = selectedKey();
|
||||||
|
const checkedAt = data.get("checked_at");
|
||||||
|
const dates = document.createElement("p");
|
||||||
|
const keyLabel = key ? `Key ${key.key_number}: ${key.name}` : "No key selected";
|
||||||
|
dates.textContent = `${keyLabel} · Check date: ${checkedAt} · Next check due: ${nextCheckDate(checkedAt)}`;
|
||||||
|
fragment.append(dates);
|
||||||
|
reviewSummary.replaceChildren(fragment);
|
||||||
|
reviewPanel.hidden = false;
|
||||||
|
saveStatus.textContent = "";
|
||||||
|
saveButton.disabled = false;
|
||||||
|
reviewPanel.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||||
|
}
|
||||||
|
|
||||||
function flagValue(data, name) {
|
function flagValue(data, name) {
|
||||||
const value = data.get(name);
|
const value = data.get(name);
|
||||||
return value === "1" || value === "0" ? Number(value) : null;
|
return value === "1" || value === "0" ? Number(value) : null;
|
||||||
@@ -217,52 +342,62 @@ function statusValue(data, name) {
|
|||||||
return typeof value === "string" && value !== "" ? value : null;
|
return typeof value === "string" && value !== "" ? value : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function collectKeyCheck(data, key) {
|
||||||
|
const available = flagValue(data, "available");
|
||||||
|
const entry = {
|
||||||
|
key_id: key.id,
|
||||||
|
available: available,
|
||||||
|
hardware_works: null,
|
||||||
|
firmware_version: "",
|
||||||
|
seed_backup_verified: null,
|
||||||
|
cloud_health_status: null,
|
||||||
|
cloud_provider_operational: null,
|
||||||
|
address_path_verified: null,
|
||||||
|
address_path: "",
|
||||||
|
comments: textValue(data, "key_comments"),
|
||||||
|
};
|
||||||
|
if (available === 0) {
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
if (key.type === "hardware") {
|
||||||
|
entry.hardware_works = flagValue(data, "hardware_works");
|
||||||
|
entry.firmware_version = textValue(data, "firmware_version");
|
||||||
|
entry.seed_backup_verified = statusValue(data, "seed_backup_verified");
|
||||||
|
} else {
|
||||||
|
entry.cloud_health_status = statusValue(data, "cloud_health_status");
|
||||||
|
entry.cloud_provider_operational = flagValue(data, "cloud_provider_operational");
|
||||||
|
}
|
||||||
|
entry.address_path_verified = statusValue(data, "address_path_verified");
|
||||||
|
entry.address_path = textValue(data, "address_path");
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
function collectPayload() {
|
function collectPayload() {
|
||||||
const data = new FormData(form);
|
const data = new FormData(form);
|
||||||
|
const key = selectedKey();
|
||||||
return {
|
return {
|
||||||
checked_at: textValue(data, "checked_at"),
|
checked_at: textValue(data, "checked_at"),
|
||||||
next_check_due: textValue(data, "next_check_due"),
|
wallet_software: data.get("wallet_software"),
|
||||||
|
software_version: textValue(data, "software_version"),
|
||||||
software_compatibility_status: data.get("software_compatibility_status"),
|
software_compatibility_status: data.get("software_compatibility_status"),
|
||||||
sparrow_version: textValue(data, "sparrow_version"),
|
|
||||||
nunchuk_version: textValue(data, "nunchuk_version"),
|
|
||||||
software_comments: textValue(data, "software_comments"),
|
software_comments: textValue(data, "software_comments"),
|
||||||
contact_info_verified: flagValue(data, "contact_info_verified"),
|
contact_info_verified: flagValue(data, "contact_info_verified"),
|
||||||
comments: textValue(data, "comments"),
|
comments: textValue(data, "comments"),
|
||||||
key_checks: keyProfiles.map((key) => {
|
key_check: collectKeyCheck(data, key),
|
||||||
const prefix = `key_${key.id}_`;
|
tool_checks: expectedProducts().map((product) => {
|
||||||
return {
|
const slug = productSlug(product);
|
||||||
key_id: key.id,
|
|
||||||
available: flagValue(data, `${prefix}available`),
|
|
||||||
hardware_works: flagValue(data, `${prefix}hardware_works`),
|
|
||||||
firmware_version: textValue(data, `${prefix}firmware_version`),
|
|
||||||
seed_backup_status: statusValue(data, `${prefix}seed_backup_status`),
|
|
||||||
seed_backup_verified: flagValue(data, `${prefix}seed_backup_verified`),
|
|
||||||
cloud_health_status: statusValue(data, `${prefix}cloud_health_status`),
|
|
||||||
cloud_provider_operational: flagValue(data, `${prefix}cloud_provider_operational`),
|
|
||||||
address_verified: flagValue(data, `${prefix}address_verified`),
|
|
||||||
derivation_height: textValue(data, `${prefix}derivation_height`),
|
|
||||||
address_path_verified: flagValue(data, `${prefix}address_path_verified`),
|
|
||||||
address_path: textValue(data, `${prefix}address_path`),
|
|
||||||
comments: textValue(data, `${prefix}comments`),
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
tool_checks: productNames.map((product) => {
|
|
||||||
const prefix = productPrefix("tool", product);
|
|
||||||
return {
|
return {
|
||||||
product,
|
product,
|
||||||
bip327_status: data.get(`${prefix}bip327_status`),
|
bip327_status: data.get(`tool_${slug}_bip327_status`),
|
||||||
slip39_status: data.get(`${prefix}slip39_status`),
|
slip39_status: data.get(`tool_${slug}_slip39_status`),
|
||||||
version: textValue(data, `${prefix}version`),
|
|
||||||
checked_at: textValue(data, `${prefix}checked_at`),
|
|
||||||
notes: textValue(data, `${prefix}notes`),
|
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
ai_security_checks: productNames.map((product) => {
|
ai_security_checks: expectedProviders().map((provider) => {
|
||||||
const prefix = productPrefix("security", product);
|
const slug = productSlug(provider);
|
||||||
return {
|
return {
|
||||||
provider: product,
|
provider,
|
||||||
status: statusValue(data, `${prefix}status`),
|
status: statusValue(data, `security_${slug}_status`),
|
||||||
comments: textValue(data, `${prefix}comments`),
|
comments: textValue(data, `security_${slug}_comments`),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
@@ -297,25 +432,28 @@ async function loadKeys() {
|
|||||||
throw new Error("Key profiles are unavailable.");
|
throw new Error("Key profiles are unavailable.");
|
||||||
}
|
}
|
||||||
keyProfiles = await response.json();
|
keyProfiles = await response.json();
|
||||||
renderKeyChecks(keyProfiles);
|
renderKeySelect();
|
||||||
} catch {
|
} catch {
|
||||||
keyChecks.replaceChildren();
|
keySelect.disabled = true;
|
||||||
const message = document.createElement("p");
|
keyCheck.replaceChildren(emptyState(
|
||||||
message.className = "empty-state";
|
"Key profiles could not be loaded. Return to the dashboard or contact the service administrator.",
|
||||||
message.textContent = "Key profiles could not be loaded. Return to the dashboard or contact the service administrator.";
|
));
|
||||||
keyChecks.append(message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setCheckDate();
|
||||||
|
renderKeyCheck();
|
||||||
renderToolChecks();
|
renderToolChecks();
|
||||||
renderSecurityChecks();
|
renderSecurityChecks();
|
||||||
setSuggestedDates();
|
|
||||||
saveButton.addEventListener("click", saveHealthCheck);
|
saveButton.addEventListener("click", saveHealthCheck);
|
||||||
form.addEventListener("input", () => {
|
keySelect.addEventListener("change", () => {
|
||||||
reviewPanel.hidden = true;
|
lockWalletSoftware();
|
||||||
saveStatus.textContent = "";
|
renderKeyCheck();
|
||||||
saveButton.disabled = true;
|
renderToolChecks();
|
||||||
|
renderSecurityChecks();
|
||||||
});
|
});
|
||||||
|
walletSoftwareSelect.addEventListener("change", renderToolChecks);
|
||||||
|
form.addEventListener("input", resetReview);
|
||||||
form.addEventListener("submit", (event) => {
|
form.addEventListener("submit", (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (!form.reportValidity()) {
|
if (!form.reportValidity()) {
|
||||||
|
|||||||
Reference in new issue
Block a user