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,99 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
function pushIssue(issues, severity, code, message, path) {
|
|
3
|
+
issues.push({ severity, code, message, ...(path ? { path } : {}) });
|
|
4
|
+
}
|
|
5
|
+
function normalizeJwkSet(publicKeys) {
|
|
6
|
+
if (!publicKeys) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
if (Array.isArray(publicKeys)) {
|
|
10
|
+
return { keys: publicKeys };
|
|
11
|
+
}
|
|
12
|
+
return publicKeys;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Builds the canonical controller/person binding from semantic variables.
|
|
16
|
+
*
|
|
17
|
+
* Use this when your integration starts from variables such as:
|
|
18
|
+
* - `controllerDid`
|
|
19
|
+
* - `controllerEmail` converted to `sameAs`
|
|
20
|
+
* - `publicSignKey`
|
|
21
|
+
* - `publicKeys`
|
|
22
|
+
*
|
|
23
|
+
* so the caller does not have to manually shape `controller.publicKeyJwk` and
|
|
24
|
+
* `controller.jwks`.
|
|
25
|
+
*/
|
|
26
|
+
export function buildControllerBindingInput(input) {
|
|
27
|
+
const jwks = normalizeJwkSet(input.publicKeys);
|
|
28
|
+
return {
|
|
29
|
+
...(input.did ? { did: input.did } : {}),
|
|
30
|
+
...(input.sameAs ? { sameAs: input.sameAs } : {}),
|
|
31
|
+
...(input.publicSignKey ? { publicKeyJwk: input.publicSignKey } : {}),
|
|
32
|
+
...(jwks ? { jwks } : {}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Builds the canonical organization/provider binding from semantic variables.
|
|
37
|
+
*/
|
|
38
|
+
export function buildOrganizationBindingInput(input) {
|
|
39
|
+
const jwks = normalizeJwkSet(input.publicKeys);
|
|
40
|
+
return {
|
|
41
|
+
...(input.did ? { did: input.did } : {}),
|
|
42
|
+
...(input.url ? { url: input.url } : {}),
|
|
43
|
+
...(input.publicSignKey ? { publicKeyJwk: input.publicSignKey } : {}),
|
|
44
|
+
...(jwks ? { jwks } : {}),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Builds the canonical `_activate` request payload shared by SDK and GW helpers.
|
|
49
|
+
*
|
|
50
|
+
* The resulting object intentionally preserves deprecated compatibility fields
|
|
51
|
+
* when supplied, so callers can keep legacy flows alive while validators and
|
|
52
|
+
* runtime layers flag that debt explicitly.
|
|
53
|
+
*/
|
|
54
|
+
export function buildOrganizationActivationRequest(input) {
|
|
55
|
+
return {
|
|
56
|
+
vp_token: input.vpToken,
|
|
57
|
+
...(input.presentationSubmission ? { presentation_submission: input.presentationSubmission } : {}),
|
|
58
|
+
...(input.controller ? { controller: input.controller } : {}),
|
|
59
|
+
...(input.organization ? { organization: input.organization } : {}),
|
|
60
|
+
...(input.data ? { data: input.data } : {}),
|
|
61
|
+
...(input.organizationCredential !== undefined ? { organizationCredential: input.organizationCredential } : {}),
|
|
62
|
+
...(input.representativeCredential !== undefined ? { representativeCredential: input.representativeCredential } : {}),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Validates the canonical activation request contract.
|
|
67
|
+
*
|
|
68
|
+
* Priority rules:
|
|
69
|
+
* 1. `vp_token` is mandatory as the canonical activation proof.
|
|
70
|
+
* 2. `controller.*` is optional, but if a controller DID/alias is provided then
|
|
71
|
+
* matching public key material must also be present so a DID Document can be published.
|
|
72
|
+
* 3. Legacy `organizationCredential` and `representativeCredential` are tolerated
|
|
73
|
+
* only as deprecated compatibility inputs and therefore produce warnings.
|
|
74
|
+
*/
|
|
75
|
+
export function validateOrganizationActivationRequest(request) {
|
|
76
|
+
const issues = [];
|
|
77
|
+
if (!String(request.vp_token || '').trim()) {
|
|
78
|
+
pushIssue(issues, 'error', 'missing-vp-token', 'Canonical activation proof must be carried in vp_token.', 'vp_token');
|
|
79
|
+
}
|
|
80
|
+
if (request.organizationCredential !== undefined) {
|
|
81
|
+
pushIssue(issues, 'warning', 'deprecated-organization-credential', 'organizationCredential is deprecated compatibility input. Canonical proof must be carried in vp_token.', 'organizationCredential');
|
|
82
|
+
}
|
|
83
|
+
if (request.representativeCredential !== undefined) {
|
|
84
|
+
pushIssue(issues, 'warning', 'deprecated-representative-credential', 'representativeCredential is deprecated compatibility input. Canonical proof must be carried in vp_token.', 'representativeCredential');
|
|
85
|
+
}
|
|
86
|
+
const controller = request.controller;
|
|
87
|
+
if (controller) {
|
|
88
|
+
const hasPublicKeyJwk = !!controller.publicKeyJwk;
|
|
89
|
+
const hasJwks = !!controller.jwks?.keys?.length;
|
|
90
|
+
if ((controller.did || controller.sameAs) && !(hasPublicKeyJwk || hasJwks)) {
|
|
91
|
+
pushIssue(issues, 'error', 'incomplete-controller-binding', 'controller.did/controller.sameAs requires controller.publicKeyJwk or controller.jwks for DID bootstrap.', 'controller');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
ok: !issues.some((issue) => issue.severity === 'error'),
|
|
96
|
+
errors: issues.filter((issue) => issue.severity === 'error'),
|
|
97
|
+
warnings: issues.filter((issue) => issue.severity === 'warning'),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ParsedActor = {
|
|
2
|
+
/**
|
|
3
|
+
* The token subject / authenticated actor identifier (as provided in the token request).
|
|
4
|
+
* Examples:
|
|
5
|
+
* - did:web:api.acme.org:employee:doctor1@acme.org:ISCO-08|2211
|
|
6
|
+
* - did:web:api.acme.org:employee:doctor1@acme.org:ISCO-08|2211:<device-uuid>
|
|
7
|
+
* - did:web:api.acme.org:family:<id>:v3-RoleCode|ONESELF
|
|
8
|
+
* - did:web:api.acme.org:family:<id>:v3-RoleCode|CHILD:<device-uuid>
|
|
9
|
+
*/
|
|
10
|
+
sub: string;
|
|
11
|
+
/** The actor identifier (employee email, familyId, or raw email). */
|
|
12
|
+
identifier?: string;
|
|
13
|
+
/** The employee role code if present (e.g. "ISCO-08|2211"). */
|
|
14
|
+
role?: string;
|
|
15
|
+
/** The base organization did:web if `sub` is did:web (e.g. "did:web:api.acme.org"). */
|
|
16
|
+
organization?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function parseActorFromSub(sub: string): ParsedActor;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// src/utils/actor.ts
|
|
2
|
+
export function parseActorFromSub(sub) {
|
|
3
|
+
const trimmed = (sub || '').trim();
|
|
4
|
+
const parsed = { sub: trimmed };
|
|
5
|
+
if (!trimmed)
|
|
6
|
+
return parsed;
|
|
7
|
+
if (trimmed.startsWith('did:web:')) {
|
|
8
|
+
// Base org DID is always the first component after did:web:
|
|
9
|
+
// did:web:<host>[:...]
|
|
10
|
+
const after = trimmed.replace(/^did:web:/, '');
|
|
11
|
+
const host = after.split(':')[0];
|
|
12
|
+
if (host)
|
|
13
|
+
parsed.organization = `did:web:${host}`;
|
|
14
|
+
// Extract email and role from endpoint-style DID shapes:
|
|
15
|
+
// did:web:<host>:(employee|family):<id>:<roleSystem>|<roleCode>[:<uuid>]
|
|
16
|
+
const parts = after.split(':');
|
|
17
|
+
const employeeIdx = parts.indexOf('employee');
|
|
18
|
+
const familyIdx = parts.indexOf('family');
|
|
19
|
+
const idIdx = employeeIdx >= 0 ? employeeIdx + 1 : familyIdx >= 0 ? familyIdx + 1 : -1;
|
|
20
|
+
const identifier = idIdx >= 0 ? parts[idIdx] : undefined;
|
|
21
|
+
if (identifier) {
|
|
22
|
+
parsed.identifier = identifier.includes('@') ? identifier.toLowerCase() : identifier;
|
|
23
|
+
}
|
|
24
|
+
if (idIdx >= 0 && parts.length > idIdx + 1) {
|
|
25
|
+
const roleCandidate = parts[idIdx + 1];
|
|
26
|
+
if (roleCandidate && roleCandidate.includes('|'))
|
|
27
|
+
parsed.role = roleCandidate;
|
|
28
|
+
}
|
|
29
|
+
return parsed;
|
|
30
|
+
}
|
|
31
|
+
// Raw email actor identifier
|
|
32
|
+
if (trimmed.includes('@') && !/\s/.test(trimmed)) {
|
|
33
|
+
parsed.identifier = trimmed.toLowerCase();
|
|
34
|
+
}
|
|
35
|
+
return parsed;
|
|
36
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a `Uint8Array` into a hexadecimal string.
|
|
3
|
+
*
|
|
4
|
+
* @param bytes Raw bytes to encode.
|
|
5
|
+
*/
|
|
6
|
+
export declare function bytesToHexString(bytes: Uint8Array): string;
|
|
7
|
+
/**
|
|
8
|
+
* Encodes a `Uint8Array` into a Base58 string.
|
|
9
|
+
*
|
|
10
|
+
* @param bytes Raw bytes to encode.
|
|
11
|
+
*/
|
|
12
|
+
export declare function bytesToBase58(bytes: Uint8Array): string;
|
|
13
|
+
/**
|
|
14
|
+
* Decodes a Base58 string into a `Uint8Array`.
|
|
15
|
+
*
|
|
16
|
+
* @param base58str Base58 string to decode.
|
|
17
|
+
*/
|
|
18
|
+
export declare function base58ToBytes(base58str: string): Uint8Array;
|
|
19
|
+
/**
|
|
20
|
+
* Encodes a string into a standard Base64 string with padding.
|
|
21
|
+
*
|
|
22
|
+
* @param str UTF-8 string to encode.
|
|
23
|
+
*/
|
|
24
|
+
export declare function stringToStdBase64(str: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Converts a standard Base64 string into a Base64URL string.
|
|
27
|
+
*
|
|
28
|
+
* @param encodedData Standard Base64 string.
|
|
29
|
+
*/
|
|
30
|
+
export declare function base64ToBase64Url(encodedData: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Encodes a string into a Base64URL string.
|
|
33
|
+
*
|
|
34
|
+
* @param stringifiedData UTF-8 string to encode.
|
|
35
|
+
*/
|
|
36
|
+
export declare function stringToBase64Url(stringifiedData: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Converts a Base64URL string into a standard Base64 string.
|
|
39
|
+
*
|
|
40
|
+
* @param encodedData Base64URL string.
|
|
41
|
+
*/
|
|
42
|
+
export declare function base64UrlToBase64(encodedData: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Decodes a string that is either Base64 or Base64URL into a `Uint8Array`.
|
|
45
|
+
*
|
|
46
|
+
* @param base64OrUrlSafe Base64 or Base64URL string.
|
|
47
|
+
*/
|
|
48
|
+
export declare function base64OrUrlSafeToBytes(base64OrUrlSafe: string): Uint8Array;
|
|
49
|
+
/**
|
|
50
|
+
* Encodes a `Uint8Array` into a standard Base64 string with padding.
|
|
51
|
+
*
|
|
52
|
+
* @param bytes Raw bytes to encode.
|
|
53
|
+
*/
|
|
54
|
+
export declare function bytesToBase64(bytes: Uint8Array): string;
|
|
55
|
+
/**
|
|
56
|
+
* Encodes a `Uint8Array` into a raw Base64URL string without padding.
|
|
57
|
+
*
|
|
58
|
+
* @param bytes Raw bytes to encode.
|
|
59
|
+
*/
|
|
60
|
+
export declare function bytesToRawBase64UrlSafe(bytes: Uint8Array): string;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// crypto-ts/utils/base-convert.ts
|
|
2
|
+
import { encode as encodeBase64, decode as decodeBase64, decodeURLSafe, encodeURLSafe, } from "@stablelib/base64";
|
|
3
|
+
import { alphabetBase58, decodeN, encodeN } from './baseN';
|
|
4
|
+
import { stringToBytesUTF8 } from './string-convert';
|
|
5
|
+
/**
|
|
6
|
+
* Converts a `Uint8Array` into a hexadecimal string.
|
|
7
|
+
*
|
|
8
|
+
* @param bytes Raw bytes to encode.
|
|
9
|
+
*/
|
|
10
|
+
export function bytesToHexString(bytes) {
|
|
11
|
+
return Array.from(bytes, (byte) => {
|
|
12
|
+
return ('0' + (byte & 0xff).toString(16)).slice(-2);
|
|
13
|
+
}).join('');
|
|
14
|
+
}
|
|
15
|
+
;
|
|
16
|
+
/**
|
|
17
|
+
* Encodes a `Uint8Array` into a Base58 string.
|
|
18
|
+
*
|
|
19
|
+
* @param bytes Raw bytes to encode.
|
|
20
|
+
*/
|
|
21
|
+
export function bytesToBase58(bytes) {
|
|
22
|
+
return encodeN(bytes, alphabetBase58, undefined);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Decodes a Base58 string into a `Uint8Array`.
|
|
26
|
+
*
|
|
27
|
+
* @param base58str Base58 string to decode.
|
|
28
|
+
*/
|
|
29
|
+
export function base58ToBytes(base58str) {
|
|
30
|
+
return decodeN(base58str, alphabetBase58);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Encodes a string into a standard Base64 string with padding.
|
|
34
|
+
*
|
|
35
|
+
* @param str UTF-8 string to encode.
|
|
36
|
+
*/
|
|
37
|
+
export function stringToStdBase64(str) {
|
|
38
|
+
const dataBytes = stringToBytesUTF8(str);
|
|
39
|
+
return encodeBase64(dataBytes);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Converts a standard Base64 string into a Base64URL string.
|
|
43
|
+
*
|
|
44
|
+
* @param encodedData Standard Base64 string.
|
|
45
|
+
*/
|
|
46
|
+
export function base64ToBase64Url(encodedData) {
|
|
47
|
+
if (encodedData && (encodedData.indexOf("+") !== -1 || encodedData.indexOf("/") !== -1)) {
|
|
48
|
+
return encodedData.split("+").join("-").split("/").join("_");
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return encodedData;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Encodes a string into a Base64URL string.
|
|
56
|
+
*
|
|
57
|
+
* @param stringifiedData UTF-8 string to encode.
|
|
58
|
+
*/
|
|
59
|
+
export function stringToBase64Url(stringifiedData) {
|
|
60
|
+
const encodedData = stringToStdBase64(stringifiedData);
|
|
61
|
+
return base64ToBase64Url(encodedData);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Converts a Base64URL string into a standard Base64 string.
|
|
65
|
+
*
|
|
66
|
+
* @param encodedData Base64URL string.
|
|
67
|
+
*/
|
|
68
|
+
export function base64UrlToBase64(encodedData) {
|
|
69
|
+
if (encodedData && (encodedData.indexOf("-") !== -1 || encodedData.indexOf("_") !== -1)) {
|
|
70
|
+
return encodedData.split("-").join("+").split("_").join("/");
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return encodedData;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Decodes a string that is either Base64 or Base64URL into a `Uint8Array`.
|
|
78
|
+
*
|
|
79
|
+
* @param base64OrUrlSafe Base64 or Base64URL string.
|
|
80
|
+
*/
|
|
81
|
+
export function base64OrUrlSafeToBytes(base64OrUrlSafe) {
|
|
82
|
+
if (String(base64OrUrlSafe).includes("+") || String(base64OrUrlSafe).includes("/")) {
|
|
83
|
+
return new Uint8Array(decodeBase64(base64OrUrlSafe));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
return new Uint8Array(decodeURLSafe(base64OrUrlSafe));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Encodes a `Uint8Array` into a standard Base64 string with padding.
|
|
91
|
+
*
|
|
92
|
+
* @param bytes Raw bytes to encode.
|
|
93
|
+
*/
|
|
94
|
+
export function bytesToBase64(bytes) {
|
|
95
|
+
return encodeBase64(bytes);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Encodes a `Uint8Array` into a raw Base64URL string without padding.
|
|
99
|
+
*
|
|
100
|
+
* @param bytes Raw bytes to encode.
|
|
101
|
+
*/
|
|
102
|
+
export function bytesToRawBase64UrlSafe(bytes) {
|
|
103
|
+
return encodeURLSafe(bytes).replace(/=/g, "");
|
|
104
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const alphabetBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2
|
+
export declare class BaseN {
|
|
3
|
+
constructor();
|
|
4
|
+
/** BaseN-encodes a Uint8Array using the given alphabet */
|
|
5
|
+
static encodeN(input: Uint8Array, alphabet: string, maxline: string | undefined): string;
|
|
6
|
+
/** Decodes a baseN-encoded (using the given alphabet) string to a Uint8Array. */
|
|
7
|
+
static decodeN(input: string, alphabet: string): Uint8Array;
|
|
8
|
+
/** Base58-encodes a Uint8Array using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' */
|
|
9
|
+
static encodeBytesToBase58(inputBytes: Uint8Array): string;
|
|
10
|
+
/** Base58-encodes a Uint8Array using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' */
|
|
11
|
+
static encodeStrToBase58(inputStr: string): string;
|
|
12
|
+
/** Decodes a base58-encoded string to a Uint8Array (using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz') */
|
|
13
|
+
static decodeBytesFromBase58(base58Str: string): Uint8Array;
|
|
14
|
+
/** Decodes a base58-encoded string to a Uint8Array (using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz') */
|
|
15
|
+
static decodeStrFromBase58(base58Str: string): string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* BaseN-encodes a Uint8Array using the given alphabet.
|
|
19
|
+
*
|
|
20
|
+
* @param {Uint8Array} input the bytes to encode in a Uint8Array.
|
|
21
|
+
* @param {number} maxline the maximum number of encoded characters per line to
|
|
22
|
+
* use, defaults to none.
|
|
23
|
+
*
|
|
24
|
+
* @return {string} the baseN-encoded output string.
|
|
25
|
+
*/
|
|
26
|
+
export declare function encodeN(input: Uint8Array, alphabet: string, maxline: string | undefined): string;
|
|
27
|
+
/**
|
|
28
|
+
* Decodes a baseN-encoded (using the given alphabet) string to a
|
|
29
|
+
* Uint8Array.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} input the baseN-encoded input string.
|
|
32
|
+
*
|
|
33
|
+
* @return {Uint8Array} the decoded bytes in a Uint8Array.
|
|
34
|
+
*/
|
|
35
|
+
export declare function decodeN(input: string, alphabet: string): Uint8Array;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* From https://raw.githubusercontent.com/digitalbazaar/base58-universal/master/baseN.js
|
|
3
|
+
* Base-N/Base-X encoding/decoding functions.
|
|
4
|
+
*
|
|
5
|
+
* Original implementation from base-x:
|
|
6
|
+
* https://github.com/cryptocoinjs/base-x
|
|
7
|
+
*
|
|
8
|
+
* Which is MIT licensed:
|
|
9
|
+
*
|
|
10
|
+
* The MIT License (MIT)
|
|
11
|
+
*
|
|
12
|
+
* Copyright base-x contributors (c) 2016
|
|
13
|
+
*
|
|
14
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
* in the Software without restriction, including without limitation the rights
|
|
17
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
* furnished to do so, subject to the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be included in
|
|
22
|
+
* all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
29
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
30
|
+
* DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
'use strict';
|
|
33
|
+
import { bytesToStringUTF8, stringToBytesUTF8 } from './string-convert';
|
|
34
|
+
// baseN alphabet indexes
|
|
35
|
+
const _reverseAlphabets = [];
|
|
36
|
+
// base58 characters (Bitcoin alphabet)
|
|
37
|
+
export const alphabetBase58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
38
|
+
export class BaseN {
|
|
39
|
+
constructor() { }
|
|
40
|
+
/** BaseN-encodes a Uint8Array using the given alphabet */
|
|
41
|
+
static encodeN(input, alphabet, maxline) {
|
|
42
|
+
return encodeN(input, alphabet, maxline);
|
|
43
|
+
}
|
|
44
|
+
/** Decodes a baseN-encoded (using the given alphabet) string to a Uint8Array. */
|
|
45
|
+
static decodeN(input, alphabet) {
|
|
46
|
+
return decodeN(input, alphabet);
|
|
47
|
+
}
|
|
48
|
+
/** Base58-encodes a Uint8Array using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' */
|
|
49
|
+
static encodeBytesToBase58(inputBytes) {
|
|
50
|
+
return encodeN(inputBytes, alphabetBase58, undefined);
|
|
51
|
+
}
|
|
52
|
+
/** Base58-encodes a Uint8Array using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' */
|
|
53
|
+
static encodeStrToBase58(inputStr) {
|
|
54
|
+
const inputBytes = stringToBytesUTF8(inputStr);
|
|
55
|
+
return this.encodeBytesToBase58(inputBytes);
|
|
56
|
+
}
|
|
57
|
+
/** Decodes a base58-encoded string to a Uint8Array (using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz') */
|
|
58
|
+
static decodeBytesFromBase58(base58Str) {
|
|
59
|
+
return decodeN(base58Str, alphabetBase58);
|
|
60
|
+
}
|
|
61
|
+
/** Decodes a base58-encoded string to a Uint8Array (using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz') */
|
|
62
|
+
static decodeStrFromBase58(base58Str) {
|
|
63
|
+
const inputBytes = this.decodeBytesFromBase58(base58Str);
|
|
64
|
+
return bytesToStringUTF8(inputBytes);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* BaseN-encodes a Uint8Array using the given alphabet.
|
|
69
|
+
*
|
|
70
|
+
* @param {Uint8Array} input the bytes to encode in a Uint8Array.
|
|
71
|
+
* @param {number} maxline the maximum number of encoded characters per line to
|
|
72
|
+
* use, defaults to none.
|
|
73
|
+
*
|
|
74
|
+
* @return {string} the baseN-encoded output string.
|
|
75
|
+
*/
|
|
76
|
+
export function encodeN(input, alphabet, maxline) {
|
|
77
|
+
if (!(input instanceof Uint8Array)) {
|
|
78
|
+
throw new TypeError('"input" must be a Uint8Array.');
|
|
79
|
+
}
|
|
80
|
+
if (typeof alphabet !== 'string') {
|
|
81
|
+
throw new TypeError('"alphabet" must be a string.');
|
|
82
|
+
}
|
|
83
|
+
if (maxline !== undefined && typeof maxline !== 'number') {
|
|
84
|
+
throw new TypeError('"maxline" must be a number.');
|
|
85
|
+
}
|
|
86
|
+
if (input.length === 0) {
|
|
87
|
+
return '';
|
|
88
|
+
}
|
|
89
|
+
let output = '';
|
|
90
|
+
let i = 0;
|
|
91
|
+
const base = alphabet.length;
|
|
92
|
+
const first = alphabet.charAt(0);
|
|
93
|
+
const digits = [0];
|
|
94
|
+
for (i = 0; i < input.length; ++i) {
|
|
95
|
+
let carry = input[i];
|
|
96
|
+
for (let j = 0; j < digits.length; ++j) {
|
|
97
|
+
carry += digits[j] << 8;
|
|
98
|
+
digits[j] = carry % base;
|
|
99
|
+
carry = (carry / base) | 0;
|
|
100
|
+
}
|
|
101
|
+
while (carry > 0) {
|
|
102
|
+
digits.push(carry % base);
|
|
103
|
+
carry = (carry / base) | 0;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// deal with leading zeros
|
|
107
|
+
for (i = 0; input[i] === 0 && i < input.length - 1; ++i) {
|
|
108
|
+
output += first;
|
|
109
|
+
}
|
|
110
|
+
// convert digits to a string
|
|
111
|
+
for (i = digits.length - 1; i >= 0; --i) {
|
|
112
|
+
output += alphabet[digits[i]];
|
|
113
|
+
}
|
|
114
|
+
if (maxline) {
|
|
115
|
+
const match = output.match(new RegExp('.{1,' + maxline + '}', 'g'));
|
|
116
|
+
if (match) {
|
|
117
|
+
output = match.join('\r\n');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return output;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Decodes a baseN-encoded (using the given alphabet) string to a
|
|
124
|
+
* Uint8Array.
|
|
125
|
+
*
|
|
126
|
+
* @param {string} input the baseN-encoded input string.
|
|
127
|
+
*
|
|
128
|
+
* @return {Uint8Array} the decoded bytes in a Uint8Array.
|
|
129
|
+
*/
|
|
130
|
+
export function decodeN(input, alphabet) {
|
|
131
|
+
if (typeof input !== 'string') {
|
|
132
|
+
throw new TypeError('"input" must be a string.');
|
|
133
|
+
}
|
|
134
|
+
if (typeof alphabet !== 'string') {
|
|
135
|
+
throw new TypeError('"alphabet" must be a string.');
|
|
136
|
+
}
|
|
137
|
+
if (input.length === 0) {
|
|
138
|
+
return new Uint8Array(0);
|
|
139
|
+
}
|
|
140
|
+
let table = _reverseAlphabets[alphabet];
|
|
141
|
+
if (!table) {
|
|
142
|
+
// compute reverse alphabet
|
|
143
|
+
table = _reverseAlphabets[alphabet] = [];
|
|
144
|
+
for (let i = 0; i < alphabet.length; ++i) {
|
|
145
|
+
table[alphabet.charCodeAt(i)] = i;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// remove whitespace characters
|
|
149
|
+
input = input.replace(/\s/g, '');
|
|
150
|
+
const base = alphabet.length;
|
|
151
|
+
const first = alphabet.charAt(0);
|
|
152
|
+
const bytes = [0];
|
|
153
|
+
for (let i = 0; i < input.length; i++) {
|
|
154
|
+
const value = table[input.charCodeAt(i)];
|
|
155
|
+
if (value === undefined) {
|
|
156
|
+
return new Uint8Array(0); // empty
|
|
157
|
+
}
|
|
158
|
+
let carry = value;
|
|
159
|
+
for (let j = 0; j < bytes.length; ++j) {
|
|
160
|
+
carry += bytes[j] * base;
|
|
161
|
+
bytes[j] = carry & 0xff;
|
|
162
|
+
carry >>= 8;
|
|
163
|
+
}
|
|
164
|
+
while (carry > 0) {
|
|
165
|
+
bytes.push(carry & 0xff);
|
|
166
|
+
carry >>= 8;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// deal with leading zeros
|
|
170
|
+
for (let k = 0; input[k] === first && k < input.length - 1; ++k) {
|
|
171
|
+
bytes.push(0);
|
|
172
|
+
}
|
|
173
|
+
return new Uint8Array(bytes.reverse());
|
|
174
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BundleEntry, BundleJsonApi } from '../models/bundle.js';
|
|
2
|
+
export type BundleResourceIdFilters = Readonly<{
|
|
3
|
+
sections?: string | readonly string[];
|
|
4
|
+
resourceTypes?: string | readonly string[];
|
|
5
|
+
dateFrom?: string;
|
|
6
|
+
dateTo?: string;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Generic bundle query helper for reusable entry filtering and lookup.
|
|
10
|
+
*
|
|
11
|
+
* This utility is intentionally communication-agnostic and can be reused by
|
|
12
|
+
* any package that works with BundleJsonApi payloads.
|
|
13
|
+
*/
|
|
14
|
+
export declare class BundleQuery {
|
|
15
|
+
private readonly bundle;
|
|
16
|
+
constructor(bundle: BundleJsonApi<BundleEntry>);
|
|
17
|
+
/**
|
|
18
|
+
* Returns stable resource IDs from bundle entries with optional filters.
|
|
19
|
+
*/
|
|
20
|
+
getResourceIds(filters?: BundleResourceIdFilters): string[];
|
|
21
|
+
/**
|
|
22
|
+
* Returns bundle entries matching resource IDs produced by `getResourceIds`.
|
|
23
|
+
*/
|
|
24
|
+
getResourceEntriesByIds(resourceIds: readonly string[]): BundleEntry[];
|
|
25
|
+
/**
|
|
26
|
+
* Resolves the entry URL (`fullUrl`) for a given entry/resource identifier.
|
|
27
|
+
*/
|
|
28
|
+
getEntryUrl(entryId: string): string | undefined;
|
|
29
|
+
private resolveBundleEntryId;
|
|
30
|
+
private resolveIdentifierFromClaims;
|
|
31
|
+
private matchesResourceFilters;
|
|
32
|
+
private matchesSections;
|
|
33
|
+
private resolveEntryDate;
|
|
34
|
+
private matchesDateRange;
|
|
35
|
+
}
|