@truvity/sdk 0.37.4 → 0.37.7
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/Client.d.ts +3 -1
- package/Client.d.ts.map +1 -1
- package/Client.js +43 -1
- package/Client.js.map +1 -1
- package/ExtendedClient.d.ts +1 -2
- package/ExtendedClient.d.ts.map +1 -1
- package/ExtendedClient.js +1 -5
- package/ExtendedClient.js.map +1 -1
- package/api/resources/apiKeys/client/Client.d.ts +3 -1
- package/api/resources/apiKeys/client/Client.d.ts.map +1 -1
- package/api/resources/apiKeys/client/Client.js +28 -31
- package/api/resources/apiKeys/client/Client.js.map +1 -1
- package/api/resources/apiKeys/client/index.d.ts +1 -0
- package/api/resources/apiKeys/client/index.d.ts.map +1 -1
- package/api/resources/apiKeys/client/index.js.map +1 -1
- package/api/resources/credentials/client/Client.d.ts +4 -3
- package/api/resources/credentials/client/Client.d.ts.map +1 -1
- package/api/resources/credentials/client/Client.js +38 -41
- package/api/resources/credentials/client/Client.js.map +1 -1
- package/api/resources/credentials/client/index.d.ts +1 -0
- package/api/resources/credentials/client/index.d.ts.map +1 -1
- package/api/resources/credentials/client/index.js.map +1 -1
- package/api/resources/desk/client/Client.d.ts +3 -1
- package/api/resources/desk/client/Client.d.ts.map +1 -1
- package/api/resources/desk/client/Client.js +7 -10
- package/api/resources/desk/client/Client.js.map +1 -1
- package/api/resources/desk/client/index.d.ts +1 -0
- package/api/resources/desk/client/index.d.ts.map +1 -1
- package/api/resources/desk/client/index.js.map +1 -1
- package/api/resources/didcommMessages/client/Client.d.ts +3 -1
- package/api/resources/didcommMessages/client/Client.d.ts.map +1 -1
- package/api/resources/didcommMessages/client/Client.js +28 -31
- package/api/resources/didcommMessages/client/Client.js.map +1 -1
- package/api/resources/didcommMessages/client/index.d.ts +1 -0
- package/api/resources/didcommMessages/client/index.d.ts.map +1 -1
- package/api/resources/didcommMessages/client/index.js.map +1 -1
- package/api/resources/dids/client/Client.d.ts +3 -1
- package/api/resources/dids/client/Client.d.ts.map +1 -1
- package/api/resources/dids/client/Client.js +4 -7
- package/api/resources/dids/client/Client.js.map +1 -1
- package/api/resources/dids/client/index.d.ts +1 -0
- package/api/resources/dids/client/index.d.ts.map +1 -1
- package/api/resources/dids/client/index.js.map +1 -1
- package/api/resources/drafts/client/Client.d.ts +4 -3
- package/api/resources/drafts/client/Client.d.ts.map +1 -1
- package/api/resources/drafts/client/Client.js +38 -41
- package/api/resources/drafts/client/Client.js.map +1 -1
- package/api/resources/drafts/client/index.d.ts +1 -0
- package/api/resources/drafts/client/index.d.ts.map +1 -1
- package/api/resources/drafts/client/index.js.map +1 -1
- package/api/resources/files/client/Client.d.ts +4 -3
- package/api/resources/files/client/Client.d.ts.map +1 -1
- package/api/resources/files/client/Client.js +35 -38
- package/api/resources/files/client/Client.js.map +1 -1
- package/api/resources/files/client/index.d.ts +1 -0
- package/api/resources/files/client/index.d.ts.map +1 -1
- package/api/resources/files/client/index.js.map +1 -1
- package/api/resources/gdpr/client/Client.d.ts +3 -1
- package/api/resources/gdpr/client/Client.d.ts.map +1 -1
- package/api/resources/gdpr/client/Client.js +4 -7
- package/api/resources/gdpr/client/Client.js.map +1 -1
- package/api/resources/gdpr/client/index.d.ts +1 -0
- package/api/resources/gdpr/client/index.d.ts.map +1 -1
- package/api/resources/gdpr/client/index.js.map +1 -1
- package/api/resources/keys/client/Client.d.ts +6 -5
- package/api/resources/keys/client/Client.d.ts.map +1 -1
- package/api/resources/keys/client/Client.js +43 -46
- package/api/resources/keys/client/Client.js.map +1 -1
- package/api/resources/keys/client/index.d.ts +1 -0
- package/api/resources/keys/client/index.d.ts.map +1 -1
- package/api/resources/keys/client/index.js.map +1 -1
- package/api/resources/presentations/client/Client.d.ts +5 -4
- package/api/resources/presentations/client/Client.d.ts.map +1 -1
- package/api/resources/presentations/client/Client.js +45 -48
- package/api/resources/presentations/client/Client.js.map +1 -1
- package/api/resources/presentations/client/index.d.ts +1 -0
- package/api/resources/presentations/client/index.d.ts.map +1 -1
- package/api/resources/presentations/client/index.js.map +1 -1
- package/api/types/DidCommMessageBlobAttachmentDescriptor.d.ts +16 -0
- package/api/types/DidCommMessageBlobAttachmentDescriptor.d.ts.map +1 -0
- package/api/types/DidCommMessageBlobAttachmentDescriptor.js +6 -0
- package/api/types/DidCommMessageBlobAttachmentDescriptor.js.map +1 -0
- package/api/types/DidCommMessageBlobAttachmentStatus.d.ts +14 -0
- package/api/types/DidCommMessageBlobAttachmentStatus.d.ts.map +1 -0
- package/api/types/DidCommMessageBlobAttachmentStatus.js +6 -0
- package/api/types/DidCommMessageBlobAttachmentStatus.js.map +1 -0
- package/api/types/DidCommMessageBlobDescriptor.d.ts +27 -0
- package/api/types/DidCommMessageBlobDescriptor.d.ts.map +1 -0
- package/api/types/{ProblemMethodNotAllowedAlive.js → DidCommMessageBlobDescriptor.js} +1 -1
- package/api/types/DidCommMessageBlobDescriptor.js.map +1 -0
- package/api/types/DidCommMessageBlobStatus.d.ts +20 -0
- package/api/types/DidCommMessageBlobStatus.d.ts.map +1 -0
- package/api/types/{ProblemPreconditionFailedBlob.js → DidCommMessageBlobStatus.js} +1 -1
- package/api/types/DidCommMessageBlobStatus.js.map +1 -0
- package/api/types/DidCommMessageCreateBlobs.d.ts +11 -0
- package/api/types/DidCommMessageCreateBlobs.d.ts.map +1 -0
- package/api/types/{ProblemMethodNotAllowedDeleted.js → DidCommMessageCreateBlobs.js} +1 -1
- package/api/types/DidCommMessageCreateBlobs.js.map +1 -0
- package/api/types/DidCommMessageCreateBlobsStatus.d.ts +11 -0
- package/api/types/DidCommMessageCreateBlobsStatus.d.ts.map +1 -0
- package/api/types/{ProblemPreconditionFailedResource.js → DidCommMessageCreateBlobsStatus.js} +1 -1
- package/api/types/DidCommMessageCreateBlobsStatus.js.map +1 -0
- package/api/types/MethodNotAllowedProblems.d.ts +2 -2
- package/api/types/MethodNotAllowedProblems.d.ts.map +1 -1
- package/api/types/MethodNotAllowedProblems.js.map +1 -1
- package/api/types/PreconditionFailedProblems.d.ts +2 -2
- package/api/types/PreconditionFailedProblems.js.map +1 -1
- package/api/types/ProblemBadRequest.d.ts +1 -1
- package/api/types/ProblemBadRequest.js.map +1 -1
- package/api/types/ProblemBadRequestBlobInvalidJson.d.ts +1 -1
- package/api/types/ProblemBadRequestBlobInvalidJson.js.map +1 -1
- package/api/types/ProblemBadRequestHasNullUnicodeCharacter.d.ts +1 -1
- package/api/types/ProblemBadRequestHasNullUnicodeCharacter.js.map +1 -1
- package/api/types/ProblemBadRequestPayloadTooLarge.d.ts +1 -1
- package/api/types/ProblemBadRequestPayloadTooLarge.js.map +1 -1
- package/api/types/ProblemBlobNotFound.d.ts +1 -1
- package/api/types/ProblemBlobNotFound.js.map +1 -1
- package/api/types/{ProblemPreconditionFailedBlob.d.ts → ProblemBlobPreconditionFailed.d.ts} +2 -2
- package/api/types/{ProblemPreconditionFailedBlob.d.ts.map → ProblemBlobPreconditionFailed.d.ts.map} +1 -1
- package/api/types/ProblemBlobPreconditionFailed.js +6 -0
- package/api/types/{ProblemPreconditionFailedBlob.js.map → ProblemBlobPreconditionFailed.js.map} +1 -1
- package/api/types/ProblemConflict.d.ts +1 -1
- package/api/types/ProblemConflict.js.map +1 -1
- package/api/types/ProblemConflictBlobRestoreInProgress.d.ts +1 -1
- package/api/types/ProblemConflictBlobRestoreInProgress.js.map +1 -1
- package/api/types/ProblemForbidden.d.ts +1 -1
- package/api/types/ProblemForbidden.js.map +1 -1
- package/api/types/ProblemInternalServerError.d.ts +1 -1
- package/api/types/ProblemInternalServerError.js.map +1 -1
- package/api/types/ProblemMethodNotAllowed.d.ts +1 -1
- package/api/types/ProblemMethodNotAllowed.js.map +1 -1
- package/api/types/{ProblemMethodNotAllowedAlive.d.ts → ProblemMethodNotAllowedResourceAlive.d.ts} +2 -2
- package/api/types/ProblemMethodNotAllowedResourceAlive.d.ts.map +1 -0
- package/api/types/ProblemMethodNotAllowedResourceAlive.js +6 -0
- package/api/types/ProblemMethodNotAllowedResourceAlive.js.map +1 -0
- package/api/types/{ProblemMethodNotAllowedDeleted.d.ts → ProblemMethodNotAllowedResourceDeleted.d.ts} +2 -2
- package/api/types/ProblemMethodNotAllowedResourceDeleted.d.ts.map +1 -0
- package/api/types/ProblemMethodNotAllowedResourceDeleted.js +6 -0
- package/api/types/ProblemMethodNotAllowedResourceDeleted.js.map +1 -0
- package/api/types/ProblemNotFound.d.ts +1 -1
- package/api/types/ProblemNotFound.js.map +1 -1
- package/api/types/ProblemPreconditionFailed.d.ts +1 -1
- package/api/types/ProblemPreconditionFailed.js.map +1 -1
- package/api/types/{ProblemPreconditionFailedResource.d.ts → ProblemResourcePreconditionFailed.d.ts} +2 -2
- package/api/types/{ProblemPreconditionFailedResource.d.ts.map → ProblemResourcePreconditionFailed.d.ts.map} +1 -1
- package/api/types/ProblemResourcePreconditionFailed.js +6 -0
- package/api/types/{ProblemPreconditionFailedResource.js.map → ProblemResourcePreconditionFailed.js.map} +1 -1
- package/api/types/ProblemResourceRevisionNotFound.d.ts +1 -1
- package/api/types/ProblemResourceRevisionNotFound.js.map +1 -1
- package/api/types/ProblemServiceUnavailable.d.ts +1 -1
- package/api/types/ProblemServiceUnavailable.js.map +1 -1
- package/api/types/ProblemUnauthorized.d.ts +1 -1
- package/api/types/ProblemUnauthorized.js.map +1 -1
- package/api/types/ProblemUnsupportedMediaType.d.ts +1 -1
- package/api/types/ProblemUnsupportedMediaType.js.map +1 -1
- package/api/types/index.d.ts +10 -4
- package/api/types/index.d.ts.map +1 -1
- package/api/types/index.js +10 -4
- package/api/types/index.js.map +1 -1
- package/core/fetcher/BinaryResponse.d.ts +21 -0
- package/core/fetcher/BinaryResponse.d.ts.map +1 -0
- package/core/fetcher/BinaryResponse.js +18 -0
- package/core/fetcher/BinaryResponse.js.map +1 -0
- package/core/fetcher/Fetcher.d.ts +3 -2
- package/core/fetcher/Fetcher.d.ts.map +1 -1
- package/core/fetcher/Fetcher.js +25 -12
- package/core/fetcher/Fetcher.js.map +1 -1
- package/core/fetcher/ResponseWithBody.d.ts +5 -0
- package/core/fetcher/ResponseWithBody.d.ts.map +1 -0
- package/core/fetcher/ResponseWithBody.js +7 -0
- package/core/fetcher/ResponseWithBody.js.map +1 -0
- package/core/fetcher/createRequestUrl.d.ts +1 -1
- package/core/fetcher/createRequestUrl.d.ts.map +1 -1
- package/core/fetcher/createRequestUrl.js +3 -7
- package/core/fetcher/createRequestUrl.js.map +1 -1
- package/core/fetcher/getErrorResponseBody.d.ts +2 -0
- package/core/fetcher/getErrorResponseBody.d.ts.map +1 -0
- package/core/fetcher/getErrorResponseBody.js +45 -0
- package/core/fetcher/getErrorResponseBody.js.map +1 -0
- package/core/fetcher/getFetchFn.d.ts +1 -4
- package/core/fetcher/getFetchFn.d.ts.map +1 -1
- package/core/fetcher/getFetchFn.js +1 -52
- package/core/fetcher/getFetchFn.js.map +1 -1
- package/core/fetcher/getResponseBody.d.ts.map +1 -1
- package/core/fetcher/getResponseBody.js +34 -33
- package/core/fetcher/getResponseBody.js.map +1 -1
- package/core/fetcher/index.d.ts +1 -0
- package/core/fetcher/index.d.ts.map +1 -1
- package/core/fetcher/index.js.map +1 -1
- package/core/headers.d.ts +4 -0
- package/core/headers.d.ts.map +1 -0
- package/core/headers.js +30 -0
- package/core/headers.js.map +1 -0
- package/core/index.d.ts +1 -0
- package/core/index.d.ts.map +1 -1
- package/core/index.js +2 -1
- package/core/index.js.map +1 -1
- package/core/runtime/runtime.d.ts.map +1 -1
- package/core/runtime/runtime.js +0 -1
- package/core/runtime/runtime.js.map +1 -1
- package/core/url/index.d.ts +3 -0
- package/core/url/index.d.ts.map +1 -0
- package/core/url/index.js +8 -0
- package/core/url/index.js.map +1 -0
- package/core/url/join.d.ts +2 -0
- package/core/url/join.d.ts.map +1 -0
- package/core/url/join.js +50 -0
- package/core/url/join.js.map +1 -0
- package/core/url/qs.d.ts +7 -0
- package/core/url/qs.d.ts.map +1 -0
- package/core/url/qs.js +65 -0
- package/core/url/qs.js.map +1 -0
- package/documents/credential/document/vcdm.d.ts +1 -1
- package/documents/credential/document/vcdm.d.ts.map +1 -1
- package/documents/credential/document/vcdm.js +12 -1
- package/documents/credential/document/vcdm.js.map +1 -1
- package/documents/credential/document.d.ts +2 -2
- package/documents/credential/document.d.ts.map +1 -1
- package/documents/credential/document.js +21 -8
- package/documents/credential/document.js.map +1 -1
- package/documents/credential/draft/draft.d.ts +2 -2
- package/documents/credential/draft/draft.d.ts.map +1 -1
- package/documents/credential/draft/draft.js.map +1 -1
- package/documents/credential/flavor/vcdm1_1.d.ts +3 -3
- package/documents/credential/flavor/vcdm1_1.d.ts.map +1 -1
- package/documents/credential/flavor/vcdm1_1.js +27 -25
- package/documents/credential/flavor/vcdm1_1.js.map +1 -1
- package/documents/credential/flavor/vcdm2_0.d.ts +2 -2
- package/documents/credential/flavor/vcdm2_0.d.ts.map +1 -1
- package/documents/credential/flavor/vcdm2_0.js +29 -16
- package/documents/credential/flavor/vcdm2_0.js.map +1 -1
- package/documents/credential/flavor.d.ts +2 -2
- package/documents/credential/flavor.d.ts.map +1 -1
- package/documents/credential/flavor.js +25 -10
- package/documents/credential/flavor.js.map +1 -1
- package/documents/credential/flavor.spec.js +3 -3
- package/documents/credential/flavor.spec.js.map +1 -1
- package/documents/credential/types.d.ts +4 -4
- package/documents/credential/types.d.ts.map +1 -1
- package/documents/credential/types.js.map +1 -1
- package/documents/credential/verifiable/verifiable.d.ts.map +1 -1
- package/documents/credential/verifiable/verifiable.js +1 -2
- package/documents/credential/verifiable/verifiable.js.map +1 -1
- package/documents/credential/verifiable/with-claims.js +1 -1
- package/documents/credential/verifiable/with-claims.js.map +1 -1
- package/documents/credential.d.ts.map +1 -1
- package/documents/credential.js +1 -5
- package/documents/credential.js.map +1 -1
- package/documents/index.d.ts +0 -1
- package/documents/index.d.ts.map +1 -1
- package/documents/index.js +0 -1
- package/documents/index.js.map +1 -1
- package/documents/models.d.ts +1 -2
- package/documents/models.d.ts.map +1 -1
- package/documents/models.js +5 -3
- package/documents/models.js.map +1 -1
- package/documents/presentation.d.ts.map +1 -1
- package/documents/presentation.js +1 -5
- package/documents/presentation.js.map +1 -1
- package/documents/types.d.ts +2 -3
- package/documents/types.d.ts.map +1 -1
- package/documents/types.js.map +1 -1
- package/middlewares/csrf/csrf.d.ts.map +1 -1
- package/middlewares/csrf/csrf.js +1 -5
- package/middlewares/csrf/csrf.js.map +1 -1
- package/package.json +9 -14
- package/serialization/types/DidCommMessageBlobAttachmentDescriptor.d.ts +17 -0
- package/serialization/types/DidCommMessageBlobAttachmentDescriptor.d.ts.map +1 -0
- package/serialization/types/DidCommMessageBlobAttachmentDescriptor.js +48 -0
- package/serialization/types/DidCommMessageBlobAttachmentDescriptor.js.map +1 -0
- package/serialization/types/DidCommMessageBlobAttachmentStatus.d.ts +16 -0
- package/serialization/types/DidCommMessageBlobAttachmentStatus.d.ts.map +1 -0
- package/serialization/types/DidCommMessageBlobAttachmentStatus.js +47 -0
- package/serialization/types/DidCommMessageBlobAttachmentStatus.js.map +1 -0
- package/serialization/types/DidCommMessageBlobDescriptor.d.ts +21 -0
- package/serialization/types/DidCommMessageBlobDescriptor.d.ts.map +1 -0
- package/serialization/types/DidCommMessageBlobDescriptor.js +52 -0
- package/serialization/types/DidCommMessageBlobDescriptor.js.map +1 -0
- package/serialization/types/DidCommMessageBlobStatus.d.ts +18 -0
- package/serialization/types/DidCommMessageBlobStatus.d.ts.map +1 -0
- package/serialization/types/DidCommMessageBlobStatus.js +49 -0
- package/serialization/types/DidCommMessageBlobStatus.js.map +1 -0
- package/serialization/types/DidCommMessageCreateBlobs.d.ts +14 -0
- package/serialization/types/DidCommMessageCreateBlobs.d.ts.map +1 -0
- package/serialization/types/DidCommMessageCreateBlobs.js +45 -0
- package/serialization/types/DidCommMessageCreateBlobs.js.map +1 -0
- package/serialization/types/DidCommMessageCreateBlobsStatus.d.ts +14 -0
- package/serialization/types/DidCommMessageCreateBlobsStatus.d.ts.map +1 -0
- package/serialization/types/DidCommMessageCreateBlobsStatus.js +45 -0
- package/serialization/types/DidCommMessageCreateBlobsStatus.js.map +1 -0
- package/serialization/types/MethodNotAllowedProblems.d.ts +4 -4
- package/serialization/types/MethodNotAllowedProblems.d.ts.map +1 -1
- package/serialization/types/MethodNotAllowedProblems.js +4 -4
- package/serialization/types/MethodNotAllowedProblems.js.map +1 -1
- package/serialization/types/PreconditionFailedProblems.d.ts +4 -4
- package/serialization/types/PreconditionFailedProblems.js +4 -4
- package/serialization/types/PreconditionFailedProblems.js.map +1 -1
- package/serialization/types/{ProblemPreconditionFailedBlob.d.ts → ProblemBlobPreconditionFailed.d.ts} +3 -3
- package/serialization/types/{ProblemPreconditionFailedBlob.d.ts.map → ProblemBlobPreconditionFailed.d.ts.map} +1 -1
- package/serialization/types/{ProblemPreconditionFailedBlob.js → ProblemBlobPreconditionFailed.js} +3 -3
- package/serialization/types/{ProblemPreconditionFailedBlob.js.map → ProblemBlobPreconditionFailed.js.map} +1 -1
- package/serialization/types/{ProblemMethodNotAllowedDeleted.d.ts → ProblemMethodNotAllowedResourceAlive.d.ts} +3 -3
- package/serialization/types/ProblemMethodNotAllowedResourceAlive.d.ts.map +1 -0
- package/serialization/types/{ProblemMethodNotAllowedDeleted.js → ProblemMethodNotAllowedResourceAlive.js} +3 -3
- package/serialization/types/ProblemMethodNotAllowedResourceAlive.js.map +1 -0
- package/serialization/types/{ProblemMethodNotAllowedAlive.d.ts → ProblemMethodNotAllowedResourceDeleted.d.ts} +3 -3
- package/serialization/types/ProblemMethodNotAllowedResourceDeleted.d.ts.map +1 -0
- package/serialization/types/{ProblemMethodNotAllowedAlive.js → ProblemMethodNotAllowedResourceDeleted.js} +3 -3
- package/serialization/types/ProblemMethodNotAllowedResourceDeleted.js.map +1 -0
- package/serialization/types/{ProblemPreconditionFailedResource.d.ts → ProblemResourcePreconditionFailed.d.ts} +3 -3
- package/serialization/types/{ProblemPreconditionFailedResource.d.ts.map → ProblemResourcePreconditionFailed.d.ts.map} +1 -1
- package/serialization/types/{ProblemPreconditionFailedResource.js → ProblemResourcePreconditionFailed.js} +3 -3
- package/serialization/types/{ProblemPreconditionFailedResource.js.map → ProblemResourcePreconditionFailed.js.map} +1 -1
- package/serialization/types/index.d.ts +10 -4
- package/serialization/types/index.d.ts.map +1 -1
- package/serialization/types/index.js +10 -4
- package/serialization/types/index.js.map +1 -1
- package/api/types/ProblemMethodNotAllowedAlive.d.ts.map +0 -1
- package/api/types/ProblemMethodNotAllowedAlive.js.map +0 -1
- package/api/types/ProblemMethodNotAllowedDeleted.d.ts.map +0 -1
- package/api/types/ProblemMethodNotAllowedDeleted.js.map +0 -1
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -31
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts.map +0 -1
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -248
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js.map +0 -1
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -22
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts.map +0 -1
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -127
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js.map +0 -1
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -32
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts.map +0 -1
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -230
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js.map +0 -1
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -19
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts.map +0 -1
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +0 -60
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js.map +0 -1
- package/documents/utils/stream.d.ts +0 -8
- package/documents/utils/stream.d.ts.map +0 -1
- package/documents/utils/stream.js +0 -50
- package/documents/utils/stream.js.map +0 -1
- package/serialization/types/ProblemMethodNotAllowedAlive.d.ts.map +0 -1
- package/serialization/types/ProblemMethodNotAllowedAlive.js.map +0 -1
- package/serialization/types/ProblemMethodNotAllowedDeleted.d.ts.map +0 -1
- package/serialization/types/ProblemMethodNotAllowedDeleted.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qs.js","sourceRoot":"","sources":["../../../src/core/url/qs.ts"],"names":[],"mappings":";;AA+DA,sCAUC;AApED,MAAM,gBAAgB,GAAiC;IACnD,WAAW,EAAE,SAAS;IACtB,MAAM,EAAE,IAAI;CACN,CAAC;AAEX,SAAS,WAAW,CAAC,KAAc,EAAE,YAAqB;IACtD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACd,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACd,CAAC;IACD,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,OAAO,YAAY,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;AACxE,CAAC;AAED,SAAS,eAAe,CAAC,GAA4B,EAAE,MAAM,GAAG,EAAE,EAAE,OAAqC;IACrG,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAEnD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,SAAS;QACb,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACvB,IAAI,KAAK,C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gBAC7D,SAAS;YACb,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,KAAgC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACvF,CAAC;aAAM,CAAC;YACJ,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YAC1E,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,IAAI,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAgB,aAAa,CAAC,GAAY,EAAE,OAA4B;IACpE,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACzC,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,KAAK,GAAG,eAAe,CAAC,GAA8B,EAAE,EAAE,kCACzD,gBAAgB,GAChB,OAAO,EACZ,CAAC;IACH,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["interface QueryStringOptions {\n arrayFormat?: 'indices' | 'repeat';\n encode?: boolean;\n}\n\nconst defaultQsOptions: Required<QueryStringOptions> = {\n arrayFormat: 'indices',\n encode: true,\n} as const;\n\nfunction encodeValue(value: unknown, shouldEncode: boolean): string {\n if (value === undefined) {\n return '';\n }\n if (value === null) {\n return '';\n }\n const stringValue = String(value);\n return shouldEncode ? encodeURIComponent(stringValue) : stringValue;\n}\n\nfunction stringifyObject(obj: Record<string, unknown>, prefix = '', options: Required<QueryStringOptions>): string[] {\n const parts: string[] = [];\n\n for (const [key, value] of Object.entries(obj)) {\n const fullKey = prefix ? `${prefix}[${key}]` : key;\n\n if (value === undefined) {\n continue;\n }\n\n if (Array.isArray(value)) {\n if (value.length === 0) {\n continue;\n }\n for (let i = 0; i < value.length; i++) {\n const item = value[i];\n if (item === undefined) {\n continue;\n }\n if (typeof item === 'object' && !Array.isArray(item) && item !== null) {\n const arrayKey = options.arrayFormat === 'indices' ? `${fullKey}[${i}]` : fullKey;\n parts.push(...stringifyObject(item as Record<string, unknown>, arrayKey, options));\n } else {\n const arrayKey = options.arrayFormat === 'indices' ? `${fullKey}[${i}]` : fullKey;\n const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;\n parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);\n }\n }\n } else if (typeof value === 'object' && value !== null) {\n if (Object.keys(value as Record<string, unknown>).length === 0) {\n continue;\n }\n parts.push(...stringifyObject(value as Record<string, unknown>, fullKey, options));\n } else {\n const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;\n parts.push(`${encodedKey}=${encodeValue(value, options.encode)}`);\n }\n }\n\n return parts;\n}\n\nexport function toQueryString(obj: unknown, options?: QueryStringOptions): string {\n if (obj == null || typeof obj !== 'object') {\n return '';\n }\n\n const parts = stringifyObject(obj as Record<string, unknown>, '', {\n ...defaultQsOptions,\n ...options,\n });\n return parts.join('&');\n}\n"]}
|
|
@@ -45,6 +45,6 @@ export declare const vcdmDocumentSchema: core.serialization.inferObjectSchemaFro
|
|
|
45
45
|
export type VcdmDocument = inferParsedObject<typeof vcdmDocumentSchema>;
|
|
46
46
|
export declare class VcdmCredentialDocument extends CredentialDocument {
|
|
47
47
|
protected jsonToVcdm(input: Json): VcdmDocument;
|
|
48
|
-
protected blobToVcdm(input: CredentialBlob): VcdmDocument
|
|
48
|
+
protected blobToVcdm(input: CredentialBlob): Promise<VcdmDocument>;
|
|
49
49
|
}
|
|
50
50
|
//# sourceMappingURL=vcdm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vcdm.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/document/vcdm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;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AAM,kBAAkB;;;;;;;;;;;;;;EAQ7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAExE,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC1D,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,GAAG,YAAY;cAI/B,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;CAG3E"}
|
|
@@ -32,6 +32,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
35
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
45
|
exports.VcdmCredentialDocument = exports.vcdmDocumentSchema = exports.jsonSchemaCredentialSubjectSchema = exports.vcdmProofSetSchema = exports.vcdmProofSchema = exports.credentialSchemaSchema = exports.jsonldContextSchema = exports.jsonldVocabSchema = void 0;
|
|
37
46
|
const core = __importStar(require("../../../core"));
|
|
@@ -79,7 +88,9 @@ class VcdmCredentialDocument extends document_1.CredentialDocument {
|
|
|
79
88
|
return this.parseJson(exports.vcdmDocumentSchema, input);
|
|
80
89
|
}
|
|
81
90
|
blobToVcdm(input) {
|
|
82
|
-
return this
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
return this.parseBlob(exports.vcdmDocumentSchema, input);
|
|
93
|
+
});
|
|
83
94
|
}
|
|
84
95
|
}
|
|
85
96
|
exports.VcdmCredentialDocument = VcdmCredentialDocument;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vcdm.js","sourceRoot":"","sources":["../../../../src/documents/credential/document/vcdm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vcdm.js","sourceRoot":"","sources":["../../../../src/documents/credential/document/vcdm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAGtC,0CAAiD;AAEpC,QAAA,iBAAiB,GAAG,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC;IACrE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;IAC3B,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;CAChC,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC;IACvE,yBAAiB;IACjB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,yBAAiB,CAAC;CAC7C,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IAC5D,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;IAC/B,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC;QAC1C,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;QAC3B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;KACvD,CAAC;CACL,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IACrD,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;CACpC,CAAC,CAAC;AAEU,QAAA,k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as core from '../../../core';\nimport { inferParsedObject } from '../../../core/schemas';\nimport type { CredentialBlob, Json } from '../types';\nimport { CredentialDocument } from '../document';\n\nexport const jsonldVocabSchema = core.serialization.undiscriminatedUnion([\n core.serialization.string(),\n core.serialization.object({}),\n]);\n\nexport const jsonldContextSchema = core.serialization.undiscriminatedUnion([\n jsonldVocabSchema,\n core.serialization.list(jsonldVocabSchema),\n]);\n\nexport const credentialSchemaSchema = core.serialization.object({\n id: core.serialization.string(),\n type: core.serialization.undiscriminatedUnion([\n core.serialization.string(),\n core.serialization.list(core.serialization.string()),\n ]),\n});\n\nexport const vcdmProofSchema = core.serialization.object({\n type: core.serialization.string(),\n});\n\nexport const vcdmProofSetSchema = core.serialization.undiscriminatedUnion([\n vcdmProofSchema,\n core.serialization.list(vcdmProofSchema),\n]);\n\nexport const jsonSchemaCredentialSubjectSchema = core.serialization.object({\n id: core.serialization.string(),\n type: core.serialization.stringLiteral('JsonSchema'),\n jsonSchema: core.serialization.object({\n $schema: core.serialization.stringLiteral('https://json-schema.org/draft/2020-12/schema'),\n }),\n});\n\nexport const vcdmDocumentSchema = core.serialization.object({\n '@context': jsonldContextSchema,\n type: core.serialization.list(core.serialization.string()),\n credentialSubject: core.serialization.object({\n id: core.serialization.string().optional(),\n type: core.serialization.string().optional(),\n }),\n credentialSchema: credentialSchemaSchema.optional(),\n});\n\nexport type VcdmDocument = inferParsedObject<typeof vcdmDocumentSchema>;\n\nexport class VcdmCredentialDocument extends CredentialDocument {\n protected jsonToVcdm(input: Json): VcdmDocument {\n return this.parseJson(vcdmDocumentSchema, input);\n }\n\n protected async blobToVcdm(input: CredentialBlob): Promise<VcdmDocument> {\n return this.parseBlob(vcdmDocumentSchema, input);\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { inferParsed, Schema } from '../../core/schemas';
|
|
2
2
|
import type { CredentialBlob, Json } from './types';
|
|
3
3
|
export declare class CredentialDocument {
|
|
4
|
-
protected blobToJson(input: CredentialBlob): Json
|
|
4
|
+
protected blobToJson(input: CredentialBlob): Promise<Json>;
|
|
5
5
|
protected parseJson<T extends Schema<any, any>>(schema: T, input: Json): inferParsed<T>;
|
|
6
|
-
protected parseBlob<T extends Schema<any, any>>(schema: T, input: CredentialBlob): inferParsed<T
|
|
6
|
+
protected parseBlob<T extends Schema<any, any>>(schema: T, input: CredentialBlob): Promise<inferParsed<T>>;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/documents/credential/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpD,qBAAa,kBAAkB;
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/documents/credential/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpD,qBAAa,kBAAkB;cACX,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAShE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC;cAQvE,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAGnH"}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.CredentialDocument = void 0;
|
|
4
13
|
class CredentialDocument {
|
|
5
14
|
blobToJson(input) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(yield input.text());
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
console.error(err);
|
|
21
|
+
throw new Error('Invalid JSON in Credential Blob');
|
|
22
|
+
}
|
|
23
|
+
});
|
|
13
24
|
}
|
|
14
25
|
parseJson(schema, input) {
|
|
15
26
|
return schema.parseOrThrow(input, {
|
|
@@ -19,7 +30,9 @@ class CredentialDocument {
|
|
|
19
30
|
});
|
|
20
31
|
}
|
|
21
32
|
parseBlob(schema, input) {
|
|
22
|
-
return this
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return this.parseJson(schema, yield this.blobToJson(input));
|
|
35
|
+
});
|
|
23
36
|
}
|
|
24
37
|
}
|
|
25
38
|
exports.CredentialDocument = CredentialDocument;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../../src/documents/credential/document.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../../src/documents/credential/document.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,MAAa,kBAAkB;IACX,UAAU,CAAC,KAAqB;;YAC5C,IAAI,CAAC;gBACD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YAC1C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;YACvD,CAAC;QACL,CAAC;KAAA;IAES,SAAS,CAA6B,MAAS,EAAE,KAAW;QAClE,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE;YAC9B,sBAAsB,EAAE,aAAa;YACrC,6BAA6B,EAAE,IAAI;YACnC,2BAA2B,EAAE,IAAI;SACpC,CAAC,CAAC;IACP,CAAC;IAEe,SAAS,CAA6B,MAAS,EAAE,KAAqB;;YAClF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,CAAC;KAAA;CACJ;AArBD,gDAqBC","sourcesContent":["import { inferParsed, Schema } from '../../core/schemas';\nimport type { CredentialBlob, Json } from './types';\n\nexport class CredentialDocument {\n protected async blobToJson(input: CredentialBlob): Promise<Json> {\n try {\n return JSON.parse(await input.text());\n } catch (err) {\n console.error(err);\n throw new Error('Invalid JSON in Credential Blob');\n }\n }\n\n protected parseJson<T extends Schema<any, any>>(schema: T, input: Json): inferParsed<T> {\n return schema.parseOrThrow(input, {\n unrecognizedObjectKeys: 'passthrough',\n allowUnrecognizedUnionMembers: true,\n allowUnrecognizedEnumValues: true,\n });\n }\n\n protected async parseBlob<T extends Schema<any, any>>(schema: T, input: CredentialBlob): Promise<inferParsed<T>> {\n return this.parseJson(schema, await this.blobToJson(input));\n }\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Readable } from 'stream';
|
|
2
1
|
import { ApiClient, DraftDescriptor } from '../../types';
|
|
3
2
|
import { DraftExportRequest, ResourceDraft } from '../../../api';
|
|
4
3
|
import { DraftDataDescriptor, DraftMetadata } from '../types';
|
|
5
4
|
import { LinkedCredential } from '../../models';
|
|
6
5
|
import { VerifiableCredential } from '../verifiable/verifiable';
|
|
6
|
+
import { BinaryResponse } from '../../../core';
|
|
7
7
|
export declare class DraftCredential {
|
|
8
8
|
protected client: ApiClient;
|
|
9
9
|
protected draftData: DraftDataDescriptor;
|
|
@@ -11,7 +11,7 @@ export declare class DraftCredential {
|
|
|
11
11
|
constructor(client: ApiClient, draftData: DraftDataDescriptor, descriptor: DraftDescriptor);
|
|
12
12
|
toLinkedCredential(): LinkedCredential<unknown>;
|
|
13
13
|
getMetaData(): Promise<DraftMetadata>;
|
|
14
|
-
export(params: DraftExportRequest): Promise<
|
|
14
|
+
export(params: DraftExportRequest): Promise<BinaryResponse>;
|
|
15
15
|
delete(): Promise<void>;
|
|
16
16
|
issue(privateKeyId: string): Promise<VerifiableCredential>;
|
|
17
17
|
toResource(): Promise<ResourceDraft>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/draft/draft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/draft/draft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,qBAAa,eAAe;IAEpB,SAAS,CAAC,MAAM,EAAE,SAAS;IAC3B,SAAS,CAAC,SAAS,EAAE,mBAAmB;IACjC,UAAU,EAAE,eAAe;gBAFxB,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,mBAAmB,EACjC,UAAU,EAAE,eAAe;IAGtC,kBAAkB,IAAI,gBAAgB,CAAC,OAAO,CAAC;IAIzC,WAAW,IAAI,OAAO,CAAC,aAAa,CAAC;IASrC,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IAI3D,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAOvB,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAgB1D,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC;CAG7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draft.js","sourceRoot":"","sources":["../../../../src/documents/credential/draft/draft.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"draft.js","sourceRoot":"","sources":["../../../../src/documents/credential/draft/draft.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yDAAsD;AAGtD,yCAAgD;AAChD,yDAAgE;AAChE,uDAAkE;AAClE,2CAA+D;AAG/D,MAAa,eAAe;IACxB,YACc,MAAiB,EACjB,SAA8B,EACjC,UAA2B;QAFxB,WAAM,GAAN,MAAM,CAAW;QACjB,cAAS,GAAT,SAAS,CAAqB;QACjC,eAAU,GAAV,UAAU,CAAiB;IACnC,CAAC;IAEJ,kBAAkB;QACd,OAAO,IAAI,yBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;IAChF,CAAC;IAE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AAI,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC1F,CAAC;KAAA;CACJ;AAlDD,0CAkDC","sourcesContent":["import { ApiClient, DraftDescriptor } from '../../types';\nimport { generateKey } from '../../utils/idempotency';\nimport { DraftExportRequest, ResourceDraft } from '../../../api';\nimport { DraftDataDescriptor, DraftMetadata } from '../types';\nimport { LinkedCredential } from '../../models';\nimport { VerifiableCredential } from '../verifiable/verifiable';\nimport { strictlyConvertToApiType } from '../../utils/converters';\nimport { verifiableCredentialDataSchema } from '../../schemas';\nimport { BinaryResponse } from '../../../core';\n\nexport class DraftCredential {\n constructor(\n protected client: ApiClient,\n protected draftData: DraftDataDescriptor,\n public descriptor: DraftDescriptor,\n ) {}\n\n toLinkedCredential(): LinkedCredential<unknown> {\n return new LinkedCredential(this.client, `urn:draft:${this.descriptor.id}`);\n }\n\n async getMetaData(): Promise<DraftMetadata> {\n const { subject, validUntil } = this.draftData.meta || {};\n\n return {\n subject,\n validUntil,\n };\n }\n\n async export(params: DraftExportRequest): Promise<BinaryResponse> {\n return this.client.drafts.draftExport(this.descriptor.id, this.descriptor.revision, params);\n }\n\n async delete(): Promise<void> {\n await this.client.drafts.draftDelete(this.descriptor.id, {\n ifMatch: this.descriptor.etag,\n idempotencyKey: generateKey('delete'),\n });\n }\n\n async issue(privateKeyId: string): Promise<VerifiableCredential> {\n const { id, etag, revision, data } = await this.client.drafts.draftLatestIssue(this.descriptor.id, {\n keyId: privateKeyId,\n });\n\n return new VerifiableCredential(this.client, {\n id: id,\n etag: etag,\n revision: revision,\n data: strictlyConvertToApiType(verifiableCredentialDataSchema, {\n id: data.id,\n digestMultibase: data.digestMultibase,\n }),\n });\n }\n\n async toResource(): Promise<ResourceDraft> {\n return this.client.drafts.draftRevision(this.descriptor.id, this.descriptor.revision);\n }\n}\n"]}
|
|
@@ -68,9 +68,9 @@ export declare class Vcdm11Flavor extends VcdmCredentialDocument implements Docu
|
|
|
68
68
|
kind: string;
|
|
69
69
|
private blobToVcdm11;
|
|
70
70
|
private loadJsonDocument;
|
|
71
|
-
isOfFlavor(blob: CredentialBlob): boolean
|
|
72
|
-
getClaims(blob: CredentialBlob): CredentialClaims
|
|
73
|
-
getMetadata(blob: CredentialBlob): CredentialMetadata
|
|
71
|
+
isOfFlavor(blob: CredentialBlob): Promise<boolean>;
|
|
72
|
+
getClaims(blob: CredentialBlob): Promise<CredentialClaims>;
|
|
73
|
+
getMetadata(blob: CredentialBlob): Promise<CredentialMetadata>;
|
|
74
74
|
getSchema(blob: CredentialBlob): Promise<CredentialSchema | undefined>;
|
|
75
75
|
}
|
|
76
76
|
//# sourceMappingURL=vcdm1_1.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vcdm1_1.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/flavor/vcdm1_1.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vcdm1_1.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/flavor/vcdm1_1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EACR,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EAEjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAEH,sBAAsB,EAGzB,MAAM,kBAAkB,CAAC;AAE1B,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CASF,CAAC;AAEhC,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE5E,qBAAa,YAAa,SAAQ,sBAAuB,YAAW,cAAc;IAC9E,IAAI,SAAa;IAEjB,OAAO,CAAC,YAAY;YAIN,gBAAgB;IAiBxB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IASlD,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAO1D,WAAW,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAa9D,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;CAuC/E"}
|
|
@@ -52,12 +52,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
52
52
|
}
|
|
53
53
|
return t;
|
|
54
54
|
};
|
|
55
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
56
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
57
|
-
};
|
|
58
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
56
|
exports.Vcdm11Flavor = exports.vcdm11DocumentSchema = void 0;
|
|
60
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
61
57
|
const core = __importStar(require("../../../core"));
|
|
62
58
|
const vcdm_1 = require("../document/vcdm");
|
|
63
59
|
exports.vcdm11DocumentSchema = core.serialization
|
|
@@ -80,7 +76,7 @@ class Vcdm11Flavor extends vcdm_1.VcdmCredentialDocument {
|
|
|
80
76
|
}
|
|
81
77
|
loadJsonDocument(url) {
|
|
82
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
return (
|
|
79
|
+
return fetch(url)
|
|
84
80
|
.then((resp) => {
|
|
85
81
|
if (!resp.ok)
|
|
86
82
|
return Promise.reject(new Error(`Failed to fetch JSON document from ${url}. Server responded with status: ${resp.status} (${resp.statusText})`));
|
|
@@ -93,33 +89,39 @@ class Vcdm11Flavor extends vcdm_1.VcdmCredentialDocument {
|
|
|
93
89
|
});
|
|
94
90
|
}
|
|
95
91
|
isOfFlavor(blob) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
try {
|
|
94
|
+
yield this.blobToVcdm11(blob);
|
|
95
|
+
}
|
|
96
|
+
catch (_a) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
103
101
|
}
|
|
104
102
|
getClaims(blob) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
const credential = yield this.blobToVcdm(blob);
|
|
105
|
+
const _a = credential.credentialSubject, { id, type } = _a, claims = __rest(_a, ["id", "type"]);
|
|
106
|
+
return claims;
|
|
107
|
+
});
|
|
108
108
|
}
|
|
109
109
|
getMetadata(blob) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
const credential = yield this.blobToVcdm11(blob);
|
|
112
|
+
return {
|
|
113
|
+
id: credential.id,
|
|
114
|
+
issuer: credential.issuer,
|
|
115
|
+
validFrom: credential.issuanceDate,
|
|
116
|
+
validUntil: credential.expirationDate,
|
|
117
|
+
subject: credential.credentialSubject.id,
|
|
118
|
+
holder: credential.holder,
|
|
119
|
+
};
|
|
120
|
+
});
|
|
119
121
|
}
|
|
120
122
|
getSchema(blob) {
|
|
121
123
|
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
const credential = this.blobToVcdm(blob);
|
|
124
|
+
const credential = yield this.blobToVcdm(blob);
|
|
123
125
|
if (!credential.credentialSchema)
|
|
124
126
|
return undefined;
|
|
125
127
|
const schemaTypes = Array.isArray(credential.credentialSchema.type)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vcdm1_1.js","sourceRoot":"","sources":["../../../../src/documents/credential/flavor/vcdm1_1.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cesContent":["import * as core from '../../../core';\nimport { inferParsedObject } from '../../../core/schemas';\nimport type {\n CredentialBlob,\n CredentialClaims,\n CredentialMetadata,\n CredentialSchema,\n DocumentFlavor,\n Json,\n} from '../types';\nimport {\n jsonSchemaCredentialSubjectSchema,\n VcdmCredentialDocument,\n vcdmDocumentSchema,\n vcdmProofSetSchema,\n} from '../document/vcdm';\n\nexport const vcdm11DocumentSchema = core.serialization\n .object({\n id: core.serialization.string(),\n holder: core.serialization.string().optional(),\n issuer: core.serialization.string(),\n issuanceDate: core.serialization.date(),\n expirationDate: core.serialization.date().optional(),\n proof: vcdmProofSetSchema,\n })\n .extend(vcdmDocumentSchema);\n\nexport type Vcdm11Document = inferParsedObject<typeof vcdm11DocumentSchema>;\n\nexport class Vcdm11Flavor extends VcdmCredentialDocument implements DocumentFlavor {\n kind = 'vcdm1_1';\n\n private blobToVcdm11(input: CredentialBlob): Promise<Vcdm11Document> {\n return this.parseBlob(vcdm11DocumentSchema, input);\n }\n\n private async loadJsonDocument(url: string): Promise<Json | undefined> {\n return fetch(url)\n .then((resp) => {\n if (!resp.ok)\n return Promise.reject(\n new Error(\n `Failed to fetch JSON document from ${url}. Server responded with status: ${resp.status} (${resp.statusText})`,\n ),\n );\n return resp.json();\n })\n .catch((err) => {\n console.warn(`Error loading JSON document from ${url}: ${err}`);\n return undefined;\n });\n }\n\n async isOfFlavor(blob: CredentialBlob): Promise<boolean> {\n try {\n await this.blobToVcdm11(blob);\n } catch {\n return false;\n }\n return true;\n }\n\n async getClaims(blob: CredentialBlob): Promise<CredentialClaims> {\n const credential = await this.blobToVcdm(blob);\n const { id, type, ...claims } = credential.credentialSubject;\n\n return claims as CredentialClaims;\n }\n\n async getMetadata(blob: CredentialBlob): Promise<CredentialMetadata> {\n const credential = await this.blobToVcdm11(blob);\n\n return {\n id: credential.id,\n issuer: credential.issuer,\n validFrom: credential.issuanceDate,\n validUntil: credential.expirationDate,\n subject: credential.credentialSubject.id,\n holder: credential.holder,\n };\n }\n\n async getSchema(blob: CredentialBlob): Promise<CredentialSchema | undefined> {\n const credential = await this.blobToVcdm(blob);\n\n if (!credential.credentialSchema) return undefined;\n\n const schemaTypes = Array.isArray(credential.credentialSchema.type)\n ? credential.credentialSchema.type\n : [credential.credentialSchema.type];\n\n if (schemaTypes.includes('JsonSchema')) {\n // External JSON Schema\n return this.loadJsonDocument(credential.credentialSchema.id);\n } else if (schemaTypes.includes('JsonSchemaCredential')) {\n let schemaCredential: Json;\n\n if (schemaTypes.includes('VerifiableCredential')) {\n // Inlined credential with JSON Schema\n schemaCredential = credential.credentialSchema;\n } else {\n // External credential with JSON Schema\n const result = await this.loadJsonDocument(credential.credentialSchema.id);\n if (!result) return undefined;\n schemaCredential = result;\n }\n\n try {\n const jsonSchemaCredential = this.jsonToVcdm(schemaCredential);\n const jsonSchemaCredentialClaims = this.parseJson(\n jsonSchemaCredentialSubjectSchema,\n jsonSchemaCredential.credentialSubject,\n );\n\n return jsonSchemaCredentialClaims.jsonSchema;\n } catch {\n console.warn(`Could not parse credential schema: ${credential.credentialSchema.id}`);\n return undefined;\n }\n }\n }\n}\n"]}
|
|
@@ -77,7 +77,7 @@ export type Vcdm22Document = inferParsedObject<typeof vcdm22DocumentSchema>;
|
|
|
77
77
|
export declare class Vcdm20Flavor extends Vcdm11Flavor implements DocumentFlavor {
|
|
78
78
|
kind: string;
|
|
79
79
|
private blobToVcdm22;
|
|
80
|
-
isOfFlavor(blob: CredentialBlob): boolean
|
|
81
|
-
getMetadata(blob: CredentialBlob): CredentialMetadata
|
|
80
|
+
isOfFlavor(blob: CredentialBlob): Promise<boolean>;
|
|
81
|
+
getMetadata(blob: CredentialBlob): Promise<CredentialMetadata>;
|
|
82
82
|
}
|
|
83
83
|
//# sourceMappingURL=vcdm2_0.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vcdm2_0.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/flavor/vcdm2_0.ts"],"names":[],"mappings":"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AG,OAAO,CAAC,kBAAkB,CAAC;CAYvE"}
|
|
@@ -32,6 +32,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
35
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
45
|
exports.Vcdm20Flavor = exports.vcdm22DocumentSchema = void 0;
|
|
37
46
|
const core = __importStar(require("../../../core"));
|
|
@@ -63,24 +72,28 @@ class Vcdm20Flavor extends vcdm1_1_1.Vcdm11Flavor {
|
|
|
63
72
|
return this.parseBlob(exports.vcdm22DocumentSchema, input);
|
|
64
73
|
}
|
|
65
74
|
isOfFlavor(blob) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
try {
|
|
77
|
+
yield this.blobToVcdm22(blob);
|
|
78
|
+
}
|
|
79
|
+
catch (_a) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
});
|
|
73
84
|
}
|
|
74
85
|
getMetadata(blob) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const credential = yield this.blobToVcdm22(blob);
|
|
88
|
+
return {
|
|
89
|
+
id: credential.id,
|
|
90
|
+
issuer: typeof credential.issuer === 'string' ? credential.issuer : credential.issuer.id,
|
|
91
|
+
validFrom: credential.validFrom,
|
|
92
|
+
validUntil: credential.validTo,
|
|
93
|
+
subject: credential.credentialSubject.id,
|
|
94
|
+
holder: credential.holder,
|
|
95
|
+
};
|
|
96
|
+
});
|
|
84
97
|
}
|
|
85
98
|
}
|
|
86
99
|
exports.Vcdm20Flavor = Vcdm20Flavor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vcdm2_0.js","sourceRoot":"","sources":["../../../../src/documents/credential/flavor/vcdm2_0.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vcdm2_0.js","sourceRoot":"","sources":["../../../../src/documents/credential/flavor/vcdm2_0.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAGtC,2CAA0E;AAC1E,uCAAyC;AAE5B,QAAA,oBAAoB,GAAG,IAAI,CAAC,aAAa;KACjD,MAAM,CAAC;IACJ,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;IAC/B,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9C,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC;QAC5C,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;QAC3B,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;YACtB,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YAC/B,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC5C,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,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import type { CredentialBlob, CredentialMetadata, DocumentFlavor } from '../types';\nimport { vcdmDocumentSchema, vcdmProofSetSchema } from '../document/vcdm';\nimport { Vcdm11Flavor } from './vcdm1_1';\n\nexport const vcdm22DocumentSchema = core.serialization\n .object({\n id: core.serialization.string(),\n holder: core.serialization.string().optional(),\n issuer: core.serialization.undiscriminatedUnion([\n core.serialization.string(),\n core.serialization.object({\n id: core.serialization.string(),\n name: core.serialization.string().optional(),\n description: core.serialization.string().optional(),\n }),\n ]),\n validFrom: core.serialization.date().optional(),\n validTo: core.serialization.date().optional(),\n proof: vcdmProofSetSchema,\n })\n .extend(vcdmDocumentSchema);\n\nexport type Vcdm22Document = inferParsedObject<typeof vcdm22DocumentSchema>;\n\nexport class Vcdm20Flavor extends Vcdm11Flavor implements DocumentFlavor {\n kind = 'vcdm2_0';\n\n private blobToVcdm22(input: CredentialBlob): Promise<Vcdm22Document> {\n return this.parseBlob(vcdm22DocumentSchema, input);\n }\n\n async isOfFlavor(blob: CredentialBlob): Promise<boolean> {\n try {\n await this.blobToVcdm22(blob);\n } catch {\n return false;\n }\n return true;\n }\n\n async getMetadata(blob: CredentialBlob): Promise<CredentialMetadata> {\n const credential = await this.blobToVcdm22(blob);\n\n return {\n id: credential.id,\n issuer: typeof credential.issuer === 'string' ? credential.issuer : credential.issuer.id,\n validFrom: credential.validFrom,\n validUntil: credential.validTo,\n subject: credential.credentialSubject.id,\n holder: credential.holder,\n };\n }\n}\n"]}
|
|
@@ -3,8 +3,8 @@ export declare class CredentialFlavor implements Flavor {
|
|
|
3
3
|
private supportedFlavors;
|
|
4
4
|
private matchFlavor;
|
|
5
5
|
private getFlavor;
|
|
6
|
-
getClaims(blob: CredentialBlob): CredentialClaims
|
|
7
|
-
getMetadata(blob: CredentialBlob): CredentialMetadata
|
|
6
|
+
getClaims(blob: CredentialBlob): Promise<CredentialClaims>;
|
|
7
|
+
getMetadata(blob: CredentialBlob): Promise<CredentialMetadata>;
|
|
8
8
|
getSchema(blob: CredentialBlob): Promise<CredentialSchema | undefined>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=flavor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flavor.d.ts","sourceRoot":"","sources":["../../../src/documents/credential/flavor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAEhB,MAAM,EACT,MAAM,SAAS,CAAC;AAIjB,qBAAa,gBAAiB,YAAW,MAAM;IAC3C,OAAO,CAAC,gBAAgB,CAA8D;
|
|
1
|
+
{"version":3,"file":"flavor.d.ts","sourceRoot":"","sources":["../../../src/documents/credential/flavor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAEhB,MAAM,EACT,MAAM,SAAS,CAAC;AAIjB,qBAAa,gBAAiB,YAAW,MAAM;IAC3C,OAAO,CAAC,gBAAgB,CAA8D;YAExE,WAAW;YAOX,SAAS;IAWjB,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAK1D,WAAW,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAK9D,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;CAI/E"}
|
|
@@ -17,25 +17,40 @@ class CredentialFlavor {
|
|
|
17
17
|
this.supportedFlavors = [new vcdm1_1_1.Vcdm11Flavor(), new vcdm2_0_1.Vcdm20Flavor()];
|
|
18
18
|
}
|
|
19
19
|
matchFlavor(blob) {
|
|
20
|
-
return this
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
for (const flavor of this.supportedFlavors) {
|
|
22
|
+
if (yield flavor.isOfFlavor(blob))
|
|
23
|
+
return flavor;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
});
|
|
21
27
|
}
|
|
22
28
|
getFlavor(blob) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const blobFlavor = yield this.matchFlavor(blob);
|
|
31
|
+
if (!blobFlavor) {
|
|
32
|
+
const knownFlavorKinds = this.supportedFlavors.map((flavor) => flavor.kind);
|
|
33
|
+
throw new Error(`Received blob does not match any known flavors: ${knownFlavorKinds}`);
|
|
34
|
+
}
|
|
35
|
+
return blobFlavor;
|
|
36
|
+
});
|
|
29
37
|
}
|
|
30
38
|
getClaims(blob) {
|
|
31
|
-
return this
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const flavor = yield this.getFlavor(blob);
|
|
41
|
+
return flavor.getClaims(blob);
|
|
42
|
+
});
|
|
32
43
|
}
|
|
33
44
|
getMetadata(blob) {
|
|
34
|
-
return this
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const flavor = yield this.getFlavor(blob);
|
|
47
|
+
return flavor.getMetadata(blob);
|
|
48
|
+
});
|
|
35
49
|
}
|
|
36
50
|
getSchema(blob) {
|
|
37
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
|
|
52
|
+
const flavor = yield this.getFlavor(blob);
|
|
53
|
+
return flavor.getSchema(blob);
|
|
39
54
|
});
|
|
40
55
|
}
|
|
41
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flavor.js","sourceRoot":"","sources":["../../../src/documents/credential/flavor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQA,8CAAgD;AAChD,8CAAgD;AAEhD,MAAa,gBAAgB;IAA7B;QACY,qBAAgB,GAAqB,CAAC,IAAI,sBAAY,EAAE,EAAE,IAAI,sBAAY,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"flavor.js","sourceRoot":"","s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AS,CAAC,IAAI,CAAC,CAAC;YAC1C,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;KAAA;CACJ;AAnCD,4CAmCC","sourcesContent":["import type {\n CredentialBlob,\n CredentialClaims,\n CredentialMetadata,\n CredentialSchema,\n DocumentFlavor,\n Flavor,\n} from './types';\nimport { Vcdm11Flavor } from './flavor/vcdm1_1';\nimport { Vcdm20Flavor } from './flavor/vcdm2_0';\n\nexport class CredentialFlavor implements Flavor {\n private supportedFlavors: DocumentFlavor[] = [new Vcdm11Flavor(), new Vcdm20Flavor()];\n\n private async matchFlavor(blob: CredentialBlob): Promise<DocumentFlavor | undefined> {\n for (const flavor of this.supportedFlavors) {\n if (await flavor.isOfFlavor(blob)) return flavor;\n }\n return undefined;\n }\n\n private async getFlavor(blob: CredentialBlob): Promise<DocumentFlavor> {\n const blobFlavor = await this.matchFlavor(blob);\n\n if (!blobFlavor) {\n const knownFlavorKinds = this.supportedFlavors.map((flavor) => flavor.kind);\n throw new Error(`Received blob does not match any known flavors: ${knownFlavorKinds}`);\n }\n\n return blobFlavor;\n }\n\n async getClaims(blob: CredentialBlob): Promise<CredentialClaims> {\n const flavor = await this.getFlavor(blob);\n return flavor.getClaims(blob);\n }\n\n async getMetadata(blob: CredentialBlob): Promise<CredentialMetadata> {\n const flavor = await this.getFlavor(blob);\n return flavor.getMetadata(blob);\n }\n\n async getSchema(blob: CredentialBlob): Promise<CredentialSchema | undefined> {\n const flavor = await this.getFlavor(blob);\n return flavor.getSchema(blob);\n }\n}\n"]}
|
|
@@ -15,20 +15,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const fs_1 = __importDefault(require("fs"));
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
17
|
const flavor_1 = require("./flavor");
|
|
18
|
-
const readTestDataFile = (filepath) => fs_1.default.readFileSync(path_1.default.join(__dirname, './testdata', filepath));
|
|
18
|
+
const readTestDataFile = (filepath) => new Blob([fs_1.default.readFileSync(path_1.default.join(__dirname, './testdata', filepath))]);
|
|
19
19
|
describe('CredentialFlavor', () => {
|
|
20
20
|
const flavor = new flavor_1.CredentialFlavor();
|
|
21
21
|
describe.each([1, 2])(`VCDM v%s`, (version) => {
|
|
22
22
|
const credential = readTestDataFile(`credentials/credential-v${version}.json`);
|
|
23
23
|
it('should return claims from a VC blob', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
-
const claims = flavor.getClaims(credential);
|
|
24
|
+
const claims = yield flavor.getClaims(credential);
|
|
25
25
|
expect(claims).toEqual({
|
|
26
26
|
bar: 'bar',
|
|
27
27
|
baz: 'baz',
|
|
28
28
|
});
|
|
29
29
|
}));
|
|
30
30
|
it('should return metadata from blob', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
-
const metadata = flavor.getMetadata(credential);
|
|
31
|
+
const metadata = yield flavor.getMetadata(credential);
|
|
32
32
|
expect(metadata).toEqual({
|
|
33
33
|
id: 'did:example:123',
|
|
34
34
|
subject: 'did:example:456',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flavor.spec.js","sourceRoot":"","sources":["../../../src/documents/credential/flavor.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,qCAA4C;AAE5C,MAAM,gBAAgB,GAAG,CAAC,QAAgB,
|
|
1
|
+
{"version":3,"file":"flavor.spec.js","sourceRoot":"","sources":["../../../src/documents/credential/flavor.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,qCAA4C;AAE5C,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAQ,EAAE,CAChD,IAAI,IAAI,CAAC,CAAC,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAI9E,QAAQ,CAAC,kBAAkB,EA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CAAC,CAAC;IACP,CAAC,CAAA,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { CredentialFlavor } from './flavor';\n\nconst readTestDataFile = (filepath: string): Blob =>\n new Blob([fs.readFileSync(path.join(__dirname, './testdata', filepath))]);\n\ntype VcdmVersion = number;\n\ndescribe('CredentialFlavor', () => {\n const flavor = new CredentialFlavor();\n\n describe.each<VcdmVersion>([1, 2])(`VCDM v%s`, (version) => {\n const credential = readTestDataFile(`credentials/credential-v${version}.json`);\n\n it('should return claims from a VC blob', async () => {\n const claims = await flavor.getClaims(credential);\n\n expect(claims).toEqual({\n bar: 'bar',\n baz: 'baz',\n });\n });\n\n it('should return metadata from blob', async () => {\n const metadata = await flavor.getMetadata(credential);\n\n expect(metadata).toEqual({\n id: 'did:example:123',\n subject: 'did:example:456',\n issuer: 'https://example.edu/issuers/565049',\n validFrom: version === 1 ? new Date('2024-09-13T13:10:52Z') : undefined,\n });\n });\n });\n\n it('should return inlined json schema', async () => {\n const credential = readTestDataFile(`credentials/credential-with-json-schema.json`);\n const schema = await flavor.getSchema(credential);\n\n expect(schema).toMatchObject({\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n $id: 'urn:json-schema:struct',\n });\n });\n});\n"]}
|