v0.2.6-pre.008
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/tests/desktop_contract.rs
|
||||
// version: 7
|
||||
// version: 8
|
||||
|
||||
//! Desktop build, shell and Config-status contract audits for Wallet Desk.
|
||||
|
||||
@@ -198,3 +198,28 @@ fn pre_007_balance_uses_authorized_pubkey_and_composite_transport() {
|
||||
assert!(main.contains("renderWalletBalance"));
|
||||
assert!(main.contains("refresh_wallet_balance"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_008_import_uses_rust_native_picker_and_wallet_transfer_adapters() {
|
||||
let root = app_root();
|
||||
let manifest = read_text(root.join("Cargo.toml").as_path());
|
||||
let state = read_text(root.join("src/app_state.rs").as_path());
|
||||
let import = read_text(root.join("src/wallet_import.rs").as_path());
|
||||
let tauri = read_text(root.join("src/tauri.rs").as_path());
|
||||
let html = read_text(root.join("frontend/main.html").as_path());
|
||||
let main = read_text(root.join("frontend/ts/main.ts").as_path());
|
||||
assert!(manifest.contains("tauri-plugin-dialog.workspace = true"));
|
||||
assert!(manifest.contains("zeroize.workspace = true"));
|
||||
assert!(tauri.contains("tauri_plugin_dialog::init()"));
|
||||
assert!(tauri.contains("blocking_pick_file"));
|
||||
assert!(tauri.contains("inspect_import_source"));
|
||||
assert!(tauri.contains("import_wallet"));
|
||||
assert!(import.contains("ksp_wallet_lib::inspect_wallet_transfer"));
|
||||
assert!(import.contains("zeroize::Zeroizing"));
|
||||
assert!(state.contains("ksp_wallet_lib::import_wallet_transfer_v1"));
|
||||
assert!(html.contains("id=\"inspectImportSource\""));
|
||||
assert!(html.contains("id=\"importWalletForm\""));
|
||||
assert!(html.contains("id=\"importSourcePubkey\""));
|
||||
assert!(main.contains("WalletTransferInspectionDto"));
|
||||
assert!(main.contains("bindImportWalletForm"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/tests/desktop_security.rs
|
||||
// version: 7
|
||||
// version: 8
|
||||
|
||||
//! Static desktop security contracts for the Wallet Desk pre.002 shell.
|
||||
|
||||
@@ -126,3 +126,39 @@ fn balance_refresh_never_accepts_pubkey_or_endpoint_url_from_frontend() {
|
||||
assert!(!main.contains("endpointUrl"));
|
||||
assert!(state.contains("wallet.pubkey()"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn import_picker_path_and_transfer_secret_never_cross_into_frontend() {
|
||||
let root = app_root();
|
||||
let package = read_text(root.join("package.json").as_path());
|
||||
let capability = read_text(root.join("capabilities/default.json").as_path());
|
||||
let import = read_text(root.join("src/wallet_import.rs").as_path());
|
||||
let tauri = read_text(root.join("src/tauri.rs").as_path());
|
||||
let main = read_text(root.join("frontend/ts/main.ts").as_path());
|
||||
assert!(!package.contains("@tauri-apps/plugin-dialog"));
|
||||
assert!(!capability.contains("dialog:"));
|
||||
assert!(!capability.contains("fs:"));
|
||||
assert!(!main.contains("@tauri-apps/plugin-dialog"));
|
||||
assert!(!main.contains("sourcePath"));
|
||||
assert!(!main.contains("source_path"));
|
||||
assert!(import.contains("zeroize::Zeroizing"));
|
||||
let inspection = import.split("pub(crate) struct WalletTransferInspectionDto").nth(1);
|
||||
assert!(inspection.is_some());
|
||||
let inspection = inspection.unwrap_or_default().split("}\n").next().unwrap_or_default();
|
||||
let inspection_fields = inspection.lines().filter(|line| return line.trim_start().starts_with("pub(crate) ")).collect::<std::vec::Vec<_>>().join("\n");
|
||||
assert!(!inspection_fields.contains("path"));
|
||||
assert!(!inspection_fields.contains("password"));
|
||||
let request = import.split("pub(crate) struct WalletImportRequestDto").nth(1);
|
||||
assert!(request.is_some());
|
||||
let request = request.unwrap_or_default().split("}\n").next().unwrap_or_default();
|
||||
let request_fields = request.lines().filter(|line| return line.trim_start().starts_with("pub(crate) ")).collect::<std::vec::Vec<_>>().join("\n");
|
||||
assert!(request_fields.contains("owner_password"));
|
||||
assert!(request_fields.contains("view_password"));
|
||||
assert!(!request_fields.contains("path"));
|
||||
let command_start = tauri.find("async fn inspect_import_source");
|
||||
assert!(command_start.is_some());
|
||||
let command = &tauri[command_start.unwrap_or_default()..];
|
||||
let command = command.split("#[tauri::command]").next().unwrap_or_default();
|
||||
assert!(command.contains("WalletImportSourceRequestDto"));
|
||||
assert!(!command.contains("source_path"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user