EncryptedDataQueue

open class EncryptedDataQueue: DataQueue

Data Queue that can encrypt resources before sending.

This class is a subclass of DataQueue, an implementation of a FHIRServer.

  • An optional delegate to ask when to encrypt a resource and when not; if not provided, all resources will be encrypted.

    Declaration

    Swift

    open var delegate: EncryptedDataQueueDelegate?
  • The endpoint for encrypted resources; usually different from baseURL since these are not FHIR compliant.

    Declaration

    Swift

    open internal(set) var encryptedBaseURL: URL
  • Designated initializer.

    Declaration

    Swift

    public init(baseURL: URL, auth: OAuth2JSON?, encBaseURL: URL, publicCertificateFile: String)

    Parameters

    baseURL

    Base URL for the server’s FHIR endpoint

    auth

    OAuth2 settings

    encBaseURL

    The base URL for encrypted resources

    publicCertificateFile

    Filename, without “.crt” extension, of a bundled X509 public key certificate

  • You CANNOT use this initializer on the encrypted data queue, use init(baseURL:auth:encBaseURL:publicCertificateFile:).

    Declaration

    Swift

    public required init(baseURL: URL, auth: OAuth2JSON?)
  • Encrypts the given data (which is presumed to be JSON data of a FHIR resource), then creates a JSON representation that also contains the encrypted symmetric key and a FHIR version flag and returns data produced when serializing that JSON.

    Declaration

    Swift

    public func encrypted(data: Data) throws -> Data

    Parameters

    data

    The data to encrypt, presumed to be Data of a JSON-serialized FHIR resource

    Return Value

    Data representing JSON