@credo-ts/anoncreds 0.6.1-pr-2091-20241119140918 → 0.6.1
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/build/AnonCredsApi.d.mts +113 -0
- package/build/AnonCredsApi.d.mts.map +1 -0
- package/build/AnonCredsApi.mjs +439 -0
- package/build/AnonCredsApi.mjs.map +1 -0
- package/build/AnonCredsApiOptions.d.mts +28 -0
- package/build/AnonCredsApiOptions.d.mts.map +1 -0
- package/build/AnonCredsModule.d.mts +29 -0
- package/build/AnonCredsModule.d.mts.map +1 -0
- package/build/AnonCredsModule.mjs +62 -0
- package/build/AnonCredsModule.mjs.map +1 -0
- package/build/AnonCredsModuleConfig.d.mts +79 -0
- package/build/AnonCredsModuleConfig.d.mts.map +1 -0
- package/build/AnonCredsModuleConfig.mjs +31 -0
- package/build/AnonCredsModuleConfig.mjs.map +1 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorate.mjs +10 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateMetadata.mjs +7 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateParam.mjs +9 -0
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.mjs +203 -0
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.mjs.map +1 -0
- package/build/anoncreds-rs/AnonCredsRsHolderService.mjs +488 -0
- package/build/anoncreds-rs/AnonCredsRsHolderService.mjs.map +1 -0
- package/build/anoncreds-rs/AnonCredsRsIssuerService.mjs +213 -0
- package/build/anoncreds-rs/AnonCredsRsIssuerService.mjs.map +1 -0
- package/build/anoncreds-rs/AnonCredsRsVerifierService.mjs +122 -0
- package/build/anoncreds-rs/AnonCredsRsVerifierService.mjs.map +1 -0
- package/build/anoncreds-rs/index.mjs +3 -0
- package/build/anoncreds-rs/utils.mjs +60 -0
- package/build/anoncreds-rs/utils.mjs.map +1 -0
- package/build/error/AnonCredsError.d.mts +13 -0
- package/build/error/AnonCredsError.d.mts.map +1 -0
- package/build/error/AnonCredsError.mjs +12 -0
- package/build/error/AnonCredsError.mjs.map +1 -0
- package/build/error/AnonCredsRsError.d.mts +13 -0
- package/build/error/AnonCredsRsError.d.mts.map +1 -0
- package/build/error/AnonCredsRsError.mjs +12 -0
- package/build/error/AnonCredsRsError.mjs.map +1 -0
- package/build/error/AnonCredsStoreRecordError.d.mts +13 -0
- package/build/error/AnonCredsStoreRecordError.d.mts.map +1 -0
- package/build/error/AnonCredsStoreRecordError.mjs +12 -0
- package/build/error/AnonCredsStoreRecordError.mjs.map +1 -0
- package/build/error/index.d.mts +3 -0
- package/build/error/index.mjs +3 -0
- package/build/formats/AnonCredsDidCommCredentialFormat.d.mts +82 -0
- package/build/formats/AnonCredsDidCommCredentialFormat.d.mts.map +1 -0
- package/build/formats/AnonCredsDidCommCredentialFormatService.d.mts +120 -0
- package/build/formats/AnonCredsDidCommCredentialFormatService.d.mts.map +1 -0
- package/build/formats/AnonCredsDidCommCredentialFormatService.mjs +331 -0
- package/build/formats/AnonCredsDidCommCredentialFormatService.mjs.map +1 -0
- package/build/formats/AnonCredsDidCommProofFormat.d.mts +77 -0
- package/build/formats/AnonCredsDidCommProofFormat.d.mts.map +1 -0
- package/build/formats/AnonCredsDidCommProofFormatService.d.mts +93 -0
- package/build/formats/AnonCredsDidCommProofFormatService.d.mts.map +1 -0
- package/build/formats/AnonCredsDidCommProofFormatService.mjs +250 -0
- package/build/formats/AnonCredsDidCommProofFormatService.mjs.map +1 -0
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.mts +118 -0
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.mts.map +1 -0
- package/build/formats/DataIntegrityDidCommCredentialFormatService.mjs +587 -0
- package/build/formats/DataIntegrityDidCommCredentialFormatService.mjs.map +1 -0
- package/build/formats/LegacyIndyDidCommCredentialFormat.d.mts +38 -0
- package/build/formats/LegacyIndyDidCommCredentialFormat.d.mts.map +1 -0
- package/build/formats/LegacyIndyDidCommCredentialFormatService.d.mts +122 -0
- package/build/formats/LegacyIndyDidCommCredentialFormatService.d.mts.map +1 -0
- package/build/formats/LegacyIndyDidCommCredentialFormatService.mjs +309 -0
- package/build/formats/LegacyIndyDidCommCredentialFormatService.mjs.map +1 -0
- package/build/formats/LegacyIndyDidCommProofFormat.d.mts +36 -0
- package/build/formats/LegacyIndyDidCommProofFormat.d.mts.map +1 -0
- package/build/formats/LegacyIndyDidCommProofFormatService.d.mts +98 -0
- package/build/formats/LegacyIndyDidCommProofFormatService.d.mts.map +1 -0
- package/build/formats/LegacyIndyDidCommProofFormatService.mjs +322 -0
- package/build/formats/LegacyIndyDidCommProofFormatService.mjs.map +1 -0
- package/build/formats/index.d.mts +9 -0
- package/build/formats/index.mjs +5 -0
- package/build/index.d.mts +86 -0
- package/build/index.mjs +69 -0
- package/build/models/AnonCredsCredentialProposal.mjs +75 -0
- package/build/models/AnonCredsCredentialProposal.mjs.map +1 -0
- package/build/models/AnonCredsProofRequest.mjs +62 -0
- package/build/models/AnonCredsProofRequest.mjs.map +1 -0
- package/build/models/AnonCredsRequestedAttribute.mjs +50 -0
- package/build/models/AnonCredsRequestedAttribute.mjs.map +1 -0
- package/build/models/AnonCredsRequestedPredicate.mjs +53 -0
- package/build/models/AnonCredsRequestedPredicate.mjs.map +1 -0
- package/build/models/AnonCredsRestriction.d.mts +29 -0
- package/build/models/AnonCredsRestriction.d.mts.map +1 -0
- package/build/models/AnonCredsRestriction.mjs +137 -0
- package/build/models/AnonCredsRestriction.mjs.map +1 -0
- package/build/models/AnonCredsRestrictionWrapper.d.mts +9 -0
- package/build/models/AnonCredsRestrictionWrapper.d.mts.map +1 -0
- package/build/models/AnonCredsRestrictionWrapper.mjs +18 -0
- package/build/models/AnonCredsRestrictionWrapper.mjs.map +1 -0
- package/build/models/AnonCredsRevocationInterval.mjs +27 -0
- package/build/models/AnonCredsRevocationInterval.mjs.map +1 -0
- package/build/models/exchange.d.mts +104 -0
- package/build/models/exchange.d.mts.map +1 -0
- package/build/models/exchange.mjs +11 -0
- package/build/models/exchange.mjs.map +1 -0
- package/build/models/index.d.mts +4 -0
- package/build/models/index.mjs +2 -0
- package/build/models/internal.d.mts +40 -0
- package/build/models/internal.d.mts.map +1 -0
- package/build/models/registry.d.mts +44 -0
- package/build/models/registry.d.mts.map +1 -0
- package/build/models/utils.d.mts +27 -0
- package/build/models/utils.d.mts.map +1 -0
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.mts +215 -0
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.mts.map +1 -0
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.mjs +827 -0
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommCredentialV1AckHandler.mjs +17 -0
- package/build/protocols/credentials/v1/handlers/DidCommCredentialV1AckHandler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommCredentialV1ProblemReportHandler.mjs +17 -0
- package/build/protocols/credentials/v1/handlers/DidCommCredentialV1ProblemReportHandler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommIssueCredentialV1Handler.mjs +36 -0
- package/build/protocols/credentials/v1/handlers/DidCommIssueCredentialV1Handler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommOfferCredentialV1Handler.mjs +32 -0
- package/build/protocols/credentials/v1/handlers/DidCommOfferCredentialV1Handler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommProposeCredentialV1Handler.mjs +35 -0
- package/build/protocols/credentials/v1/handlers/DidCommProposeCredentialV1Handler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommRequestCredentialV1Handler.mjs +36 -0
- package/build/protocols/credentials/v1/handlers/DidCommRequestCredentialV1Handler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/index.mjs +6 -0
- package/build/protocols/credentials/v1/index.d.mts +9 -0
- package/build/protocols/credentials/v1/index.mjs +9 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.mts +16 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.mjs +21 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.mts +32 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.mjs +57 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.d.mts +16 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.mjs +21 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.mts +26 -0
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.mjs +46 -0
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.mts +34 -0
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.mjs +61 -0
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.mts +64 -0
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.mjs +95 -0
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.mts +26 -0
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.mjs +46 -0
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/index.d.mts +7 -0
- package/build/protocols/credentials/v1/messages/index.mjs +7 -0
- package/build/protocols/index.d.mts +18 -0
- package/build/protocols/index.mjs +18 -0
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.mts +105 -0
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.mts.map +1 -0
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.mjs +723 -0
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.mjs.map +1 -0
- package/build/protocols/proofs/v1/errors/DidCommPresentationV1ProblemReportError.d.mts +18 -0
- package/build/protocols/proofs/v1/errors/DidCommPresentationV1ProblemReportError.d.mts.map +1 -0
- package/build/protocols/proofs/v1/errors/DidCommPresentationV1ProblemReportError.mjs +19 -0
- package/build/protocols/proofs/v1/errors/DidCommPresentationV1ProblemReportError.mjs.map +1 -0
- package/build/protocols/proofs/v1/errors/index.d.mts +1 -0
- package/build/protocols/proofs/v1/errors/index.mjs +1 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1AckHandler.mjs +17 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1AckHandler.mjs.map +1 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1Handler.mjs +36 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1Handler.mjs.map +1 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1ProblemReportHandler.mjs +16 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1ProblemReportHandler.mjs.map +1 -0
- package/build/protocols/proofs/v1/handlers/DidCommProposePresentationV1Handler.mjs +35 -0
- package/build/protocols/proofs/v1/handlers/DidCommProposePresentationV1Handler.mjs.map +1 -0
- package/build/protocols/proofs/v1/handlers/DidCommRequestPresentationV1Handler.mjs +32 -0
- package/build/protocols/proofs/v1/handlers/DidCommRequestPresentationV1Handler.mjs.map +1 -0
- package/build/protocols/proofs/v1/handlers/index.mjs +5 -0
- package/build/protocols/proofs/v1/index.d.mts +11 -0
- package/build/protocols/proofs/v1/index.mjs +11 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.d.mts +12 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.d.mts.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.mjs +18 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.mjs.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.mts +38 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.mts.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.mjs +52 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.mjs.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.d.mts +16 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.d.mts.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.mjs +21 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.mjs.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.mts +32 -0
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.mts.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.mjs +44 -0
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.mjs.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.mts +36 -0
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.mts.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.mjs +50 -0
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.mjs.map +1 -0
- package/build/protocols/proofs/v1/messages/index.d.mts +5 -0
- package/build/protocols/proofs/v1/messages/index.mjs +5 -0
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.mts +57 -0
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.mts.map +1 -0
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.mjs +113 -0
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.mjs.map +1 -0
- package/build/protocols/proofs/v1/models/index.d.mts +1 -0
- package/build/protocols/proofs/v1/models/index.mjs +1 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.d.mts +25 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.mjs +26 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.mjs.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.d.mts +12 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.mjs +28 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.mjs.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionRecord.d.mts +44 -0
- package/build/repository/AnonCredsCredentialDefinitionRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionRecord.mjs +38 -0
- package/build/repository/AnonCredsCredentialDefinitionRecord.mjs.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionRepository.d.mts +12 -0
- package/build/repository/AnonCredsCredentialDefinitionRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionRepository.mjs +28 -0
- package/build/repository/AnonCredsCredentialDefinitionRepository.mjs.map +1 -0
- package/build/repository/AnonCredsCredentialRecord.d.mts +53 -0
- package/build/repository/AnonCredsCredentialRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialRecord.mjs +46 -0
- package/build/repository/AnonCredsCredentialRecord.mjs.map +1 -0
- package/build/repository/AnonCredsCredentialRepository.d.mts +14 -0
- package/build/repository/AnonCredsCredentialRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialRepository.mjs +34 -0
- package/build/repository/AnonCredsCredentialRepository.mjs.map +1 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.d.mts +25 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.mjs +26 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.mjs.map +1 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.d.mts +12 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.mjs +28 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.mjs.map +1 -0
- package/build/repository/AnonCredsLinkSecretRecord.d.mts +28 -0
- package/build/repository/AnonCredsLinkSecretRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsLinkSecretRecord.mjs +25 -0
- package/build/repository/AnonCredsLinkSecretRecord.mjs.map +1 -0
- package/build/repository/AnonCredsLinkSecretRepository.d.mts +14 -0
- package/build/repository/AnonCredsLinkSecretRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsLinkSecretRepository.mjs +34 -0
- package/build/repository/AnonCredsLinkSecretRepository.mjs.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.d.mts +37 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.mjs +35 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.mjs.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.mts +13 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.mjs +34 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.mjs.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.mts +30 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.mjs +27 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.mjs.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.d.mts +13 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.mjs +31 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.mjs.map +1 -0
- package/build/repository/AnonCredsSchemaRecord.d.mts +44 -0
- package/build/repository/AnonCredsSchemaRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsSchemaRecord.mjs +38 -0
- package/build/repository/AnonCredsSchemaRecord.mjs.map +1 -0
- package/build/repository/AnonCredsSchemaRepository.d.mts +12 -0
- package/build/repository/AnonCredsSchemaRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsSchemaRepository.mjs +28 -0
- package/build/repository/AnonCredsSchemaRepository.mjs.map +1 -0
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.d.mts +14 -0
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.d.mts.map +1 -0
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.mjs +10 -0
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.mjs.map +1 -0
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.d.mts +14 -0
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.d.mts.map +1 -0
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.mjs +10 -0
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.mjs.map +1 -0
- package/build/repository/anonCredsSchemaRecordMetadataTypes.d.mts +14 -0
- package/build/repository/anonCredsSchemaRecordMetadataTypes.d.mts.map +1 -0
- package/build/repository/index.d.mts +16 -0
- package/build/repository/index.mjs +16 -0
- package/build/services/AnonCredsHolderService.d.mts +28 -0
- package/build/services/AnonCredsHolderService.d.mts.map +1 -0
- package/build/services/AnonCredsHolderService.mjs +6 -0
- package/build/services/AnonCredsHolderService.mjs.map +1 -0
- package/build/services/AnonCredsHolderServiceOptions.d.mts +107 -0
- package/build/services/AnonCredsHolderServiceOptions.d.mts.map +1 -0
- package/build/services/AnonCredsIssuerService.d.mts +19 -0
- package/build/services/AnonCredsIssuerService.d.mts.map +1 -0
- package/build/services/AnonCredsIssuerService.mjs +6 -0
- package/build/services/AnonCredsIssuerService.mjs.map +1 -0
- package/build/services/AnonCredsIssuerServiceOptions.d.mts +66 -0
- package/build/services/AnonCredsIssuerServiceOptions.d.mts.map +1 -0
- package/build/services/AnonCredsVerifierService.d.mts +12 -0
- package/build/services/AnonCredsVerifierService.d.mts.map +1 -0
- package/build/services/AnonCredsVerifierService.mjs +6 -0
- package/build/services/AnonCredsVerifierService.mjs.map +1 -0
- package/build/services/AnonCredsVerifierServiceOptions.d.mts +30 -0
- package/build/services/AnonCredsVerifierServiceOptions.d.mts.map +1 -0
- package/build/services/index.d.mts +17 -0
- package/build/services/index.mjs +7 -0
- package/build/services/registry/AnonCredsRegistry.d.mts +43 -0
- package/build/services/registry/AnonCredsRegistry.d.mts.map +1 -0
- package/build/services/registry/AnonCredsRegistryService.d.mts +27 -0
- package/build/services/registry/AnonCredsRegistryService.d.mts.map +1 -0
- package/build/services/registry/AnonCredsRegistryService.mjs +226 -0
- package/build/services/registry/AnonCredsRegistryService.mjs.map +1 -0
- package/build/services/registry/CredentialDefinitionOptions.d.mts +39 -0
- package/build/services/registry/CredentialDefinitionOptions.d.mts.map +1 -0
- package/build/services/registry/RevocationRegistryDefinitionOptions.d.mts +39 -0
- package/build/services/registry/RevocationRegistryDefinitionOptions.d.mts.map +1 -0
- package/build/services/registry/RevocationStatusListOptions.d.mts +37 -0
- package/build/services/registry/RevocationStatusListOptions.d.mts.map +1 -0
- package/build/services/registry/SchemaOptions.d.mts +39 -0
- package/build/services/registry/SchemaOptions.d.mts.map +1 -0
- package/build/services/registry/base.d.mts +65 -0
- package/build/services/registry/base.d.mts.map +1 -0
- package/build/services/registry/index.d.mts +7 -0
- package/build/services/registry/index.mjs +1 -0
- package/build/services/tails/BasicTailsFileService.d.mts +29 -0
- package/build/services/tails/BasicTailsFileService.d.mts.map +1 -0
- package/build/services/tails/BasicTailsFileService.mjs +52 -0
- package/build/services/tails/BasicTailsFileService.mjs.map +1 -0
- package/build/services/tails/TailsFileService.d.mts +48 -0
- package/build/services/tails/TailsFileService.d.mts.map +1 -0
- package/build/services/tails/index.d.mts +2 -0
- package/build/services/tails/index.mjs +1 -0
- package/build/updates/0.3.1-0.4/credentialDefinition.mjs +49 -0
- package/build/updates/0.3.1-0.4/credentialDefinition.mjs.map +1 -0
- package/build/updates/0.3.1-0.4/credentialExchangeRecord.mjs +118 -0
- package/build/updates/0.3.1-0.4/credentialExchangeRecord.mjs.map +1 -0
- package/build/updates/0.3.1-0.4/index.d.mts +7 -0
- package/build/updates/0.3.1-0.4/index.d.mts.map +1 -0
- package/build/updates/0.3.1-0.4/index.mjs +16 -0
- package/build/updates/0.3.1-0.4/index.mjs.map +1 -0
- package/build/updates/0.3.1-0.4/linkSecret.mjs +21 -0
- package/build/updates/0.3.1-0.4/linkSecret.mjs.map +1 -0
- package/build/updates/0.3.1-0.4/schema.mjs +39 -0
- package/build/updates/0.3.1-0.4/schema.mjs.map +1 -0
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.mjs +126 -0
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.mjs.map +1 -0
- package/build/updates/0.4-0.5/index.d.mts +7 -0
- package/build/updates/0.4-0.5/index.d.mts.map +1 -0
- package/build/updates/0.4-0.5/index.mjs +10 -0
- package/build/updates/0.4-0.5/index.mjs.map +1 -0
- package/build/utils/anonCredsObjects.d.mts +27 -0
- package/build/utils/anonCredsObjects.d.mts.map +1 -0
- package/build/utils/anonCredsObjects.mjs +57 -0
- package/build/utils/anonCredsObjects.mjs.map +1 -0
- package/build/utils/areRequestsEqual.d.mts +1 -0
- package/build/utils/areRequestsEqual.mjs +86 -0
- package/build/utils/areRequestsEqual.mjs.map +1 -0
- package/build/utils/bytesToBigint.mjs +11 -0
- package/build/utils/bytesToBigint.mjs.map +1 -0
- package/build/utils/composeAutoAccept.d.mts +1 -0
- package/build/utils/composeAutoAccept.mjs +25 -0
- package/build/utils/composeAutoAccept.mjs.map +1 -0
- package/build/utils/createRequestFromPreview.d.mts +2 -0
- package/build/utils/createRequestFromPreview.mjs +50 -0
- package/build/utils/createRequestFromPreview.mjs.map +1 -0
- package/build/utils/credential.d.mts +12 -0
- package/build/utils/credential.d.mts.map +1 -0
- package/build/utils/credential.mjs +119 -0
- package/build/utils/credential.mjs.map +1 -0
- package/build/utils/credentialPreviewAttributes.d.mts +1 -0
- package/build/utils/credentialPreviewAttributes.mjs +21 -0
- package/build/utils/credentialPreviewAttributes.mjs.map +1 -0
- package/build/utils/getCredentialsForAnonCredsRequest.d.mts +11 -0
- package/build/utils/getCredentialsForAnonCredsRequest.d.mts.map +1 -0
- package/build/utils/getCredentialsForAnonCredsRequest.mjs +70 -0
- package/build/utils/getCredentialsForAnonCredsRequest.mjs.map +1 -0
- package/build/utils/getRevocationRegistries.d.mts +4 -0
- package/build/utils/getRevocationRegistries.mjs +121 -0
- package/build/utils/getRevocationRegistries.mjs.map +1 -0
- package/build/utils/hasDuplicateGroupNames.d.mts +1 -0
- package/build/utils/hasDuplicateGroupNames.mjs +22 -0
- package/build/utils/hasDuplicateGroupNames.mjs.map +1 -0
- package/build/utils/index.d.mts +17 -0
- package/build/utils/index.mjs +17 -0
- package/build/utils/indyIdentifiers.d.mts +71 -0
- package/build/utils/indyIdentifiers.d.mts.map +1 -0
- package/build/utils/indyIdentifiers.mjs +249 -0
- package/build/utils/indyIdentifiers.mjs.map +1 -0
- package/build/utils/isMap.d.mts +1 -0
- package/build/utils/isMap.mjs +19 -0
- package/build/utils/isMap.mjs.map +1 -0
- package/build/utils/linkSecret.d.mts +13 -0
- package/build/utils/linkSecret.d.mts.map +1 -0
- package/build/utils/linkSecret.mjs +35 -0
- package/build/utils/linkSecret.mjs.map +1 -0
- package/build/utils/metadata.d.mts +30 -0
- package/build/utils/metadata.d.mts.map +1 -0
- package/build/utils/metadata.mjs +23 -0
- package/build/utils/metadata.mjs.map +1 -0
- package/build/utils/proofRequest.mjs +10 -0
- package/build/utils/proofRequest.mjs.map +1 -0
- package/build/utils/proverDid.d.mts +12 -0
- package/build/utils/proverDid.d.mts.map +1 -0
- package/build/utils/proverDid.mjs +17 -0
- package/build/utils/proverDid.mjs.map +1 -0
- package/build/utils/revocationInterval.d.mts +12 -0
- package/build/utils/revocationInterval.d.mts.map +1 -0
- package/build/utils/revocationInterval.mjs +11 -0
- package/build/utils/revocationInterval.mjs.map +1 -0
- package/build/utils/sortRequestedCredentialsMatches.d.mts +1 -0
- package/build/utils/sortRequestedCredentialsMatches.mjs +22 -0
- package/build/utils/sortRequestedCredentialsMatches.mjs.map +1 -0
- package/build/utils/timestamp.d.mts +5 -0
- package/build/utils/timestamp.d.mts.map +1 -0
- package/build/utils/timestamp.mjs +6 -0
- package/build/utils/timestamp.mjs.map +1 -0
- package/build/utils/w3cAnonCredsUtils.d.mts +28 -0
- package/build/utils/w3cAnonCredsUtils.d.mts.map +1 -0
- package/build/utils/w3cAnonCredsUtils.mjs +101 -0
- package/build/utils/w3cAnonCredsUtils.mjs.map +1 -0
- package/package.json +20 -21
- package/build/AnonCredsApi.d.ts +0 -97
- package/build/AnonCredsApi.js +0 -582
- package/build/AnonCredsApi.js.map +0 -1
- package/build/AnonCredsApiOptions.d.ts +0 -24
- package/build/AnonCredsApiOptions.js +0 -3
- package/build/AnonCredsApiOptions.js.map +0 -1
- package/build/AnonCredsModule.d.ts +0 -24
- package/build/AnonCredsModule.js +0 -56
- package/build/AnonCredsModule.js.map +0 -1
- package/build/AnonCredsModuleConfig.d.ts +0 -72
- package/build/AnonCredsModuleConfig.js +0 -31
- package/build/AnonCredsModuleConfig.js.map +0 -1
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.d.ts +0 -27
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.js +0 -241
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.js.map +0 -1
- package/build/anoncreds-rs/AnonCredsRsHolderService.d.ts +0 -38
- package/build/anoncreds-rs/AnonCredsRsHolderService.js +0 -622
- package/build/anoncreds-rs/AnonCredsRsHolderService.js.map +0 -1
- package/build/anoncreds-rs/AnonCredsRsIssuerService.d.ts +0 -12
- package/build/anoncreds-rs/AnonCredsRsIssuerService.js +0 -253
- package/build/anoncreds-rs/AnonCredsRsIssuerService.js.map +0 -1
- package/build/anoncreds-rs/AnonCredsRsVerifierService.d.ts +0 -8
- package/build/anoncreds-rs/AnonCredsRsVerifierService.js +0 -157
- package/build/anoncreds-rs/AnonCredsRsVerifierService.js.map +0 -1
- package/build/anoncreds-rs/index.d.ts +0 -3
- package/build/anoncreds-rs/index.js +0 -10
- package/build/anoncreds-rs/index.js.map +0 -1
- package/build/anoncreds-rs/utils.d.ts +0 -23
- package/build/anoncreds-rs/utils.js +0 -71
- package/build/anoncreds-rs/utils.js.map +0 -1
- package/build/error/AnonCredsError.d.ts +0 -6
- package/build/error/AnonCredsError.js +0 -11
- package/build/error/AnonCredsError.js.map +0 -1
- package/build/error/AnonCredsRsError.d.ts +0 -6
- package/build/error/AnonCredsRsError.js +0 -11
- package/build/error/AnonCredsRsError.js.map +0 -1
- package/build/error/AnonCredsStoreRecordError.d.ts +0 -6
- package/build/error/AnonCredsStoreRecordError.js +0 -11
- package/build/error/AnonCredsStoreRecordError.js.map +0 -1
- package/build/error/index.d.ts +0 -3
- package/build/error/index.js +0 -20
- package/build/error/index.js.map +0 -1
- package/build/formats/AnonCredsCredentialFormat.d.ts +0 -79
- package/build/formats/AnonCredsCredentialFormat.js +0 -3
- package/build/formats/AnonCredsCredentialFormat.js.map +0 -1
- package/build/formats/AnonCredsCredentialFormatService.d.ts +0 -80
- package/build/formats/AnonCredsCredentialFormatService.js +0 -433
- package/build/formats/AnonCredsCredentialFormatService.js.map +0 -1
- package/build/formats/AnonCredsProofFormat.d.ts +0 -70
- package/build/formats/AnonCredsProofFormat.js +0 -3
- package/build/formats/AnonCredsProofFormat.js.map +0 -1
- package/build/formats/AnonCredsProofFormatService.d.ts +0 -55
- package/build/formats/AnonCredsProofFormatService.js +0 -289
- package/build/formats/AnonCredsProofFormatService.js.map +0 -1
- package/build/formats/DataIntegrityCredentialFormatService.d.ts +0 -89
- package/build/formats/DataIntegrityCredentialFormatService.js +0 -773
- package/build/formats/DataIntegrityCredentialFormatService.js.map +0 -1
- package/build/formats/LegacyIndyCredentialFormat.d.ts +0 -32
- package/build/formats/LegacyIndyCredentialFormat.js +0 -3
- package/build/formats/LegacyIndyCredentialFormat.js.map +0 -1
- package/build/formats/LegacyIndyCredentialFormatService.d.ts +0 -80
- package/build/formats/LegacyIndyCredentialFormatService.js +0 -379
- package/build/formats/LegacyIndyCredentialFormatService.js.map +0 -1
- package/build/formats/LegacyIndyProofFormat.d.ts +0 -29
- package/build/formats/LegacyIndyProofFormat.js +0 -3
- package/build/formats/LegacyIndyProofFormat.js.map +0 -1
- package/build/formats/LegacyIndyProofFormatService.d.ts +0 -58
- package/build/formats/LegacyIndyProofFormatService.js +0 -374
- package/build/formats/LegacyIndyProofFormatService.js.map +0 -1
- package/build/formats/index.d.ts +0 -9
- package/build/formats/index.js +0 -32
- package/build/formats/index.js.map +0 -1
- package/build/index.d.ts +0 -21
- package/build/index.js +0 -54
- package/build/index.js.map +0 -1
- package/build/models/AnonCredsCredentialProposal.d.ts +0 -62
- package/build/models/AnonCredsCredentialProposal.js +0 -81
- package/build/models/AnonCredsCredentialProposal.js.map +0 -1
- package/build/models/AnonCredsProofRequest.d.ts +0 -27
- package/build/models/AnonCredsProofRequest.js +0 -82
- package/build/models/AnonCredsProofRequest.js.map +0 -1
- package/build/models/AnonCredsRequestedAttribute.d.ts +0 -16
- package/build/models/AnonCredsRequestedAttribute.js +0 -56
- package/build/models/AnonCredsRequestedAttribute.js.map +0 -1
- package/build/models/AnonCredsRequestedPredicate.d.ts +0 -19
- package/build/models/AnonCredsRequestedPredicate.js +0 -61
- package/build/models/AnonCredsRequestedPredicate.js.map +0 -1
- package/build/models/AnonCredsRestriction.d.ts +0 -55
- package/build/models/AnonCredsRestriction.js +0 -160
- package/build/models/AnonCredsRestriction.js.map +0 -1
- package/build/models/AnonCredsRestrictionWrapper.d.ts +0 -4
- package/build/models/AnonCredsRestrictionWrapper.js +0 -25
- package/build/models/AnonCredsRestrictionWrapper.js.map +0 -1
- package/build/models/AnonCredsRevocationInterval.d.ts +0 -5
- package/build/models/AnonCredsRevocationInterval.js +0 -33
- package/build/models/AnonCredsRevocationInterval.js.map +0 -1
- package/build/models/exchange.d.ts +0 -99
- package/build/models/exchange.js +0 -5
- package/build/models/exchange.js.map +0 -1
- package/build/models/index.d.ts +0 -4
- package/build/models/index.js +0 -21
- package/build/models/index.js.map +0 -1
- package/build/models/internal.d.ts +0 -35
- package/build/models/internal.js +0 -3
- package/build/models/internal.js.map +0 -1
- package/build/models/registry.d.ts +0 -39
- package/build/models/registry.js +0 -3
- package/build/models/registry.js.map +0 -1
- package/build/models/utils.d.ts +0 -22
- package/build/models/utils.js +0 -3
- package/build/models/utils.js.map +0 -1
- package/build/protocols/credentials/v1/V1CredentialProtocol.d.ts +0 -162
- package/build/protocols/credentials/v1/V1CredentialProtocol.js +0 -948
- package/build/protocols/credentials/v1/V1CredentialProtocol.js.map +0 -1
- package/build/protocols/credentials/v1/errors/V1CredentialProblemReportError.d.ts +0 -10
- package/build/protocols/credentials/v1/errors/V1CredentialProblemReportError.js +0 -18
- package/build/protocols/credentials/v1/errors/V1CredentialProblemReportError.js.map +0 -1
- package/build/protocols/credentials/v1/errors/index.d.ts +0 -1
- package/build/protocols/credentials/v1/errors/index.js +0 -6
- package/build/protocols/credentials/v1/errors/index.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1CredentialAckHandler.d.ts +0 -9
- package/build/protocols/credentials/v1/handlers/V1CredentialAckHandler.js +0 -15
- package/build/protocols/credentials/v1/handlers/V1CredentialAckHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1CredentialProblemReportHandler.d.ts +0 -9
- package/build/protocols/credentials/v1/handlers/V1CredentialProblemReportHandler.js +0 -15
- package/build/protocols/credentials/v1/handlers/V1CredentialProblemReportHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1IssueCredentialHandler.d.ts +0 -10
- package/build/protocols/credentials/v1/handlers/V1IssueCredentialHandler.js +0 -40
- package/build/protocols/credentials/v1/handlers/V1IssueCredentialHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1OfferCredentialHandler.d.ts +0 -10
- package/build/protocols/credentials/v1/handlers/V1OfferCredentialHandler.js +0 -33
- package/build/protocols/credentials/v1/handlers/V1OfferCredentialHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1ProposeCredentialHandler.d.ts +0 -10
- package/build/protocols/credentials/v1/handlers/V1ProposeCredentialHandler.js +0 -38
- package/build/protocols/credentials/v1/handlers/V1ProposeCredentialHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1RequestCredentialHandler.d.ts +0 -10
- package/build/protocols/credentials/v1/handlers/V1RequestCredentialHandler.js +0 -40
- package/build/protocols/credentials/v1/handlers/V1RequestCredentialHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/index.d.ts +0 -6
- package/build/protocols/credentials/v1/handlers/index.js +0 -23
- package/build/protocols/credentials/v1/handlers/index.js.map +0 -1
- package/build/protocols/credentials/v1/index.d.ts +0 -2
- package/build/protocols/credentials/v1/index.js +0 -19
- package/build/protocols/credentials/v1/index.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1CredentialAckMessage.d.ts +0 -16
- package/build/protocols/credentials/v1/messages/V1CredentialAckMessage.js +0 -34
- package/build/protocols/credentials/v1/messages/V1CredentialAckMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1CredentialPreview.d.ts +0 -26
- package/build/protocols/credentials/v1/messages/V1CredentialPreview.js +0 -69
- package/build/protocols/credentials/v1/messages/V1CredentialPreview.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1CredentialProblemReportMessage.d.ts +0 -16
- package/build/protocols/credentials/v1/messages/V1CredentialProblemReportMessage.js +0 -34
- package/build/protocols/credentials/v1/messages/V1CredentialProblemReportMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1IssueCredentialMessage.d.ts +0 -19
- package/build/protocols/credentials/v1/messages/V1IssueCredentialMessage.js +0 -62
- package/build/protocols/credentials/v1/messages/V1IssueCredentialMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1OfferCredentialMessage.d.ts +0 -27
- package/build/protocols/credentials/v1/messages/V1OfferCredentialMessage.js +0 -75
- package/build/protocols/credentials/v1/messages/V1OfferCredentialMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1ProposeCredentialMessage.d.ts +0 -59
- package/build/protocols/credentials/v1/messages/V1ProposeCredentialMessage.js +0 -109
- package/build/protocols/credentials/v1/messages/V1ProposeCredentialMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1RequestCredentialMessage.d.ts +0 -19
- package/build/protocols/credentials/v1/messages/V1RequestCredentialMessage.js +0 -61
- package/build/protocols/credentials/v1/messages/V1RequestCredentialMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/index.d.ts +0 -7
- package/build/protocols/credentials/v1/messages/index.js +0 -24
- package/build/protocols/credentials/v1/messages/index.js.map +0 -1
- package/build/protocols/index.d.ts +0 -2
- package/build/protocols/index.js +0 -19
- package/build/protocols/index.js.map +0 -1
- package/build/protocols/proofs/v1/V1ProofProtocol.d.ts +0 -50
- package/build/protocols/proofs/v1/V1ProofProtocol.js +0 -864
- package/build/protocols/proofs/v1/V1ProofProtocol.js.map +0 -1
- package/build/protocols/proofs/v1/errors/V1PresentationProblemReportError.d.ts +0 -12
- package/build/protocols/proofs/v1/errors/V1PresentationProblemReportError.js +0 -19
- package/build/protocols/proofs/v1/errors/V1PresentationProblemReportError.js.map +0 -1
- package/build/protocols/proofs/v1/errors/index.d.ts +0 -1
- package/build/protocols/proofs/v1/errors/index.js +0 -18
- package/build/protocols/proofs/v1/errors/index.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/V1PresentationAckHandler.d.ts +0 -9
- package/build/protocols/proofs/v1/handlers/V1PresentationAckHandler.js +0 -15
- package/build/protocols/proofs/v1/handlers/V1PresentationAckHandler.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/V1PresentationHandler.d.ts +0 -10
- package/build/protocols/proofs/v1/handlers/V1PresentationHandler.js +0 -40
- package/build/protocols/proofs/v1/handlers/V1PresentationHandler.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/V1PresentationProblemReportHandler.d.ts +0 -9
- package/build/protocols/proofs/v1/handlers/V1PresentationProblemReportHandler.js +0 -15
- package/build/protocols/proofs/v1/handlers/V1PresentationProblemReportHandler.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/V1ProposePresentationHandler.d.ts +0 -11
- package/build/protocols/proofs/v1/handlers/V1ProposePresentationHandler.js +0 -38
- package/build/protocols/proofs/v1/handlers/V1ProposePresentationHandler.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/V1RequestPresentationHandler.d.ts +0 -10
- package/build/protocols/proofs/v1/handlers/V1RequestPresentationHandler.js +0 -35
- package/build/protocols/proofs/v1/handlers/V1RequestPresentationHandler.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/index.d.ts +0 -5
- package/build/protocols/proofs/v1/handlers/index.js +0 -22
- package/build/protocols/proofs/v1/handlers/index.js.map +0 -1
- package/build/protocols/proofs/v1/index.d.ts +0 -4
- package/build/protocols/proofs/v1/index.js +0 -21
- package/build/protocols/proofs/v1/index.js.map +0 -1
- package/build/protocols/proofs/v1/messages/V1PresentationAckMessage.d.ts +0 -8
- package/build/protocols/proofs/v1/messages/V1PresentationAckMessage.js +0 -27
- package/build/protocols/proofs/v1/messages/V1PresentationAckMessage.js.map +0 -1
- package/build/protocols/proofs/v1/messages/V1PresentationMessage.d.ts +0 -31
- package/build/protocols/proofs/v1/messages/V1PresentationMessage.js +0 -67
- package/build/protocols/proofs/v1/messages/V1PresentationMessage.js.map +0 -1
- package/build/protocols/proofs/v1/messages/V1PresentationProblemReportMessage.d.ts +0 -16
- package/build/protocols/proofs/v1/messages/V1PresentationProblemReportMessage.js +0 -34
- package/build/protocols/proofs/v1/messages/V1PresentationProblemReportMessage.js.map +0 -1
- package/build/protocols/proofs/v1/messages/V1ProposePresentationMessage.d.ts +0 -26
- package/build/protocols/proofs/v1/messages/V1ProposePresentationMessage.js +0 -53
- package/build/protocols/proofs/v1/messages/V1ProposePresentationMessage.js.map +0 -1
- package/build/protocols/proofs/v1/messages/V1RequestPresentationMessage.d.ts +0 -29
- package/build/protocols/proofs/v1/messages/V1RequestPresentationMessage.js +0 -65
- package/build/protocols/proofs/v1/messages/V1RequestPresentationMessage.js.map +0 -1
- package/build/protocols/proofs/v1/messages/index.d.ts +0 -5
- package/build/protocols/proofs/v1/messages/index.js +0 -22
- package/build/protocols/proofs/v1/messages/index.js.map +0 -1
- package/build/protocols/proofs/v1/models/V1PresentationPreview.d.ts +0 -50
- package/build/protocols/proofs/v1/models/V1PresentationPreview.js +0 -130
- package/build/protocols/proofs/v1/models/V1PresentationPreview.js.map +0 -1
- package/build/protocols/proofs/v1/models/index.d.ts +0 -1
- package/build/protocols/proofs/v1/models/index.js +0 -18
- package/build/protocols/proofs/v1/models/index.js.map +0 -1
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.d.ts +0 -21
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.js +0 -23
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.js.map +0 -1
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.d.ts +0 -8
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.js +0 -35
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.js.map +0 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.d.ts +0 -39
- package/build/repository/AnonCredsCredentialDefinitionRecord.js +0 -30
- package/build/repository/AnonCredsCredentialDefinitionRecord.js.map +0 -1
- package/build/repository/AnonCredsCredentialDefinitionRepository.d.ts +0 -8
- package/build/repository/AnonCredsCredentialDefinitionRepository.js +0 -53
- package/build/repository/AnonCredsCredentialDefinitionRepository.js.map +0 -1
- package/build/repository/AnonCredsCredentialRecord.d.ts +0 -48
- package/build/repository/AnonCredsCredentialRecord.js +0 -37
- package/build/repository/AnonCredsCredentialRecord.js.map +0 -1
- package/build/repository/AnonCredsCredentialRepository.d.ts +0 -10
- package/build/repository/AnonCredsCredentialRepository.js +0 -41
- package/build/repository/AnonCredsCredentialRepository.js.map +0 -1
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.d.ts +0 -21
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.js +0 -23
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.js.map +0 -1
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.d.ts +0 -8
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.js +0 -35
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.js.map +0 -1
- package/build/repository/AnonCredsLinkSecretRecord.d.ts +0 -23
- package/build/repository/AnonCredsLinkSecretRecord.js +0 -22
- package/build/repository/AnonCredsLinkSecretRecord.js.map +0 -1
- package/build/repository/AnonCredsLinkSecretRepository.d.ts +0 -10
- package/build/repository/AnonCredsLinkSecretRepository.js +0 -41
- package/build/repository/AnonCredsLinkSecretRepository.js.map +0 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.d.ts +0 -34
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.js +0 -30
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.js.map +0 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.ts +0 -10
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.js +0 -38
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.js.map +0 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.ts +0 -25
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.js +0 -23
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.js.map +0 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.d.ts +0 -9
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.js +0 -38
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.js.map +0 -1
- package/build/repository/AnonCredsSchemaRecord.d.ts +0 -39
- package/build/repository/AnonCredsSchemaRecord.js +0 -30
- package/build/repository/AnonCredsSchemaRecord.js.map +0 -1
- package/build/repository/AnonCredsSchemaRepository.d.ts +0 -8
- package/build/repository/AnonCredsSchemaRepository.js +0 -53
- package/build/repository/AnonCredsSchemaRepository.js.map +0 -1
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.d.ts +0 -9
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.js +0 -9
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.js.map +0 -1
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.d.ts +0 -9
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.js +0 -9
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.js.map +0 -1
- package/build/repository/anonCredsSchemaRecordMetadataTypes.d.ts +0 -9
- package/build/repository/anonCredsSchemaRecordMetadataTypes.js +0 -9
- package/build/repository/anonCredsSchemaRecordMetadataTypes.js.map +0 -1
- package/build/repository/index.d.ts +0 -16
- package/build/repository/index.js +0 -33
- package/build/repository/index.js.map +0 -1
- package/build/services/AnonCredsHolderService.d.ts +0 -18
- package/build/services/AnonCredsHolderService.js +0 -5
- package/build/services/AnonCredsHolderService.js.map +0 -1
- package/build/services/AnonCredsHolderServiceOptions.d.ts +0 -101
- package/build/services/AnonCredsHolderServiceOptions.js +0 -3
- package/build/services/AnonCredsHolderServiceOptions.js.map +0 -1
- package/build/services/AnonCredsIssuerService.d.ts +0 -14
- package/build/services/AnonCredsIssuerService.js +0 -5
- package/build/services/AnonCredsIssuerService.js.map +0 -1
- package/build/services/AnonCredsIssuerServiceOptions.d.ts +0 -61
- package/build/services/AnonCredsIssuerServiceOptions.js +0 -3
- package/build/services/AnonCredsIssuerServiceOptions.js.map +0 -1
- package/build/services/AnonCredsVerifierService.d.ts +0 -7
- package/build/services/AnonCredsVerifierService.js +0 -5
- package/build/services/AnonCredsVerifierService.js.map +0 -1
- package/build/services/AnonCredsVerifierServiceOptions.d.ts +0 -25
- package/build/services/AnonCredsVerifierServiceOptions.js +0 -3
- package/build/services/AnonCredsVerifierServiceOptions.js.map +0 -1
- package/build/services/index.d.ts +0 -8
- package/build/services/index.js +0 -27
- package/build/services/index.js.map +0 -1
- package/build/services/registry/AnonCredsRegistry.d.ts +0 -25
- package/build/services/registry/AnonCredsRegistry.js +0 -3
- package/build/services/registry/AnonCredsRegistry.js.map +0 -1
- package/build/services/registry/AnonCredsRegistryService.d.ts +0 -10
- package/build/services/registry/AnonCredsRegistryService.js +0 -33
- package/build/services/registry/AnonCredsRegistryService.js.map +0 -1
- package/build/services/registry/CredentialDefinitionOptions.d.ts +0 -34
- package/build/services/registry/CredentialDefinitionOptions.js +0 -3
- package/build/services/registry/CredentialDefinitionOptions.js.map +0 -1
- package/build/services/registry/RevocationRegistryDefinitionOptions.d.ts +0 -34
- package/build/services/registry/RevocationRegistryDefinitionOptions.js +0 -3
- package/build/services/registry/RevocationRegistryDefinitionOptions.js.map +0 -1
- package/build/services/registry/RevocationStatusListOptions.d.ts +0 -32
- package/build/services/registry/RevocationStatusListOptions.js +0 -3
- package/build/services/registry/RevocationStatusListOptions.js.map +0 -1
- package/build/services/registry/SchemaOptions.d.ts +0 -34
- package/build/services/registry/SchemaOptions.js +0 -3
- package/build/services/registry/SchemaOptions.js.map +0 -1
- package/build/services/registry/base.d.ts +0 -19
- package/build/services/registry/base.js +0 -3
- package/build/services/registry/base.js.map +0 -1
- package/build/services/registry/index.d.ts +0 -7
- package/build/services/registry/index.js +0 -23
- package/build/services/registry/index.js.map +0 -1
- package/build/services/tails/BasicTailsFileService.d.ts +0 -23
- package/build/services/tails/BasicTailsFileService.js +0 -65
- package/build/services/tails/BasicTailsFileService.js.map +0 -1
- package/build/services/tails/TailsFileService.d.ts +0 -42
- package/build/services/tails/TailsFileService.js +0 -3
- package/build/services/tails/TailsFileService.js.map +0 -1
- package/build/services/tails/index.d.ts +0 -2
- package/build/services/tails/index.js +0 -19
- package/build/services/tails/index.js.map +0 -1
- package/build/updates/0.3.1-0.4/credentialDefinition.d.ts +0 -18
- package/build/updates/0.3.1-0.4/credentialDefinition.js +0 -56
- package/build/updates/0.3.1-0.4/credentialDefinition.js.map +0 -1
- package/build/updates/0.3.1-0.4/credentialExchangeRecord.d.ts +0 -69
- package/build/updates/0.3.1-0.4/credentialExchangeRecord.js +0 -121
- package/build/updates/0.3.1-0.4/credentialExchangeRecord.js.map +0 -1
- package/build/updates/0.3.1-0.4/index.d.ts +0 -2
- package/build/updates/0.3.1-0.4/index.js +0 -14
- package/build/updates/0.3.1-0.4/index.js.map +0 -1
- package/build/updates/0.3.1-0.4/linkSecret.d.ts +0 -6
- package/build/updates/0.3.1-0.4/linkSecret.js +0 -35
- package/build/updates/0.3.1-0.4/linkSecret.js.map +0 -1
- package/build/updates/0.3.1-0.4/schema.d.ts +0 -15
- package/build/updates/0.3.1-0.4/schema.js +0 -41
- package/build/updates/0.3.1-0.4/schema.js.map +0 -1
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.d.ts +0 -5
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.js +0 -149
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.js.map +0 -1
- package/build/updates/0.4-0.5/index.d.ts +0 -2
- package/build/updates/0.4-0.5/index.js +0 -8
- package/build/updates/0.4-0.5/index.js.map +0 -1
- package/build/utils/anonCredsObjects.d.ts +0 -26
- package/build/utils/anonCredsObjects.js +0 -81
- package/build/utils/anonCredsObjects.js.map +0 -1
- package/build/utils/areRequestsEqual.d.ts +0 -6
- package/build/utils/areRequestsEqual.js +0 -135
- package/build/utils/areRequestsEqual.js.map +0 -1
- package/build/utils/composeAutoAccept.d.ts +0 -15
- package/build/utils/composeAutoAccept.js +0 -26
- package/build/utils/composeAutoAccept.js.map +0 -1
- package/build/utils/createRequestFromPreview.d.ts +0 -10
- package/build/utils/createRequestFromPreview.js +0 -71
- package/build/utils/createRequestFromPreview.js.map +0 -1
- package/build/utils/credential.d.ts +0 -68
- package/build/utils/credential.js +0 -188
- package/build/utils/credential.js.map +0 -1
- package/build/utils/credentialPreviewAttributes.d.ts +0 -2
- package/build/utils/credentialPreviewAttributes.js +0 -24
- package/build/utils/credentialPreviewAttributes.js.map +0 -1
- package/build/utils/getCredentialsForAnonCredsRequest.d.ts +0 -4
- package/build/utils/getCredentialsForAnonCredsRequest.js +0 -81
- package/build/utils/getCredentialsForAnonCredsRequest.js.map +0 -1
- package/build/utils/getRevocationRegistries.d.ts +0 -14
- package/build/utils/getRevocationRegistries.js +0 -151
- package/build/utils/getRevocationRegistries.js.map +0 -1
- package/build/utils/hasDuplicateGroupNames.d.ts +0 -2
- package/build/utils/hasDuplicateGroupNames.js +0 -22
- package/build/utils/hasDuplicateGroupNames.js.map +0 -1
- package/build/utils/index.d.ts +0 -17
- package/build/utils/index.js +0 -48
- package/build/utils/index.js.map +0 -1
- package/build/utils/indyIdentifiers.d.ts +0 -66
- package/build/utils/indyIdentifiers.js +0 -298
- package/build/utils/indyIdentifiers.js.map +0 -1
- package/build/utils/isMap.d.ts +0 -5
- package/build/utils/isMap.js +0 -17
- package/build/utils/isMap.js.map +0 -1
- package/build/utils/linkSecret.d.ts +0 -9
- package/build/utils/linkSecret.js +0 -43
- package/build/utils/linkSecret.js.map +0 -1
- package/build/utils/metadata.d.ts +0 -35
- package/build/utils/metadata.js +0 -24
- package/build/utils/metadata.js.map +0 -1
- package/build/utils/proofRequest.d.ts +0 -2
- package/build/utils/proofRequest.js +0 -21
- package/build/utils/proofRequest.js.map +0 -1
- package/build/utils/proverDid.d.ts +0 -8
- package/build/utils/proverDid.js +0 -15
- package/build/utils/proverDid.js.map +0 -1
- package/build/utils/revocationInterval.d.ts +0 -7
- package/build/utils/revocationInterval.js +0 -14
- package/build/utils/revocationInterval.js.map +0 -1
- package/build/utils/sortRequestedCredentialsMatches.d.ts +0 -8
- package/build/utils/sortRequestedCredentialsMatches.js +0 -31
- package/build/utils/sortRequestedCredentialsMatches.js.map +0 -1
- package/build/utils/timestamp.d.ts +0 -1
- package/build/utils/timestamp.js +0 -7
- package/build/utils/timestamp.js.map +0 -1
- package/build/utils/w3cAnonCredsUtils.d.ts +0 -37
- package/build/utils/w3cAnonCredsUtils.js +0 -132
- package/build/utils/w3cAnonCredsUtils.js.map +0 -1
|
@@ -1,948 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.V1CredentialProtocol = void 0;
|
|
4
|
-
const core_1 = require("@credo-ts/core");
|
|
5
|
-
const AnonCredsCredentialProposal_1 = require("../../../models/AnonCredsCredentialProposal");
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
|
-
const handlers_1 = require("./handlers");
|
|
8
|
-
const messages_1 = require("./messages");
|
|
9
|
-
class V1CredentialProtocol extends core_1.BaseCredentialProtocol {
|
|
10
|
-
constructor({ indyCredentialFormat }) {
|
|
11
|
-
super();
|
|
12
|
-
/**
|
|
13
|
-
* The version of the issue credential protocol this protocol supports
|
|
14
|
-
*/
|
|
15
|
-
this.version = 'v1';
|
|
16
|
-
// TODO: just create a new instance of LegacyIndyCredentialFormatService here so it makes the setup easier
|
|
17
|
-
this.indyCredentialFormat = indyCredentialFormat;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Registers the protocol implementation (handlers, feature registry) on the agent.
|
|
21
|
-
*/
|
|
22
|
-
register(dependencyManager, featureRegistry) {
|
|
23
|
-
// Register message handlers for the Issue Credential V1 Protocol
|
|
24
|
-
dependencyManager.registerMessageHandlers([
|
|
25
|
-
new handlers_1.V1ProposeCredentialHandler(this),
|
|
26
|
-
new handlers_1.V1OfferCredentialHandler(this),
|
|
27
|
-
new handlers_1.V1RequestCredentialHandler(this),
|
|
28
|
-
new handlers_1.V1IssueCredentialHandler(this),
|
|
29
|
-
new handlers_1.V1CredentialAckHandler(this),
|
|
30
|
-
new handlers_1.V1CredentialProblemReportHandler(this),
|
|
31
|
-
]);
|
|
32
|
-
// Register Issue Credential V1 in feature registry, with supported roles
|
|
33
|
-
featureRegistry.register(new core_1.Protocol({
|
|
34
|
-
id: 'https://didcomm.org/issue-credential/1.0',
|
|
35
|
-
roles: ['holder', 'issuer'],
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Create a {@link ProposeCredentialMessage} not bound to an existing credential exchange.
|
|
40
|
-
* To create a proposal as response to an existing credential exchange, use {@link createProposalAsResponse}.
|
|
41
|
-
*
|
|
42
|
-
* @param options The object containing config options
|
|
43
|
-
* @returns Object containing proposal message and associated credential record
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
async createProposal(agentContext, { connectionRecord, credentialFormats, comment, autoAcceptCredential, }) {
|
|
47
|
-
this.assertOnlyIndyFormat(credentialFormats);
|
|
48
|
-
const credentialRepository = agentContext.dependencyManager.resolve(core_1.CredentialRepository);
|
|
49
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
50
|
-
if (!credentialFormats.indy) {
|
|
51
|
-
throw new core_1.CredoError('Missing indy credential format in v1 create proposal call.');
|
|
52
|
-
}
|
|
53
|
-
// TODO: linked attachments are broken currently. We never include them in the messages.
|
|
54
|
-
// The linking with previews does work, so it shouldn't be too much work to re-enable this.
|
|
55
|
-
const { linkedAttachments } = credentialFormats.indy;
|
|
56
|
-
// Create record
|
|
57
|
-
const credentialRecord = new core_1.CredentialExchangeRecord({
|
|
58
|
-
connectionId: connectionRecord.id,
|
|
59
|
-
threadId: core_1.utils.uuid(),
|
|
60
|
-
state: core_1.CredentialState.ProposalSent,
|
|
61
|
-
role: core_1.CredentialRole.Holder,
|
|
62
|
-
linkedAttachments: linkedAttachments === null || linkedAttachments === void 0 ? void 0 : linkedAttachments.map((linkedAttachment) => linkedAttachment.attachment),
|
|
63
|
-
autoAcceptCredential,
|
|
64
|
-
protocolVersion: 'v1',
|
|
65
|
-
});
|
|
66
|
-
// call create proposal for validation of the proposal and addition of linked attachments
|
|
67
|
-
const { previewAttributes, attachment } = await this.indyCredentialFormat.createProposal(agentContext, {
|
|
68
|
-
credentialFormats,
|
|
69
|
-
credentialRecord,
|
|
70
|
-
});
|
|
71
|
-
// Transform the attachment into the attachment payload and use that to construct the v1 message
|
|
72
|
-
const indyCredentialProposal = core_1.JsonTransformer.fromJSON(attachment.getDataAsJson(), AnonCredsCredentialProposal_1.AnonCredsCredentialProposal);
|
|
73
|
-
const credentialProposal = previewAttributes
|
|
74
|
-
? new messages_1.V1CredentialPreview({
|
|
75
|
-
attributes: previewAttributes,
|
|
76
|
-
})
|
|
77
|
-
: undefined;
|
|
78
|
-
// Create message
|
|
79
|
-
const message = new messages_1.V1ProposeCredentialMessage(Object.assign(Object.assign({}, indyCredentialProposal), { id: credentialRecord.threadId, credentialPreview: credentialProposal, comment }));
|
|
80
|
-
await didCommMessageRepository.saveAgentMessage(agentContext, {
|
|
81
|
-
agentMessage: message,
|
|
82
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
83
|
-
associatedRecordId: credentialRecord.id,
|
|
84
|
-
});
|
|
85
|
-
credentialRecord.credentialAttributes = credentialProposal === null || credentialProposal === void 0 ? void 0 : credentialProposal.attributes;
|
|
86
|
-
await credentialRepository.save(agentContext, credentialRecord);
|
|
87
|
-
this.emitStateChangedEvent(agentContext, credentialRecord, null);
|
|
88
|
-
return { credentialRecord, message };
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Process a received {@link ProposeCredentialMessage}. This will not accept the credential proposal
|
|
92
|
-
* or send a credential offer. It will only create a new, or update the existing credential record with
|
|
93
|
-
* the information from the credential proposal message. Use {@link createOfferAsResponse}
|
|
94
|
-
* after calling this method to create a credential offer.
|
|
95
|
-
*
|
|
96
|
-
* @param messageContext The message context containing a credential proposal message
|
|
97
|
-
* @returns credential record associated with the credential proposal message
|
|
98
|
-
*
|
|
99
|
-
*/
|
|
100
|
-
async processProposal(messageContext) {
|
|
101
|
-
const { message: proposalMessage, connection, agentContext } = messageContext;
|
|
102
|
-
const credentialRepository = agentContext.dependencyManager.resolve(core_1.CredentialRepository);
|
|
103
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
104
|
-
// TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it
|
|
105
|
-
// only depends on the public api, rather than the internal API (this helps with breaking changes)
|
|
106
|
-
const connectionService = agentContext.dependencyManager.resolve(core_1.ConnectionService);
|
|
107
|
-
agentContext.config.logger.debug(`Processing credential proposal with message id ${proposalMessage.id}`);
|
|
108
|
-
let credentialRecord = await this.findByProperties(messageContext.agentContext, {
|
|
109
|
-
threadId: proposalMessage.threadId,
|
|
110
|
-
role: core_1.CredentialRole.Issuer,
|
|
111
|
-
connectionId: connection === null || connection === void 0 ? void 0 : connection.id,
|
|
112
|
-
});
|
|
113
|
-
// Credential record already exists, this is a response to an earlier message sent by us
|
|
114
|
-
if (credentialRecord) {
|
|
115
|
-
agentContext.config.logger.debug('Credential record already exists for incoming proposal');
|
|
116
|
-
// Assert
|
|
117
|
-
credentialRecord.assertProtocolVersion('v1');
|
|
118
|
-
credentialRecord.assertState(core_1.CredentialState.OfferSent);
|
|
119
|
-
const lastReceivedMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {
|
|
120
|
-
associatedRecordId: credentialRecord.id,
|
|
121
|
-
messageClass: messages_1.V1ProposeCredentialMessage,
|
|
122
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
123
|
-
});
|
|
124
|
-
const lastSentMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {
|
|
125
|
-
associatedRecordId: credentialRecord.id,
|
|
126
|
-
messageClass: messages_1.V1OfferCredentialMessage,
|
|
127
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
128
|
-
});
|
|
129
|
-
await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {
|
|
130
|
-
lastReceivedMessage,
|
|
131
|
-
lastSentMessage,
|
|
132
|
-
expectedConnectionId: credentialRecord.connectionId,
|
|
133
|
-
});
|
|
134
|
-
await this.indyCredentialFormat.processProposal(messageContext.agentContext, {
|
|
135
|
-
credentialRecord,
|
|
136
|
-
attachment: new core_1.Attachment({
|
|
137
|
-
data: new core_1.AttachmentData({
|
|
138
|
-
json: core_1.JsonTransformer.toJSON(this.rfc0592ProposalFromV1ProposeMessage(proposalMessage)),
|
|
139
|
-
}),
|
|
140
|
-
}),
|
|
141
|
-
});
|
|
142
|
-
// Update record
|
|
143
|
-
await this.updateState(messageContext.agentContext, credentialRecord, core_1.CredentialState.ProposalReceived);
|
|
144
|
-
await didCommMessageRepository.saveOrUpdateAgentMessage(messageContext.agentContext, {
|
|
145
|
-
agentMessage: proposalMessage,
|
|
146
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
147
|
-
associatedRecordId: credentialRecord.id,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
agentContext.config.logger.debug('Credential record does not exists yet for incoming proposal');
|
|
152
|
-
// Assert
|
|
153
|
-
await connectionService.assertConnectionOrOutOfBandExchange(messageContext);
|
|
154
|
-
// No credential record exists with thread id
|
|
155
|
-
credentialRecord = new core_1.CredentialExchangeRecord({
|
|
156
|
-
connectionId: connection === null || connection === void 0 ? void 0 : connection.id,
|
|
157
|
-
threadId: proposalMessage.threadId,
|
|
158
|
-
state: core_1.CredentialState.ProposalReceived,
|
|
159
|
-
role: core_1.CredentialRole.Issuer,
|
|
160
|
-
protocolVersion: 'v1',
|
|
161
|
-
});
|
|
162
|
-
// Save record
|
|
163
|
-
await credentialRepository.save(messageContext.agentContext, credentialRecord);
|
|
164
|
-
this.emitStateChangedEvent(messageContext.agentContext, credentialRecord, null);
|
|
165
|
-
await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {
|
|
166
|
-
agentMessage: proposalMessage,
|
|
167
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
168
|
-
associatedRecordId: credentialRecord.id,
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
return credentialRecord;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Processing an incoming credential message and create a credential offer as a response
|
|
175
|
-
* @param options The object containing config options
|
|
176
|
-
* @returns Object containing proposal message and associated credential record
|
|
177
|
-
*/
|
|
178
|
-
async acceptProposal(agentContext, { credentialRecord, credentialFormats, comment, autoAcceptCredential, }) {
|
|
179
|
-
var _a;
|
|
180
|
-
// Assert
|
|
181
|
-
credentialRecord.assertProtocolVersion('v1');
|
|
182
|
-
credentialRecord.assertState(core_1.CredentialState.ProposalReceived);
|
|
183
|
-
if (credentialFormats)
|
|
184
|
-
this.assertOnlyIndyFormat(credentialFormats);
|
|
185
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
186
|
-
const proposalMessage = await didCommMessageRepository.getAgentMessage(agentContext, {
|
|
187
|
-
associatedRecordId: credentialRecord.id,
|
|
188
|
-
messageClass: messages_1.V1ProposeCredentialMessage,
|
|
189
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
190
|
-
});
|
|
191
|
-
// NOTE: We set the credential attributes from the proposal on the record as we've 'accepted' them
|
|
192
|
-
// and can now use them to create the offer in the format services. It may be overwritten later on
|
|
193
|
-
// if the user provided other attributes in the credentialFormats array.
|
|
194
|
-
credentialRecord.credentialAttributes = (_a = proposalMessage.credentialPreview) === null || _a === void 0 ? void 0 : _a.attributes;
|
|
195
|
-
const { attachment, previewAttributes } = await this.indyCredentialFormat.acceptProposal(agentContext, {
|
|
196
|
-
attachmentId: messages_1.INDY_CREDENTIAL_OFFER_ATTACHMENT_ID,
|
|
197
|
-
credentialFormats,
|
|
198
|
-
credentialRecord,
|
|
199
|
-
proposalAttachment: new core_1.Attachment({
|
|
200
|
-
data: new core_1.AttachmentData({
|
|
201
|
-
json: core_1.JsonTransformer.toJSON(this.rfc0592ProposalFromV1ProposeMessage(proposalMessage)),
|
|
202
|
-
}),
|
|
203
|
-
}),
|
|
204
|
-
});
|
|
205
|
-
if (!previewAttributes) {
|
|
206
|
-
throw new core_1.CredoError('Missing required credential preview attributes from indy format service');
|
|
207
|
-
}
|
|
208
|
-
const message = new messages_1.V1OfferCredentialMessage({
|
|
209
|
-
comment,
|
|
210
|
-
offerAttachments: [attachment],
|
|
211
|
-
credentialPreview: new messages_1.V1CredentialPreview({
|
|
212
|
-
attributes: previewAttributes,
|
|
213
|
-
}),
|
|
214
|
-
attachments: credentialRecord.linkedAttachments,
|
|
215
|
-
});
|
|
216
|
-
message.setThread({ threadId: credentialRecord.threadId, parentThreadId: credentialRecord.parentThreadId });
|
|
217
|
-
credentialRecord.credentialAttributes = message.credentialPreview.attributes;
|
|
218
|
-
credentialRecord.autoAcceptCredential = autoAcceptCredential !== null && autoAcceptCredential !== void 0 ? autoAcceptCredential : credentialRecord.autoAcceptCredential;
|
|
219
|
-
await this.updateState(agentContext, credentialRecord, core_1.CredentialState.OfferSent);
|
|
220
|
-
await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {
|
|
221
|
-
agentMessage: message,
|
|
222
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
223
|
-
associatedRecordId: credentialRecord.id,
|
|
224
|
-
});
|
|
225
|
-
return { credentialRecord, message };
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Negotiate a credential proposal as issuer (by sending a credential offer message) to the connection
|
|
229
|
-
* associated with the credential record.
|
|
230
|
-
*
|
|
231
|
-
* @param options configuration for the offer see {@link NegotiateCredentialProposalOptions}
|
|
232
|
-
* @returns Credential record associated with the credential offer and the corresponding new offer message
|
|
233
|
-
*
|
|
234
|
-
*/
|
|
235
|
-
async negotiateProposal(agentContext, { credentialFormats, credentialRecord, comment, autoAcceptCredential, }) {
|
|
236
|
-
// Assert
|
|
237
|
-
credentialRecord.assertProtocolVersion('v1');
|
|
238
|
-
credentialRecord.assertState(core_1.CredentialState.ProposalReceived);
|
|
239
|
-
this.assertOnlyIndyFormat(credentialFormats);
|
|
240
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
241
|
-
const { attachment, previewAttributes } = await this.indyCredentialFormat.createOffer(agentContext, {
|
|
242
|
-
attachmentId: messages_1.INDY_CREDENTIAL_OFFER_ATTACHMENT_ID,
|
|
243
|
-
credentialFormats,
|
|
244
|
-
credentialRecord,
|
|
245
|
-
});
|
|
246
|
-
if (!previewAttributes) {
|
|
247
|
-
throw new core_1.CredoError('Missing required credential preview attributes from indy format service');
|
|
248
|
-
}
|
|
249
|
-
const message = new messages_1.V1OfferCredentialMessage({
|
|
250
|
-
comment,
|
|
251
|
-
offerAttachments: [attachment],
|
|
252
|
-
credentialPreview: new messages_1.V1CredentialPreview({
|
|
253
|
-
attributes: previewAttributes,
|
|
254
|
-
}),
|
|
255
|
-
attachments: credentialRecord.linkedAttachments,
|
|
256
|
-
});
|
|
257
|
-
message.setThread({ threadId: credentialRecord.threadId, parentThreadId: credentialRecord.parentThreadId });
|
|
258
|
-
credentialRecord.credentialAttributes = message.credentialPreview.attributes;
|
|
259
|
-
credentialRecord.autoAcceptCredential = autoAcceptCredential !== null && autoAcceptCredential !== void 0 ? autoAcceptCredential : credentialRecord.autoAcceptCredential;
|
|
260
|
-
await this.updateState(agentContext, credentialRecord, core_1.CredentialState.OfferSent);
|
|
261
|
-
await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {
|
|
262
|
-
agentMessage: message,
|
|
263
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
264
|
-
associatedRecordId: credentialRecord.id,
|
|
265
|
-
});
|
|
266
|
-
return { credentialRecord, message };
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Create a {@link OfferCredentialMessage} not bound to an existing credential exchange.
|
|
270
|
-
* To create an offer as response to an existing credential exchange, use {@link V1CredentialProtocol#createOfferAsResponse}.
|
|
271
|
-
*
|
|
272
|
-
* @param options The options containing config params for creating the credential offer
|
|
273
|
-
* @returns Object containing offer message and associated credential record
|
|
274
|
-
*
|
|
275
|
-
*/
|
|
276
|
-
async createOffer(agentContext, { credentialFormats, autoAcceptCredential, comment, connectionRecord, }) {
|
|
277
|
-
var _a, _b;
|
|
278
|
-
// Assert
|
|
279
|
-
this.assertOnlyIndyFormat(credentialFormats);
|
|
280
|
-
const credentialRepository = agentContext.dependencyManager.resolve(core_1.CredentialRepository);
|
|
281
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
282
|
-
if (!credentialFormats.indy) {
|
|
283
|
-
throw new core_1.CredoError('Missing indy credential format data for v1 create offer');
|
|
284
|
-
}
|
|
285
|
-
// Create record
|
|
286
|
-
const credentialRecord = new core_1.CredentialExchangeRecord({
|
|
287
|
-
connectionId: connectionRecord === null || connectionRecord === void 0 ? void 0 : connectionRecord.id,
|
|
288
|
-
threadId: core_1.utils.uuid(),
|
|
289
|
-
linkedAttachments: (_a = credentialFormats.indy.linkedAttachments) === null || _a === void 0 ? void 0 : _a.map((linkedAttachments) => linkedAttachments.attachment),
|
|
290
|
-
state: core_1.CredentialState.OfferSent,
|
|
291
|
-
role: core_1.CredentialRole.Issuer,
|
|
292
|
-
autoAcceptCredential,
|
|
293
|
-
protocolVersion: 'v1',
|
|
294
|
-
});
|
|
295
|
-
const { attachment, previewAttributes } = await this.indyCredentialFormat.createOffer(agentContext, {
|
|
296
|
-
attachmentId: messages_1.INDY_CREDENTIAL_OFFER_ATTACHMENT_ID,
|
|
297
|
-
credentialFormats,
|
|
298
|
-
credentialRecord,
|
|
299
|
-
});
|
|
300
|
-
if (!previewAttributes) {
|
|
301
|
-
throw new core_1.CredoError('Missing required credential preview from indy format service');
|
|
302
|
-
}
|
|
303
|
-
// Construct offer message
|
|
304
|
-
const message = new messages_1.V1OfferCredentialMessage({
|
|
305
|
-
id: credentialRecord.threadId,
|
|
306
|
-
credentialPreview: new messages_1.V1CredentialPreview({
|
|
307
|
-
attributes: previewAttributes,
|
|
308
|
-
}),
|
|
309
|
-
comment,
|
|
310
|
-
offerAttachments: [attachment],
|
|
311
|
-
attachments: (_b = credentialFormats.indy.linkedAttachments) === null || _b === void 0 ? void 0 : _b.map((linkedAttachments) => linkedAttachments.attachment),
|
|
312
|
-
});
|
|
313
|
-
await didCommMessageRepository.saveAgentMessage(agentContext, {
|
|
314
|
-
associatedRecordId: credentialRecord.id,
|
|
315
|
-
agentMessage: message,
|
|
316
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
317
|
-
});
|
|
318
|
-
credentialRecord.credentialAttributes = message.credentialPreview.attributes;
|
|
319
|
-
await credentialRepository.save(agentContext, credentialRecord);
|
|
320
|
-
this.emitStateChangedEvent(agentContext, credentialRecord, null);
|
|
321
|
-
return { message, credentialRecord };
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Process a received {@link OfferCredentialMessage}. This will not accept the credential offer
|
|
325
|
-
* or send a credential request. It will only create a new credential record with
|
|
326
|
-
* the information from the credential offer message. Use {@link createRequest}
|
|
327
|
-
* after calling this method to create a credential request.
|
|
328
|
-
*
|
|
329
|
-
* @param messageContext The message context containing a credential request message
|
|
330
|
-
* @returns credential record associated with the credential offer message
|
|
331
|
-
*
|
|
332
|
-
*/
|
|
333
|
-
async processOffer(messageContext) {
|
|
334
|
-
var _a;
|
|
335
|
-
const { message: offerMessage, connection, agentContext } = messageContext;
|
|
336
|
-
const credentialRepository = agentContext.dependencyManager.resolve(core_1.CredentialRepository);
|
|
337
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
338
|
-
// TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it
|
|
339
|
-
// only depends on the public api, rather than the internal API (this helps with breaking changes)
|
|
340
|
-
const connectionService = agentContext.dependencyManager.resolve(core_1.ConnectionService);
|
|
341
|
-
agentContext.config.logger.debug(`Processing credential offer with id ${offerMessage.id}`);
|
|
342
|
-
let credentialRecord = await this.findByProperties(agentContext, {
|
|
343
|
-
threadId: offerMessage.threadId,
|
|
344
|
-
role: core_1.CredentialRole.Holder,
|
|
345
|
-
connectionId: connection === null || connection === void 0 ? void 0 : connection.id,
|
|
346
|
-
});
|
|
347
|
-
const offerAttachment = offerMessage.getOfferAttachmentById(messages_1.INDY_CREDENTIAL_OFFER_ATTACHMENT_ID);
|
|
348
|
-
if (!offerAttachment) {
|
|
349
|
-
throw new core_1.CredoError(`Indy attachment with id ${messages_1.INDY_CREDENTIAL_OFFER_ATTACHMENT_ID} not found in offer message`);
|
|
350
|
-
}
|
|
351
|
-
if (credentialRecord) {
|
|
352
|
-
const lastSentMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {
|
|
353
|
-
associatedRecordId: credentialRecord.id,
|
|
354
|
-
messageClass: messages_1.V1ProposeCredentialMessage,
|
|
355
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
356
|
-
});
|
|
357
|
-
const lastReceivedMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {
|
|
358
|
-
associatedRecordId: credentialRecord.id,
|
|
359
|
-
messageClass: messages_1.V1OfferCredentialMessage,
|
|
360
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
361
|
-
});
|
|
362
|
-
// Assert
|
|
363
|
-
credentialRecord.assertProtocolVersion('v1');
|
|
364
|
-
credentialRecord.assertState(core_1.CredentialState.ProposalSent);
|
|
365
|
-
await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {
|
|
366
|
-
lastReceivedMessage,
|
|
367
|
-
lastSentMessage,
|
|
368
|
-
expectedConnectionId: credentialRecord.connectionId,
|
|
369
|
-
});
|
|
370
|
-
await this.indyCredentialFormat.processOffer(messageContext.agentContext, {
|
|
371
|
-
credentialRecord,
|
|
372
|
-
attachment: offerAttachment,
|
|
373
|
-
});
|
|
374
|
-
await didCommMessageRepository.saveOrUpdateAgentMessage(messageContext.agentContext, {
|
|
375
|
-
agentMessage: offerMessage,
|
|
376
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
377
|
-
associatedRecordId: credentialRecord.id,
|
|
378
|
-
});
|
|
379
|
-
await this.updateState(messageContext.agentContext, credentialRecord, core_1.CredentialState.OfferReceived);
|
|
380
|
-
return credentialRecord;
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
// Assert
|
|
384
|
-
await connectionService.assertConnectionOrOutOfBandExchange(messageContext);
|
|
385
|
-
// No credential record exists with thread id
|
|
386
|
-
credentialRecord = new core_1.CredentialExchangeRecord({
|
|
387
|
-
connectionId: connection === null || connection === void 0 ? void 0 : connection.id,
|
|
388
|
-
threadId: offerMessage.threadId,
|
|
389
|
-
parentThreadId: (_a = offerMessage.thread) === null || _a === void 0 ? void 0 : _a.parentThreadId,
|
|
390
|
-
state: core_1.CredentialState.OfferReceived,
|
|
391
|
-
role: core_1.CredentialRole.Holder,
|
|
392
|
-
protocolVersion: 'v1',
|
|
393
|
-
});
|
|
394
|
-
await this.indyCredentialFormat.processOffer(messageContext.agentContext, {
|
|
395
|
-
credentialRecord,
|
|
396
|
-
attachment: offerAttachment,
|
|
397
|
-
});
|
|
398
|
-
// Save in repository
|
|
399
|
-
await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {
|
|
400
|
-
agentMessage: offerMessage,
|
|
401
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
402
|
-
associatedRecordId: credentialRecord.id,
|
|
403
|
-
});
|
|
404
|
-
await credentialRepository.save(messageContext.agentContext, credentialRecord);
|
|
405
|
-
this.emitStateChangedEvent(messageContext.agentContext, credentialRecord, null);
|
|
406
|
-
return credentialRecord;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Create a {@link RequestCredentialMessage} as response to a received credential offer.
|
|
411
|
-
*
|
|
412
|
-
* @param options configuration to use for the credential request
|
|
413
|
-
* @returns Object containing request message and associated credential record
|
|
414
|
-
*
|
|
415
|
-
*/
|
|
416
|
-
async acceptOffer(agentContext, { credentialRecord, credentialFormats, comment, autoAcceptCredential, }) {
|
|
417
|
-
var _a, _b;
|
|
418
|
-
// Assert credential
|
|
419
|
-
credentialRecord.assertProtocolVersion('v1');
|
|
420
|
-
credentialRecord.assertState(core_1.CredentialState.OfferReceived);
|
|
421
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
422
|
-
const offerMessage = await didCommMessageRepository.getAgentMessage(agentContext, {
|
|
423
|
-
associatedRecordId: credentialRecord.id,
|
|
424
|
-
messageClass: messages_1.V1OfferCredentialMessage,
|
|
425
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
426
|
-
});
|
|
427
|
-
const offerAttachment = offerMessage.getOfferAttachmentById(messages_1.INDY_CREDENTIAL_OFFER_ATTACHMENT_ID);
|
|
428
|
-
if (!offerAttachment) {
|
|
429
|
-
throw new core_1.CredoError(`Indy attachment with id ${messages_1.INDY_CREDENTIAL_OFFER_ATTACHMENT_ID} not found in offer message`);
|
|
430
|
-
}
|
|
431
|
-
const { attachment } = await this.indyCredentialFormat.acceptOffer(agentContext, {
|
|
432
|
-
credentialRecord,
|
|
433
|
-
credentialFormats,
|
|
434
|
-
attachmentId: messages_1.INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID,
|
|
435
|
-
offerAttachment,
|
|
436
|
-
});
|
|
437
|
-
const requestMessage = new messages_1.V1RequestCredentialMessage({
|
|
438
|
-
comment,
|
|
439
|
-
requestAttachments: [attachment],
|
|
440
|
-
attachments: (_a = offerMessage.appendedAttachments) === null || _a === void 0 ? void 0 : _a.filter((attachment) => (0, core_1.isLinkedAttachment)(attachment)),
|
|
441
|
-
});
|
|
442
|
-
requestMessage.setThread({ threadId: credentialRecord.threadId, parentThreadId: credentialRecord.parentThreadId });
|
|
443
|
-
credentialRecord.credentialAttributes = offerMessage.credentialPreview.attributes;
|
|
444
|
-
credentialRecord.autoAcceptCredential = autoAcceptCredential !== null && autoAcceptCredential !== void 0 ? autoAcceptCredential : credentialRecord.autoAcceptCredential;
|
|
445
|
-
credentialRecord.linkedAttachments = (_b = offerMessage.appendedAttachments) === null || _b === void 0 ? void 0 : _b.filter((attachment) => (0, core_1.isLinkedAttachment)(attachment));
|
|
446
|
-
await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {
|
|
447
|
-
agentMessage: requestMessage,
|
|
448
|
-
associatedRecordId: credentialRecord.id,
|
|
449
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
450
|
-
});
|
|
451
|
-
await this.updateState(agentContext, credentialRecord, core_1.CredentialState.RequestSent);
|
|
452
|
-
return { message: requestMessage, credentialRecord };
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Process a received {@link RequestCredentialMessage}. This will not accept the credential request
|
|
456
|
-
* or send a credential. It will only update the existing credential record with
|
|
457
|
-
* the information from the credential request message. Use {@link createCredential}
|
|
458
|
-
* after calling this method to create a credential.
|
|
459
|
-
*
|
|
460
|
-
* @param messageContext The message context containing a credential request message
|
|
461
|
-
* @returns credential record associated with the credential request message
|
|
462
|
-
*
|
|
463
|
-
*/
|
|
464
|
-
async negotiateOffer(agentContext, { credentialFormats, credentialRecord, autoAcceptCredential, comment, }) {
|
|
465
|
-
var _a;
|
|
466
|
-
// Assert
|
|
467
|
-
credentialRecord.assertProtocolVersion('v1');
|
|
468
|
-
credentialRecord.assertState(core_1.CredentialState.OfferReceived);
|
|
469
|
-
this.assertOnlyIndyFormat(credentialFormats);
|
|
470
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
471
|
-
if (!credentialRecord.connectionId) {
|
|
472
|
-
throw new core_1.CredoError(`No connectionId found for credential record '${credentialRecord.id}'. Connection-less issuance does not support negotiation.`);
|
|
473
|
-
}
|
|
474
|
-
if (!credentialFormats.indy) {
|
|
475
|
-
throw new core_1.CredoError('Missing indy credential format in v1 negotiate proposal call.');
|
|
476
|
-
}
|
|
477
|
-
const { linkedAttachments } = credentialFormats.indy;
|
|
478
|
-
// call create proposal for validation of the proposal and addition of linked attachments
|
|
479
|
-
// As the format is different for v1 of the issue credential protocol we won't be using the attachment
|
|
480
|
-
const { previewAttributes, attachment } = await this.indyCredentialFormat.createProposal(agentContext, {
|
|
481
|
-
credentialFormats,
|
|
482
|
-
credentialRecord,
|
|
483
|
-
});
|
|
484
|
-
// Transform the attachment into the attachment payload and use that to construct the v1 message
|
|
485
|
-
const indyCredentialProposal = core_1.JsonTransformer.fromJSON(attachment.getDataAsJson(), AnonCredsCredentialProposal_1.AnonCredsCredentialProposal);
|
|
486
|
-
const credentialProposal = previewAttributes
|
|
487
|
-
? new messages_1.V1CredentialPreview({
|
|
488
|
-
attributes: previewAttributes,
|
|
489
|
-
})
|
|
490
|
-
: undefined;
|
|
491
|
-
// Create message
|
|
492
|
-
const message = new messages_1.V1ProposeCredentialMessage(Object.assign(Object.assign({}, indyCredentialProposal), { credentialPreview: credentialProposal, comment }));
|
|
493
|
-
message.setThread({ threadId: credentialRecord.threadId, parentThreadId: credentialRecord.parentThreadId });
|
|
494
|
-
await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {
|
|
495
|
-
agentMessage: message,
|
|
496
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
497
|
-
associatedRecordId: credentialRecord.id,
|
|
498
|
-
});
|
|
499
|
-
// Update record
|
|
500
|
-
credentialRecord.credentialAttributes = (_a = message.credentialPreview) === null || _a === void 0 ? void 0 : _a.attributes;
|
|
501
|
-
credentialRecord.linkedAttachments = linkedAttachments === null || linkedAttachments === void 0 ? void 0 : linkedAttachments.map((attachment) => attachment.attachment);
|
|
502
|
-
credentialRecord.autoAcceptCredential = autoAcceptCredential !== null && autoAcceptCredential !== void 0 ? autoAcceptCredential : credentialRecord.autoAcceptCredential;
|
|
503
|
-
await this.updateState(agentContext, credentialRecord, core_1.CredentialState.ProposalSent);
|
|
504
|
-
return { credentialRecord, message };
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Starting from a request is not supported in v1 of the issue credential protocol
|
|
508
|
-
* because indy doesn't allow to start from a request
|
|
509
|
-
*/
|
|
510
|
-
async createRequest() {
|
|
511
|
-
throw new core_1.CredoError('Starting from a request is not supported for v1 issue credential protocol');
|
|
512
|
-
}
|
|
513
|
-
async processRequest(messageContext) {
|
|
514
|
-
const { message: requestMessage, connection, agentContext } = messageContext;
|
|
515
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
516
|
-
// TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it
|
|
517
|
-
// only depends on the public api, rather than the internal API (this helps with breaking changes)
|
|
518
|
-
const connectionService = agentContext.dependencyManager.resolve(core_1.ConnectionService);
|
|
519
|
-
agentContext.config.logger.debug(`Processing credential request with id ${requestMessage.id}`);
|
|
520
|
-
const credentialRecord = await this.getByProperties(messageContext.agentContext, {
|
|
521
|
-
threadId: requestMessage.threadId,
|
|
522
|
-
role: core_1.CredentialRole.Issuer,
|
|
523
|
-
});
|
|
524
|
-
agentContext.config.logger.trace('Credential record found when processing credential request', credentialRecord);
|
|
525
|
-
const proposalMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {
|
|
526
|
-
associatedRecordId: credentialRecord.id,
|
|
527
|
-
messageClass: messages_1.V1ProposeCredentialMessage,
|
|
528
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
529
|
-
});
|
|
530
|
-
const offerMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {
|
|
531
|
-
associatedRecordId: credentialRecord.id,
|
|
532
|
-
messageClass: messages_1.V1OfferCredentialMessage,
|
|
533
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
534
|
-
});
|
|
535
|
-
// Assert
|
|
536
|
-
credentialRecord.assertProtocolVersion('v1');
|
|
537
|
-
credentialRecord.assertState(core_1.CredentialState.OfferSent);
|
|
538
|
-
await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {
|
|
539
|
-
lastReceivedMessage: proposalMessage !== null && proposalMessage !== void 0 ? proposalMessage : undefined,
|
|
540
|
-
lastSentMessage: offerMessage !== null && offerMessage !== void 0 ? offerMessage : undefined,
|
|
541
|
-
expectedConnectionId: credentialRecord.connectionId,
|
|
542
|
-
});
|
|
543
|
-
// This makes sure that the sender of the incoming message is authorized to do so.
|
|
544
|
-
if (!credentialRecord.connectionId) {
|
|
545
|
-
await connectionService.matchIncomingMessageToRequestMessageInOutOfBandExchange(messageContext, {
|
|
546
|
-
expectedConnectionId: credentialRecord.connectionId,
|
|
547
|
-
});
|
|
548
|
-
credentialRecord.connectionId = connection === null || connection === void 0 ? void 0 : connection.id;
|
|
549
|
-
}
|
|
550
|
-
const requestAttachment = requestMessage.getRequestAttachmentById(messages_1.INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID);
|
|
551
|
-
if (!requestAttachment) {
|
|
552
|
-
throw new core_1.CredoError(`Indy attachment with id ${messages_1.INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID} not found in request message`);
|
|
553
|
-
}
|
|
554
|
-
await this.indyCredentialFormat.processRequest(messageContext.agentContext, {
|
|
555
|
-
credentialRecord,
|
|
556
|
-
attachment: requestAttachment,
|
|
557
|
-
});
|
|
558
|
-
await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {
|
|
559
|
-
agentMessage: requestMessage,
|
|
560
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
561
|
-
associatedRecordId: credentialRecord.id,
|
|
562
|
-
});
|
|
563
|
-
await this.updateState(messageContext.agentContext, credentialRecord, core_1.CredentialState.RequestReceived);
|
|
564
|
-
return credentialRecord;
|
|
565
|
-
}
|
|
566
|
-
/**
|
|
567
|
-
* Create a {@link V1IssueCredentialMessage} as response to a received credential request.
|
|
568
|
-
*
|
|
569
|
-
* @returns Object containing issue credential message and associated credential record
|
|
570
|
-
*
|
|
571
|
-
*/
|
|
572
|
-
async acceptRequest(agentContext, { credentialRecord, credentialFormats, comment, autoAcceptCredential, }) {
|
|
573
|
-
// Assert
|
|
574
|
-
credentialRecord.assertProtocolVersion('v1');
|
|
575
|
-
credentialRecord.assertState(core_1.CredentialState.RequestReceived);
|
|
576
|
-
if (credentialFormats)
|
|
577
|
-
this.assertOnlyIndyFormat(credentialFormats);
|
|
578
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
579
|
-
const offerMessage = await didCommMessageRepository.getAgentMessage(agentContext, {
|
|
580
|
-
associatedRecordId: credentialRecord.id,
|
|
581
|
-
messageClass: messages_1.V1OfferCredentialMessage,
|
|
582
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
583
|
-
});
|
|
584
|
-
const requestMessage = await didCommMessageRepository.getAgentMessage(agentContext, {
|
|
585
|
-
associatedRecordId: credentialRecord.id,
|
|
586
|
-
messageClass: messages_1.V1RequestCredentialMessage,
|
|
587
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
588
|
-
});
|
|
589
|
-
const offerAttachment = offerMessage.getOfferAttachmentById(messages_1.INDY_CREDENTIAL_OFFER_ATTACHMENT_ID);
|
|
590
|
-
const requestAttachment = requestMessage.getRequestAttachmentById(messages_1.INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID);
|
|
591
|
-
if (!offerAttachment || !requestAttachment) {
|
|
592
|
-
throw new core_1.CredoError(`Missing data payload in offer or request attachment in credential Record ${credentialRecord.id}`);
|
|
593
|
-
}
|
|
594
|
-
const { attachment } = await this.indyCredentialFormat.acceptRequest(agentContext, {
|
|
595
|
-
credentialRecord,
|
|
596
|
-
requestAttachment,
|
|
597
|
-
offerAttachment,
|
|
598
|
-
attachmentId: messages_1.INDY_CREDENTIAL_ATTACHMENT_ID,
|
|
599
|
-
credentialFormats,
|
|
600
|
-
});
|
|
601
|
-
const issueMessage = new messages_1.V1IssueCredentialMessage({
|
|
602
|
-
comment,
|
|
603
|
-
credentialAttachments: [attachment],
|
|
604
|
-
attachments: credentialRecord.linkedAttachments,
|
|
605
|
-
});
|
|
606
|
-
issueMessage.setThread({ threadId: credentialRecord.threadId, parentThreadId: credentialRecord.parentThreadId });
|
|
607
|
-
issueMessage.setPleaseAck();
|
|
608
|
-
await didCommMessageRepository.saveAgentMessage(agentContext, {
|
|
609
|
-
agentMessage: issueMessage,
|
|
610
|
-
associatedRecordId: credentialRecord.id,
|
|
611
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
612
|
-
});
|
|
613
|
-
credentialRecord.autoAcceptCredential = autoAcceptCredential !== null && autoAcceptCredential !== void 0 ? autoAcceptCredential : credentialRecord.autoAcceptCredential;
|
|
614
|
-
await this.updateState(agentContext, credentialRecord, core_1.CredentialState.CredentialIssued);
|
|
615
|
-
return { message: issueMessage, credentialRecord };
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* Process an incoming {@link V1IssueCredentialMessage}
|
|
619
|
-
*
|
|
620
|
-
* @param messageContext The message context containing a credential acknowledgement message
|
|
621
|
-
* @returns credential record associated with the credential acknowledgement message
|
|
622
|
-
*
|
|
623
|
-
*/
|
|
624
|
-
async processCredential(messageContext) {
|
|
625
|
-
const { message: issueMessage, connection, agentContext } = messageContext;
|
|
626
|
-
agentContext.config.logger.debug(`Processing credential with id ${issueMessage.id}`);
|
|
627
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
628
|
-
// TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it
|
|
629
|
-
// only depends on the public api, rather than the internal API (this helps with breaking changes)
|
|
630
|
-
const connectionService = agentContext.dependencyManager.resolve(core_1.ConnectionService);
|
|
631
|
-
const credentialRecord = await this.getByProperties(messageContext.agentContext, {
|
|
632
|
-
threadId: issueMessage.threadId,
|
|
633
|
-
role: core_1.CredentialRole.Holder,
|
|
634
|
-
connectionId: connection === null || connection === void 0 ? void 0 : connection.id,
|
|
635
|
-
});
|
|
636
|
-
const requestCredentialMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {
|
|
637
|
-
associatedRecordId: credentialRecord.id,
|
|
638
|
-
messageClass: messages_1.V1RequestCredentialMessage,
|
|
639
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
640
|
-
});
|
|
641
|
-
const offerCredentialMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {
|
|
642
|
-
associatedRecordId: credentialRecord.id,
|
|
643
|
-
messageClass: messages_1.V1OfferCredentialMessage,
|
|
644
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
645
|
-
});
|
|
646
|
-
// Assert
|
|
647
|
-
credentialRecord.assertProtocolVersion('v1');
|
|
648
|
-
credentialRecord.assertState(core_1.CredentialState.RequestSent);
|
|
649
|
-
await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {
|
|
650
|
-
lastReceivedMessage: offerCredentialMessage,
|
|
651
|
-
lastSentMessage: requestCredentialMessage,
|
|
652
|
-
expectedConnectionId: credentialRecord.connectionId,
|
|
653
|
-
});
|
|
654
|
-
const issueAttachment = issueMessage.getCredentialAttachmentById(messages_1.INDY_CREDENTIAL_ATTACHMENT_ID);
|
|
655
|
-
if (!issueAttachment) {
|
|
656
|
-
throw new core_1.CredoError('Missing indy credential attachment in processCredential');
|
|
657
|
-
}
|
|
658
|
-
const requestAttachment = requestCredentialMessage === null || requestCredentialMessage === void 0 ? void 0 : requestCredentialMessage.getRequestAttachmentById(messages_1.INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID);
|
|
659
|
-
if (!requestAttachment) {
|
|
660
|
-
throw new core_1.CredoError('Missing indy credential request attachment in processCredential');
|
|
661
|
-
}
|
|
662
|
-
const offerAttachment = offerCredentialMessage === null || offerCredentialMessage === void 0 ? void 0 : offerCredentialMessage.getOfferAttachmentById(messages_1.INDY_CREDENTIAL_OFFER_ATTACHMENT_ID);
|
|
663
|
-
if (!offerAttachment) {
|
|
664
|
-
throw new core_1.CredoError('Missing indy credential request attachment in processCredential');
|
|
665
|
-
}
|
|
666
|
-
await this.indyCredentialFormat.processCredential(messageContext.agentContext, {
|
|
667
|
-
offerAttachment,
|
|
668
|
-
attachment: issueAttachment,
|
|
669
|
-
credentialRecord,
|
|
670
|
-
requestAttachment,
|
|
671
|
-
});
|
|
672
|
-
await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {
|
|
673
|
-
agentMessage: issueMessage,
|
|
674
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
675
|
-
associatedRecordId: credentialRecord.id,
|
|
676
|
-
});
|
|
677
|
-
await this.updateState(messageContext.agentContext, credentialRecord, core_1.CredentialState.CredentialReceived);
|
|
678
|
-
return credentialRecord;
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Create a {@link CredentialAckMessage} as response to a received credential.
|
|
682
|
-
*
|
|
683
|
-
* @param credentialRecord The credential record for which to create the credential acknowledgement
|
|
684
|
-
* @returns Object containing credential acknowledgement message and associated credential record
|
|
685
|
-
*
|
|
686
|
-
*/
|
|
687
|
-
async acceptCredential(agentContext, { credentialRecord }) {
|
|
688
|
-
credentialRecord.assertProtocolVersion('v1');
|
|
689
|
-
credentialRecord.assertState(core_1.CredentialState.CredentialReceived);
|
|
690
|
-
// Create message
|
|
691
|
-
const ackMessage = new messages_1.V1CredentialAckMessage({
|
|
692
|
-
status: core_1.AckStatus.OK,
|
|
693
|
-
threadId: credentialRecord.threadId,
|
|
694
|
-
});
|
|
695
|
-
ackMessage.setThread({ threadId: credentialRecord.threadId, parentThreadId: credentialRecord.parentThreadId });
|
|
696
|
-
await this.updateState(agentContext, credentialRecord, core_1.CredentialState.Done);
|
|
697
|
-
return { message: ackMessage, credentialRecord };
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Process a received {@link CredentialAckMessage}.
|
|
701
|
-
*
|
|
702
|
-
* @param messageContext The message context containing a credential acknowledgement message
|
|
703
|
-
* @returns credential record associated with the credential acknowledgement message
|
|
704
|
-
*
|
|
705
|
-
*/
|
|
706
|
-
async processAck(messageContext) {
|
|
707
|
-
const { message: ackMessage, connection, agentContext } = messageContext;
|
|
708
|
-
agentContext.config.logger.debug(`Processing credential ack with id ${ackMessage.id}`);
|
|
709
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
710
|
-
// TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it
|
|
711
|
-
// only depends on the public api, rather than the internal API (this helps with breaking changes)
|
|
712
|
-
const connectionService = agentContext.dependencyManager.resolve(core_1.ConnectionService);
|
|
713
|
-
const credentialRecord = await this.getByProperties(messageContext.agentContext, {
|
|
714
|
-
threadId: ackMessage.threadId,
|
|
715
|
-
role: core_1.CredentialRole.Issuer,
|
|
716
|
-
connectionId: connection === null || connection === void 0 ? void 0 : connection.id,
|
|
717
|
-
});
|
|
718
|
-
const requestCredentialMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {
|
|
719
|
-
associatedRecordId: credentialRecord.id,
|
|
720
|
-
messageClass: messages_1.V1RequestCredentialMessage,
|
|
721
|
-
role: core_1.DidCommMessageRole.Receiver,
|
|
722
|
-
});
|
|
723
|
-
const issueCredentialMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {
|
|
724
|
-
associatedRecordId: credentialRecord.id,
|
|
725
|
-
messageClass: messages_1.V1IssueCredentialMessage,
|
|
726
|
-
role: core_1.DidCommMessageRole.Sender,
|
|
727
|
-
});
|
|
728
|
-
// Assert
|
|
729
|
-
credentialRecord.assertProtocolVersion('v1');
|
|
730
|
-
credentialRecord.assertState(core_1.CredentialState.CredentialIssued);
|
|
731
|
-
await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {
|
|
732
|
-
lastReceivedMessage: requestCredentialMessage,
|
|
733
|
-
lastSentMessage: issueCredentialMessage,
|
|
734
|
-
expectedConnectionId: credentialRecord.connectionId,
|
|
735
|
-
});
|
|
736
|
-
// Update record
|
|
737
|
-
await this.updateState(messageContext.agentContext, credentialRecord, core_1.CredentialState.Done);
|
|
738
|
-
return credentialRecord;
|
|
739
|
-
}
|
|
740
|
-
/**
|
|
741
|
-
* Create a {@link V1CredentialProblemReportMessage} to be sent.
|
|
742
|
-
*
|
|
743
|
-
* @param message message to send
|
|
744
|
-
* @returns a {@link V1CredentialProblemReportMessage}
|
|
745
|
-
*
|
|
746
|
-
*/
|
|
747
|
-
async createProblemReport(_agentContext, { credentialRecord, description }) {
|
|
748
|
-
const message = new messages_1.V1CredentialProblemReportMessage({
|
|
749
|
-
description: {
|
|
750
|
-
en: description,
|
|
751
|
-
code: core_1.CredentialProblemReportReason.IssuanceAbandoned,
|
|
752
|
-
},
|
|
753
|
-
});
|
|
754
|
-
return { message, credentialRecord };
|
|
755
|
-
}
|
|
756
|
-
// AUTO RESPOND METHODS
|
|
757
|
-
async shouldAutoRespondToProposal(agentContext, options) {
|
|
758
|
-
const { credentialRecord, proposalMessage } = options;
|
|
759
|
-
const credentialsModuleConfig = agentContext.dependencyManager.resolve(core_1.CredentialsModuleConfig);
|
|
760
|
-
const autoAccept = (0, utils_1.composeCredentialAutoAccept)(credentialRecord.autoAcceptCredential, credentialsModuleConfig.autoAcceptCredentials);
|
|
761
|
-
// Handle always / never cases
|
|
762
|
-
if (autoAccept === core_1.AutoAcceptCredential.Always)
|
|
763
|
-
return true;
|
|
764
|
-
if (autoAccept === core_1.AutoAcceptCredential.Never)
|
|
765
|
-
return false;
|
|
766
|
-
const offerMessage = await this.findOfferMessage(agentContext, credentialRecord.id);
|
|
767
|
-
// Do not auto accept if missing properties
|
|
768
|
-
if (!offerMessage || !offerMessage.credentialPreview)
|
|
769
|
-
return false;
|
|
770
|
-
if (!proposalMessage.credentialPreview || !proposalMessage.credentialDefinitionId)
|
|
771
|
-
return false;
|
|
772
|
-
const credentialOfferJson = offerMessage.indyCredentialOffer;
|
|
773
|
-
// Check if credential definition id matches
|
|
774
|
-
if (!credentialOfferJson)
|
|
775
|
-
return false;
|
|
776
|
-
if (credentialOfferJson.cred_def_id !== proposalMessage.credentialDefinitionId)
|
|
777
|
-
return false;
|
|
778
|
-
// Check if preview values match
|
|
779
|
-
return (0, utils_1.areCredentialPreviewAttributesEqual)(proposalMessage.credentialPreview.attributes, offerMessage.credentialPreview.attributes);
|
|
780
|
-
}
|
|
781
|
-
async shouldAutoRespondToOffer(agentContext, options) {
|
|
782
|
-
const { credentialRecord, offerMessage } = options;
|
|
783
|
-
const credentialsModuleConfig = agentContext.dependencyManager.resolve(core_1.CredentialsModuleConfig);
|
|
784
|
-
const autoAccept = (0, utils_1.composeCredentialAutoAccept)(credentialRecord.autoAcceptCredential, credentialsModuleConfig.autoAcceptCredentials);
|
|
785
|
-
// Handle always / never cases
|
|
786
|
-
if (autoAccept === core_1.AutoAcceptCredential.Always)
|
|
787
|
-
return true;
|
|
788
|
-
if (autoAccept === core_1.AutoAcceptCredential.Never)
|
|
789
|
-
return false;
|
|
790
|
-
const proposalMessage = await this.findProposalMessage(agentContext, credentialRecord.id);
|
|
791
|
-
// Do not auto accept if missing properties
|
|
792
|
-
if (!offerMessage.credentialPreview)
|
|
793
|
-
return false;
|
|
794
|
-
if (!proposalMessage || !proposalMessage.credentialPreview || !proposalMessage.credentialDefinitionId)
|
|
795
|
-
return false;
|
|
796
|
-
const credentialOfferJson = offerMessage.indyCredentialOffer;
|
|
797
|
-
// Check if credential definition id matches
|
|
798
|
-
if (!credentialOfferJson)
|
|
799
|
-
return false;
|
|
800
|
-
if (credentialOfferJson.cred_def_id !== proposalMessage.credentialDefinitionId)
|
|
801
|
-
return false;
|
|
802
|
-
// Check if preview values match
|
|
803
|
-
return (0, utils_1.areCredentialPreviewAttributesEqual)(proposalMessage.credentialPreview.attributes, offerMessage.credentialPreview.attributes);
|
|
804
|
-
}
|
|
805
|
-
async shouldAutoRespondToRequest(agentContext, options) {
|
|
806
|
-
const { credentialRecord, requestMessage } = options;
|
|
807
|
-
const credentialsModuleConfig = agentContext.dependencyManager.resolve(core_1.CredentialsModuleConfig);
|
|
808
|
-
const autoAccept = (0, utils_1.composeCredentialAutoAccept)(credentialRecord.autoAcceptCredential, credentialsModuleConfig.autoAcceptCredentials);
|
|
809
|
-
// Handle always / never cases
|
|
810
|
-
if (autoAccept === core_1.AutoAcceptCredential.Always)
|
|
811
|
-
return true;
|
|
812
|
-
if (autoAccept === core_1.AutoAcceptCredential.Never)
|
|
813
|
-
return false;
|
|
814
|
-
const offerMessage = await this.findOfferMessage(agentContext, credentialRecord.id);
|
|
815
|
-
if (!offerMessage)
|
|
816
|
-
return false;
|
|
817
|
-
const offerAttachment = offerMessage.getOfferAttachmentById(messages_1.INDY_CREDENTIAL_OFFER_ATTACHMENT_ID);
|
|
818
|
-
const requestAttachment = requestMessage.getRequestAttachmentById(messages_1.INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID);
|
|
819
|
-
if (!offerAttachment || !requestAttachment)
|
|
820
|
-
return false;
|
|
821
|
-
return this.indyCredentialFormat.shouldAutoRespondToRequest(agentContext, {
|
|
822
|
-
credentialRecord,
|
|
823
|
-
offerAttachment,
|
|
824
|
-
requestAttachment,
|
|
825
|
-
});
|
|
826
|
-
}
|
|
827
|
-
async shouldAutoRespondToCredential(agentContext, options) {
|
|
828
|
-
const { credentialRecord, credentialMessage } = options;
|
|
829
|
-
const credentialsModuleConfig = agentContext.dependencyManager.resolve(core_1.CredentialsModuleConfig);
|
|
830
|
-
const autoAccept = (0, utils_1.composeCredentialAutoAccept)(credentialRecord.autoAcceptCredential, credentialsModuleConfig.autoAcceptCredentials);
|
|
831
|
-
// Handle always / never cases
|
|
832
|
-
if (autoAccept === core_1.AutoAcceptCredential.Always)
|
|
833
|
-
return true;
|
|
834
|
-
if (autoAccept === core_1.AutoAcceptCredential.Never)
|
|
835
|
-
return false;
|
|
836
|
-
const requestMessage = await this.findRequestMessage(agentContext, credentialRecord.id);
|
|
837
|
-
const offerMessage = await this.findOfferMessage(agentContext, credentialRecord.id);
|
|
838
|
-
const credentialAttachment = credentialMessage.getCredentialAttachmentById(messages_1.INDY_CREDENTIAL_ATTACHMENT_ID);
|
|
839
|
-
if (!credentialAttachment)
|
|
840
|
-
return false;
|
|
841
|
-
const requestAttachment = requestMessage === null || requestMessage === void 0 ? void 0 : requestMessage.getRequestAttachmentById(messages_1.INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID);
|
|
842
|
-
if (!requestAttachment)
|
|
843
|
-
return false;
|
|
844
|
-
const offerAttachment = offerMessage === null || offerMessage === void 0 ? void 0 : offerMessage.getOfferAttachmentById(messages_1.INDY_CREDENTIAL_OFFER_ATTACHMENT_ID);
|
|
845
|
-
return this.indyCredentialFormat.shouldAutoRespondToCredential(agentContext, {
|
|
846
|
-
credentialRecord,
|
|
847
|
-
credentialAttachment,
|
|
848
|
-
requestAttachment,
|
|
849
|
-
offerAttachment,
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
|
-
async findProposalMessage(agentContext, credentialExchangeId) {
|
|
853
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
854
|
-
return await didCommMessageRepository.findAgentMessage(agentContext, {
|
|
855
|
-
associatedRecordId: credentialExchangeId,
|
|
856
|
-
messageClass: messages_1.V1ProposeCredentialMessage,
|
|
857
|
-
});
|
|
858
|
-
}
|
|
859
|
-
async findOfferMessage(agentContext, credentialExchangeId) {
|
|
860
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
861
|
-
return await didCommMessageRepository.findAgentMessage(agentContext, {
|
|
862
|
-
associatedRecordId: credentialExchangeId,
|
|
863
|
-
messageClass: messages_1.V1OfferCredentialMessage,
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
async findRequestMessage(agentContext, credentialExchangeId) {
|
|
867
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
868
|
-
return await didCommMessageRepository.findAgentMessage(agentContext, {
|
|
869
|
-
associatedRecordId: credentialExchangeId,
|
|
870
|
-
messageClass: messages_1.V1RequestCredentialMessage,
|
|
871
|
-
});
|
|
872
|
-
}
|
|
873
|
-
async findCredentialMessage(agentContext, credentialExchangeId) {
|
|
874
|
-
const didCommMessageRepository = agentContext.dependencyManager.resolve(core_1.DidCommMessageRepository);
|
|
875
|
-
return await didCommMessageRepository.findAgentMessage(agentContext, {
|
|
876
|
-
associatedRecordId: credentialExchangeId,
|
|
877
|
-
messageClass: messages_1.V1IssueCredentialMessage,
|
|
878
|
-
});
|
|
879
|
-
}
|
|
880
|
-
async getFormatData(agentContext, credentialExchangeId) {
|
|
881
|
-
var _a, _b, _c, _d, _e;
|
|
882
|
-
// TODO: we could looking at fetching all record using a single query and then filtering based on the type of the message.
|
|
883
|
-
const [proposalMessage, offerMessage, requestMessage, credentialMessage] = await Promise.all([
|
|
884
|
-
this.findProposalMessage(agentContext, credentialExchangeId),
|
|
885
|
-
this.findOfferMessage(agentContext, credentialExchangeId),
|
|
886
|
-
this.findRequestMessage(agentContext, credentialExchangeId),
|
|
887
|
-
this.findCredentialMessage(agentContext, credentialExchangeId),
|
|
888
|
-
]);
|
|
889
|
-
const indyProposal = proposalMessage
|
|
890
|
-
? core_1.JsonTransformer.toJSON(this.rfc0592ProposalFromV1ProposeMessage(proposalMessage))
|
|
891
|
-
: undefined;
|
|
892
|
-
const indyOffer = (_a = offerMessage === null || offerMessage === void 0 ? void 0 : offerMessage.indyCredentialOffer) !== null && _a !== void 0 ? _a : undefined;
|
|
893
|
-
const indyRequest = (_b = requestMessage === null || requestMessage === void 0 ? void 0 : requestMessage.indyCredentialRequest) !== null && _b !== void 0 ? _b : undefined;
|
|
894
|
-
const indyCredential = (_c = credentialMessage === null || credentialMessage === void 0 ? void 0 : credentialMessage.indyCredential) !== null && _c !== void 0 ? _c : undefined;
|
|
895
|
-
return {
|
|
896
|
-
proposalAttributes: (_d = proposalMessage === null || proposalMessage === void 0 ? void 0 : proposalMessage.credentialPreview) === null || _d === void 0 ? void 0 : _d.attributes,
|
|
897
|
-
proposal: proposalMessage
|
|
898
|
-
? {
|
|
899
|
-
indy: indyProposal,
|
|
900
|
-
}
|
|
901
|
-
: undefined,
|
|
902
|
-
offerAttributes: (_e = offerMessage === null || offerMessage === void 0 ? void 0 : offerMessage.credentialPreview) === null || _e === void 0 ? void 0 : _e.attributes,
|
|
903
|
-
offer: offerMessage
|
|
904
|
-
? {
|
|
905
|
-
indy: indyOffer,
|
|
906
|
-
}
|
|
907
|
-
: undefined,
|
|
908
|
-
request: requestMessage
|
|
909
|
-
? {
|
|
910
|
-
indy: indyRequest,
|
|
911
|
-
}
|
|
912
|
-
: undefined,
|
|
913
|
-
credential: credentialMessage
|
|
914
|
-
? {
|
|
915
|
-
indy: indyCredential,
|
|
916
|
-
}
|
|
917
|
-
: undefined,
|
|
918
|
-
};
|
|
919
|
-
}
|
|
920
|
-
rfc0592ProposalFromV1ProposeMessage(proposalMessage) {
|
|
921
|
-
const indyCredentialProposal = new AnonCredsCredentialProposal_1.AnonCredsCredentialProposal({
|
|
922
|
-
credentialDefinitionId: proposalMessage.credentialDefinitionId,
|
|
923
|
-
schemaId: proposalMessage.schemaId,
|
|
924
|
-
issuerDid: proposalMessage.issuerDid,
|
|
925
|
-
schemaIssuerDid: proposalMessage.schemaIssuerDid,
|
|
926
|
-
schemaName: proposalMessage.schemaName,
|
|
927
|
-
schemaVersion: proposalMessage.schemaVersion,
|
|
928
|
-
});
|
|
929
|
-
return indyCredentialProposal;
|
|
930
|
-
}
|
|
931
|
-
assertOnlyIndyFormat(credentialFormats) {
|
|
932
|
-
const formatKeys = Object.keys(credentialFormats);
|
|
933
|
-
// It's fine to not have any formats in some cases, if indy is required the method that calls this should check for this
|
|
934
|
-
if (formatKeys.length === 0)
|
|
935
|
-
return;
|
|
936
|
-
if (formatKeys.length !== 1 || !formatKeys.includes('indy')) {
|
|
937
|
-
throw new core_1.CredoError('Only indy credential format is supported for issue credential v1 protocol');
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
getFormatServiceForRecordType(credentialRecordType) {
|
|
941
|
-
if (credentialRecordType !== this.indyCredentialFormat.credentialRecordType) {
|
|
942
|
-
throw new core_1.CredoError(`Unsupported credential record type ${credentialRecordType} for v1 issue credential protocol (need ${this.indyCredentialFormat.credentialRecordType})`);
|
|
943
|
-
}
|
|
944
|
-
return this.indyCredentialFormat;
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
exports.V1CredentialProtocol = V1CredentialProtocol;
|
|
948
|
-
//# sourceMappingURL=V1CredentialProtocol.js.map
|