Kill the Clipboard - SMART Health Cards Library - v0.0.1
    Preparing search index...

    Class SmartHealthCard

    Represents an issued SMART Health Card with various output formats. This is the main user-facing object that provides different ways to export the health card.

    Index

    Constructors

    Methods

    • Return the FHIR Bundle from the health card.

      Parameters

      • config: { optimizeForQR?: boolean; strictReferences?: boolean } = {}
        • OptionaloptimizeForQR?: boolean

          Whether to optimize the FHIR Bundle for QR code optimization

        • OptionalstrictReferences?: boolean

          Whether to enforce strict reference validation during QR optimization

      Returns Promise<FHIRBundle>

      Promise resolving to FHIR Bundle

      InvalidBundleReferenceError If optimizeForQR is true and a reference target is missing when strictReferences is true

      FhirValidationError If the bundle fails validation during QR optimization

    • Return downloadable Blob with correct MIME type.

      Returns Promise<Blob>

      Promise resolving to Blob with application/smart-health-card MIME type

    • Return JSON file content for .smart-health-card files.

      Returns Promise<string>

      Promise resolving to JSON string with verifiableCredential array

    • Returns the raw JWS string.

      Returns string

      The JWS string

    • Generate QR code data URLs from the health card.

      Parameters

      Returns Promise<string[]>

      Promise resolving to array of QR code data URLs

      QRCodeError When JWS contains invalid characters or chunking is required but disabled

      const qrCodes = await healthCard.asQR({
      enableChunking: false,
      encodeOptions: {
      errorCorrectionLevel: 'L',
      scale: 4
      }
      });
    • Generate QR numeric strings from the health card.

      Parameters

      Returns string[]

      Array of QR numeric strings in SMART Health Cards format (shc:/...)

      QRCodeError When JWS contains invalid characters

      const qrNumericStrings = healthCard.asQRNumeric();
      console.log(qrNumericStrings[0]); // "shc:/567629595326546034602925..."

      // With chunking for large health cards
      const chunkedStrings = healthCard.asQRNumeric({
      enableChunking: true,
      maxSingleQRSize: 500
      });