Skip to content

Feature/kasm 8734 muti smartcard reader support - #202

Open
rspruel wants to merge 4 commits into
masterfrom
feature/KASM-8734-muti-smartcard-support
Open

Feature/kasm 8734 muti smartcard reader support#202
rspruel wants to merge 4 commits into
masterfrom
feature/KASM-8734-muti-smartcard-support

Conversation

@rspruel

@rspruel rspruel commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

This PR updates smartcard.js to support passing through multiple smart-card readers.

Comment thread core/output/smartcard.js
// host formats the code uppercase ("0x8010002E"), but it reaches us via the
// extension's asHex() (BigInt.toString(16)), which lowercases it — a case-sensitive
// match here would silently never fire.
const SCARD_E_NO_READERS_AVAILABLE = "0x8010002e";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments are unnecessary. The code is self-documenting already.

Comment thread core/output/smartcard.js
Comment on lines +332 to +333
// Add a session to the lane map, wiring up the peer lookup its late-bind guard
// needs. All session inserts must go through this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is unnecessary. The code is self-documenting already.

Comment thread core/output/smartcard.js
Comment on lines +340 to +343
// Live PC/SC reader enumeration — establish a throwaway context, list readers,
// release it. Used both for the one-time startup warm start and for every
// REQUEST_INITIALIZE discovery request, so discovery always reflects reality
// instead of replaying whatever was seen at page load.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, a comment should explain the purpose, not the usage. The usage can change after all causing drift.

Comment thread core/output/smartcard.js
Comment on lines +402 to +406
// Always provide lane 0 for backward compat with v0 (legacy single-reader) bridges.
// readerId is set so refresh() can late-bind the reader if discovery failed at startup.
if (!sessions.has(0)) {
registerSession(sessions, 0, new SmartcardSession(null, 0));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the v1 protocol breaking due to payload change?

Comment thread core/output/smartcard.js
Comment on lines +437 to +438
// Best-effort release of the now-orphaned handle/context, detached from the
// session so its outcome can't touch the (possibly rebound) session state.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary comment.

Comment thread core/output/smartcard.js
Comment on lines +582 to +583
// A native-host hiccup must not flap live lanes — keep the existing
// bindings and reply with whatever the session map currently holds.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants