CH-J Toolsspráva serverů přes SSH
Menu
Vydané zdroje

CH-J Tools

Procházejte adresáře a soubory konkrétního vydání aplikace.

Stáhnout zdroje ZIP
CH-J / Server Manager 872 souborů
core-20261030T220507Z-61e4558d889f Přidáno: · Sestaveno:
vault.ts Přidáno: Datum není evidováno 1,6 KB · 26 řádků
Kód Stáhnout soubor
1/** Encrypted vault and OS-protected (biometric) unlocking. Secrets never leave the Rust Core. */
2import { call } from "../transport";
3import type { BiometricStatus, Result, VaultStatus } from "../types";
5async function unwrap<T>(command: string, channel: string): Promise<T> {
6 const result = await call<Result<T>>(command, channel);
7 if (!result.ok) throw Object.assign(new Error(result.error.message), { code: result.error.code });
8 return result.value;
9}
11export const vault = Object.freeze({
12 status: () => call<VaultStatus>("core_vault_status", "vault:status"),
13 create: (password: string) => call<VaultStatus>("core_vault_create", "vault:create", { password }),
14 unlock: (password: string) => call<VaultStatus>("core_vault_unlock", "vault:unlock", { password }),
15 lock: () => call<VaultStatus>("core_vault_lock", "vault:lock"),
16 reset: (confirmation: string) => call<VaultStatus>("core_vault_reset", "vault:reset", { confirmation })
17});
19export const biometrics = Object.freeze({
20 status: () => unwrap<BiometricStatus>("core_biometrics_status", "biometrics:status"),
21 enable: () => unwrap<BiometricStatus>("core_biometrics_enable", "biometrics:enable"),
22 disable: () => unwrap<{ enabled: false; enrolled: false }>("core_biometrics_disable", "biometrics:disable"),
23 unlock: () => unwrap<VaultStatus>("core_biometrics_unlock", "biometrics:unlock"),
24 autoUnlock: () => unwrap<{ attempted: boolean; reason?: string; status?: VaultStatus; error?: { code: string } }>("core_biometrics_auto_unlock", "biometrics:autoUnlock"),
25 authenticate: () => unwrap<{ authenticated: true }>("core_biometrics_authenticate", "biometrics:authenticate")
26});
SHA-25621b41491ea0d7008f21a59ab7c65d0a07f73e558f8a9878a74e477b48f2c978a

CH-J Proprietary Software License 1.14 · Zdroje jsou zveřejněny pod CH-J Proprietary Software License 1.14. Jejich dostupnost nemění licenční podmínky ani neposkytuje další oprávnění.

SHA-256 archivu77380d4805485ffa4027fbe7858b5836f197a4aa9d52358a43e2d12d018744df
Soubory