mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 16:42:19 +00:00
* feat(ssh): restore FIDO2 security key support (#2308) Consolidate the restored feature and its review fixes before rebasing onto current main. Original PR head: 5d0a0c6c9a550364d3ec5c2331395cedfc9ea7ae. * fix(ssh): verify and repair FIDO authentication with simulated hardware Preserve complete OpenSSH SK signature payloads, classify combined PIN/presence prompts correctly, expand IdentityFile tokens, retain certificate selectors, and route shared-agent signing prompts to their originating window. Dismiss prompts when notification helpers exit. Add a software SK provider and opt-in real OpenSSH integration coverage for both algorithms, certificates, SFTP, forwarding, and concurrent windows. * refactor(ui): refine security key forms and authentication motion Use shared Select and Switch controls, concise localized copy and compact token-based dialogs. Add scoped enter/exit, field transition and presence animations with reduced-motion support. Preserve raw prompt details and visible PIN errors. * fix(ssh): align security key prompts with hardware presence and verify Docker logins * fix(ui): keep security key dialog above its remounted overlay * fix: address Codex review on PR #2823 * feat(ssh): guide security key recovery and explicit authentication fallback * test(ssh): exercise security key authentication on native Windows * test(ssh): verify Windows fixture signatures and explicit fallback * test(ssh): configure Windows OpenSSH toolchain and document coverage --------- Co-authored-by: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com>
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
"use strict";
|
|
|
|
/**
|
|
* Attach a one-shot release for an owned FIDO agent / askpass lease to a
|
|
* connection-like EventEmitter (ssh2 Client, etc.).
|
|
*
|
|
* @param {import("events").EventEmitter|null|undefined} conn
|
|
* @param {{ _releaseNetcattyFidoAgent?: () => void }|null|undefined} agent
|
|
*/
|
|
function attachFidoAgentRelease(conn, agent) {
|
|
if (!conn || typeof conn.once !== "function") return;
|
|
if (!agent || typeof agent._releaseNetcattyFidoAgent !== "function") return;
|
|
let released = false;
|
|
const releaseOwned = () => {
|
|
if (released) return;
|
|
released = true;
|
|
try { agent._releaseNetcattyFidoAgent(); } catch { /* ignore */ }
|
|
};
|
|
conn.once("close", releaseOwned);
|
|
conn.once("end", releaseOwned);
|
|
const onError = error => {
|
|
if (error?.code !== "ERR_FIDO_CANCELLED") return;
|
|
// ssh2 would otherwise try another key/password after an agent failure.
|
|
// Explicitly cancelling hardware authentication must end this connection.
|
|
try { conn.end?.(); } catch { /* already closed */ }
|
|
};
|
|
conn.on("error", onError);
|
|
conn.once("close", () => conn.removeListener("error", onError));
|
|
return releaseOwned;
|
|
}
|
|
|
|
module.exports = { attachFidoAgentRelease };
|