gdc-sdk-front-ts 0.6.2 → 0.6.6
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.
- package/README.md +36 -8
- package/dist/ProfileManager.d.ts +22 -0
- package/dist/ProfileManager.js +155 -0
- package/dist/gdc-common-utils-ts/src/AesManager.d.ts +27 -0
- package/dist/gdc-common-utils-ts/src/AesManager.js +64 -0
- package/dist/gdc-common-utils-ts/src/CryptographyService.d.ts +76 -0
- package/dist/gdc-common-utils-ts/src/CryptographyService.js +401 -0
- package/dist/gdc-common-utils-ts/src/constants/actor-session.d.ts +40 -0
- package/dist/gdc-common-utils-ts/src/constants/actor-session.js +40 -0
- package/dist/gdc-common-utils-ts/src/constants/communication.d.ts +28 -0
- package/dist/gdc-common-utils-ts/src/constants/communication.js +14 -0
- package/dist/gdc-common-utils-ts/src/constants/cryptography.d.ts +58 -0
- package/dist/gdc-common-utils-ts/src/constants/cryptography.js +49 -0
- package/dist/gdc-common-utils-ts/src/constants/dataspace-discovery.d.ts +11 -0
- package/dist/gdc-common-utils-ts/src/constants/dataspace-discovery.js +11 -0
- package/dist/gdc-common-utils-ts/src/constants/dataspace-protocol.d.ts +27 -0
- package/dist/gdc-common-utils-ts/src/constants/dataspace-protocol.js +27 -0
- package/dist/gdc-common-utils-ts/src/constants/device.d.ts +16 -0
- package/dist/gdc-common-utils-ts/src/constants/device.js +15 -0
- package/dist/gdc-common-utils-ts/src/constants/did-services.d.ts +42 -0
- package/dist/gdc-common-utils-ts/src/constants/did-services.js +40 -0
- package/dist/gdc-common-utils-ts/src/constants/eu-countries.d.ts +36 -0
- package/dist/gdc-common-utils-ts/src/constants/eu-countries.js +69 -0
- package/dist/gdc-common-utils-ts/src/constants/fhir-code-systems.d.ts +12 -0
- package/dist/gdc-common-utils-ts/src/constants/fhir-code-systems.js +12 -0
- package/dist/gdc-common-utils-ts/src/constants/fhir-resource-types.d.ts +52 -0
- package/dist/gdc-common-utils-ts/src/constants/fhir-resource-types.js +33 -0
- package/dist/gdc-common-utils-ts/src/constants/fhir-versions.d.ts +10 -0
- package/dist/gdc-common-utils-ts/src/constants/fhir-versions.js +10 -0
- package/dist/gdc-common-utils-ts/src/constants/healthcare.d.ts +496 -0
- package/dist/gdc-common-utils-ts/src/constants/healthcare.js +274 -0
- package/dist/gdc-common-utils-ts/src/constants/hl7-roles.d.ts +44 -0
- package/dist/gdc-common-utils-ts/src/constants/hl7-roles.js +208 -0
- package/dist/gdc-common-utils-ts/src/constants/index.d.ts +21 -0
- package/dist/gdc-common-utils-ts/src/constants/index.js +21 -0
- package/dist/gdc-common-utils-ts/src/constants/network.d.ts +25 -0
- package/dist/gdc-common-utils-ts/src/constants/network.js +17 -0
- package/dist/gdc-common-utils-ts/src/constants/schemaorg.d.ts +175 -0
- package/dist/gdc-common-utils-ts/src/constants/schemaorg.js +261 -0
- package/dist/gdc-common-utils-ts/src/constants/sectors.d.ts +24 -0
- package/dist/gdc-common-utils-ts/src/constants/sectors.js +24 -0
- package/dist/gdc-common-utils-ts/src/constants/service-capabilities.d.ts +82 -0
- package/dist/gdc-common-utils-ts/src/constants/service-capabilities.js +105 -0
- package/dist/gdc-common-utils-ts/src/constants/smart.d.ts +12 -0
- package/dist/gdc-common-utils-ts/src/constants/smart.js +12 -0
- package/dist/gdc-common-utils-ts/src/constants/urn.d.ts +11 -0
- package/dist/gdc-common-utils-ts/src/constants/urn.js +11 -0
- package/dist/gdc-common-utils-ts/src/constants/verifiable-credentials.d.ts +34 -0
- package/dist/gdc-common-utils-ts/src/constants/verifiable-credentials.js +42 -0
- package/dist/gdc-common-utils-ts/src/constants/vital-signs.d.ts +75 -0
- package/dist/gdc-common-utils-ts/src/constants/vital-signs.js +33 -0
- package/dist/gdc-common-utils-ts/src/examples/api-flow-examples.d.ts +15 -0
- package/dist/gdc-common-utils-ts/src/examples/api-flow-examples.js +16 -0
- package/dist/gdc-common-utils-ts/src/examples/communication-bundle-session.d.ts +22 -0
- package/dist/gdc-common-utils-ts/src/examples/communication-bundle-session.js +81 -0
- package/dist/gdc-common-utils-ts/src/examples/consent-access.d.ts +30 -0
- package/dist/gdc-common-utils-ts/src/examples/consent-access.js +121 -0
- package/dist/gdc-common-utils-ts/src/examples/contract-examples.d.ts +15 -0
- package/dist/gdc-common-utils-ts/src/examples/contract-examples.js +16 -0
- package/dist/gdc-common-utils-ts/src/examples/dataspace-discovery.d.ts +98 -0
- package/dist/gdc-common-utils-ts/src/examples/dataspace-discovery.js +141 -0
- package/dist/gdc-common-utils-ts/src/examples/frontend-session.d.ts +13 -0
- package/dist/gdc-common-utils-ts/src/examples/frontend-session.js +24 -0
- package/dist/gdc-common-utils-ts/src/examples/ica-activation-proof.d.ts +64 -0
- package/dist/gdc-common-utils-ts/src/examples/ica-activation-proof.js +77 -0
- package/dist/gdc-common-utils-ts/src/examples/index.d.ts +14 -0
- package/dist/gdc-common-utils-ts/src/examples/index.js +14 -0
- package/dist/gdc-common-utils-ts/src/examples/individual-controller.d.ts +100 -0
- package/dist/gdc-common-utils-ts/src/examples/individual-controller.js +71 -0
- package/dist/gdc-common-utils-ts/src/examples/lifecycle.d.ts +505 -0
- package/dist/gdc-common-utils-ts/src/examples/lifecycle.js +291 -0
- package/dist/gdc-common-utils-ts/src/examples/organization-controller.d.ts +163 -0
- package/dist/gdc-common-utils-ts/src/examples/organization-controller.js +93 -0
- package/dist/gdc-common-utils-ts/src/examples/professional.d.ts +228 -0
- package/dist/gdc-common-utils-ts/src/examples/professional.js +324 -0
- package/dist/gdc-common-utils-ts/src/examples/related-person.d.ts +10 -0
- package/dist/gdc-common-utils-ts/src/examples/related-person.js +13 -0
- package/dist/gdc-common-utils-ts/src/examples/relationship-access.d.ts +11 -0
- package/dist/gdc-common-utils-ts/src/examples/relationship-access.js +96 -0
- package/dist/gdc-common-utils-ts/src/examples/shared.d.ts +220 -0
- package/dist/gdc-common-utils-ts/src/examples/shared.js +191 -0
- package/dist/gdc-common-utils-ts/src/hmac.d.ts +14 -0
- package/dist/gdc-common-utils-ts/src/hmac.js +24 -0
- package/dist/gdc-common-utils-ts/src/i18n/clinical-sections.i18n.d.ts +6 -0
- package/dist/gdc-common-utils-ts/src/i18n/clinical-sections.i18n.js +15 -0
- package/dist/gdc-common-utils-ts/src/i18n/role-codes.i18n.d.ts +4 -0
- package/dist/gdc-common-utils-ts/src/i18n/role-codes.i18n.js +13 -0
- package/dist/gdc-common-utils-ts/src/index.d.ts +10 -0
- package/dist/gdc-common-utils-ts/src/index.js +10 -0
- package/dist/gdc-common-utils-ts/src/interfaces/Cryptography.types.d.ts +139 -0
- package/dist/gdc-common-utils-ts/src/interfaces/Cryptography.types.js +8 -0
- package/dist/gdc-common-utils-ts/src/interfaces/ICryptoHelper.d.ts +28 -0
- package/dist/gdc-common-utils-ts/src/interfaces/ICryptoHelper.js +3 -0
- package/dist/gdc-common-utils-ts/src/interfaces/ICryptography.d.ts +154 -0
- package/dist/gdc-common-utils-ts/src/interfaces/ICryptography.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/actor-session.d.ts +9 -0
- package/dist/gdc-common-utils-ts/src/models/actor-session.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/aes.d.ts +85 -0
- package/dist/gdc-common-utils-ts/src/models/aes.js +10 -0
- package/dist/gdc-common-utils-ts/src/models/auth.d.ts +35 -0
- package/dist/gdc-common-utils-ts/src/models/auth.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/bundle.d.ts +153 -0
- package/dist/gdc-common-utils-ts/src/models/bundle.js +25 -0
- package/dist/gdc-common-utils-ts/src/models/clinical-sections.d.ts +36 -0
- package/dist/gdc-common-utils-ts/src/models/clinical-sections.en.d.ts +150 -0
- package/dist/gdc-common-utils-ts/src/models/clinical-sections.en.js +104 -0
- package/dist/gdc-common-utils-ts/src/models/clinical-sections.js +32 -0
- package/dist/gdc-common-utils-ts/src/models/clinical-workbook-summary.d.ts +126 -0
- package/dist/gdc-common-utils-ts/src/models/clinical-workbook-summary.js +67 -0
- package/dist/gdc-common-utils-ts/src/models/comm.d.ts +56 -0
- package/dist/gdc-common-utils-ts/src/models/comm.js +4 -0
- package/dist/gdc-common-utils-ts/src/models/confidential-job.d.ts +78 -0
- package/dist/gdc-common-utils-ts/src/models/confidential-job.js +20 -0
- package/dist/gdc-common-utils-ts/src/models/confidential-message.d.ts +97 -0
- package/dist/gdc-common-utils-ts/src/models/confidential-message.js +4 -0
- package/dist/gdc-common-utils-ts/src/models/confidential-storage.d.ts +134 -0
- package/dist/gdc-common-utils-ts/src/models/confidential-storage.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/consent-access.d.ts +79 -0
- package/dist/gdc-common-utils-ts/src/models/consent-access.js +2 -0
- package/dist/gdc-common-utils-ts/src/models/consent-rule.d.ts +122 -0
- package/dist/gdc-common-utils-ts/src/models/consent-rule.js +22 -0
- package/dist/gdc-common-utils-ts/src/models/crypto.d.ts +35 -0
- package/dist/gdc-common-utils-ts/src/models/crypto.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/dataspace-discovery-defaults.d.ts +79 -0
- package/dist/gdc-common-utils-ts/src/models/dataspace-discovery-defaults.js +2 -0
- package/dist/gdc-common-utils-ts/src/models/dataspace-discovery.d.ts +68 -0
- package/dist/gdc-common-utils-ts/src/models/dataspace-discovery.js +9 -0
- package/dist/gdc-common-utils-ts/src/models/dataspace-protocol.d.ts +14 -0
- package/dist/gdc-common-utils-ts/src/models/dataspace-protocol.js +2 -0
- package/dist/gdc-common-utils-ts/src/models/device-license.d.ts +134 -0
- package/dist/gdc-common-utils-ts/src/models/device-license.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/did.d.ts +108 -0
- package/dist/gdc-common-utils-ts/src/models/did.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/fhir-documents.d.ts +101 -0
- package/dist/gdc-common-utils-ts/src/models/fhir-documents.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/identity-bootstrap.d.ts +104 -0
- package/dist/gdc-common-utils-ts/src/models/identity-bootstrap.js +2 -0
- package/dist/gdc-common-utils-ts/src/models/index.d.ts +42 -0
- package/dist/gdc-common-utils-ts/src/models/index.js +42 -0
- package/dist/gdc-common-utils-ts/src/models/indexing.d.ts +11 -0
- package/dist/gdc-common-utils-ts/src/models/indexing.js +18 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/allergy-intolerance-claims.d.ts +24 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/allergy-intolerance-claims.js +36 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/communication-claims.d.ts +53 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/communication-claims.js +55 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/condition-claims.d.ts +14 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/condition-claims.js +25 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/device-use-statement-claims.d.ts +13 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/device-use-statement-claims.js +23 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/document-reference-claims.d.ts +36 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/document-reference-claims.js +89 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/medication-statement-claims.d.ts +341 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/medication-statement-claims.js +204 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/types.d.ts +9 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/types.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims.d.ts +5 -0
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims.js +7 -0
- package/dist/gdc-common-utils-ts/src/models/issue.d.ts +57 -0
- package/dist/gdc-common-utils-ts/src/models/issue.js +75 -0
- package/dist/gdc-common-utils-ts/src/models/jsonapi.d.ts +13 -0
- package/dist/gdc-common-utils-ts/src/models/jsonapi.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/jwe.d.ts +120 -0
- package/dist/gdc-common-utils-ts/src/models/jwe.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/jwk.d.ts +39 -0
- package/dist/gdc-common-utils-ts/src/models/jwk.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/jws.d.ts +35 -0
- package/dist/gdc-common-utils-ts/src/models/jws.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/jwt.d.ts +9 -0
- package/dist/gdc-common-utils-ts/src/models/jwt.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/loinc-document-ontology.d.ts +55 -0
- package/dist/gdc-common-utils-ts/src/models/loinc-document-ontology.js +58 -0
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.common.model.d.ts +33 -0
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.common.model.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.document.model.d.ts +50 -0
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.document.model.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.electronicRecord.model.d.ts +67 -0
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.electronicRecord.model.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.evidence.model.d.ts +51 -0
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.evidence.model.js +5 -0
- package/dist/gdc-common-utils-ts/src/models/openid-device.d.ts +119 -0
- package/dist/gdc-common-utils-ts/src/models/openid-device.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/operation-outcome.d.ts +26 -0
- package/dist/gdc-common-utils-ts/src/models/operation-outcome.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/params.d.ts +133 -0
- package/dist/gdc-common-utils-ts/src/models/params.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/relationship-access.d.ts +160 -0
- package/dist/gdc-common-utils-ts/src/models/relationship-access.js +21 -0
- package/dist/gdc-common-utils-ts/src/models/resource-document.d.ts +14 -0
- package/dist/gdc-common-utils-ts/src/models/resource-document.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/response.d.ts +1 -0
- package/dist/gdc-common-utils-ts/src/models/response.js +3 -0
- package/dist/gdc-common-utils-ts/src/models/urlPath.d.ts +58 -0
- package/dist/gdc-common-utils-ts/src/models/urlPath.js +76 -0
- package/dist/gdc-common-utils-ts/src/models/verifiable-credential.d.ts +45 -0
- package/dist/gdc-common-utils-ts/src/models/verifiable-credential.js +8 -0
- package/dist/gdc-common-utils-ts/src/storage/IVaultRepository.d.ts +53 -0
- package/dist/gdc-common-utils-ts/src/storage/IVaultRepository.js +25 -0
- package/dist/gdc-common-utils-ts/src/storage/VaultMemRepository.d.ts +30 -0
- package/dist/gdc-common-utils-ts/src/storage/VaultMemRepository.js +81 -0
- package/dist/gdc-common-utils-ts/src/storage/index.d.ts +3 -0
- package/dist/gdc-common-utils-ts/src/storage/index.js +4 -0
- package/dist/gdc-common-utils-ts/src/utils/activation-policy.d.ts +86 -0
- package/dist/gdc-common-utils-ts/src/utils/activation-policy.js +218 -0
- package/dist/gdc-common-utils-ts/src/utils/activation-request.d.ts +81 -0
- package/dist/gdc-common-utils-ts/src/utils/activation-request.js +99 -0
- package/dist/gdc-common-utils-ts/src/utils/actor.d.ts +18 -0
- package/dist/gdc-common-utils-ts/src/utils/actor.js +36 -0
- package/dist/gdc-common-utils-ts/src/utils/base-convert.d.ts +60 -0
- package/dist/gdc-common-utils-ts/src/utils/base-convert.js +104 -0
- package/dist/gdc-common-utils-ts/src/utils/baseN.d.ts +35 -0
- package/dist/gdc-common-utils-ts/src/utils/baseN.js +174 -0
- package/dist/gdc-common-utils-ts/src/utils/bundle-query.d.ts +35 -0
- package/dist/gdc-common-utils-ts/src/utils/bundle-query.js +177 -0
- package/dist/gdc-common-utils-ts/src/utils/bundle.d.ts +13 -0
- package/dist/gdc-common-utils-ts/src/utils/bundle.js +39 -0
- package/dist/gdc-common-utils-ts/src/utils/clinical-resource-converters.d.ts +64 -0
- package/dist/gdc-common-utils-ts/src/utils/clinical-resource-converters.js +279 -0
- package/dist/gdc-common-utils-ts/src/utils/clinical-resource-view.d.ts +55 -0
- package/dist/gdc-common-utils-ts/src/utils/clinical-resource-view.js +291 -0
- package/dist/gdc-common-utils-ts/src/utils/communication-bundle-session.d.ts +110 -0
- package/dist/gdc-common-utils-ts/src/utils/communication-bundle-session.js +326 -0
- package/dist/gdc-common-utils-ts/src/utils/communication-document-reference.d.ts +41 -0
- package/dist/gdc-common-utils-ts/src/utils/communication-document-reference.js +170 -0
- package/dist/gdc-common-utils-ts/src/utils/communication-fhir-r4.d.ts +41 -0
- package/dist/gdc-common-utils-ts/src/utils/communication-fhir-r4.js +215 -0
- package/dist/gdc-common-utils-ts/src/utils/communication-identity.d.ts +152 -0
- package/dist/gdc-common-utils-ts/src/utils/communication-identity.js +121 -0
- package/dist/gdc-common-utils-ts/src/utils/consent-claim-helpers.d.ts +79 -0
- package/dist/gdc-common-utils-ts/src/utils/consent-claim-helpers.js +213 -0
- package/dist/gdc-common-utils-ts/src/utils/consent.d.ts +218 -0
- package/dist/gdc-common-utils-ts/src/utils/consent.js +679 -0
- package/dist/gdc-common-utils-ts/src/utils/content.d.ts +55 -0
- package/dist/gdc-common-utils-ts/src/utils/content.js +60 -0
- package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery-defaults.d.ts +130 -0
- package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery-defaults.js +307 -0
- package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery.d.ts +235 -0
- package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery.js +482 -0
- package/dist/gdc-common-utils-ts/src/utils/dataspace-protocol.d.ts +66 -0
- package/dist/gdc-common-utils-ts/src/utils/dataspace-protocol.js +109 -0
- package/dist/gdc-common-utils-ts/src/utils/did-resolution.d.ts +60 -0
- package/dist/gdc-common-utils-ts/src/utils/did-resolution.js +173 -0
- package/dist/gdc-common-utils-ts/src/utils/did.d.ts +124 -0
- package/dist/gdc-common-utils-ts/src/utils/did.js +204 -0
- package/dist/gdc-common-utils-ts/src/utils/didcomm-submit-policy.d.ts +10 -0
- package/dist/gdc-common-utils-ts/src/utils/didcomm-submit-policy.js +15 -0
- package/dist/gdc-common-utils-ts/src/utils/didcomm-submit.d.ts +48 -0
- package/dist/gdc-common-utils-ts/src/utils/didcomm-submit.js +81 -0
- package/dist/gdc-common-utils-ts/src/utils/didcomm.d.ts +60 -0
- package/dist/gdc-common-utils-ts/src/utils/didcomm.js +78 -0
- package/dist/gdc-common-utils-ts/src/utils/discovery-normalization.d.ts +28 -0
- package/dist/gdc-common-utils-ts/src/utils/discovery-normalization.js +64 -0
- package/dist/gdc-common-utils-ts/src/utils/fhir-cid.d.ts +60 -0
- package/dist/gdc-common-utils-ts/src/utils/fhir-cid.js +152 -0
- package/dist/gdc-common-utils-ts/src/utils/fhir-validator.d.ts +61 -0
- package/dist/gdc-common-utils-ts/src/utils/fhir-validator.js +91 -0
- package/dist/gdc-common-utils-ts/src/utils/format-converter.d.ts +21 -0
- package/dist/gdc-common-utils-ts/src/utils/format-converter.js +109 -0
- package/dist/gdc-common-utils-ts/src/utils/index.d.ts +39 -0
- package/dist/gdc-common-utils-ts/src/utils/index.js +39 -0
- package/dist/gdc-common-utils-ts/src/utils/individual-form-pdf.d.ts +55 -0
- package/dist/gdc-common-utils-ts/src/utils/individual-form-pdf.js +191 -0
- package/dist/gdc-common-utils-ts/src/utils/jwt.d.ts +53 -0
- package/dist/gdc-common-utils-ts/src/utils/jwt.js +154 -0
- package/dist/gdc-common-utils-ts/src/utils/manager-error.d.ts +15 -0
- package/dist/gdc-common-utils-ts/src/utils/manager-error.js +21 -0
- package/dist/gdc-common-utils-ts/src/utils/medication-claim-helpers.d.ts +56 -0
- package/dist/gdc-common-utils-ts/src/utils/medication-claim-helpers.js +127 -0
- package/dist/gdc-common-utils-ts/src/utils/multibase58.d.ts +13 -0
- package/dist/gdc-common-utils-ts/src/utils/multibase58.js +40 -0
- package/dist/gdc-common-utils-ts/src/utils/multibasehash.d.ts +8 -0
- package/dist/gdc-common-utils-ts/src/utils/multibasehash.js +23 -0
- package/dist/gdc-common-utils-ts/src/utils/normalize-uuid.d.ts +1 -0
- package/dist/gdc-common-utils-ts/src/utils/normalize-uuid.js +35 -0
- package/dist/gdc-common-utils-ts/src/utils/normalize.d.ts +16 -0
- package/dist/gdc-common-utils-ts/src/utils/normalize.js +40 -0
- package/dist/gdc-common-utils-ts/src/utils/object-convert.d.ts +20 -0
- package/dist/gdc-common-utils-ts/src/utils/object-convert.js +51 -0
- package/dist/gdc-common-utils-ts/src/utils/smart-scope.d.ts +28 -0
- package/dist/gdc-common-utils-ts/src/utils/smart-scope.js +29 -0
- package/dist/gdc-common-utils-ts/src/utils/string-convert.d.ts +24 -0
- package/dist/gdc-common-utils-ts/src/utils/string-convert.js +62 -0
- package/dist/gdc-common-utils-ts/src/utils/string-utils.d.ts +25 -0
- package/dist/gdc-common-utils-ts/src/utils/string-utils.js +66 -0
- package/dist/gdc-common-utils-ts/src/utils/url.d.ts +26 -0
- package/dist/gdc-common-utils-ts/src/utils/url.js +44 -0
- package/dist/gdc-common-utils-ts/src/utils/vp-token.d.ts +139 -0
- package/dist/gdc-common-utils-ts/src/utils/vp-token.js +256 -0
- package/dist/gdc-sdk-core-ts/src/actor-model.d.ts +56 -0
- package/dist/gdc-sdk-core-ts/src/actor-model.js +112 -0
- package/dist/gdc-sdk-core-ts/src/app-identity.d.ts +80 -0
- package/dist/gdc-sdk-core-ts/src/app-identity.js +147 -0
- package/dist/gdc-sdk-core-ts/src/bootstrap-facade.d.ts +165 -0
- package/dist/gdc-sdk-core-ts/src/bootstrap-facade.js +191 -0
- package/dist/gdc-sdk-core-ts/src/communication-bundle-contracts.d.ts +112 -0
- package/dist/gdc-sdk-core-ts/src/communication-bundle-contracts.js +185 -0
- package/dist/gdc-sdk-core-ts/src/communication-bundle-resources.d.ts +32 -0
- package/dist/gdc-sdk-core-ts/src/communication-bundle-resources.js +215 -0
- package/dist/gdc-sdk-core-ts/src/communication-consent-mutation-contract.d.ts +55 -0
- package/dist/gdc-sdk-core-ts/src/communication-consent-mutation-contract.js +190 -0
- package/dist/gdc-sdk-core-ts/src/communication-document-facade.d.ts +55 -0
- package/dist/gdc-sdk-core-ts/src/communication-document-facade.js +194 -0
- package/dist/gdc-sdk-core-ts/src/communication-draft.d.ts +104 -0
- package/dist/gdc-sdk-core-ts/src/communication-draft.js +143 -0
- package/dist/gdc-sdk-core-ts/src/communication-outbox.d.ts +49 -0
- package/dist/gdc-sdk-core-ts/src/communication-outbox.js +62 -0
- package/dist/gdc-sdk-core-ts/src/communication-resource-helpers.d.ts +180 -0
- package/dist/gdc-sdk-core-ts/src/communication-resource-helpers.js +455 -0
- package/dist/gdc-sdk-core-ts/src/consent-access.d.ts +73 -0
- package/dist/gdc-sdk-core-ts/src/consent-access.js +109 -0
- package/dist/gdc-sdk-core-ts/src/consent-claim-helpers.d.ts +5 -0
- package/dist/gdc-sdk-core-ts/src/consent-claim-helpers.js +6 -0
- package/dist/gdc-sdk-core-ts/src/consent-communication-operations.d.ts +82 -0
- package/dist/gdc-sdk-core-ts/src/consent-communication-operations.js +135 -0
- package/dist/gdc-sdk-core-ts/src/did-resolution-session.d.ts +33 -0
- package/dist/gdc-sdk-core-ts/src/did-resolution-session.js +56 -0
- package/dist/gdc-sdk-core-ts/src/discovery-facade.d.ts +84 -0
- package/dist/gdc-sdk-core-ts/src/discovery-facade.js +24 -0
- package/dist/gdc-sdk-core-ts/src/identity-model.d.ts +46 -0
- package/dist/gdc-sdk-core-ts/src/identity-model.js +2 -0
- package/dist/gdc-sdk-core-ts/src/identity-store.d.ts +83 -0
- package/dist/gdc-sdk-core-ts/src/identity-store.js +51 -0
- package/dist/gdc-sdk-core-ts/src/index.d.ts +23 -0
- package/dist/gdc-sdk-core-ts/src/index.js +24 -0
- package/dist/gdc-sdk-core-ts/src/medication-claim-helpers.d.ts +5 -0
- package/dist/gdc-sdk-core-ts/src/medication-claim-helpers.js +6 -0
- package/dist/gdc-sdk-core-ts/src/polling-model.d.ts +35 -0
- package/dist/gdc-sdk-core-ts/src/polling-model.js +24 -0
- package/dist/gdc-sdk-core-ts/src/relationship-access.d.ts +40 -0
- package/dist/gdc-sdk-core-ts/src/relationship-access.js +150 -0
- package/dist/gdc-sdk-core-ts/src/session-model.d.ts +134 -0
- package/dist/gdc-sdk-core-ts/src/session-model.js +2 -0
- package/dist/gdc-sdk-core-ts/src/smart-endpoint-resolver.d.ts +19 -0
- package/dist/gdc-sdk-core-ts/src/smart-endpoint-resolver.js +19 -0
- package/dist/gdc-sdk-core-ts/src/vital-signs.d.ts +38 -0
- package/dist/gdc-sdk-core-ts/src/vital-signs.js +155 -0
- package/dist/gdc-sdk-front-ts/src/ClientSDK.d.ts +99 -0
- package/dist/gdc-sdk-front-ts/src/ClientSDK.js +177 -0
- package/dist/gdc-sdk-front-ts/src/ProfileManager.d.ts +140 -0
- package/dist/gdc-sdk-front-ts/src/ProfileManager.js +76 -0
- package/dist/gdc-sdk-front-ts/src/ProfileRegistry.d.ts +11 -0
- package/dist/gdc-sdk-front-ts/src/ProfileRegistry.js +26 -0
- package/dist/gdc-sdk-front-ts/src/VerifierService.d.ts +6 -0
- package/dist/gdc-sdk-front-ts/src/VerifierService.js +10 -0
- package/dist/gdc-sdk-front-ts/src/actor-session.d.ts +2 -0
- package/dist/gdc-sdk-front-ts/src/actor-session.js +2 -0
- package/dist/gdc-sdk-front-ts/src/capabilityMapper.d.ts +8 -0
- package/dist/gdc-sdk-front-ts/src/capabilityMapper.js +28 -0
- package/dist/gdc-sdk-front-ts/src/consent-claim-helpers.d.ts +4 -0
- package/dist/gdc-sdk-front-ts/src/consent-claim-helpers.js +5 -0
- package/dist/gdc-sdk-front-ts/src/discovery/DataspaceDiscoveryClient.d.ts +54 -0
- package/dist/gdc-sdk-front-ts/src/discovery/DataspaceDiscoveryClient.js +85 -0
- package/dist/gdc-sdk-front-ts/src/discovery/index.d.ts +3 -0
- package/dist/gdc-sdk-front-ts/src/discovery/index.js +4 -0
- package/dist/gdc-sdk-front-ts/src/discovery/mappers.d.ts +29 -0
- package/dist/gdc-sdk-front-ts/src/discovery/mappers.js +60 -0
- package/dist/gdc-sdk-front-ts/src/discovery/types.d.ts +83 -0
- package/dist/gdc-sdk-front-ts/src/discovery/types.js +2 -0
- package/dist/gdc-sdk-front-ts/src/index.d.ts +15 -0
- package/dist/gdc-sdk-front-ts/src/index.js +16 -0
- package/dist/gdc-sdk-front-ts/src/medication-claim-helpers.d.ts +4 -0
- package/dist/gdc-sdk-front-ts/src/medication-claim-helpers.js +5 -0
- package/dist/gdc-sdk-front-ts/src/roleRegistry.d.ts +19 -0
- package/dist/gdc-sdk-front-ts/src/roleRegistry.js +2 -0
- package/dist/gdc-sdk-front-ts/src/runtime-contracts.d.ts +22 -0
- package/dist/gdc-sdk-front-ts/src/runtime-contracts.js +7 -0
- package/dist/gdc-sdk-front-ts/src/services.d.ts +167 -0
- package/dist/gdc-sdk-front-ts/src/services.js +78 -0
- package/dist/gdc-sdk-front-ts/src/session-descriptor.d.ts +11 -0
- package/dist/gdc-sdk-front-ts/src/session-descriptor.js +8 -0
- package/dist/gdc-sdk-front-ts/src/types.d.ts +11 -0
- package/dist/gdc-sdk-front-ts/src/types.js +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/medication-claim-helpers.d.ts +4 -0
- package/dist/medication-claim-helpers.js +5 -0
- package/dist/orchestration/client-port.d.ts +161 -0
- package/dist/orchestration/client-port.js +26 -0
- package/dist/orchestration/facades.d.ts +65 -0
- package/dist/orchestration/facades.js +142 -0
- package/dist/orchestration/host-onboarding-sdk.d.ts +9 -0
- package/dist/orchestration/host-onboarding-sdk.js +16 -0
- package/dist/orchestration/individual-controller-sdk.d.ts +18 -0
- package/dist/orchestration/individual-controller-sdk.js +43 -0
- package/dist/orchestration/individual-member-sdk.d.ts +8 -0
- package/dist/orchestration/individual-member-sdk.js +13 -0
- package/dist/orchestration/organization-controller-sdk.d.ts +11 -0
- package/dist/orchestration/organization-controller-sdk.js +22 -0
- package/dist/orchestration/organization-employee-sdk.d.ts +8 -0
- package/dist/orchestration/organization-employee-sdk.js +13 -0
- package/dist/orchestration/personal-sdk.d.ts +13 -0
- package/dist/orchestration/personal-sdk.js +28 -0
- package/dist/orchestration/professional-sdk.d.ts +10 -0
- package/dist/orchestration/professional-sdk.js +19 -0
- package/dist/services.d.ts +58 -10
- package/dist/services.js +88 -5
- package/package.json +3 -3
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { resolveDidcommSubmissionPlan } from './didcomm-submit-policy';
|
|
2
|
+
function getHeaderValue(headers, name) {
|
|
3
|
+
if (!headers || typeof headers.get !== 'function') {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
const value = headers.get(name);
|
|
7
|
+
return value == null ? undefined : value;
|
|
8
|
+
}
|
|
9
|
+
async function parseBody(response) {
|
|
10
|
+
if (typeof response.text === 'function') {
|
|
11
|
+
const raw = await response.text();
|
|
12
|
+
if (!raw)
|
|
13
|
+
return undefined;
|
|
14
|
+
try {
|
|
15
|
+
return JSON.parse(raw);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return raw;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Submits a DIDComm payload using either plaintext or encrypted transport,
|
|
25
|
+
* depending on the resolved submission policy.
|
|
26
|
+
*
|
|
27
|
+
* @param input.mode Communication mode that drives plain vs encrypted submission.
|
|
28
|
+
* @param input.url Target endpoint URL.
|
|
29
|
+
* @param input.payload DIDComm payload body to submit.
|
|
30
|
+
* @param input.defaultHeaders Optional extra request headers.
|
|
31
|
+
* @param input.bearerToken Optional bearer token.
|
|
32
|
+
* @param input.recipientEncryptionJwk Recipient public key for encrypted mode.
|
|
33
|
+
* @param input.fetcher Runtime fetch-like implementation.
|
|
34
|
+
* @param input.signCompactJws Callback used to sign plaintext claims before encryption.
|
|
35
|
+
* @param input.encryptCompactJwe Callback used to encrypt the signed JWS.
|
|
36
|
+
*/
|
|
37
|
+
export async function submitDidcomm(input) {
|
|
38
|
+
const plan = resolveDidcommSubmissionPlan(input.mode, {
|
|
39
|
+
hasRecipientEncryptionJwk: !!input.recipientEncryptionJwk,
|
|
40
|
+
});
|
|
41
|
+
const headers = {
|
|
42
|
+
...(input.defaultHeaders ?? {}),
|
|
43
|
+
Accept: 'application/json, application/didcomm-plaintext+json, */*',
|
|
44
|
+
};
|
|
45
|
+
let body;
|
|
46
|
+
let contentType;
|
|
47
|
+
if (plan.submitKind === 'plain') {
|
|
48
|
+
contentType = 'application/didcomm-plaintext+json';
|
|
49
|
+
body = JSON.stringify(input.payload);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
if (!input.signCompactJws) {
|
|
53
|
+
throw new Error('Encrypted DIDComm submission requires signCompactJws callback.');
|
|
54
|
+
}
|
|
55
|
+
if (!input.encryptCompactJwe) {
|
|
56
|
+
throw new Error('Encrypted DIDComm submission requires encryptCompactJwe callback.');
|
|
57
|
+
}
|
|
58
|
+
if (!input.recipientEncryptionJwk) {
|
|
59
|
+
throw new Error('Encrypted DIDComm submission requires recipientEncryptionJwk.');
|
|
60
|
+
}
|
|
61
|
+
const compactJws = await input.signCompactJws(input.payload);
|
|
62
|
+
body = await input.encryptCompactJwe(compactJws, input.recipientEncryptionJwk);
|
|
63
|
+
contentType = 'application/didcomm-encrypted+json';
|
|
64
|
+
}
|
|
65
|
+
headers['Content-Type'] = contentType;
|
|
66
|
+
if (input.bearerToken) {
|
|
67
|
+
headers.Authorization = `Bearer ${input.bearerToken}`;
|
|
68
|
+
}
|
|
69
|
+
const response = await input.fetcher(input.url, {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
headers,
|
|
72
|
+
body,
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
status: response.status,
|
|
76
|
+
location: getHeaderValue(response.headers, 'location'),
|
|
77
|
+
body: await parseBody(response),
|
|
78
|
+
submitKind: plan.submitKind,
|
|
79
|
+
contentType,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { DidCommPayload, DidCommAttachment } from '../models/comm';
|
|
2
|
+
export { DidCommAttachment } from '../models/comm';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a DIDComm message instance.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DidCommMessage implements DidCommPayload {
|
|
7
|
+
id: string;
|
|
8
|
+
type: string;
|
|
9
|
+
from?: string;
|
|
10
|
+
to?: string[];
|
|
11
|
+
thid?: string;
|
|
12
|
+
pthid?: string;
|
|
13
|
+
created_time?: number;
|
|
14
|
+
expires_time?: number;
|
|
15
|
+
body: {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
attachments?: DidCommAttachment[];
|
|
19
|
+
/**
|
|
20
|
+
* Creates an empty DIDComm message with generated `id`, empty `type`,
|
|
21
|
+
* and empty `body`.
|
|
22
|
+
*/
|
|
23
|
+
constructor();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Prepares a DIDComm request message.
|
|
27
|
+
*
|
|
28
|
+
* @param type DIDComm message type.
|
|
29
|
+
* @param body DIDComm body payload.
|
|
30
|
+
* @param attachments Optional DIDComm attachments.
|
|
31
|
+
*/
|
|
32
|
+
export declare function prepareDidCommRequest(type: string, body?: any, attachments?: DidCommAttachment[]): DidCommMessage;
|
|
33
|
+
/**
|
|
34
|
+
* Includes VP token in DIDComm message body.
|
|
35
|
+
*
|
|
36
|
+
* @param message DIDComm message to mutate.
|
|
37
|
+
* @param vpToken VP token string to place under `body.vp_token`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function includeVpTokenInMessage(message: DidCommMessage, vpToken: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Includes file bytes as base64 attachment in DIDComm message.
|
|
42
|
+
*
|
|
43
|
+
* @param message DIDComm message to mutate.
|
|
44
|
+
* @param fileBytes Raw file bytes.
|
|
45
|
+
* @param mediaType Attachment media type.
|
|
46
|
+
* @param id Attachment identifier.
|
|
47
|
+
*/
|
|
48
|
+
export declare function includeFileInMessage(message: DidCommMessage, fileBytes: Uint8Array, mediaType: string, id: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* Gets THID from DIDComm message.
|
|
51
|
+
*
|
|
52
|
+
* @param message DIDComm message.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getThidFromMessage(message: DidCommMessage): string;
|
|
55
|
+
/**
|
|
56
|
+
* Gets data results from polling response body.
|
|
57
|
+
*
|
|
58
|
+
* @param response DIDComm response carrying `body.data`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getDataResults(response: DidCommMessage): any[];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random ID for DIDComm messages.
|
|
3
|
+
*/
|
|
4
|
+
function generateId() {
|
|
5
|
+
return Math.random().toString(36).substr(2, 9);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Creates a DIDComm message instance.
|
|
9
|
+
*/
|
|
10
|
+
export class DidCommMessage {
|
|
11
|
+
/**
|
|
12
|
+
* Creates an empty DIDComm message with generated `id`, empty `type`,
|
|
13
|
+
* and empty `body`.
|
|
14
|
+
*/
|
|
15
|
+
constructor() {
|
|
16
|
+
this.id = generateId();
|
|
17
|
+
this.type = '';
|
|
18
|
+
this.body = {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Prepares a DIDComm request message.
|
|
23
|
+
*
|
|
24
|
+
* @param type DIDComm message type.
|
|
25
|
+
* @param body DIDComm body payload.
|
|
26
|
+
* @param attachments Optional DIDComm attachments.
|
|
27
|
+
*/
|
|
28
|
+
export function prepareDidCommRequest(type, body = {}, attachments = []) {
|
|
29
|
+
const message = new DidCommMessage();
|
|
30
|
+
message.type = type;
|
|
31
|
+
message.body = body;
|
|
32
|
+
message.attachments = attachments;
|
|
33
|
+
message.thid = message.id; // Set thid to id for new threads
|
|
34
|
+
return message;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Includes VP token in DIDComm message body.
|
|
38
|
+
*
|
|
39
|
+
* @param message DIDComm message to mutate.
|
|
40
|
+
* @param vpToken VP token string to place under `body.vp_token`.
|
|
41
|
+
*/
|
|
42
|
+
export function includeVpTokenInMessage(message, vpToken) {
|
|
43
|
+
message.body.vp_token = vpToken;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Includes file bytes as base64 attachment in DIDComm message.
|
|
47
|
+
*
|
|
48
|
+
* @param message DIDComm message to mutate.
|
|
49
|
+
* @param fileBytes Raw file bytes.
|
|
50
|
+
* @param mediaType Attachment media type.
|
|
51
|
+
* @param id Attachment identifier.
|
|
52
|
+
*/
|
|
53
|
+
export function includeFileInMessage(message, fileBytes, mediaType, id) {
|
|
54
|
+
const base64 = Buffer.from(fileBytes).toString('base64');
|
|
55
|
+
if (!message.attachments)
|
|
56
|
+
message.attachments = [];
|
|
57
|
+
message.attachments.push({
|
|
58
|
+
id,
|
|
59
|
+
media_type: mediaType,
|
|
60
|
+
data: { base64 }
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Gets THID from DIDComm message.
|
|
65
|
+
*
|
|
66
|
+
* @param message DIDComm message.
|
|
67
|
+
*/
|
|
68
|
+
export function getThidFromMessage(message) {
|
|
69
|
+
return message.thid || message.id;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets data results from polling response body.
|
|
73
|
+
*
|
|
74
|
+
* @param response DIDComm response carrying `body.data`.
|
|
75
|
+
*/
|
|
76
|
+
export function getDataResults(response) {
|
|
77
|
+
return response.body?.data || [];
|
|
78
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DidResolutionResult } from '../models/did';
|
|
2
|
+
/**
|
|
3
|
+
* Canonical runtime-neutral discovery result used by SDK and GW code after
|
|
4
|
+
* normalizing metadata from ICA, node operators, or provider catalogs.
|
|
5
|
+
*/
|
|
6
|
+
export type NormalizedDiscoveryMetadata = DidResolutionResult & {
|
|
7
|
+
/** Origin of the normalized metadata payload. */
|
|
8
|
+
source: 'ica' | 'node-operator' | 'service-provider';
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes ICA discovery metadata into the shared DID/discovery result shape.
|
|
12
|
+
*
|
|
13
|
+
* The input can be partial. When no DID Document is supplied, a minimal synthetic
|
|
14
|
+
* one is created from `did`/`issuer` so downstream code still has a stable carrier.
|
|
15
|
+
*/
|
|
16
|
+
export declare function normalizeIcaDiscoveryMetadata(metadata: Record<string, unknown>): NormalizedDiscoveryMetadata;
|
|
17
|
+
/**
|
|
18
|
+
* Normalizes node-operator discovery metadata into the shared DID/discovery result shape.
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalizeNodeOperatorDiscoveryMetadata(metadata: Record<string, unknown>): NormalizedDiscoveryMetadata;
|
|
21
|
+
/**
|
|
22
|
+
* Normalizes a service-provider or DCAT-style entry into the shared DID/discovery result shape.
|
|
23
|
+
*
|
|
24
|
+
* This helper extracts well-known operational URLs such as the DID Document URL,
|
|
25
|
+
* JWKS URL, and SMART token endpoint from `service[]` instead of rebuilding them
|
|
26
|
+
* from public aliases or assumed base URLs.
|
|
27
|
+
*/
|
|
28
|
+
export declare function normalizeServiceProviderEntry(entry: Record<string, unknown>): NormalizedDiscoveryMetadata;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
import { getDidDocumentEndpoint, getJwksServiceEndpoint, getSmartTokenEndpoint, toDidResolutionResult } from './did-resolution';
|
|
3
|
+
function ensureDidDocument(metadata, fallbackDid) {
|
|
4
|
+
const didDocument = metadata.didDocument;
|
|
5
|
+
if (didDocument?.id) {
|
|
6
|
+
return didDocument;
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
'@context': 'https://www.w3.org/ns/did/v1',
|
|
10
|
+
id: String(metadata.did || metadata.issuer || metadata.providerDid || fallbackDid || '').trim(),
|
|
11
|
+
service: [],
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function attachMetadata(result, metadata) {
|
|
15
|
+
return {
|
|
16
|
+
...result,
|
|
17
|
+
issuer: typeof metadata.issuer === 'string' ? metadata.issuer : result.issuer,
|
|
18
|
+
jwksUri: typeof metadata.jwks_uri === 'string' ? metadata.jwks_uri : result.jwksUri,
|
|
19
|
+
metadata,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Normalizes ICA discovery metadata into the shared DID/discovery result shape.
|
|
24
|
+
*
|
|
25
|
+
* The input can be partial. When no DID Document is supplied, a minimal synthetic
|
|
26
|
+
* one is created from `did`/`issuer` so downstream code still has a stable carrier.
|
|
27
|
+
*/
|
|
28
|
+
export function normalizeIcaDiscoveryMetadata(metadata) {
|
|
29
|
+
const didDocument = ensureDidDocument(metadata, metadata.issuer);
|
|
30
|
+
return {
|
|
31
|
+
...attachMetadata(toDidResolutionResult(didDocument), metadata),
|
|
32
|
+
source: 'ica',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Normalizes node-operator discovery metadata into the shared DID/discovery result shape.
|
|
37
|
+
*/
|
|
38
|
+
export function normalizeNodeOperatorDiscoveryMetadata(metadata) {
|
|
39
|
+
const didDocument = ensureDidDocument(metadata, metadata.operatorDid);
|
|
40
|
+
return {
|
|
41
|
+
...attachMetadata(toDidResolutionResult(didDocument), metadata),
|
|
42
|
+
source: 'node-operator',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Normalizes a service-provider or DCAT-style entry into the shared DID/discovery result shape.
|
|
47
|
+
*
|
|
48
|
+
* This helper extracts well-known operational URLs such as the DID Document URL,
|
|
49
|
+
* JWKS URL, and SMART token endpoint from `service[]` instead of rebuilding them
|
|
50
|
+
* from public aliases or assumed base URLs.
|
|
51
|
+
*/
|
|
52
|
+
export function normalizeServiceProviderEntry(entry) {
|
|
53
|
+
const didDocument = ensureDidDocument(entry, entry.providerDid);
|
|
54
|
+
const result = attachMetadata(toDidResolutionResult(didDocument), entry);
|
|
55
|
+
const jwks = entry.jwks;
|
|
56
|
+
return {
|
|
57
|
+
...result,
|
|
58
|
+
jwks,
|
|
59
|
+
didDocumentUrl: getDidDocumentEndpoint(didDocument),
|
|
60
|
+
jwksUri: result.jwksUri || getJwksServiceEndpoint(didDocument),
|
|
61
|
+
smartTokenEndpoint: getSmartTokenEndpoint(didDocument),
|
|
62
|
+
source: 'service-provider',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type FhirCanonicalizationOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Removes `meta.versionId` from canonical input to avoid self-referential hashes.
|
|
4
|
+
* Default: true.
|
|
5
|
+
*/
|
|
6
|
+
stripMetaVersionId?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Removes top-level narrative `text` if present.
|
|
9
|
+
* Default: false.
|
|
10
|
+
*/
|
|
11
|
+
stripNarrativeText?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Removes nested `id` fields in backbone elements (resource root `id` is preserved).
|
|
14
|
+
* Default: false.
|
|
15
|
+
*/
|
|
16
|
+
stripNestedElementIds?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type FhirCidBuildOptions = {
|
|
19
|
+
canonicalization?: FhirCanonicalizationOptions;
|
|
20
|
+
/**
|
|
21
|
+
* CID multicodec for canonical FHIR JSON payloads.
|
|
22
|
+
* `0x0129` is DAG-JSON.
|
|
23
|
+
*/
|
|
24
|
+
multicodecCode?: number;
|
|
25
|
+
};
|
|
26
|
+
export type FhirCidResult = {
|
|
27
|
+
cid: string;
|
|
28
|
+
versionId: string;
|
|
29
|
+
canonicalJson: string;
|
|
30
|
+
digestHex: string;
|
|
31
|
+
};
|
|
32
|
+
export type ClaimsCidResult = {
|
|
33
|
+
cid: string;
|
|
34
|
+
canonicalJson: string;
|
|
35
|
+
digestHex: string;
|
|
36
|
+
};
|
|
37
|
+
export type FhirCidVersionMapping = {
|
|
38
|
+
resourceType?: string;
|
|
39
|
+
resourceId?: string;
|
|
40
|
+
fullUrl?: string;
|
|
41
|
+
cid: string;
|
|
42
|
+
versionId: string;
|
|
43
|
+
};
|
|
44
|
+
export declare function canonicalizeFhirResource(resource: Record<string, unknown>, options?: FhirCanonicalizationOptions): string;
|
|
45
|
+
export declare function buildCidV1FromCanonicalJson(canonicalJson: string, multicodecCode?: number): FhirCidResult;
|
|
46
|
+
export declare function canonicalizeClaimsForCid(claims: Record<string, unknown>): string;
|
|
47
|
+
export declare function claimsToCid(claims: Record<string, unknown>): ClaimsCidResult;
|
|
48
|
+
export declare function assignCidToClaimsId(claims: Record<string, unknown>): {
|
|
49
|
+
claims: Record<string, unknown>;
|
|
50
|
+
cid: string;
|
|
51
|
+
};
|
|
52
|
+
export declare function fhirResourceToCid(resource: Record<string, unknown>, options?: FhirCidBuildOptions): FhirCidResult;
|
|
53
|
+
export declare function assignCidToFhirResourceVersionId(resource: Record<string, unknown>, options?: FhirCidBuildOptions): {
|
|
54
|
+
resource: Record<string, unknown>;
|
|
55
|
+
mapping: FhirCidVersionMapping;
|
|
56
|
+
};
|
|
57
|
+
export declare function assignCidToFhirBundleEntries(bundle: Record<string, unknown>, options?: FhirCidBuildOptions): {
|
|
58
|
+
bundle: Record<string, unknown>;
|
|
59
|
+
mappings: FhirCidVersionMapping[];
|
|
60
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
import { sha256 } from '@noble/hashes/sha2.js';
|
|
3
|
+
import { utf8ToBytes } from '@noble/hashes/utils.js';
|
|
4
|
+
import { encodeMultibase58btc } from './multibase58.js';
|
|
5
|
+
const DEFAULT_MULTICODEC_DAG_JSON = 0x0129;
|
|
6
|
+
const MULTIHASH_SHA2_256_CODE = 0x12;
|
|
7
|
+
const MULTIHASH_SHA2_256_LEN = 32;
|
|
8
|
+
const CID_V1 = 0x01;
|
|
9
|
+
function toHex(bytes) {
|
|
10
|
+
return Buffer.from(bytes).toString('hex');
|
|
11
|
+
}
|
|
12
|
+
function encodeVarint(value) {
|
|
13
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
14
|
+
throw new Error(`Invalid varint value: ${value}`);
|
|
15
|
+
}
|
|
16
|
+
const out = [];
|
|
17
|
+
let n = value >>> 0;
|
|
18
|
+
while (n >= 0x80) {
|
|
19
|
+
out.push((n & 0x7f) | 0x80);
|
|
20
|
+
n >>>= 7;
|
|
21
|
+
}
|
|
22
|
+
out.push(n);
|
|
23
|
+
return Uint8Array.from(out);
|
|
24
|
+
}
|
|
25
|
+
function concatBytes(...parts) {
|
|
26
|
+
const total = parts.reduce((acc, part) => acc + part.length, 0);
|
|
27
|
+
const out = new Uint8Array(total);
|
|
28
|
+
let offset = 0;
|
|
29
|
+
for (const part of parts) {
|
|
30
|
+
out.set(part, offset);
|
|
31
|
+
offset += part.length;
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
function canonicalizeValue(value, options, depth) {
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
// FHIR array order can be significant; preserve order, canonicalize each element.
|
|
38
|
+
return value.map((entry) => canonicalizeValue(entry, options, depth + 1));
|
|
39
|
+
}
|
|
40
|
+
if (value && typeof value === 'object') {
|
|
41
|
+
const asRecord = value;
|
|
42
|
+
const keys = Object.keys(asRecord).sort();
|
|
43
|
+
const out = {};
|
|
44
|
+
for (const key of keys) {
|
|
45
|
+
if (options.stripNarrativeText && depth === 0 && key === 'text') {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (options.stripNestedElementIds && depth > 0 && key === 'id') {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
let next = asRecord[key];
|
|
52
|
+
if (next === undefined)
|
|
53
|
+
continue;
|
|
54
|
+
if (options.stripMetaVersionId && key === 'meta' && next && typeof next === 'object' && !Array.isArray(next)) {
|
|
55
|
+
const metaRecord = { ...next };
|
|
56
|
+
delete metaRecord.versionId;
|
|
57
|
+
next = metaRecord;
|
|
58
|
+
}
|
|
59
|
+
out[key] = canonicalizeValue(next, options, depth + 1);
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
export function canonicalizeFhirResource(resource, options = {}) {
|
|
66
|
+
const normalizedOptions = {
|
|
67
|
+
stripMetaVersionId: options.stripMetaVersionId ?? true,
|
|
68
|
+
stripNarrativeText: options.stripNarrativeText ?? false,
|
|
69
|
+
stripNestedElementIds: options.stripNestedElementIds ?? false,
|
|
70
|
+
};
|
|
71
|
+
const normalized = canonicalizeValue(resource, normalizedOptions, 0);
|
|
72
|
+
return JSON.stringify(normalized);
|
|
73
|
+
}
|
|
74
|
+
export function buildCidV1FromCanonicalJson(canonicalJson, multicodecCode = DEFAULT_MULTICODEC_DAG_JSON) {
|
|
75
|
+
const digest = sha256(utf8ToBytes(canonicalJson));
|
|
76
|
+
const multihash = concatBytes(Uint8Array.from([MULTIHASH_SHA2_256_CODE, MULTIHASH_SHA2_256_LEN]), digest);
|
|
77
|
+
const cidBytes = concatBytes(encodeVarint(CID_V1), encodeVarint(multicodecCode), multihash);
|
|
78
|
+
const cid = encodeMultibase58btc(cidBytes);
|
|
79
|
+
return {
|
|
80
|
+
cid,
|
|
81
|
+
versionId: cid,
|
|
82
|
+
canonicalJson,
|
|
83
|
+
digestHex: toHex(digest),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function canonicalizeClaimsForCid(claims) {
|
|
87
|
+
const stripped = { ...(claims || {}) };
|
|
88
|
+
delete stripped['@context'];
|
|
89
|
+
delete stripped['@type'];
|
|
90
|
+
delete stripped['@id'];
|
|
91
|
+
const normalized = canonicalizeValue(stripped, {
|
|
92
|
+
stripMetaVersionId: false,
|
|
93
|
+
stripNarrativeText: false,
|
|
94
|
+
stripNestedElementIds: false,
|
|
95
|
+
}, 0);
|
|
96
|
+
return JSON.stringify(normalized);
|
|
97
|
+
}
|
|
98
|
+
export function claimsToCid(claims) {
|
|
99
|
+
const canonicalJson = canonicalizeClaimsForCid(claims);
|
|
100
|
+
const cidData = buildCidV1FromCanonicalJson(canonicalJson, DEFAULT_MULTICODEC_DAG_JSON);
|
|
101
|
+
return {
|
|
102
|
+
cid: cidData.cid,
|
|
103
|
+
canonicalJson,
|
|
104
|
+
digestHex: cidData.digestHex,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export function assignCidToClaimsId(claims) {
|
|
108
|
+
const out = JSON.parse(JSON.stringify(claims || {}));
|
|
109
|
+
const { cid } = claimsToCid(out);
|
|
110
|
+
out['@id'] = cid;
|
|
111
|
+
return {
|
|
112
|
+
claims: out,
|
|
113
|
+
cid,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export function fhirResourceToCid(resource, options = {}) {
|
|
117
|
+
const canonicalJson = canonicalizeFhirResource(resource, options.canonicalization);
|
|
118
|
+
return buildCidV1FromCanonicalJson(canonicalJson, options.multicodecCode ?? DEFAULT_MULTICODEC_DAG_JSON);
|
|
119
|
+
}
|
|
120
|
+
export function assignCidToFhirResourceVersionId(resource, options = {}) {
|
|
121
|
+
const cid = fhirResourceToCid(resource, options);
|
|
122
|
+
const out = JSON.parse(JSON.stringify(resource));
|
|
123
|
+
const meta = (out.meta && typeof out.meta === 'object' && !Array.isArray(out.meta))
|
|
124
|
+
? { ...out.meta }
|
|
125
|
+
: {};
|
|
126
|
+
meta.versionId = cid.versionId;
|
|
127
|
+
out.meta = meta;
|
|
128
|
+
return {
|
|
129
|
+
resource: out,
|
|
130
|
+
mapping: {
|
|
131
|
+
resourceType: String(out.resourceType || ''),
|
|
132
|
+
resourceId: out.id ? String(out.id) : undefined,
|
|
133
|
+
cid: cid.cid,
|
|
134
|
+
versionId: cid.versionId,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export function assignCidToFhirBundleEntries(bundle, options = {}) {
|
|
139
|
+
const out = JSON.parse(JSON.stringify(bundle));
|
|
140
|
+
const entries = Array.isArray(out.entry) ? out.entry : [];
|
|
141
|
+
const mappings = [];
|
|
142
|
+
for (const entry of entries) {
|
|
143
|
+
const resource = entry?.resource;
|
|
144
|
+
if (!resource || typeof resource !== 'object' || Array.isArray(resource))
|
|
145
|
+
continue;
|
|
146
|
+
const assigned = assignCidToFhirResourceVersionId(resource, options);
|
|
147
|
+
entry.resource = assigned.resource;
|
|
148
|
+
assigned.mapping.fullUrl = entry.fullUrl ? String(entry.fullUrl) : undefined;
|
|
149
|
+
mappings.push(assigned.mapping);
|
|
150
|
+
}
|
|
151
|
+
return { bundle: out, mappings };
|
|
152
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type FhirVersion = 'r4' | 'r5' | string;
|
|
2
|
+
export type FhirValidationIssue = {
|
|
3
|
+
severity: 'error' | 'warning';
|
|
4
|
+
code: string;
|
|
5
|
+
diagnostics: string;
|
|
6
|
+
expression?: string;
|
|
7
|
+
};
|
|
8
|
+
export type FhirValidationResult = {
|
|
9
|
+
ok: boolean;
|
|
10
|
+
issues: FhirValidationIssue[];
|
|
11
|
+
};
|
|
12
|
+
export type FhirValidatorAdapter = {
|
|
13
|
+
/**
|
|
14
|
+
* Stable adapter id for observability/configuration.
|
|
15
|
+
* Example: `basic`, `hl7-official-cli`, `hapi`.
|
|
16
|
+
*/
|
|
17
|
+
id: string;
|
|
18
|
+
/**
|
|
19
|
+
* Returns true when this adapter can validate the requested FHIR version.
|
|
20
|
+
*/
|
|
21
|
+
supports(version: FhirVersion): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Validates one resource and returns OperationOutcome-like issues.
|
|
24
|
+
*/
|
|
25
|
+
validate(resource: Record<string, unknown>, version: FhirVersion): Promise<FhirValidationResult> | FhirValidationResult;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Registers a custom FHIR validator adapter.
|
|
29
|
+
* Adapters are checked in registration order.
|
|
30
|
+
*
|
|
31
|
+
* @param adapter Validator adapter to register.
|
|
32
|
+
*/
|
|
33
|
+
export declare function registerFhirValidatorAdapter(adapter: FhirValidatorAdapter): void;
|
|
34
|
+
/**
|
|
35
|
+
* Clears all registered adapters.
|
|
36
|
+
* Intended for tests or explicit runtime reconfiguration.
|
|
37
|
+
*/
|
|
38
|
+
export declare function clearFhirValidatorAdapters(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Returns currently registered adapters (read-only copy).
|
|
41
|
+
*/
|
|
42
|
+
export declare function listFhirValidatorAdapters(): FhirValidatorAdapter[];
|
|
43
|
+
/**
|
|
44
|
+
* Validates a FHIR resource using the first registered adapter that supports the requested version.
|
|
45
|
+
* Falls back to built-in structural validation when no adapter matches.
|
|
46
|
+
*
|
|
47
|
+
* This utility is intentionally adapter-based so SDK/GW can share one validation entrypoint while
|
|
48
|
+
* keeping the formal validator implementation pluggable per deployment.
|
|
49
|
+
* @param resource FHIR resource candidate.
|
|
50
|
+
* @param version Requested FHIR version, defaults to `r4`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function validateFhirResource(resource: Record<string, unknown>, version?: FhirVersion): Promise<FhirValidationResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Minimal built-in structural validation.
|
|
55
|
+
* This does not replace a formal HL7 profile validator; it provides a safe baseline
|
|
56
|
+
* and deterministic checks for common gateway constraints.
|
|
57
|
+
*
|
|
58
|
+
* @param resource FHIR resource candidate.
|
|
59
|
+
* @param _version Requested FHIR version, defaults to `r4`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function validateFhirResourceBasic(resource: Record<string, unknown>, _version?: FhirVersion): FhirValidationResult;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const validators = [];
|
|
2
|
+
/**
|
|
3
|
+
* Registers a custom FHIR validator adapter.
|
|
4
|
+
* Adapters are checked in registration order.
|
|
5
|
+
*
|
|
6
|
+
* @param adapter Validator adapter to register.
|
|
7
|
+
*/
|
|
8
|
+
export function registerFhirValidatorAdapter(adapter) {
|
|
9
|
+
validators.push(adapter);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Clears all registered adapters.
|
|
13
|
+
* Intended for tests or explicit runtime reconfiguration.
|
|
14
|
+
*/
|
|
15
|
+
export function clearFhirValidatorAdapters() {
|
|
16
|
+
validators.length = 0;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns currently registered adapters (read-only copy).
|
|
20
|
+
*/
|
|
21
|
+
export function listFhirValidatorAdapters() {
|
|
22
|
+
return [...validators];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Validates a FHIR resource using the first registered adapter that supports the requested version.
|
|
26
|
+
* Falls back to built-in structural validation when no adapter matches.
|
|
27
|
+
*
|
|
28
|
+
* This utility is intentionally adapter-based so SDK/GW can share one validation entrypoint while
|
|
29
|
+
* keeping the formal validator implementation pluggable per deployment.
|
|
30
|
+
* @param resource FHIR resource candidate.
|
|
31
|
+
* @param version Requested FHIR version, defaults to `r4`.
|
|
32
|
+
*/
|
|
33
|
+
export async function validateFhirResource(resource, version = 'r4') {
|
|
34
|
+
const adapter = validators.find((item) => item.supports(version));
|
|
35
|
+
if (adapter)
|
|
36
|
+
return adapter.validate(resource, version);
|
|
37
|
+
return validateFhirResourceBasic(resource, version);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Minimal built-in structural validation.
|
|
41
|
+
* This does not replace a formal HL7 profile validator; it provides a safe baseline
|
|
42
|
+
* and deterministic checks for common gateway constraints.
|
|
43
|
+
*
|
|
44
|
+
* @param resource FHIR resource candidate.
|
|
45
|
+
* @param _version Requested FHIR version, defaults to `r4`.
|
|
46
|
+
*/
|
|
47
|
+
export function validateFhirResourceBasic(resource, _version = 'r4') {
|
|
48
|
+
const issues = [];
|
|
49
|
+
const resourceType = String(resource?.resourceType || '').trim();
|
|
50
|
+
if (!resourceType) {
|
|
51
|
+
issues.push({
|
|
52
|
+
severity: 'error',
|
|
53
|
+
code: 'required',
|
|
54
|
+
diagnostics: 'Missing required field: resourceType.',
|
|
55
|
+
expression: 'resourceType',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (resourceType === 'Communication') {
|
|
59
|
+
const status = String(resource?.status || '').trim();
|
|
60
|
+
if (!status) {
|
|
61
|
+
issues.push({
|
|
62
|
+
severity: 'error',
|
|
63
|
+
code: 'required',
|
|
64
|
+
diagnostics: 'Communication.status is required.',
|
|
65
|
+
expression: 'Communication.status',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const payload = resource?.payload;
|
|
69
|
+
if (Array.isArray(payload) && payload.length > 1) {
|
|
70
|
+
issues.push({
|
|
71
|
+
severity: 'warning',
|
|
72
|
+
code: 'business-rule',
|
|
73
|
+
diagnostics: 'Gateway convention recommends one payload per Communication.',
|
|
74
|
+
expression: 'Communication.payload',
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const note = resource?.note;
|
|
78
|
+
if (Array.isArray(note) && note.length > 1) {
|
|
79
|
+
issues.push({
|
|
80
|
+
severity: 'warning',
|
|
81
|
+
code: 'business-rule',
|
|
82
|
+
diagnostics: 'Gateway convention recommends one note per Communication.',
|
|
83
|
+
expression: 'Communication.note',
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
ok: issues.every((issue) => issue.severity !== 'error'),
|
|
89
|
+
issues,
|
|
90
|
+
};
|
|
91
|
+
}
|