CH-J Toolsmanagementul serverului peste SSH
Meniu
Sursă publicată

CH-J Tools

Navighează directoarele și fișierele pentru o anumită versiune a aplicației.

Descarcă sursa ZIP
CH-J / Server Manager 872 fișiere
core-20261030T220507Z-61e4558d889f Adăugat: · Construit:
vault.ts Adăugat: Data neînregistrată 1,6 KB · 26 linii
Cod Descarcă fișierul
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 · Sursa este furnizată în cadrul CH-J Proprietary Software License 1.14. Disponibilitatea sa nu modifică termenii licenţei sau nu acordă drepturi suplimentare.

Archive SHA-25677380d4805485ffa4027fbe7858b5836f197a4aa9d52358a43e2d12d018744df
Fișiere