Creates a new SHCReader instance.
Configuration parameters for the reader
// Using PEM format keys
const reader = new SHCReader({
publicKey: publicKeySPKIString, // ES256 public key in SPKI format
});
// Using JsonWebKey format
const readerJWK = new SHCReader({
publicKey: { kty: 'EC', crv: 'P-256', x: '...', y: '...' },
});
// Using automatic key resolution from issuer JWKS
const readerAuto = new SHCReader({
publicKey: null, // Will resolve from issuer's /.well-known/jwks.json
});
Read and verify a SMART Health Card from file content.
File content as string or Blob from .smart-health-card files
Promise resolving to verified SHC object
FileFormatError If the file is not valid JSON or missing the verifiableCredential
array
SignatureVerificationError If JWS signature verification fails
ExpirationError If the health card has expired
PayloadValidationError If JWT payload validation fails
BundleValidationError If FHIR Bundle validation fails
CredentialValidationError If verifiable credential validation fails
JWSError If JWS processing fails
VerificationError For unexpected errors during verification or JWKS resolution (propagated from fromJWS)
Read and verify a SMART Health Card JWS.
JWS string to verify
Promise resolving to verified SHC object
SignatureVerificationError If JWS signature verification fails
ExpirationError If the health card has expired
PayloadValidationError If JWT payload validation fails
BundleValidationError If FHIR Bundle validation fails
CredentialValidationError If verifiable credential validation fails
JWSError If JWS processing fails
VerificationError For unexpected errors during verification or JWKS resolution
Reads and verifies SMART Health Cards from various sources.