smart_health_cards_test_kit 0.9.0 → 0.10.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8dcd02e218c20c7df4ac05da3a491653ea9cf69f8c2f86471407a68d0582bbd5
4
- data.tar.gz: 801a9e6c1301ce4daf3c1a126e9a00537dd4871e7786f664f1591daeea7e43a0
3
+ metadata.gz: 51f6dab0372c9503ccc8799beabcf00a7d1a704ca4ea3a22571a36629ccd2721
4
+ data.tar.gz: '086956b67891836434dc0239778db343c1d562b2d6ab12b33078fd397ca7781a'
5
5
  SHA512:
6
- metadata.gz: a45f4aead162a4ba9dfb363310eca1e36cc09a7c289e0f7659a06a19c2d4b3c1217b3c48269d858ba0c75af99ffc937081541075db7b93715a22b12ecda73c56
7
- data.tar.gz: fb75562a3a42290e637434d3b96782e51d79081343b5c50722b9fbf912e90602d21eaf91e025fe01bbc22858d9c7953cc343cc5c3c6ac3e4ce3cfe424c47faf5
6
+ metadata.gz: a96c251549bb37ecc945d883d9bfe332bac72af5de889c700f5a0485aeef2cc8e50992a96cc9a699636d613dcb0aa0581fadad3449f8530bac7d94fc28ab640d
7
+ data.tar.gz: 98299d46294ac055880916481945d1316163c6d8e6a8bd2aa784de2281886c85dcc252434d570a8229c1f595068a129d1cd41c996c1f79aef749a317d509d5a0
@@ -0,0 +1,55 @@
1
+ require_relative 'version'
2
+
3
+ module SmartHealthCardsTestKit
4
+ class Metadata < Inferno::TestKit
5
+ id :smart_health_cards
6
+ title 'SMART Health Cards'
7
+ description <<~DESCRIPTION
8
+ The SMART Health Cards Test Kit provides an
9
+ executable set of tests for the [SMART Health Cards Framework v1.4.0](https://spec.smarthealth.cards/).
10
+ This test kit simulates downloading and validating a SMART Health Card.
11
+ <!-- break -->
12
+
13
+ This test kit is [open source](https://github.com/inferno-framework/smart-health-cards-test-kit#license)
14
+ and freely available for use or adoption by the health IT community including EHR vendors, health app
15
+ developers, and testing labs. It is built using the [Inferno Framework](https://inferno-framework.github.io/inferno-core/).
16
+ The Inferno Framework is designed for reuse and aims to make it easier to build test kits for any
17
+ FHIR-based data exchange.
18
+
19
+ ## Status
20
+
21
+ These tests are intended to allow server implementers to perform checks of their server against SMART Health Cards Framework requrirements.
22
+
23
+ The test kit currently tests the following requirements:
24
+ - Download and validate a health card [via File Download](https://spec.smarthealth.cards/#via-file-download)
25
+ - Download and validate a health card [via FHIR $health-cards-issue Operation](https://spec.smarthealth.cards/#via-fhir-health-cards-issue-operation)
26
+ - Download and validate a health card [via QR Code](https://spec.smarthealth.cards/#via-qr-print-or-scan)
27
+
28
+ The test kit does **NOT** test this requirement:
29
+ - Download and validate a health card [via Deep Link](https://spec.smarthealth.cards/#via-deep-link)
30
+
31
+ See the test descriptions within the test kit for detail on the specific validations performed as part of testing these requirements.
32
+
33
+ ## Repository
34
+
35
+ The SMART Health Cards Test Kit GitHub repository can be [found here](https://github.com/inferno-framework/smart-health-cards-test-kit).
36
+
37
+ ## Providing Feedback and Reporting Issues
38
+
39
+ We welcome feedback on the tests, including but not limited to the following areas:
40
+
41
+ - Validation logic, such as potential bugs, lax checks, and unexpected failures.
42
+ - Requirements coverage, such as requirements that have been missed, tests that necessitate features that the IG does not require, or other issues with the interpretation of the IG's requirements.
43
+ - User experience, such as confusing or missing information in the test UI.
44
+
45
+ Please report any issues with this set of tests in the [issues section](https://github.com/inferno-framework/smart-health-cards-test-kit/issues) of the repository.
46
+ DESCRIPTION
47
+ suite_ids [:smart_health_cards]
48
+ tags ['SMART Health Cards']
49
+ last_updated LAST_UPDATED
50
+ version VERSION
51
+ maturity 'Low'
52
+ authors ['Yunwei Wang']
53
+ repo 'https://github.com/inferno-framework/smart-health-cards-test-kit'
54
+ end
55
+ end
@@ -7,33 +7,19 @@ module SmartHealthCardsTestKit
7
7
  description %(
8
8
  SMART Health Card payload SHALL be a valid FHIR Bundle resource
9
9
  )
10
- input :credential_strings
11
- output :fhir_bundles
10
+ input :fhir_bundles
12
11
 
13
12
  run do
13
+ skip_if fhir_bundles.blank?, 'No FHIR bundles received'
14
14
 
15
- skip_if credential_strings.blank?, 'No Verifiable Credentials received'
16
- bundle_array = []
15
+ assert_valid_json(fhir_bundles)
16
+ bundle_array = JSON.parse(fhir_bundles)
17
17
 
18
- credential_strings.split(',').each do |credential|
19
- jws = SmartHealthCardsTestKit::Utils::JWS.from_jws(credential)
20
- payload = payload_from_jws(jws)
21
-
22
- vc = payload['vc']
23
- assert vc.is_a?(Hash), "Expected 'vc' claim to be a JSON object, but found #{vc.class}"
24
-
25
- subject = vc['credentialSubject']
26
- assert subject.is_a?(Hash), "Expected 'vc.credentialSubject' to be a JSON object, but found #{subject.class}"
27
-
28
- raw_bundle = subject['fhirBundle']
29
- assert raw_bundle.is_a?(Hash), "Expected 'vc.fhirBundle' to be a JSON object, but found #{raw_bundle.class}"
30
-
31
- bundle = FHIR::Bundle.new(raw_bundle)
32
- assert_valid_resource(resource: bundle)
33
- bundle_array.append(bundle)
18
+ skip_if bundle_array.blank?, 'No FHIR bundles received'
34
19
 
20
+ bundle_array.each do |bundle|
21
+ assert_valid_resource(resource: FHIR::Bundle.new(bundle))
35
22
  end
36
- output fhir_bundles: bundle_array
37
23
  end
38
24
  end
39
25
  end
@@ -33,11 +33,11 @@ module SmartHealthCardsTestKit
33
33
  (e.g., `{"patient": {"reference": "resource:0"}}`)
34
34
  )
35
35
  input :credential_strings
36
- output :decompressed_payloads
36
+ output :fhir_bundles
37
37
 
38
38
  run do
39
39
  skip_if credential_strings.blank?, 'No Verifiable Credentials received'
40
- decompressed_payload_array = []
40
+ fhir_bundles = []
41
41
 
42
42
  credential_strings.split(',').each do |credential|
43
43
  jws = SmartHealthCardsTestKit::Utils::JWS.from_jws(credential)
@@ -79,6 +79,9 @@ module SmartHealthCardsTestKit
79
79
  "The following Bundle entry urls do not use short resource-scheme URIs: #{bad_urls.join(', ')}"
80
80
  end
81
81
 
82
+ # Have to make another copy of bundle to avoid being modified by the following codes
83
+ fhir_bundles.append(FHIR::Bundle.new(raw_bundle))
84
+
82
85
  bundle = FHIR::Bundle.new(raw_bundle)
83
86
  resources = bundle.entry.map(&:resource)
84
87
  bundle.entry.each { |entry| entry.resource = nil }
@@ -117,7 +120,8 @@ module SmartHealthCardsTestKit
117
120
  end
118
121
  end
119
122
  end
120
- output decompressed_payloads: decompressed_payload_array
123
+
124
+ output fhir_bundles: fhir_bundles.to_json
121
125
  end
122
126
  end
123
127
  end
@@ -0,0 +1,85 @@
1
+ require 'json'
2
+
3
+ require_relative 'version'
4
+
5
+ require_relative 'utils/jws'
6
+ require_relative 'health_card'
7
+
8
+ require_relative 'shc_fhir_validation'
9
+ require_relative 'shc_header_verification'
10
+ require_relative 'shc_payload_verification'
11
+ require_relative 'shc_signature_verification'
12
+
13
+ require_relative 'file_download_group'
14
+ require_relative 'qr_code_group'
15
+ require_relative 'fhir_operation_group'
16
+
17
+ module SmartHealthCardsTestKit
18
+ class SmartHealthCardsTestSuite < Inferno::TestSuite
19
+ id :smart_health_cards
20
+ title 'SMART Health Cards'
21
+ description %(
22
+ The SMART Health Cards tests systems for their conformance to the
23
+ [SMART Health Cards Framework v1.4.0](https://spec.smarthealth.cards/)
24
+ )
25
+
26
+ links [
27
+ {
28
+ label: 'Report Issue',
29
+ url: 'https://github.com/inferno-framework/smart-health-cards-test-kit/issues'
30
+ },
31
+ {
32
+ label: 'Open Source',
33
+ url: 'https://github.com/inferno-framework/smart-health-cards-test-kit'
34
+ },
35
+ {
36
+ label: 'Download',
37
+ url: 'https://github.com/inferno-framework/smart-health-cards-test-kit/releases'
38
+ },
39
+ {
40
+ label: 'SMART Health Cards Framework',
41
+ url: 'https://spec.smarthealth.cards/'
42
+ }
43
+ ]
44
+
45
+ # All FHIR validation requsets will use this FHIR validator
46
+ fhir_resource_validator do
47
+ # igs 'identifier#version' # Use this method for published IGs/versions
48
+ # igs 'igs/filename.tgz' # Use this otherwise
49
+
50
+ exclude_message do |message|
51
+ message.message.match?(/\A\S+: \S+: URL value '.*' does not resolve/)
52
+ end
53
+ end
54
+
55
+ # HTTP Routes
56
+ resume_test_route :post, '/post_qr_code' do |request|
57
+ request.query_parameters['id']
58
+ end
59
+
60
+ scan_qr_code_html = File.read(File.join(__dir__, './views/scan_qr_code.html'))
61
+ scan_qr_code_html_route_handler = proc { [200, { 'Content-Type' => 'text/html' }, [scan_qr_code_html]] }
62
+ route(:get, '/scan_qr_code', scan_qr_code_html_route_handler)
63
+
64
+ qr_scanner = File.read(File.join(__dir__, './javascript/qr-scanner.min.js'))
65
+ qr_scanner_route_handler = proc { [200, { 'Content-Type' => 'text/javascript' }, [qr_scanner]] }
66
+ route(:get, '/qr-scanner.min.js', qr_scanner_route_handler)
67
+
68
+ qr_scanner_worker = File.read(File.join(__dir__, './javascript/qr-scanner-worker.min.js'))
69
+ qr_scanner_worker_route_handler = proc { [200, { 'Content-Type' => 'text/javascript' }, [qr_scanner_worker]] }
70
+ route(:get, '/qr-scanner-worker.min.js', qr_scanner_worker_route_handler)
71
+
72
+ js_qr = File.read(File.join(__dir__, './javascript/jsQR.js'))
73
+ js_qr_route_handler = proc { [200, { 'Content-Type' => 'text/javascript' }, [js_qr]] }
74
+ route(:get, '/jsqr.js', js_qr_route_handler)
75
+
76
+ upload_html = File.read(File.join(__dir__, './views/upload_qr_code.html'))
77
+ upload_html_route_handler = proc { [200, { 'Content-Type' => 'text/html' }, [upload_html]] }
78
+ route(:get, '/upload_qr_code', upload_html_route_handler)
79
+
80
+ # Tests and TestGroups
81
+ group from: :shc_file_download_group
82
+ group from: :shc_fhir_operation_group
83
+ group from: :shc_qr_code_group
84
+ end
85
+ end
@@ -1,3 +1,4 @@
1
1
  module SmartHealthCardsTestKit
2
- VERSION = '0.9.0'
3
- end
2
+ VERSION = '0.10.1'.freeze
3
+ LAST_UPDATED = '2025-03-05'.freeze # TODO: update next release
4
+ end
@@ -1,67 +1,5 @@
1
- require 'json'
2
-
3
- require_relative 'smart_health_cards_test_kit/version'
4
-
5
- require_relative 'smart_health_cards_test_kit/utils/jws'
6
- require_relative 'smart_health_cards_test_kit/health_card'
7
-
8
- require_relative 'smart_health_cards_test_kit/shc_fhir_validation'
9
- require_relative 'smart_health_cards_test_kit/shc_header_verification'
10
- require_relative 'smart_health_cards_test_kit/shc_payload_verification'
11
- require_relative 'smart_health_cards_test_kit/shc_signature_verification'
12
-
13
- require_relative 'smart_health_cards_test_kit/file_download_group'
14
- require_relative 'smart_health_cards_test_kit/qr_code_group'
15
- require_relative 'smart_health_cards_test_kit/fhir_operation_group'
1
+ require_relative 'smart_health_cards_test_kit/smart_health_cards_test_suite'
2
+ require_relative 'smart_health_cards_test_kit/metadata'
16
3
 
17
4
  module SmartHealthCardsTestKit
18
- class SmartHealthCardsTestSuite < Inferno::TestSuite
19
- id :smart_health_cards
20
- title 'SMART Health Cards'
21
- description %(
22
- The US Core Test Kit tests systems for their conformance to the
23
- [SMART Health Cards Framework v1.4.0](https://spec.smarthealth.cards/)
24
- )
25
- version VERSION
26
-
27
- # All FHIR validation requsets will use this FHIR validator
28
- fhir_resource_validator do
29
- # igs 'identifier#version' # Use this method for published IGs/versions
30
- # igs 'igs/filename.tgz' # Use this otherwise
31
-
32
- exclude_message do |message|
33
- message.message.match?(/\A\S+: \S+: URL value '.*' does not resolve/)
34
- end
35
- end
36
-
37
- # HTTP Routes
38
- resume_test_route :post, '/post_qr_code' do |request|
39
- request.query_parameters['id']
40
- end
41
-
42
- scan_qr_code_html = File.read(File.join(__dir__, './smart_health_cards_test_kit/views/scan_qr_code.html'))
43
- scan_qr_code_html_route_handler = proc { [200, { 'Content-Type' => 'text/html' }, [scan_qr_code_html]] }
44
- route(:get, '/scan_qr_code', scan_qr_code_html_route_handler)
45
-
46
- qr_scanner = File.read(File.join(__dir__, './smart_health_cards_test_kit/javascript/qr-scanner.min.js'))
47
- qr_scanner_route_handler = proc { [200, { 'Content-Type' => 'text/javascript' }, [qr_scanner]] }
48
- route(:get, '/qr-scanner.min.js', qr_scanner_route_handler)
49
-
50
- qr_scanner_worker = File.read(File.join(__dir__, './smart_health_cards_test_kit/javascript/qr-scanner-worker.min.js'))
51
- qr_scanner_worker_route_handler = proc { [200, { 'Content-Type' => 'text/javascript' }, [qr_scanner_worker]] }
52
- route(:get, '/qr-scanner-worker.min.js', qr_scanner_worker_route_handler)
53
-
54
- js_qr = File.read(File.join(__dir__, './smart_health_cards_test_kit/javascript/jsQR.js'))
55
- js_qr_route_handler = proc { [200, { 'Content-Type' => 'text/javascript' }, [js_qr]] }
56
- route(:get, '/jsqr.js', js_qr_route_handler)
57
-
58
- upload_html = File.read(File.join(__dir__, './smart_health_cards_test_kit/views/upload_qr_code.html'))
59
- upload_html_route_handler = proc { [200, { 'Content-Type' => 'text/html' }, [upload_html]] }
60
- route(:get, '/upload_qr_code', upload_html_route_handler)
61
-
62
- # Tests and TestGroups
63
- group from: :shc_file_download_group
64
- group from: :shc_fhir_operation_group
65
- group from: :shc_qr_code_group
66
- end
67
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_health_cards_test_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yunwei Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-07 00:00:00.000000000 Z
11
+ date: 2025-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inferno_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.0
19
+ version: 0.6.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.0
26
+ version: 0.6.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rqrcode
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -123,11 +123,13 @@ files:
123
123
  - lib/smart_health_cards_test_kit/javascript/jsQR.js
124
124
  - lib/smart_health_cards_test_kit/javascript/qr-scanner-worker.min.js
125
125
  - lib/smart_health_cards_test_kit/javascript/qr-scanner.min.js
126
+ - lib/smart_health_cards_test_kit/metadata.rb
126
127
  - lib/smart_health_cards_test_kit/qr_code_group.rb
127
128
  - lib/smart_health_cards_test_kit/shc_fhir_validation.rb
128
129
  - lib/smart_health_cards_test_kit/shc_header_verification.rb
129
130
  - lib/smart_health_cards_test_kit/shc_payload_verification.rb
130
131
  - lib/smart_health_cards_test_kit/shc_signature_verification.rb
132
+ - lib/smart_health_cards_test_kit/smart_health_cards_test_suite.rb
131
133
  - lib/smart_health_cards_test_kit/utils/chunking_utils.rb
132
134
  - lib/smart_health_cards_test_kit/utils/encoding.rb
133
135
  - lib/smart_health_cards_test_kit/utils/jws.rb
@@ -146,6 +148,7 @@ licenses:
146
148
  metadata:
147
149
  homepage_uri: https://github.com/inferno-framework/smart-health-cards-test-kit
148
150
  source_code_uri: https://github.com/inferno-framework/smart-health-cards-test-kit
151
+ inferno_test_kit: 'true'
149
152
  post_install_message:
150
153
  rdoc_options: []
151
154
  require_paths:
@@ -154,14 +157,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
157
  requirements:
155
158
  - - ">="
156
159
  - !ruby/object:Gem::Version
157
- version: 3.1.2
160
+ version: 3.3.6
158
161
  required_rubygems_version: !ruby/object:Gem::Requirement
159
162
  requirements:
160
163
  - - ">="
161
164
  - !ruby/object:Gem::Version
162
165
  version: '0'
163
166
  requirements: []
164
- rubygems_version: 3.5.7
167
+ rubygems_version: 3.5.22
165
168
  signing_key:
166
169
  specification_version: 4
167
170
  summary: Smart Health Cards test kit