Accessing Data from a SMART Health Card
At a glance
| Item | Summary |
|---|---|
| Purpose | Query for and validate a verifiable clinical record. |
| App architecture | A Swift sample with the source-visible chain WWDCDemoApp → ContentView → HealthKit APIs. |
| Main patterns | No named application pattern supported by the extracted structure |
| Project style | 14 scanned source file(s) across Swift, organized around ranked entry, type, and file boundaries. |
Project structure
Source bundle/
└── Verifiable Clinical Records/
└── Verifiable Clinical Records/
├── WWDCDemoApp.swift
├── ContentView.swift
├── JWT/
│ ├── SMARTHealthCardPayload.swift
│ ├── JWS.swift
│ ├── CompressionAlgorithm.swift
│ ├── JWK.swift
│ ├── JWKError.swift
│ ├── JWKSet.swift
│ ├── JWS+Verification.swift
│ ├── JWSError.swift
│ └── SignatureAlgorithm.swift
└── utilities/
└── Base64URL.swift
Structure observations
- Architecturally prominent files are ranked from entry points and role-named declarations; resource-only paths are omitted.
- Primary languages: Swift.
- The verified tree contains 5 project/configuration file(s) and 17 source declaration(s).
Overall architecture
flowchart LR
N1["WWDCDemoApp"]
N2["ContentView"]
N3["HealthKit APIs"]
N1 --> N2
N2 --> N3
Reference code
Verifiable Clinical Records/Verifiable Clinical Records/WWDCDemoApp.swift:10 — architecture anchor
@main
struct WWDCDemoApp: App {
var body: some Scene {
WindowGroup {
// Instantiate and display the root view.
ContentView()
}
}
}Interpretation
The arrows summarize the source-visible entry, role-named types or folders, and framework direction; when nodes come from structural folders, the sequence is a high-level interpretation rather than proof that every adjacent node calls the next. Ownership is claimed only where the next section cites a stored property or assignment. The diagram is intentionally limited to the dominant path into HealthKit.
Ownership and state
classDiagram
VC *-- Array : type
VC o-- CredentialSubject : credentialSubject
VC *-- String : iss
VC *-- Double : nbf
Ownership evidence
Verifiable Clinical Records/Verifiable Clinical Records/JWT/SMARTHealthCardPayload.swift:14 — stored dependency or nearest verified ownership anchor
public struct VC: Codable {
public let type: [String]
public let credentialSubject: CredentialSubject
}| Owner | Object or state | Relationship | Mutation authority |
|---|---|---|---|
VC |
Array (type) |
owns value state | Initialized by the owner; the binding is immutable |
VC |
CredentialSubject (credentialSubject) |
stores or receives | Initialized by the owner; the binding is immutable |
VC |
String (iss) |
owns value state | Initialized by the owner; the binding is immutable |
VC |
Double (nbf) |
owns value state | Initialized by the owner; the binding is immutable |
Composition arrows indicate a source-visible construction expression or locally owned value state; aggregation means the owner stores or receives a dependency without proving exclusive lifetime ownership.
Class and protocol design
Verifiable Clinical Records/Verifiable Clinical Records/WWDCDemoApp.swift:11 — representative type boundary
struct WWDCDemoApp: App {
// ...
}| Type | Responsibility | Depends on or conforms to |
|---|---|---|
WWDCDemoApp |
Application entry and top-level composition | App |
ContentView |
User-interface presentation and input forwarding | View |
SMARTHealthCardPayload |
Represents a feature value or composable behavior | Codable |
VC |
Represents a feature value or composable behavior | Codable |
CredentialSubject |
Represents a feature value or composable behavior | Codable |
JWS |
Represents a feature value or composable behavior | Codable |
JWSHeader |
Represents a feature value or composable behavior | Codable |
Base64URL |
Represents a feature value or composable behavior | Concrete collaborators/imported frameworks |
Base64URLError |
Represents feature failure conditions | Error |
CompressionAlgorithm |
Defines a closed set of feature states or choices | String, Codable |
No local protocol conformance is claimed as protocol-oriented design; external framework conformances are listed only as dependencies.
Access control
| Symbol | Access | Verified effect | Likely rationale |
|---|---|---|---|
requestVerifiableHealthRecords (Verifiable Clinical Records/Verifiable Clinical Records/ContentView.swift:54) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: hide an implementation step that is not part of the collaboration surface. |
verify (Verifiable Clinical Records/Verifiable Clinical Records/ContentView.swift:99) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: hide an implementation step that is not part of the collaboration surface. |
kty (Verifiable Clinical Records/Verifiable Clinical Records/JWT/JWK.swift:13) |
public |
The symbol is visible to importing modules. | Inference: make the declaration available across a module or target boundary. |
crv (Verifiable Clinical Records/Verifiable Clinical Records/JWT/JWK.swift:14) |
public |
The symbol is visible to importing modules. | Inference: make the declaration available across a module or target boundary. |
Reference code
Verifiable Clinical Records/Verifiable Clinical Records/ContentView.swift:54 — representative boundary
private func requestVerifiableHealthRecords() {
// ...
}Swift declarations without a modifier are internal; explicit private, fileprivate, private(set), public, or open entries above are interpreted by language semantics. Objective-C/C samples instead rely on header and implementation boundaries, which are not equivalent to Swift lexical privacy.
Logic ownership and placement
| Logic | Owning type or file | Placement rationale |
|---|---|---|
| Application entry and top-level composition | WWDCDemoApp |
The source’s App suffix makes this role explicit. |
| User-interface presentation and input forwarding | ContentView |
The source’s View suffix makes this role explicit. |
Design patterns
| Pattern | Source evidence | Purpose or tradeoff |
|---|---|---|
| No named application pattern | Verifiable Clinical Records/Verifiable Clinical Records/WWDCDemoApp.swift:10 |
The verified source directly composes concrete framework types; this document avoids forcing a pattern name. |
Naming conventions
- Types: App: WWDCDemoApp; View: ContentView.
- Protocols: no local protocol declaration in the scanned source.
- Methods:
requestVerifiableHealthRecords,verify,split,decode,asP256PublicKey,asRawPublicKey. - Files:
Verifiable Clinical Records/Verifiable Clinical Records/WWDCDemoApp.swift,Verifiable Clinical Records/Verifiable Clinical Records/ContentView.swift,Verifiable Clinical Records/Verifiable Clinical Records/JWT/SMARTHealthCardPayload.swift,Verifiable Clinical Records/Verifiable Clinical Records/JWT/JWS.swift,Verifiable Clinical Records/Verifiable Clinical Records/utilities/Base64URL.swift,Verifiable Clinical Records/Verifiable Clinical Records/JWT/CompressionAlgorithm.swift.
Architecture takeaways
WWDCDemoAppis the main source-visible entry or composition anchor for this sample.- Framework work reaches SwiftUI, CryptoKit, Compression, HealthKit through a deliberately small high-level chain; the detailed API graph remains inside the cited implementation files.
- Stored-property evidence identifies lifecycle collaboration; it does not by itself prove exclusive object ownership.
- Access-control conclusions separate verified language visibility from the likely design rationale.
- The source does not justify labeling the design protocol-oriented.
Source map
| Source file | Relevant symbols |
|---|---|
Verifiable Clinical Records/Verifiable Clinical Records/WWDCDemoApp.swift |
WWDCDemoApp |
Verifiable Clinical Records/Verifiable Clinical Records/ContentView.swift |
ContentView |
Verifiable Clinical Records/Verifiable Clinical Records/JWT/SMARTHealthCardPayload.swift |
SMARTHealthCardPayload, VC, CredentialSubject |
Verifiable Clinical Records/Verifiable Clinical Records/JWT/JWS.swift |
JWS, JWSHeader |
Verifiable Clinical Records/Verifiable Clinical Records/utilities/Base64URL.swift |
Base64URL, Base64URLError |
Verifiable Clinical Records/Verifiable Clinical Records/JWT/CompressionAlgorithm.swift |
CompressionAlgorithm |
Verifiable Clinical Records/Verifiable Clinical Records/JWT/JWK.swift |
JWK |
Verifiable Clinical Records/Verifiable Clinical Records/JWT/JWKError.swift |
JWKError |
Verifiable Clinical Records/Verifiable Clinical Records/JWT/JWKSet.swift |
JWKSet |
Verifiable Clinical Records/Verifiable Clinical Records/JWT/JWS+Verification.swift |
VerificationError |