CH-J Tools透過 SSH 管理伺服器
選單
已發布的原始碼

CH-J Tools

瀏覽特定應用程式版本的目錄與檔案。

下載原始碼 ZIP
CH-J / Server Manager 1704 個檔案
0.1.2-beta 新增時間: · 建置時間:
vault.ts 新增時間: 未記錄日期 1.8 KB · 28 行
程式碼 下載檔案
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});
28export const keychain = (action: string, options: Record<string, unknown> = {}) => call<Record<string, unknown>>("core_keychain", "keychain", { ...options, action });
SHA-2560c4214e706abf96295d54d81f021310dbe25d3e5deafe3eb5b710ee054f22ddd

CH-J Proprietary Software License 1.14 · 原始碼依 CH-J Proprietary Software License 1.14 提供。公開原始碼不會改變授權條款,也不會授予額外的權利。

壓縮檔 SHA-256ac8fe790f4ba60fc098f8c985fc2656cfcc6cdc21fb34b30e308a2b54e62258f
檔案