{"_id":"@bun-win32/winscard","_rev":"3-4d059af049af860d2b249102e3b14379","name":"@bun-win32/winscard","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/winscard","version":"1.0.0","keywords":["bun","ffi","win32","windows","winscard","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/winscard@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"c7c882cb67e4b30af9f239f10b8d4d530614b156","tarball":"https://registry.npmjs.org/@bun-win32/winscard/-/winscard-1.0.0.tgz","fileCount":6,"integrity":"sha512-hpNy2fq9PPjkZQ/eHAZjwIcIak8PP4cknWSodi968x26PmuwzkuJ7m7uluSuF3uF1Datkkw6BPaoTXAI2HeE3g==","signatures":[{"sig":"MEQCIH/fLxJNvHEEdo/PpL0neIdny0G1ZWxAoK2+aZGF90hVAiB7CgASD+ZI9Hnkth8O8m7lyLLxpW6gMIi3LjgzXsS3Jg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44386},"main":"./index.ts","type":"module","module":"index.ts","shasum":"c7c882cb67e4b30af9f239f10b8d4d530614b156","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:reader-radar":"bun ./example/reader-radar.ts","example:smart-card-diagnostic":"bun ./example/smart-card-diagnostic.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-hpNy2fq9PPjkZQ/eHAZjwIcIak8PP4cknWSodi968x26PmuwzkuJ7m7uluSuF3uF1Datkkw6BPaoTXAI2HeE3g==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/winscard"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 WINSCARD bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/winscard_1.0.0_1775784235079_0.57029469008343","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/winscard","version":"2.0.0","keywords":["bun","ffi","win32","windows","winscard","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/winscard@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"825c11f09f8379b29bd66b9d6834f8f00f76a0bf","tarball":"https://registry.npmjs.org/@bun-win32/winscard/-/winscard-2.0.0.tgz","fileCount":6,"integrity":"sha512-UKM88U89eclFfTpwwi8+DGIh9WXxPoT/5py4/o5ZABLwnsR+OoxtAxwW6/nTd6RNDKOSGgXEQUhqKIB56D+s3w==","signatures":[{"sig":"MEYCIQCiDsb7JZF+8vs4kt+AwrrA41TOUWifEE77Bfw6cIhFBgIhAPUlo7Yj1zeejbUIndJlPp80i1rmuavgWIdvFN9eB34I","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46623},"main":"./index.ts","type":"module","module":"index.ts","shasum":"825c11f09f8379b29bd66b9d6834f8f00f76a0bf","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:reader-radar":"bun ./example/reader-radar.ts","example:smart-card-diagnostic":"bun ./example/smart-card-diagnostic.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-UKM88U89eclFfTpwwi8+DGIh9WXxPoT/5py4/o5ZABLwnsR+OoxtAxwW6/nTd6RNDKOSGgXEQUhqKIB56D+s3w==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/winscard"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 WINSCARD bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/winscard_2.0.0_1782435996277_0.06409741223654697","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 WINSCARD bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/winscard","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/winscard"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","winscard","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:reader-radar":"bun ./example/reader-radar.ts","example:smart-card-diagnostic":"bun ./example/smart-card-diagnostic.ts"},"_id":"@bun-win32/winscard@2.0.1","_integrity":"sha512-KtlSn32APAS76lnfpMkVS4iocpWrEjC4QNJeDL9kG64dIW/st/8JTwtnCxK+MR6khhCAJciHZwnrs1FrBAT2/Q==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"ddd805f8529cdae0045e2562296e67d8781f0595","dist":{"integrity":"sha512-KtlSn32APAS76lnfpMkVS4iocpWrEjC4QNJeDL9kG64dIW/st/8JTwtnCxK+MR6khhCAJciHZwnrs1FrBAT2/Q==","shasum":"ddd805f8529cdae0045e2562296e67d8781f0595","tarball":"https://registry.npmjs.org/@bun-win32/winscard/-/winscard-2.0.1.tgz","fileCount":6,"unpackedSize":46623,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHMQ6oKFfB7Bt12TduhQCA9yadWwJH1hGRiBFcrKRzuAAiButiu0uWFmtn6P+afHHb8DboyeEP4cJjPV1/0RSwkWzw=="}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/winscard_2.0.1_1782438221339_0.5884359050817345"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-10T01:23:55.021Z","modified":"2026-06-26T01:43:41.672Z","1.0.0":"2026-04-10T01:23:55.222Z","2.0.0":"2026-06-26T01:06:36.424Z","2.0.1":"2026-06-26T01:43:41.475Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","winscard","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/winscard"},"description":"Zero-dependency, zero-overhead Win32 WINSCARD bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/winscard\n\nZero-dependency, zero-overhead Win32 WinSCard bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/winscard` exposes the `winscard.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `WinSCard`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `winscard.dll` (smart cards, readers, contexts, status changes, and APDU transport).\n- In-source docs in `structs/WinSCard.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`WinSCard.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed WinSCard aliases (see `types/WinSCard.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later\n\n## Installation\n\n```sh\nbun add @bun-win32/winscard\n```\n\n## Quick Start\n\n```ts\nimport WinSCard, { SCARD_SCOPE } from '@bun-win32/winscard';\n\nconst contextHandleBuffer = Buffer.alloc(8);\nconst status = WinSCard.SCardEstablishContext(SCARD_SCOPE.SYSTEM, null, null, contextHandleBuffer.ptr);\n\nif (status !== 0) {\n  throw new Error(`SCardEstablishContext failed: 0x${status.toString(16)}`);\n}\n\nconst contextHandle = contextHandleBuffer.readBigUInt64LE(0);\nconsole.log({ contextHandle });\n\nWinSCard.SCardReleaseContext(contextHandle);\n```\n\n> [!NOTE]\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\n\n## Examples\n\nRun the included examples:\n\n```sh\nbun run example:reader-radar\nbun run example:smart-card-diagnostic\n```\n\n## Notes\n\n- Either rely on lazy binding or call `WinSCard.Preload()`.\n- The documented `g_rgSCard*Pci` data exports are not surfaced as callable bindings; construct your own `SCARD_IO_REQUEST` buffer when calling `SCardTransmit`.\n- Windows only. Bun runtime required.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}