hid-access-control 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bb86125b12bef657f9cb57f31392fb8c570e19aa2546e9451b441d5919c1e0bb
4
+ data.tar.gz: 386b6d65d1dd440f1610d3fb05fffc0b2b22fd5bc1e589abc4d4596cafed5e8b
5
+ SHA512:
6
+ metadata.gz: 66358f93b414f8aefa9566d97ef58bd8ba6c08581efd9cd36bf26a1f5d3cd4125d6da78678a6afa0ea8a3e7406d7bd12ea20b22f77b94c1a154e34b37d881cc4
7
+ data.tar.gz: fb241973bb77689aa50e4e48d16421a16b60ef15787b6eb74ebf9d09bdf6d1f0a23bc67b14398e7e9212ebd00fd7366a0801854fa11b35258f2ef24777ab5b35
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 titanfyre
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # HID-Access-Control Ruby SDK
2
+
3
+ `gem install hid-access-control`
4
+
5
+ Windows x64 Ruby3.1+.
6
+
7
+ ```ruby
8
+ require "hid_access_control"
9
+ HIDAccessControlSDK::Client.open { |client| p client.call("status") }
10
+ ```
11
+
12
+ [API and operation schema](docs/API.md). Matching driver installed separately.
data/docs/API.md ADDED
@@ -0,0 +1,14 @@
1
+ # HID-Access-Control operation schema
2
+
3
+ The unchanged product C++ SDK is called directly. Operations: `check`, `probe`, `status`, `devices`, `apply`, `stop`, `read_events`. The dispatch source in `Bridge.cpp` lists exact argument keys and maps every operation to the original public SDK. Protocol structs retain their public-header field names, including case. UInt64 and Int64 fields are decimal strings; fixed arrays accept at most their capacity and omitted fields initialize to zero. Unknown fields and out-of-range values are rejected. SDK validators apply original protocol constraints.
4
+
5
+ Wire types and fields:
6
+
7
+
8
+ Only explicit start/connect/policy calls start the corresponding operation. The C ABI session constructor is inert; one active session per product DLL. Always close. Capture receives are bounded when the native API accepts a timeout. SDK original licensing/trial checks remain unchanged. No driver is installed by packages.
9
+
10
+ Tests exercise synthetic wire inputs using the real production SDK validation/formatting helpers, rejected arguments, exact unsigned values and inert session lifecycle. No live capture, policy application, storage fault, traffic modification or driver activation is performed by these tests. Operational driver paths require a separate integration environment.
11
+
12
+ ## Language client
13
+
14
+ The client calls the native SDK directly. Use the call method with an operation name and argument object. Calls are synchronous; only operations exposing a receive timeout are capped at100ms; use an application worker for responsive UI/event loops. Explicitly close the client after use. 64-bit identifiers and counters are decimal strings. Native errors expose their Windows code. Matching driver and licensing are separate requirements.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2013-2025 Niels Lohmann
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,7 @@
1
+ The MIT source license applies to this repository's original user-mode SDK,
2
+ application, examples, protocol and installer source. Evaluation driver source is documented in [driver/README.md](driver/README.md) with its own source-license scope. Prebuilt driver binaries retain their separate evaluation terms.
3
+
4
+ This independent project addresses the device access-control use case described
5
+ by HidHide (https://github.com/nefarius/HidHide). It is not affiliated with,
6
+ endorsed by or a binary/API-compatible replacement for Nefarius or HidHide.
7
+ No HidHide implementation source is included.
@@ -0,0 +1,46 @@
1
+ require 'json'
2
+ require 'fiddle'
3
+ require 'thread'
4
+ module HIDAccessControlSDK
5
+ class NativeError < StandardError
6
+ attr_reader :code
7
+ def initialize(code,message);@code=code;super(message);end
8
+ end
9
+ class Client
10
+ def self.open(library_path: nil)
11
+ client=new(library_path: library_path)
12
+ return client unless block_given?
13
+ begin;yield client;ensure;client.close;end
14
+ end
15
+ def initialize(library_path: nil)
16
+ raise 'Windows x64 required' unless Fiddle::SIZEOF_VOIDP==8 && RUBY_PLATFORM.match?(/mingw|mswin/)
17
+ @library=Fiddle::Handle.new(library_path || ENV['HID_ACCESS_CONTROL_SDK_NATIVE_PATH'] || File.expand_path('../native/HIDAccessControlJsonSDK.dll',__dir__))
18
+ @mutex=Mutex.new
19
+ @open=Fiddle::Function.new(@library['hid_access_control_json_open'],[Fiddle::TYPE_VOIDP],Fiddle::TYPE_INT)
20
+ @close=Fiddle::Function.new(@library['hid_access_control_json_close'],[Fiddle::TYPE_LONG_LONG],Fiddle::TYPE_INT)
21
+ @call=Fiddle::Function.new(@library['hid_access_control_json_call'],[Fiddle::TYPE_LONG_LONG,Fiddle::TYPE_VOIDP,Fiddle::TYPE_INT],Fiddle::TYPE_VOIDP)
22
+ @free=Fiddle::Function.new(@library['hid_access_control_json_free'],[Fiddle::TYPE_VOIDP],Fiddle::TYPE_VOID)
23
+ out=Fiddle::Pointer.malloc(8,Fiddle::RUBY_FREE);out[0,8]=[0].pack('Q<');code=@open.call(out);raise NativeError.new(code,'Cannot open SDK') if code!=0
24
+ @session=out[0,8].unpack1('Q<')
25
+ end
26
+ def call(operation,arguments={})
27
+ payload=JSON.generate({operation:operation,arguments:arguments}).encode('UTF-8')
28
+ raise ArgumentError,'Request exceeds 32 MiB' if payload.bytesize>32*1024*1024
29
+ @mutex.synchronize do
30
+ raise 'SDK is closed' if @session==0
31
+ pointer=@call.call(@session,payload,payload.bytesize);raise NoMemoryError,'Native response allocation failed' if pointer.null?
32
+ begin;response=JSON.parse(pointer.to_s);ensure;@free.call(pointer);end
33
+ raise NativeError.new(response['code'],response['message']) unless response['ok']
34
+ response['result']
35
+ end
36
+ end
37
+ def close
38
+ @mutex.synchronize do
39
+ if @session!=0
40
+ code=@close.call(@session);raise NativeError.new(code,'Native close failed') if code!=0
41
+ @session=0
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
Binary file
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hid-access-control
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - TitanCSA
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: fiddle
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '1.1'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '2'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '1.1'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '2'
32
+ description: Product native SDK operations through a UTF-8 JSON C ABI; driver installed
33
+ separately.
34
+ executables: []
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - LICENSE
39
+ - README.md
40
+ - docs/API.md
41
+ - docs/LICENSE.nlohmann-json
42
+ - docs/Native-NOTICE
43
+ - lib/hid_access_control.rb
44
+ - native/HIDAccessControlJsonSDK.dll
45
+ homepage: https://github.com/titanfyre/HID-Access-Control
46
+ licenses:
47
+ - MIT
48
+ metadata:
49
+ source_code_uri: https://github.com/titanfyre/HID-Access-Control
50
+ documentation_uri: https://github.com/titanfyre/HID-Access-Control/tree/main/HID-Access-Control-Ruby-rubygems/docs
51
+ allowed_push_host: https://rubygems.org
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '3.1'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubygems_version: 4.0.20
67
+ specification_version: 4
68
+ summary: Windows x64 HID-Access-Control direct SDK
69
+ test_files: []