@credo-ts/anoncreds 0.6.0-pr-2444-20251010162514 → 0.6.0-pr-2454-20251015095608
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 +4 -4
- package/build/AnonCredsApi.d.mts.map +1 -1
- package/build/AnonCredsApi.d.ts +4 -4
- package/build/AnonCredsApi.d.ts.map +1 -1
- package/build/AnonCredsApi.js +14 -14
- package/build/AnonCredsApi.mjs +14 -14
- package/build/AnonCredsApi.mjs.map +1 -1
- package/build/AnonCredsModule.d.mts.map +1 -1
- package/build/AnonCredsModule.d.ts.map +1 -1
- package/build/AnonCredsModule.js +7 -7
- package/build/AnonCredsModule.mjs +7 -7
- package/build/AnonCredsModule.mjs.map +1 -1
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.js +1 -1
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.mjs +1 -1
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.mjs.map +1 -1
- package/build/anoncreds-rs/AnonCredsRsHolderService.js +6 -6
- package/build/anoncreds-rs/AnonCredsRsHolderService.mjs +6 -6
- package/build/anoncreds-rs/AnonCredsRsHolderService.mjs.map +1 -1
- package/build/anoncreds-rs/AnonCredsRsIssuerService.js +3 -3
- package/build/anoncreds-rs/AnonCredsRsIssuerService.mjs +3 -3
- package/build/anoncreds-rs/AnonCredsRsIssuerService.mjs.map +1 -1
- package/build/anoncreds-rs/AnonCredsRsVerifierService.mjs.map +1 -1
- package/build/anoncreds-rs/utils.js +1 -1
- package/build/anoncreds-rs/utils.mjs +1 -1
- package/build/anoncreds-rs/utils.mjs.map +1 -1
- package/build/error/index.js +1 -1
- package/build/error/index.mjs +1 -1
- package/build/formats/AnonCredsDidCommCredentialFormatService.d.mts.map +1 -1
- package/build/formats/AnonCredsDidCommCredentialFormatService.d.ts.map +1 -1
- package/build/formats/AnonCredsDidCommCredentialFormatService.js +5 -5
- package/build/formats/AnonCredsDidCommCredentialFormatService.mjs +5 -5
- package/build/formats/AnonCredsDidCommCredentialFormatService.mjs.map +1 -1
- package/build/formats/AnonCredsDidCommProofFormat.d.mts +1 -1
- package/build/formats/AnonCredsDidCommProofFormat.d.ts +1 -1
- package/build/formats/AnonCredsDidCommProofFormatService.d.mts.map +1 -1
- package/build/formats/AnonCredsDidCommProofFormatService.d.ts.map +1 -1
- package/build/formats/AnonCredsDidCommProofFormatService.js +5 -5
- package/build/formats/AnonCredsDidCommProofFormatService.mjs +5 -5
- package/build/formats/AnonCredsDidCommProofFormatService.mjs.map +1 -1
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.mts +4 -18
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.mts.map +1 -1
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.ts +4 -18
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.ts.map +1 -1
- package/build/formats/DataIntegrityDidCommCredentialFormatService.js +16 -16
- package/build/formats/DataIntegrityDidCommCredentialFormatService.mjs +16 -16
- package/build/formats/DataIntegrityDidCommCredentialFormatService.mjs.map +1 -1
- package/build/formats/LegacyIndyDidCommCredentialFormatService.d.mts.map +1 -1
- package/build/formats/LegacyIndyDidCommCredentialFormatService.d.ts.map +1 -1
- package/build/formats/LegacyIndyDidCommCredentialFormatService.js +3 -3
- package/build/formats/LegacyIndyDidCommCredentialFormatService.mjs +3 -3
- package/build/formats/LegacyIndyDidCommCredentialFormatService.mjs.map +1 -1
- package/build/formats/LegacyIndyDidCommProofFormat.d.mts +1 -1
- package/build/formats/LegacyIndyDidCommProofFormat.d.ts +1 -1
- package/build/formats/LegacyIndyDidCommProofFormatService.d.mts.map +1 -1
- package/build/formats/LegacyIndyDidCommProofFormatService.d.ts.map +1 -1
- package/build/formats/LegacyIndyDidCommProofFormatService.js +8 -8
- package/build/formats/LegacyIndyDidCommProofFormatService.mjs +8 -8
- package/build/formats/LegacyIndyDidCommProofFormatService.mjs.map +1 -1
- package/build/formats/index.js +1 -1
- package/build/formats/index.mjs +1 -1
- package/build/index.d.mts +30 -30
- package/build/index.d.ts +30 -30
- package/build/index.js +25 -25
- package/build/index.mjs +25 -25
- package/build/models/AnonCredsCredentialProposal.js +2 -2
- package/build/models/AnonCredsCredentialProposal.mjs +1 -1
- package/build/models/AnonCredsProofRequest.js +2 -2
- package/build/models/AnonCredsProofRequest.mjs +1 -1
- package/build/models/AnonCredsProofRequest.mjs.map +1 -1
- package/build/models/AnonCredsRequestedAttribute.js +2 -2
- package/build/models/AnonCredsRequestedAttribute.mjs +1 -1
- package/build/models/AnonCredsRequestedAttribute.mjs.map +1 -1
- package/build/models/AnonCredsRequestedPredicate.js +3 -3
- package/build/models/AnonCredsRequestedPredicate.mjs +2 -2
- package/build/models/AnonCredsRequestedPredicate.mjs.map +1 -1
- package/build/models/AnonCredsRestriction.js +2 -2
- package/build/models/AnonCredsRestriction.mjs +1 -1
- package/build/models/AnonCredsRestrictionWrapper.js +2 -2
- package/build/models/AnonCredsRestrictionWrapper.mjs +1 -1
- package/build/models/exchange.mjs.map +1 -1
- package/build/models/index.js +1 -1
- package/build/models/index.mjs +1 -1
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.mts +1 -1
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.mts.map +1 -1
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.ts +1 -1
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.ts.map +1 -1
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.js +4 -4
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.mjs +4 -4
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.mjs.map +1 -1
- package/build/protocols/credentials/v1/handlers/DidCommIssueCredentialV1Handler.mjs.map +1 -1
- package/build/protocols/credentials/v1/handlers/DidCommOfferCredentialV1Handler.mjs.map +1 -1
- package/build/protocols/credentials/v1/handlers/DidCommProposeCredentialV1Handler.mjs.map +1 -1
- package/build/protocols/credentials/v1/handlers/DidCommRequestCredentialV1Handler.mjs.map +1 -1
- package/build/protocols/credentials/v1/handlers/index.js +1 -1
- package/build/protocols/credentials/v1/handlers/index.mjs +1 -1
- package/build/protocols/credentials/v1/index.js +2 -2
- package/build/protocols/credentials/v1/index.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.mts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.ts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.js +4 -4
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.mjs.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.mts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.ts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.js +4 -4
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.mjs.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.mts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.ts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.js +4 -4
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.mjs.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.mts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.js +4 -4
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.mts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.ts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.js +4 -4
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.mjs.map +1 -1
- package/build/protocols/credentials/v1/messages/index.js +2 -2
- package/build/protocols/credentials/v1/messages/index.mjs +2 -2
- package/build/protocols/index.js +5 -5
- package/build/protocols/index.mjs +5 -5
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.mts +2 -2
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.mts.map +1 -1
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.ts +2 -2
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.ts.map +1 -1
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.js +6 -6
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.mjs +6 -6
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.mjs.map +1 -1
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1Handler.mjs.map +1 -1
- package/build/protocols/proofs/v1/handlers/DidCommProposePresentationV1Handler.mjs.map +1 -1
- package/build/protocols/proofs/v1/handlers/DidCommRequestPresentationV1Handler.mjs.map +1 -1
- package/build/protocols/proofs/v1/handlers/index.js +1 -1
- package/build/protocols/proofs/v1/handlers/index.mjs +1 -1
- package/build/protocols/proofs/v1/index.js +4 -4
- package/build/protocols/proofs/v1/index.mjs +4 -4
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.d.mts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.d.ts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.mts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.mts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.ts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.ts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.js +4 -4
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.mjs +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.mjs.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.d.mts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.d.mts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.mts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.mts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.ts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.ts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.js +4 -4
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.mjs +2 -2
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.mts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.mts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.ts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.ts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.js +4 -4
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.mjs +2 -2
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.mjs.map +1 -1
- package/build/protocols/proofs/v1/messages/index.js +3 -3
- package/build/protocols/proofs/v1/messages/index.mjs +3 -3
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.mts +1 -1
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.mts.map +1 -1
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.ts +2 -2
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.ts.map +1 -1
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.js +6 -6
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.mjs +4 -4
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.mjs.map +1 -1
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.js +2 -2
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.mjs +2 -2
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.mjs.map +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.d.mts.map +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.d.ts.map +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.js +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.mjs +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.mjs.map +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRepository.js +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRepository.mjs +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRepository.mjs.map +1 -1
- package/build/repository/AnonCredsCredentialRecord.d.mts.map +1 -1
- package/build/repository/AnonCredsCredentialRecord.d.ts.map +1 -1
- package/build/repository/AnonCredsCredentialRecord.mjs.map +1 -1
- package/build/repository/AnonCredsCredentialRepository.js +1 -1
- package/build/repository/AnonCredsCredentialRepository.mjs +1 -1
- package/build/repository/AnonCredsCredentialRepository.mjs.map +1 -1
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.js +1 -1
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.mjs +1 -1
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.mjs.map +1 -1
- package/build/repository/AnonCredsLinkSecretRepository.js +1 -1
- package/build/repository/AnonCredsLinkSecretRepository.mjs +1 -1
- package/build/repository/AnonCredsLinkSecretRepository.mjs.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.mts.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.ts.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.js +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.mjs +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.mjs.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.mts.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.ts.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.mjs.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.js +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.mjs +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.mjs.map +1 -1
- package/build/repository/AnonCredsSchemaRecord.d.mts.map +1 -1
- package/build/repository/AnonCredsSchemaRecord.d.ts.map +1 -1
- package/build/repository/AnonCredsSchemaRecord.js +1 -1
- package/build/repository/AnonCredsSchemaRecord.mjs +1 -1
- package/build/repository/AnonCredsSchemaRecord.mjs.map +1 -1
- package/build/repository/AnonCredsSchemaRepository.js +1 -1
- package/build/repository/AnonCredsSchemaRepository.mjs +1 -1
- package/build/repository/AnonCredsSchemaRepository.mjs.map +1 -1
- package/build/repository/index.js +6 -6
- package/build/repository/index.mjs +6 -6
- package/build/services/AnonCredsHolderService.d.mts +1 -1
- package/build/services/AnonCredsHolderService.d.ts +1 -1
- package/build/services/AnonCredsHolderServiceOptions.d.mts +1 -1
- package/build/services/AnonCredsHolderServiceOptions.d.ts +1 -1
- package/build/services/index.js +3 -3
- package/build/services/index.mjs +3 -3
- package/build/services/registry/AnonCredsRegistryService.d.mts.map +1 -1
- package/build/services/registry/AnonCredsRegistryService.d.ts.map +1 -1
- package/build/services/registry/AnonCredsRegistryService.js +1 -1
- package/build/services/registry/AnonCredsRegistryService.mjs +1 -1
- package/build/services/registry/AnonCredsRegistryService.mjs.map +1 -1
- package/build/services/tails/BasicTailsFileService.d.mts.map +1 -1
- package/build/services/tails/BasicTailsFileService.d.ts.map +1 -1
- package/build/services/tails/BasicTailsFileService.mjs.map +1 -1
- package/build/updates/0.3.1-0.4/credentialDefinition.js +1 -1
- package/build/updates/0.3.1-0.4/credentialDefinition.mjs +1 -1
- package/build/updates/0.3.1-0.4/credentialDefinition.mjs.map +1 -1
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.js +3 -3
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.mjs +3 -3
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.mjs.map +1 -1
- package/build/utils/anonCredsObjects.d.mts.map +1 -1
- package/build/utils/anonCredsObjects.d.ts.map +1 -1
- package/build/utils/anonCredsObjects.mjs.map +1 -1
- package/build/utils/areRequestsEqual.mjs.map +1 -1
- package/build/utils/bytesToBigint.mjs.map +1 -1
- package/build/utils/createRequestFromPreview.mjs.map +1 -1
- package/build/utils/credential.d.mts.map +1 -1
- package/build/utils/credential.d.ts.map +1 -1
- package/build/utils/credential.mjs.map +1 -1
- package/build/utils/getCredentialsForAnonCredsRequest.js +3 -3
- package/build/utils/getCredentialsForAnonCredsRequest.mjs +3 -3
- package/build/utils/getCredentialsForAnonCredsRequest.mjs.map +1 -1
- package/build/utils/getRevocationRegistries.mjs.map +1 -1
- package/build/utils/hasDuplicateGroupNames.mjs.map +1 -1
- package/build/utils/index.js +9 -9
- package/build/utils/index.mjs +9 -9
- package/build/utils/indyIdentifiers.d.mts.map +1 -1
- package/build/utils/indyIdentifiers.d.ts.map +1 -1
- package/build/utils/indyIdentifiers.mjs.map +1 -1
- package/build/utils/isMap.mjs.map +1 -1
- package/build/utils/revocationInterval.d.mts.map +1 -1
- package/build/utils/revocationInterval.d.ts.map +1 -1
- package/build/utils/revocationInterval.mjs.map +1 -1
- package/build/utils/w3cAnonCredsUtils.d.mts.map +1 -1
- package/build/utils/w3cAnonCredsUtils.d.ts.map +1 -1
- package/build/utils/w3cAnonCredsUtils.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidCommCredentialV1Protocol.mjs","names":["attachment"],"sources":["../../../../src/protocols/credentials/v1/DidCommCredentialV1Protocol.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport type {\n CredentialProtocolOptions,\n DidCommCredentialProtocol,\n DidCommFeatureRegistry,\n DidCommInboundMessageContext,\n DidCommMessage,\n DidCommMessageHandlerRegistry,\n DidCommProblemReportMessage,\n ExtractCredentialFormats,\n} from '@credo-ts/didcomm'\nimport type { LegacyIndyDidCommCredentialFormatService } from '../../../formats'\n\nimport { CredoError, JsonTransformer, utils } from '@credo-ts/core'\nimport {\n AckStatus,\n BaseDidCommCredentialProtocol,\n DidCommAttachment,\n DidCommAttachmentData,\n DidCommAutoAcceptCredential,\n DidCommConnectionService,\n DidCommCredentialExchangeRecord,\n DidCommCredentialExchangeRepository,\n DidCommCredentialProblemReportReason,\n DidCommCredentialRole,\n DidCommCredentialState,\n DidCommCredentialsModuleConfig,\n DidCommMessageRepository,\n DidCommMessageRole,\n DidCommProtocol,\n isLinkedAttachment,\n} from '@credo-ts/didcomm'\n\nimport { AnonCredsCredentialProposal } from '../../../models/AnonCredsCredentialProposal'\nimport { areCredentialPreviewAttributesEqual, composeCredentialAutoAccept } from '../../../utils'\n\nimport {\n DidCommCredentialV1AckHandler,\n DidCommCredentialV1ProblemReportHandler,\n DidCommIssueCredentialV1Handler,\n DidCommOfferCredentialV1Handler,\n DidCommProposeCredentialV1Handler,\n DidCommRequestCredentialV1Handler,\n} from './handlers'\nimport {\n DidCommCredentialV1AckMessage,\n DidCommCredentialV1Preview,\n DidCommCredentialV1ProblemReportMessage,\n DidCommIssueCredentialV1Message,\n DidCommProposeCredentialV1Message,\n DidCommRequestCredentialV1Message,\n INDY_CREDENTIAL_ATTACHMENT_ID,\n INDY_CREDENTIAL_OFFER_ATTACHMENT_ID,\n INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID,\n V1OfferCredentialMessage,\n} from './messages'\n\nexport interface DidCommCredentialV1ProtocolConfig {\n indyCredentialFormat: LegacyIndyDidCommCredentialFormatService\n}\n\nexport class DidCommCredentialV1Protocol\n extends BaseDidCommCredentialProtocol<[LegacyIndyDidCommCredentialFormatService]>\n implements DidCommCredentialProtocol<[LegacyIndyDidCommCredentialFormatService]>\n{\n private indyCredentialFormat: LegacyIndyDidCommCredentialFormatService\n\n public constructor({ indyCredentialFormat }: DidCommCredentialV1ProtocolConfig) {\n super()\n\n // TODO: just create a new instance of LegacyIndyDidCommCredentialFormatService here so it makes the setup easier\n this.indyCredentialFormat = indyCredentialFormat\n }\n\n /**\n * The version of the issue credential protocol this protocol supports\n */\n public readonly version = 'v1'\n\n /**\n * Registers the protocol implementation (handlers, feature registry) on the agent.\n */\n public register(messageHandlerRegistry: DidCommMessageHandlerRegistry, featureRegistry: DidCommFeatureRegistry) {\n // Register message handlers for the Issue Credential V1 Protocol\n messageHandlerRegistry.registerMessageHandlers([\n new DidCommProposeCredentialV1Handler(this),\n new DidCommOfferCredentialV1Handler(this),\n new DidCommRequestCredentialV1Handler(this),\n new DidCommIssueCredentialV1Handler(this),\n new DidCommCredentialV1AckHandler(this),\n new DidCommCredentialV1ProblemReportHandler(this),\n ])\n\n // Register Issue Credential V1 in feature registry, with supported roles\n featureRegistry.register(\n new DidCommProtocol({\n id: 'https://didcomm.org/issue-credential/1.0',\n roles: ['holder', 'issuer'],\n })\n )\n }\n\n /**\n * Create a {@link ProposeCredentialMessage} not bound to an existing credential exchange.\n * To create a proposal as response to an existing credential exchange, use {@link createProposalAsResponse}.\n *\n * @param options The object containing config options\n * @returns Object containing proposal message and associated credential record\n *\n */\n public async createProposal(\n agentContext: AgentContext,\n {\n connectionRecord,\n credentialFormats,\n comment,\n autoAcceptCredential,\n }: CredentialProtocolOptions.CreateCredentialProposalOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommMessage>> {\n this.assertOnlyIndyFormat(credentialFormats)\n\n const credentialRepository = agentContext.dependencyManager.resolve(DidCommCredentialExchangeRepository)\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n if (!credentialFormats.indy) {\n throw new CredoError('Missing indy credential format in v1 create proposal call.')\n }\n\n // TODO: linked attachments are broken currently. We never include them in the messages.\n // The linking with previews does work, so it shouldn't be too much work to re-enable this.\n const { linkedAttachments } = credentialFormats.indy\n\n // Create record\n const credentialExchangeRecord = new DidCommCredentialExchangeRecord({\n connectionId: connectionRecord.id,\n threadId: utils.uuid(),\n state: DidCommCredentialState.ProposalSent,\n role: DidCommCredentialRole.Holder,\n linkedAttachments: linkedAttachments?.map((linkedAttachment) => linkedAttachment.attachment),\n autoAcceptCredential,\n protocolVersion: 'v1',\n })\n\n // call create proposal for validation of the proposal and addition of linked attachments\n const { previewAttributes, attachment } = await this.indyCredentialFormat.createProposal(agentContext, {\n credentialFormats,\n credentialExchangeRecord,\n })\n\n // Transform the attachment into the attachment payload and use that to construct the v1 message\n const indyCredentialProposal = JsonTransformer.fromJSON(attachment.getDataAsJson(), AnonCredsCredentialProposal)\n\n const credentialProposal = previewAttributes\n ? new DidCommCredentialV1Preview({\n attributes: previewAttributes,\n })\n : undefined\n\n // Create message\n const message = new DidCommProposeCredentialV1Message({\n ...indyCredentialProposal,\n id: credentialExchangeRecord.threadId,\n credentialPreview: credentialProposal,\n comment,\n })\n\n await didCommMessageRepository.saveAgentMessage(agentContext, {\n agentMessage: message,\n role: DidCommMessageRole.Sender,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n credentialExchangeRecord.credentialAttributes = credentialProposal?.attributes\n await credentialRepository.save(agentContext, credentialExchangeRecord)\n this.emitStateChangedEvent(agentContext, credentialExchangeRecord, null)\n\n return { credentialExchangeRecord, message }\n }\n\n /**\n * Process a received {@link ProposeCredentialMessage}. This will not accept the credential proposal\n * or send a credential offer. It will only create a new, or update the existing credential record with\n * the information from the credential proposal message. Use {@link createOfferAsResponse}\n * after calling this method to create a credential offer.\n *\n * @param messageContext The message context containing a credential proposal message\n * @returns credential record associated with the credential proposal message\n *\n */\n public async processProposal(\n messageContext: DidCommInboundMessageContext<DidCommProposeCredentialV1Message>\n ): Promise<DidCommCredentialExchangeRecord> {\n const { message: proposalMessage, connection, agentContext } = messageContext\n\n const credentialRepository = agentContext.dependencyManager.resolve(DidCommCredentialExchangeRepository)\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n // TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it\n // only depends on the public api, rather than the internal API (this helps with breaking changes)\n const connectionService = agentContext.dependencyManager.resolve(DidCommConnectionService)\n\n agentContext.config.logger.debug(`Processing credential proposal with message id ${proposalMessage.id}`)\n\n let credentialExchangeRecord = await this.findByProperties(messageContext.agentContext, {\n threadId: proposalMessage.threadId,\n role: DidCommCredentialRole.Issuer,\n connectionId: connection?.id,\n })\n\n // Credential record already exists, this is a response to an earlier message sent by us\n if (credentialExchangeRecord) {\n agentContext.config.logger.debug('Credential record already exists for incoming proposal')\n\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.OfferSent)\n\n const lastReceivedMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommProposeCredentialV1Message,\n role: DidCommMessageRole.Receiver,\n })\n const lastSentMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Sender,\n })\n\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {\n lastReceivedMessage,\n lastSentMessage,\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n\n await this.indyCredentialFormat.processProposal(messageContext.agentContext, {\n credentialExchangeRecord,\n attachment: new DidCommAttachment({\n data: new DidCommAttachmentData({\n json: JsonTransformer.toJSON(this.rfc0592ProposalFromV1ProposeMessage(proposalMessage)),\n }),\n }),\n })\n\n // Update record\n await this.updateState(\n messageContext.agentContext,\n credentialExchangeRecord,\n DidCommCredentialState.ProposalReceived\n )\n await didCommMessageRepository.saveOrUpdateAgentMessage(messageContext.agentContext, {\n agentMessage: proposalMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n } else {\n agentContext.config.logger.debug('Credential record does not exists yet for incoming proposal')\n // Assert\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext)\n\n // No credential record exists with thread id\n credentialExchangeRecord = new DidCommCredentialExchangeRecord({\n connectionId: connection?.id,\n threadId: proposalMessage.threadId,\n state: DidCommCredentialState.ProposalReceived,\n role: DidCommCredentialRole.Issuer,\n protocolVersion: 'v1',\n })\n\n // Save record\n await credentialRepository.save(messageContext.agentContext, credentialExchangeRecord)\n this.emitStateChangedEvent(messageContext.agentContext, credentialExchangeRecord, null)\n\n await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {\n agentMessage: proposalMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n }\n return credentialExchangeRecord\n }\n\n /**\n * Processing an incoming credential message and create a credential offer as a response\n * @param options The object containing config options\n * @returns Object containing proposal message and associated credential record\n */\n public async acceptProposal(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n credentialFormats,\n comment,\n autoAcceptCredential,\n }: CredentialProtocolOptions.AcceptCredentialProposalOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<V1OfferCredentialMessage>> {\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.ProposalReceived)\n if (credentialFormats) this.assertOnlyIndyFormat(credentialFormats)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n const proposalMessage = await didCommMessageRepository.getAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommProposeCredentialV1Message,\n role: DidCommMessageRole.Receiver,\n })\n\n // NOTE: We set the credential attributes from the proposal on the record as we've 'accepted' them\n // and can now use them to create the offer in the format services. It may be overwritten later on\n // if the user provided other attributes in the credentialFormats array.\n credentialExchangeRecord.credentialAttributes = proposalMessage.credentialPreview?.attributes\n\n const { attachment, previewAttributes } = await this.indyCredentialFormat.acceptProposal(agentContext, {\n attachmentId: INDY_CREDENTIAL_OFFER_ATTACHMENT_ID,\n credentialFormats,\n credentialExchangeRecord,\n proposalAttachment: new DidCommAttachment({\n data: new DidCommAttachmentData({\n json: JsonTransformer.toJSON(this.rfc0592ProposalFromV1ProposeMessage(proposalMessage)),\n }),\n }),\n })\n\n if (!previewAttributes) {\n throw new CredoError('Missing required credential preview attributes from indy format service')\n }\n\n const message = new V1OfferCredentialMessage({\n comment,\n offerAttachments: [attachment],\n credentialPreview: new DidCommCredentialV1Preview({\n attributes: previewAttributes,\n }),\n attachments: credentialExchangeRecord.linkedAttachments,\n })\n\n message.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n\n credentialExchangeRecord.credentialAttributes = message.credentialPreview.attributes\n credentialExchangeRecord.autoAcceptCredential =\n autoAcceptCredential ?? credentialExchangeRecord.autoAcceptCredential\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.OfferSent)\n\n await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {\n agentMessage: message,\n role: DidCommMessageRole.Sender,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n return { credentialExchangeRecord, message }\n }\n\n /**\n * Negotiate a credential proposal as issuer (by sending a credential offer message) to the connection\n * associated with the credential record.\n *\n * @param options configuration for the offer see {@link NegotiateCredentialProposalOptions}\n * @returns Credential record associated with the credential offer and the corresponding new offer message\n *\n */\n public async negotiateProposal(\n agentContext: AgentContext,\n {\n credentialFormats,\n credentialExchangeRecord,\n comment,\n autoAcceptCredential,\n }: CredentialProtocolOptions.NegotiateCredentialProposalOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<V1OfferCredentialMessage>> {\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.ProposalReceived)\n this.assertOnlyIndyFormat(credentialFormats)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n const { attachment, previewAttributes } = await this.indyCredentialFormat.createOffer(agentContext, {\n attachmentId: INDY_CREDENTIAL_OFFER_ATTACHMENT_ID,\n credentialFormats,\n credentialExchangeRecord,\n })\n\n if (!previewAttributes) {\n throw new CredoError('Missing required credential preview attributes from indy format service')\n }\n\n const message = new V1OfferCredentialMessage({\n comment,\n offerAttachments: [attachment],\n credentialPreview: new DidCommCredentialV1Preview({\n attributes: previewAttributes,\n }),\n attachments: credentialExchangeRecord.linkedAttachments,\n })\n message.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n\n credentialExchangeRecord.credentialAttributes = message.credentialPreview.attributes\n credentialExchangeRecord.autoAcceptCredential =\n autoAcceptCredential ?? credentialExchangeRecord.autoAcceptCredential\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.OfferSent)\n\n await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {\n agentMessage: message,\n role: DidCommMessageRole.Sender,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n return { credentialExchangeRecord, message }\n }\n\n /**\n * Create a {@link OfferCredentialMessage} not bound to an existing credential exchange.\n * To create an offer as response to an existing credential exchange, use {@link DidCommCredentialV1Protocol#createOfferAsResponse}.\n *\n * @param options The options containing config params for creating the credential offer\n * @returns Object containing offer message and associated credential record\n *\n */\n public async createOffer(\n agentContext: AgentContext,\n {\n credentialFormats,\n autoAcceptCredential,\n comment,\n connectionRecord,\n }: CredentialProtocolOptions.CreateCredentialOfferOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<V1OfferCredentialMessage>> {\n // Assert\n this.assertOnlyIndyFormat(credentialFormats)\n\n const credentialRepository = agentContext.dependencyManager.resolve(DidCommCredentialExchangeRepository)\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n if (!credentialFormats.indy) {\n throw new CredoError('Missing indy credential format data for v1 create offer')\n }\n\n // Create record\n const credentialExchangeRecord = new DidCommCredentialExchangeRecord({\n connectionId: connectionRecord?.id,\n threadId: utils.uuid(),\n linkedAttachments: credentialFormats.indy.linkedAttachments?.map(\n (linkedAttachments) => linkedAttachments.attachment\n ),\n state: DidCommCredentialState.OfferSent,\n role: DidCommCredentialRole.Issuer,\n autoAcceptCredential,\n protocolVersion: 'v1',\n })\n\n const { attachment, previewAttributes } = await this.indyCredentialFormat.createOffer(agentContext, {\n attachmentId: INDY_CREDENTIAL_OFFER_ATTACHMENT_ID,\n credentialFormats,\n credentialExchangeRecord,\n })\n\n if (!previewAttributes) {\n throw new CredoError('Missing required credential preview from indy format service')\n }\n\n // Construct offer message\n const message = new V1OfferCredentialMessage({\n id: credentialExchangeRecord.threadId,\n credentialPreview: new DidCommCredentialV1Preview({\n attributes: previewAttributes,\n }),\n comment,\n offerAttachments: [attachment],\n attachments: credentialFormats.indy.linkedAttachments?.map((linkedAttachments) => linkedAttachments.attachment),\n })\n\n await didCommMessageRepository.saveAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n agentMessage: message,\n role: DidCommMessageRole.Sender,\n })\n\n credentialExchangeRecord.credentialAttributes = message.credentialPreview.attributes\n await credentialRepository.save(agentContext, credentialExchangeRecord)\n this.emitStateChangedEvent(agentContext, credentialExchangeRecord, null)\n\n return { message, credentialExchangeRecord }\n }\n\n /**\n * Process a received {@link OfferCredentialMessage}. This will not accept the credential offer\n * or send a credential request. It will only create a new credential record with\n * the information from the credential offer message. Use {@link createRequest}\n * after calling this method to create a credential request.\n *\n * @param messageContext The message context containing a credential request message\n * @returns credential record associated with the credential offer message\n *\n */\n public async processOffer(\n messageContext: DidCommInboundMessageContext<V1OfferCredentialMessage>\n ): Promise<DidCommCredentialExchangeRecord> {\n const { message: offerMessage, connection, agentContext } = messageContext\n\n const credentialRepository = agentContext.dependencyManager.resolve(DidCommCredentialExchangeRepository)\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n // TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it\n // only depends on the public api, rather than the internal API (this helps with breaking changes)\n const connectionService = agentContext.dependencyManager.resolve(DidCommConnectionService)\n\n agentContext.config.logger.debug(`Processing credential offer with id ${offerMessage.id}`)\n\n let credentialExchangeRecord = await this.findByProperties(agentContext, {\n threadId: offerMessage.threadId,\n role: DidCommCredentialRole.Holder,\n connectionId: connection?.id,\n })\n\n const offerAttachment = offerMessage.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n if (!offerAttachment) {\n throw new CredoError(`Indy attachment with id ${INDY_CREDENTIAL_OFFER_ATTACHMENT_ID} not found in offer message`)\n }\n\n if (credentialExchangeRecord) {\n const lastSentMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommProposeCredentialV1Message,\n role: DidCommMessageRole.Sender,\n })\n const lastReceivedMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Receiver,\n })\n\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.ProposalSent)\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {\n lastReceivedMessage,\n lastSentMessage,\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n\n await this.indyCredentialFormat.processOffer(messageContext.agentContext, {\n credentialExchangeRecord,\n attachment: offerAttachment,\n })\n\n await didCommMessageRepository.saveOrUpdateAgentMessage(messageContext.agentContext, {\n agentMessage: offerMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n await this.updateState(\n messageContext.agentContext,\n credentialExchangeRecord,\n DidCommCredentialState.OfferReceived\n )\n\n return credentialExchangeRecord\n }\n // Assert\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext)\n\n // No credential record exists with thread id\n credentialExchangeRecord = new DidCommCredentialExchangeRecord({\n connectionId: connection?.id,\n threadId: offerMessage.threadId,\n parentThreadId: offerMessage.thread?.parentThreadId,\n state: DidCommCredentialState.OfferReceived,\n role: DidCommCredentialRole.Holder,\n protocolVersion: 'v1',\n })\n\n await this.indyCredentialFormat.processOffer(messageContext.agentContext, {\n credentialExchangeRecord,\n attachment: offerAttachment,\n })\n\n // Save in repository\n await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {\n agentMessage: offerMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n await credentialRepository.save(messageContext.agentContext, credentialExchangeRecord)\n this.emitStateChangedEvent(messageContext.agentContext, credentialExchangeRecord, null)\n\n return credentialExchangeRecord\n }\n\n /**\n * Create a {@link RequestCredentialMessage} as response to a received credential offer.\n *\n * @param options configuration to use for the credential request\n * @returns Object containing request message and associated credential record\n *\n */\n public async acceptOffer(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n credentialFormats,\n comment,\n autoAcceptCredential,\n }: CredentialProtocolOptions.AcceptCredentialOfferOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommRequestCredentialV1Message>> {\n // Assert credential\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.OfferReceived)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n const offerMessage = await didCommMessageRepository.getAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Receiver,\n })\n\n const offerAttachment = offerMessage.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n if (!offerAttachment) {\n throw new CredoError(`Indy attachment with id ${INDY_CREDENTIAL_OFFER_ATTACHMENT_ID} not found in offer message`)\n }\n\n const { attachment } = await this.indyCredentialFormat.acceptOffer(agentContext, {\n credentialExchangeRecord,\n credentialFormats,\n attachmentId: INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID,\n offerAttachment,\n })\n\n const requestMessage = new DidCommRequestCredentialV1Message({\n comment,\n requestAttachments: [attachment],\n attachments: offerMessage.appendedAttachments?.filter((attachment) => isLinkedAttachment(attachment)),\n })\n requestMessage.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n\n credentialExchangeRecord.credentialAttributes = offerMessage.credentialPreview.attributes\n credentialExchangeRecord.autoAcceptCredential =\n autoAcceptCredential ?? credentialExchangeRecord.autoAcceptCredential\n credentialExchangeRecord.linkedAttachments = offerMessage.appendedAttachments?.filter((attachment) =>\n isLinkedAttachment(attachment)\n )\n\n await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {\n agentMessage: requestMessage,\n associatedRecordId: credentialExchangeRecord.id,\n role: DidCommMessageRole.Sender,\n })\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.RequestSent)\n\n return { message: requestMessage, credentialExchangeRecord }\n }\n\n /**\n * Process a received {@link RequestCredentialMessage}. This will not accept the credential request\n * or send a credential. It will only update the existing credential record with\n * the information from the credential request message. Use {@link createCredential}\n * after calling this method to create a credential.\n *\n * @param messageContext The message context containing a credential request message\n * @returns credential record associated with the credential request message\n *\n */\n public async negotiateOffer(\n agentContext: AgentContext,\n {\n credentialFormats,\n credentialExchangeRecord,\n autoAcceptCredential,\n comment,\n }: CredentialProtocolOptions.NegotiateCredentialOfferOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommMessage>> {\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.OfferReceived)\n this.assertOnlyIndyFormat(credentialFormats)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n if (!credentialExchangeRecord.connectionId) {\n throw new CredoError(\n `No connectionId found for credential record '${credentialExchangeRecord.id}'. Connection-less issuance does not support negotiation.`\n )\n }\n\n if (!credentialFormats.indy) {\n throw new CredoError('Missing indy credential format in v1 negotiate proposal call.')\n }\n\n const { linkedAttachments } = credentialFormats.indy\n\n // call create proposal for validation of the proposal and addition of linked attachments\n // As the format is different for v1 of the issue credential protocol we won't be using the attachment\n const { previewAttributes, attachment } = await this.indyCredentialFormat.createProposal(agentContext, {\n credentialFormats,\n credentialExchangeRecord,\n })\n\n // Transform the attachment into the attachment payload and use that to construct the v1 message\n const indyCredentialProposal = JsonTransformer.fromJSON(attachment.getDataAsJson(), AnonCredsCredentialProposal)\n\n const credentialProposal = previewAttributes\n ? new DidCommCredentialV1Preview({\n attributes: previewAttributes,\n })\n : undefined\n\n // Create message\n const message = new DidCommProposeCredentialV1Message({\n ...indyCredentialProposal,\n credentialPreview: credentialProposal,\n comment,\n })\n\n message.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n\n await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {\n agentMessage: message,\n role: DidCommMessageRole.Sender,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n // Update record\n credentialExchangeRecord.credentialAttributes = message.credentialPreview?.attributes\n credentialExchangeRecord.linkedAttachments = linkedAttachments?.map((attachment) => attachment.attachment)\n credentialExchangeRecord.autoAcceptCredential =\n autoAcceptCredential ?? credentialExchangeRecord.autoAcceptCredential\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.ProposalSent)\n\n return { credentialExchangeRecord, message }\n }\n\n /**\n * Starting from a request is not supported in v1 of the issue credential protocol\n * because indy doesn't allow to start from a request\n */\n public async createRequest(): Promise<\n CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommRequestCredentialV1Message>\n > {\n throw new CredoError('Starting from a request is not supported for v1 issue credential protocol')\n }\n\n public async processRequest(\n messageContext: DidCommInboundMessageContext<DidCommRequestCredentialV1Message>\n ): Promise<DidCommCredentialExchangeRecord> {\n const { message: requestMessage, connection, agentContext } = messageContext\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n // TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it\n // only depends on the public api, rather than the internal API (this helps with breaking changes)\n const connectionService = agentContext.dependencyManager.resolve(DidCommConnectionService)\n\n agentContext.config.logger.debug(`Processing credential request with id ${requestMessage.id}`)\n\n const credentialExchangeRecord = await this.getByProperties(messageContext.agentContext, {\n threadId: requestMessage.threadId,\n role: DidCommCredentialRole.Issuer,\n })\n\n agentContext.config.logger.trace(\n 'Credential record found when processing credential request',\n credentialExchangeRecord\n )\n\n const proposalMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommProposeCredentialV1Message,\n role: DidCommMessageRole.Receiver,\n })\n const offerMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Sender,\n })\n\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.OfferSent)\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {\n lastReceivedMessage: proposalMessage ?? undefined,\n lastSentMessage: offerMessage ?? undefined,\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n\n // This makes sure that the sender of the incoming message is authorized to do so.\n if (!credentialExchangeRecord.connectionId) {\n await connectionService.matchIncomingMessageToRequestMessageInOutOfBandExchange(messageContext, {\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n credentialExchangeRecord.connectionId = connection?.id\n }\n\n const requestAttachment = requestMessage.getRequestAttachmentById(INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID)\n\n if (!requestAttachment) {\n throw new CredoError(\n `Indy attachment with id ${INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID} not found in request message`\n )\n }\n\n await this.indyCredentialFormat.processRequest(messageContext.agentContext, {\n credentialExchangeRecord,\n attachment: requestAttachment,\n })\n\n await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {\n agentMessage: requestMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n await this.updateState(\n messageContext.agentContext,\n credentialExchangeRecord,\n DidCommCredentialState.RequestReceived\n )\n\n return credentialExchangeRecord\n }\n\n /**\n * Create a {@link DidCommIssueCredentialV1Message} as response to a received credential request.\n *\n * @returns Object containing issue credential message and associated credential record\n *\n */\n public async acceptRequest(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n credentialFormats,\n comment,\n autoAcceptCredential,\n }: CredentialProtocolOptions.AcceptCredentialRequestOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommIssueCredentialV1Message>> {\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.RequestReceived)\n if (credentialFormats) this.assertOnlyIndyFormat(credentialFormats)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n const offerMessage = await didCommMessageRepository.getAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Sender,\n })\n const requestMessage = await didCommMessageRepository.getAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommRequestCredentialV1Message,\n role: DidCommMessageRole.Receiver,\n })\n\n const offerAttachment = offerMessage.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n const requestAttachment = requestMessage.getRequestAttachmentById(INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID)\n\n if (!offerAttachment || !requestAttachment) {\n throw new CredoError(\n `Missing data payload in offer or request attachment in credential Record ${credentialExchangeRecord.id}`\n )\n }\n\n const { attachment } = await this.indyCredentialFormat.acceptRequest(agentContext, {\n credentialExchangeRecord,\n requestAttachment,\n offerAttachment,\n attachmentId: INDY_CREDENTIAL_ATTACHMENT_ID,\n credentialFormats,\n })\n\n const issueMessage = new DidCommIssueCredentialV1Message({\n comment,\n credentialAttachments: [attachment],\n attachments: credentialExchangeRecord.linkedAttachments,\n })\n\n issueMessage.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n issueMessage.setPleaseAck()\n\n await didCommMessageRepository.saveAgentMessage(agentContext, {\n agentMessage: issueMessage,\n associatedRecordId: credentialExchangeRecord.id,\n role: DidCommMessageRole.Sender,\n })\n\n credentialExchangeRecord.autoAcceptCredential =\n autoAcceptCredential ?? credentialExchangeRecord.autoAcceptCredential\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.CredentialIssued)\n\n return { message: issueMessage, credentialExchangeRecord }\n }\n\n /**\n * Process an incoming {@link DidCommIssueCredentialV1Message}\n *\n * @param messageContext The message context containing a credential acknowledgement message\n * @returns credential record associated with the credential acknowledgement message\n *\n */\n public async processCredential(\n messageContext: DidCommInboundMessageContext<DidCommIssueCredentialV1Message>\n ): Promise<DidCommCredentialExchangeRecord> {\n const { message: issueMessage, connection, agentContext } = messageContext\n\n agentContext.config.logger.debug(`Processing credential with id ${issueMessage.id}`)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n // TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it\n // only depends on the public api, rather than the internal API (this helps with breaking changes)\n const connectionService = agentContext.dependencyManager.resolve(DidCommConnectionService)\n\n const credentialExchangeRecord = await this.getByProperties(messageContext.agentContext, {\n threadId: issueMessage.threadId,\n role: DidCommCredentialRole.Holder,\n connectionId: connection?.id,\n })\n\n const requestCredentialMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommRequestCredentialV1Message,\n role: DidCommMessageRole.Sender,\n })\n const offerCredentialMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Receiver,\n })\n\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.RequestSent)\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {\n lastReceivedMessage: offerCredentialMessage,\n lastSentMessage: requestCredentialMessage,\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n\n const issueAttachment = issueMessage.getCredentialAttachmentById(INDY_CREDENTIAL_ATTACHMENT_ID)\n if (!issueAttachment) {\n throw new CredoError('Missing indy credential attachment in processCredential')\n }\n\n const requestAttachment = requestCredentialMessage?.getRequestAttachmentById(INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID)\n if (!requestAttachment) {\n throw new CredoError('Missing indy credential request attachment in processCredential')\n }\n\n const offerAttachment = offerCredentialMessage?.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n if (!offerAttachment) {\n throw new CredoError('Missing indy credential request attachment in processCredential')\n }\n\n await this.indyCredentialFormat.processCredential(messageContext.agentContext, {\n offerAttachment,\n attachment: issueAttachment,\n credentialExchangeRecord,\n requestAttachment,\n })\n\n await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {\n agentMessage: issueMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n await this.updateState(\n messageContext.agentContext,\n credentialExchangeRecord,\n DidCommCredentialState.CredentialReceived\n )\n\n return credentialExchangeRecord\n }\n\n /**\n * Create a {@link CredentialAckMessage} as response to a received credential.\n *\n * @param credentialExchangeRecord The credential record for which to create the credential acknowledgement\n * @returns Object containing credential acknowledgement message and associated credential record\n *\n */\n public async acceptCredential(\n agentContext: AgentContext,\n { credentialExchangeRecord }: CredentialProtocolOptions.AcceptCredentialOptions\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommCredentialV1AckMessage>> {\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.CredentialReceived)\n\n // Create message\n const ackMessage = new DidCommCredentialV1AckMessage({\n status: AckStatus.OK,\n threadId: credentialExchangeRecord.threadId,\n })\n\n ackMessage.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.Done)\n\n return { message: ackMessage, credentialExchangeRecord }\n }\n\n /**\n * Process a received {@link CredentialAckMessage}.\n *\n * @param messageContext The message context containing a credential acknowledgement message\n * @returns credential record associated with the credential acknowledgement message\n *\n */\n public async processAck(\n messageContext: DidCommInboundMessageContext<DidCommCredentialV1AckMessage>\n ): Promise<DidCommCredentialExchangeRecord> {\n const { message: ackMessage, connection, agentContext } = messageContext\n\n agentContext.config.logger.debug(`Processing credential ack with id ${ackMessage.id}`)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n // TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it\n // only depends on the public api, rather than the internal API (this helps with breaking changes)\n const connectionService = agentContext.dependencyManager.resolve(DidCommConnectionService)\n\n const credentialExchangeRecord = await this.getByProperties(messageContext.agentContext, {\n threadId: ackMessage.threadId,\n\n role: DidCommCredentialRole.Issuer,\n connectionId: connection?.id,\n })\n\n const requestCredentialMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommRequestCredentialV1Message,\n role: DidCommMessageRole.Receiver,\n })\n const issueCredentialMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommIssueCredentialV1Message,\n role: DidCommMessageRole.Sender,\n })\n\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.CredentialIssued)\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {\n lastReceivedMessage: requestCredentialMessage,\n lastSentMessage: issueCredentialMessage,\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n\n // Update record\n await this.updateState(messageContext.agentContext, credentialExchangeRecord, DidCommCredentialState.Done)\n\n return credentialExchangeRecord\n }\n\n /**\n * Create a {@link DidCommCredentialV1ProblemReportMessage} to be sent.\n *\n * @param message message to send\n * @returns a {@link DidCommCredentialV1ProblemReportMessage}\n *\n */\n public async createProblemReport(\n _agentContext: AgentContext,\n { credentialExchangeRecord, description }: CredentialProtocolOptions.CreateCredentialProblemReportOptions\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommProblemReportMessage>> {\n const message = new DidCommCredentialV1ProblemReportMessage({\n description: {\n en: description,\n code: DidCommCredentialProblemReportReason.IssuanceAbandoned,\n },\n })\n\n return { message, credentialExchangeRecord }\n }\n\n // AUTO RESPOND METHODS\n public async shouldAutoRespondToProposal(\n agentContext: AgentContext,\n options: {\n credentialExchangeRecord: DidCommCredentialExchangeRecord\n proposalMessage: DidCommProposeCredentialV1Message\n }\n ) {\n const { credentialExchangeRecord, proposalMessage } = options\n\n const credentialsModuleConfig = agentContext.dependencyManager.resolve(DidCommCredentialsModuleConfig)\n\n const autoAccept = composeCredentialAutoAccept(\n credentialExchangeRecord.autoAcceptCredential,\n credentialsModuleConfig.autoAcceptCredentials\n )\n\n // Handle always / never cases\n if (autoAccept === DidCommAutoAcceptCredential.Always) return true\n if (autoAccept === DidCommAutoAcceptCredential.Never) return false\n\n const offerMessage = await this.findOfferMessage(agentContext, credentialExchangeRecord.id)\n\n // Do not auto accept if missing properties\n if (!offerMessage || !offerMessage.credentialPreview) return false\n if (!proposalMessage.credentialPreview || !proposalMessage.credentialDefinitionId) return false\n\n const credentialOfferJson = offerMessage.indyCredentialOffer\n\n // Check if credential definition id matches\n if (!credentialOfferJson) return false\n if (credentialOfferJson.cred_def_id !== proposalMessage.credentialDefinitionId) return false\n\n // Check if preview values match\n return areCredentialPreviewAttributesEqual(\n proposalMessage.credentialPreview.attributes,\n offerMessage.credentialPreview.attributes\n )\n }\n\n public async shouldAutoRespondToOffer(\n agentContext: AgentContext,\n options: {\n credentialExchangeRecord: DidCommCredentialExchangeRecord\n offerMessage: V1OfferCredentialMessage\n }\n ) {\n const { credentialExchangeRecord, offerMessage } = options\n\n const credentialsModuleConfig = agentContext.dependencyManager.resolve(DidCommCredentialsModuleConfig)\n\n const autoAccept = composeCredentialAutoAccept(\n credentialExchangeRecord.autoAcceptCredential,\n credentialsModuleConfig.autoAcceptCredentials\n )\n\n // Handle always / never cases\n if (autoAccept === DidCommAutoAcceptCredential.Always) return true\n if (autoAccept === DidCommAutoAcceptCredential.Never) return false\n\n const proposalMessage = await this.findProposalMessage(agentContext, credentialExchangeRecord.id)\n\n // Do not auto accept if missing properties\n if (!offerMessage.credentialPreview) return false\n if (!proposalMessage || !proposalMessage.credentialPreview || !proposalMessage.credentialDefinitionId) return false\n\n const credentialOfferJson = offerMessage.indyCredentialOffer\n\n // Check if credential definition id matches\n if (!credentialOfferJson) return false\n if (credentialOfferJson.cred_def_id !== proposalMessage.credentialDefinitionId) return false\n\n // Check if preview values match\n return areCredentialPreviewAttributesEqual(\n proposalMessage.credentialPreview.attributes,\n offerMessage.credentialPreview.attributes\n )\n }\n\n public async shouldAutoRespondToRequest(\n agentContext: AgentContext,\n options: {\n credentialExchangeRecord: DidCommCredentialExchangeRecord\n requestMessage: DidCommRequestCredentialV1Message\n }\n ) {\n const { credentialExchangeRecord, requestMessage } = options\n\n const credentialsModuleConfig = agentContext.dependencyManager.resolve(DidCommCredentialsModuleConfig)\n\n const autoAccept = composeCredentialAutoAccept(\n credentialExchangeRecord.autoAcceptCredential,\n credentialsModuleConfig.autoAcceptCredentials\n )\n\n // Handle always / never cases\n if (autoAccept === DidCommAutoAcceptCredential.Always) return true\n if (autoAccept === DidCommAutoAcceptCredential.Never) return false\n\n const offerMessage = await this.findOfferMessage(agentContext, credentialExchangeRecord.id)\n if (!offerMessage) return false\n\n const offerAttachment = offerMessage.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n const requestAttachment = requestMessage.getRequestAttachmentById(INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID)\n\n if (!offerAttachment || !requestAttachment) return false\n\n return this.indyCredentialFormat.shouldAutoRespondToRequest(agentContext, {\n credentialExchangeRecord,\n offerAttachment,\n requestAttachment,\n })\n }\n\n public async shouldAutoRespondToCredential(\n agentContext: AgentContext,\n options: {\n credentialExchangeRecord: DidCommCredentialExchangeRecord\n credentialMessage: DidCommIssueCredentialV1Message\n }\n ) {\n const { credentialExchangeRecord, credentialMessage } = options\n\n const credentialsModuleConfig = agentContext.dependencyManager.resolve(DidCommCredentialsModuleConfig)\n\n const autoAccept = composeCredentialAutoAccept(\n credentialExchangeRecord.autoAcceptCredential,\n credentialsModuleConfig.autoAcceptCredentials\n )\n\n // Handle always / never cases\n if (autoAccept === DidCommAutoAcceptCredential.Always) return true\n if (autoAccept === DidCommAutoAcceptCredential.Never) return false\n\n const requestMessage = await this.findRequestMessage(agentContext, credentialExchangeRecord.id)\n const offerMessage = await this.findOfferMessage(agentContext, credentialExchangeRecord.id)\n\n const credentialAttachment = credentialMessage.getCredentialAttachmentById(INDY_CREDENTIAL_ATTACHMENT_ID)\n if (!credentialAttachment) return false\n\n const requestAttachment = requestMessage?.getRequestAttachmentById(INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID)\n if (!requestAttachment) return false\n\n const offerAttachment = offerMessage?.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n\n return this.indyCredentialFormat.shouldAutoRespondToCredential(agentContext, {\n credentialExchangeRecord,\n credentialAttachment,\n requestAttachment,\n offerAttachment,\n })\n }\n\n public async findProposalMessage(agentContext: AgentContext, credentialExchangeId: string) {\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n return await didCommMessageRepository.findAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeId,\n messageClass: DidCommProposeCredentialV1Message,\n })\n }\n\n public async findOfferMessage(agentContext: AgentContext, credentialExchangeId: string) {\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n return await didCommMessageRepository.findAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeId,\n messageClass: V1OfferCredentialMessage,\n })\n }\n\n public async findRequestMessage(agentContext: AgentContext, credentialExchangeId: string) {\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n return await didCommMessageRepository.findAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeId,\n messageClass: DidCommRequestCredentialV1Message,\n })\n }\n\n public async findCredentialMessage(agentContext: AgentContext, credentialExchangeId: string) {\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n return await didCommMessageRepository.findAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeId,\n messageClass: DidCommIssueCredentialV1Message,\n })\n }\n\n public async getFormatData(\n agentContext: AgentContext,\n credentialExchangeId: string\n ): Promise<\n CredentialProtocolOptions.GetCredentialFormatDataReturn<\n ExtractCredentialFormats<[LegacyIndyDidCommCredentialFormatService]>\n >\n > {\n // TODO: we could looking at fetching all record using a single query and then filtering based on the type of the message.\n const [proposalMessage, offerMessage, requestMessage, credentialMessage] = await Promise.all([\n this.findProposalMessage(agentContext, credentialExchangeId),\n this.findOfferMessage(agentContext, credentialExchangeId),\n this.findRequestMessage(agentContext, credentialExchangeId),\n this.findCredentialMessage(agentContext, credentialExchangeId),\n ])\n\n const indyProposal = proposalMessage\n ? JsonTransformer.toJSON(this.rfc0592ProposalFromV1ProposeMessage(proposalMessage))\n : undefined\n\n const indyOffer = offerMessage?.indyCredentialOffer ?? undefined\n const indyRequest = requestMessage?.indyCredentialRequest ?? undefined\n const indyCredential = credentialMessage?.indyCredential ?? undefined\n\n return {\n proposalAttributes: proposalMessage?.credentialPreview?.attributes,\n proposal: proposalMessage\n ? {\n indy: indyProposal,\n }\n : undefined,\n offerAttributes: offerMessage?.credentialPreview?.attributes,\n offer: offerMessage\n ? {\n indy: indyOffer,\n }\n : undefined,\n request: requestMessage\n ? {\n indy: indyRequest,\n }\n : undefined,\n credential: credentialMessage\n ? {\n indy: indyCredential,\n }\n : undefined,\n }\n }\n\n private rfc0592ProposalFromV1ProposeMessage(proposalMessage: DidCommProposeCredentialV1Message) {\n const indyCredentialProposal = new AnonCredsCredentialProposal({\n credentialDefinitionId: proposalMessage.credentialDefinitionId,\n schemaId: proposalMessage.schemaId,\n issuerDid: proposalMessage.issuerDid,\n schemaIssuerDid: proposalMessage.schemaIssuerDid,\n schemaName: proposalMessage.schemaName,\n schemaVersion: proposalMessage.schemaVersion,\n })\n\n return indyCredentialProposal\n }\n\n private assertOnlyIndyFormat(credentialFormats: Record<string, unknown>) {\n const formatKeys = Object.keys(credentialFormats)\n\n // It's fine to not have any formats in some cases, if indy is required the method that calls this should check for this\n if (formatKeys.length === 0) return\n\n if (formatKeys.length !== 1 || !formatKeys.includes('indy')) {\n throw new CredoError('Only indy credential format is supported for issue credential v1 protocol')\n }\n }\n\n public getFormatServiceForRecordType(credentialRecordType: string) {\n if (credentialRecordType !== this.indyCredentialFormat.credentialRecordType) {\n throw new CredoError(\n `Unsupported credential record type ${credentialRecordType} for v1 issue credential protocol (need ${this.indyCredentialFormat.credentialRecordType})`\n )\n }\n\n return this.indyCredentialFormat\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6DA,IAAa,8BAAb,cACU,8BAEV;CAGE,AAAO,YAAY,EAAE,wBAA2D;AAC9E,SAAO;OASO,UAAU;AANxB,OAAK,uBAAuB;;;;;CAW9B,AAAO,SAAS,wBAAuD,iBAAyC;AAE9G,yBAAuB,wBAAwB;GAC7C,IAAI,kCAAkC,KAAK;GAC3C,IAAI,gCAAgC,KAAK;GACzC,IAAI,kCAAkC,KAAK;GAC3C,IAAI,gCAAgC,KAAK;GACzC,IAAI,8BAA8B,KAAK;GACvC,IAAI,wCAAwC,KAAK;GAClD,CAAC;AAGF,kBAAgB,SACd,IAAI,gBAAgB;GACl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,GACD;GACJ,iBAAiB,cAAc,mBAAmB;GAClD,OAAO,eACH,EACE,MAAM,WACP,GACD;GACJ,SAAS,iBACL,EACE,MAAM,aACP,GACD;GACJ,YAAY,oBACR,EACE,MAAM,gBACP,GACD;GACL;;CAGH,AAAQ,oCAAoC,iBAAoD;AAU9F,SAT+B,IAAI,4BAA4B;GAC7D,wBAAwB,gBAAgB;GACxC,UAAU,gBAAgB;GAC1B,WAAW,gBAAgB;GAC3B,iBAAiB,gBAAgB;GACjC,YAAY,gBAAgB;GAC5B,eAAe,gBAAgB;GAChC,CAAC;;CAKJ,AAAQ,qBAAqB,mBAA4C;EACvE,MAAM,aAAa,OAAO,KAAK,kBAAkB;AAGjD,MAAI,WAAW,WAAW,EAAG;AAE7B,MAAI,WAAW,WAAW,KAAK,CAAC,WAAW,SAAS,OAAO,CACzD,OAAM,IAAI,WAAW,4EAA4E;;CAIrG,AAAO,8BAA8B,sBAA8B;AACjE,MAAI,yBAAyB,KAAK,qBAAqB,qBACrD,OAAM,IAAI,WACR,sCAAsC,qBAAqB,0CAA0C,KAAK,qBAAqB,qBAAqB,GACrJ;AAGH,SAAO,KAAK"}
|
|
1
|
+
{"version":3,"file":"DidCommCredentialV1Protocol.mjs","names":["attachment"],"sources":["../../../../src/protocols/credentials/v1/DidCommCredentialV1Protocol.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport { CredoError, JsonTransformer, utils } from '@credo-ts/core'\nimport type {\n CredentialProtocolOptions,\n DidCommCredentialProtocol,\n DidCommFeatureRegistry,\n DidCommInboundMessageContext,\n DidCommMessage,\n DidCommMessageHandlerRegistry,\n DidCommProblemReportMessage,\n ExtractCredentialFormats,\n} from '@credo-ts/didcomm'\nimport {\n AckStatus,\n BaseDidCommCredentialProtocol,\n DidCommAttachment,\n DidCommAttachmentData,\n DidCommAutoAcceptCredential,\n DidCommConnectionService,\n DidCommCredentialExchangeRecord,\n DidCommCredentialExchangeRepository,\n DidCommCredentialProblemReportReason,\n DidCommCredentialRole,\n DidCommCredentialState,\n DidCommCredentialsModuleConfig,\n DidCommMessageRepository,\n DidCommMessageRole,\n DidCommProtocol,\n isLinkedAttachment,\n} from '@credo-ts/didcomm'\nimport type { LegacyIndyDidCommCredentialFormatService } from '../../../formats'\n\nimport { AnonCredsCredentialProposal } from '../../../models/AnonCredsCredentialProposal'\nimport { areCredentialPreviewAttributesEqual, composeCredentialAutoAccept } from '../../../utils'\n\nimport {\n DidCommCredentialV1AckHandler,\n DidCommCredentialV1ProblemReportHandler,\n DidCommIssueCredentialV1Handler,\n DidCommOfferCredentialV1Handler,\n DidCommProposeCredentialV1Handler,\n DidCommRequestCredentialV1Handler,\n} from './handlers'\nimport {\n DidCommCredentialV1AckMessage,\n DidCommCredentialV1Preview,\n DidCommCredentialV1ProblemReportMessage,\n DidCommIssueCredentialV1Message,\n DidCommProposeCredentialV1Message,\n DidCommRequestCredentialV1Message,\n INDY_CREDENTIAL_ATTACHMENT_ID,\n INDY_CREDENTIAL_OFFER_ATTACHMENT_ID,\n INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID,\n V1OfferCredentialMessage,\n} from './messages'\n\nexport interface DidCommCredentialV1ProtocolConfig {\n indyCredentialFormat: LegacyIndyDidCommCredentialFormatService\n}\n\nexport class DidCommCredentialV1Protocol\n extends BaseDidCommCredentialProtocol<[LegacyIndyDidCommCredentialFormatService]>\n implements DidCommCredentialProtocol<[LegacyIndyDidCommCredentialFormatService]>\n{\n private indyCredentialFormat: LegacyIndyDidCommCredentialFormatService\n\n public constructor({ indyCredentialFormat }: DidCommCredentialV1ProtocolConfig) {\n super()\n\n // TODO: just create a new instance of LegacyIndyDidCommCredentialFormatService here so it makes the setup easier\n this.indyCredentialFormat = indyCredentialFormat\n }\n\n /**\n * The version of the issue credential protocol this protocol supports\n */\n public readonly version = 'v1'\n\n /**\n * Registers the protocol implementation (handlers, feature registry) on the agent.\n */\n public register(messageHandlerRegistry: DidCommMessageHandlerRegistry, featureRegistry: DidCommFeatureRegistry) {\n // Register message handlers for the Issue Credential V1 Protocol\n messageHandlerRegistry.registerMessageHandlers([\n new DidCommProposeCredentialV1Handler(this),\n new DidCommOfferCredentialV1Handler(this),\n new DidCommRequestCredentialV1Handler(this),\n new DidCommIssueCredentialV1Handler(this),\n new DidCommCredentialV1AckHandler(this),\n new DidCommCredentialV1ProblemReportHandler(this),\n ])\n\n // Register Issue Credential V1 in feature registry, with supported roles\n featureRegistry.register(\n new DidCommProtocol({\n id: 'https://didcomm.org/issue-credential/1.0',\n roles: ['holder', 'issuer'],\n })\n )\n }\n\n /**\n * Create a {@link ProposeCredentialMessage} not bound to an existing credential exchange.\n * To create a proposal as response to an existing credential exchange, use {@link createProposalAsResponse}.\n *\n * @param options The object containing config options\n * @returns Object containing proposal message and associated credential record\n *\n */\n public async createProposal(\n agentContext: AgentContext,\n {\n connectionRecord,\n credentialFormats,\n comment,\n autoAcceptCredential,\n }: CredentialProtocolOptions.CreateCredentialProposalOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommMessage>> {\n this.assertOnlyIndyFormat(credentialFormats)\n\n const credentialRepository = agentContext.dependencyManager.resolve(DidCommCredentialExchangeRepository)\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n if (!credentialFormats.indy) {\n throw new CredoError('Missing indy credential format in v1 create proposal call.')\n }\n\n // TODO: linked attachments are broken currently. We never include them in the messages.\n // The linking with previews does work, so it shouldn't be too much work to re-enable this.\n const { linkedAttachments } = credentialFormats.indy\n\n // Create record\n const credentialExchangeRecord = new DidCommCredentialExchangeRecord({\n connectionId: connectionRecord.id,\n threadId: utils.uuid(),\n state: DidCommCredentialState.ProposalSent,\n role: DidCommCredentialRole.Holder,\n linkedAttachments: linkedAttachments?.map((linkedAttachment) => linkedAttachment.attachment),\n autoAcceptCredential,\n protocolVersion: 'v1',\n })\n\n // call create proposal for validation of the proposal and addition of linked attachments\n const { previewAttributes, attachment } = await this.indyCredentialFormat.createProposal(agentContext, {\n credentialFormats,\n credentialExchangeRecord,\n })\n\n // Transform the attachment into the attachment payload and use that to construct the v1 message\n const indyCredentialProposal = JsonTransformer.fromJSON(attachment.getDataAsJson(), AnonCredsCredentialProposal)\n\n const credentialProposal = previewAttributes\n ? new DidCommCredentialV1Preview({\n attributes: previewAttributes,\n })\n : undefined\n\n // Create message\n const message = new DidCommProposeCredentialV1Message({\n ...indyCredentialProposal,\n id: credentialExchangeRecord.threadId,\n credentialPreview: credentialProposal,\n comment,\n })\n\n await didCommMessageRepository.saveAgentMessage(agentContext, {\n agentMessage: message,\n role: DidCommMessageRole.Sender,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n credentialExchangeRecord.credentialAttributes = credentialProposal?.attributes\n await credentialRepository.save(agentContext, credentialExchangeRecord)\n this.emitStateChangedEvent(agentContext, credentialExchangeRecord, null)\n\n return { credentialExchangeRecord, message }\n }\n\n /**\n * Process a received {@link ProposeCredentialMessage}. This will not accept the credential proposal\n * or send a credential offer. It will only create a new, or update the existing credential record with\n * the information from the credential proposal message. Use {@link createOfferAsResponse}\n * after calling this method to create a credential offer.\n *\n * @param messageContext The message context containing a credential proposal message\n * @returns credential record associated with the credential proposal message\n *\n */\n public async processProposal(\n messageContext: DidCommInboundMessageContext<DidCommProposeCredentialV1Message>\n ): Promise<DidCommCredentialExchangeRecord> {\n const { message: proposalMessage, connection, agentContext } = messageContext\n\n const credentialRepository = agentContext.dependencyManager.resolve(DidCommCredentialExchangeRepository)\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n // TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it\n // only depends on the public api, rather than the internal API (this helps with breaking changes)\n const connectionService = agentContext.dependencyManager.resolve(DidCommConnectionService)\n\n agentContext.config.logger.debug(`Processing credential proposal with message id ${proposalMessage.id}`)\n\n let credentialExchangeRecord = await this.findByProperties(messageContext.agentContext, {\n threadId: proposalMessage.threadId,\n role: DidCommCredentialRole.Issuer,\n connectionId: connection?.id,\n })\n\n // Credential record already exists, this is a response to an earlier message sent by us\n if (credentialExchangeRecord) {\n agentContext.config.logger.debug('Credential record already exists for incoming proposal')\n\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.OfferSent)\n\n const lastReceivedMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommProposeCredentialV1Message,\n role: DidCommMessageRole.Receiver,\n })\n const lastSentMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Sender,\n })\n\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {\n lastReceivedMessage,\n lastSentMessage,\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n\n await this.indyCredentialFormat.processProposal(messageContext.agentContext, {\n credentialExchangeRecord,\n attachment: new DidCommAttachment({\n data: new DidCommAttachmentData({\n json: JsonTransformer.toJSON(this.rfc0592ProposalFromV1ProposeMessage(proposalMessage)),\n }),\n }),\n })\n\n // Update record\n await this.updateState(\n messageContext.agentContext,\n credentialExchangeRecord,\n DidCommCredentialState.ProposalReceived\n )\n await didCommMessageRepository.saveOrUpdateAgentMessage(messageContext.agentContext, {\n agentMessage: proposalMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n } else {\n agentContext.config.logger.debug('Credential record does not exists yet for incoming proposal')\n // Assert\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext)\n\n // No credential record exists with thread id\n credentialExchangeRecord = new DidCommCredentialExchangeRecord({\n connectionId: connection?.id,\n threadId: proposalMessage.threadId,\n state: DidCommCredentialState.ProposalReceived,\n role: DidCommCredentialRole.Issuer,\n protocolVersion: 'v1',\n })\n\n // Save record\n await credentialRepository.save(messageContext.agentContext, credentialExchangeRecord)\n this.emitStateChangedEvent(messageContext.agentContext, credentialExchangeRecord, null)\n\n await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {\n agentMessage: proposalMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n }\n return credentialExchangeRecord\n }\n\n /**\n * Processing an incoming credential message and create a credential offer as a response\n * @param options The object containing config options\n * @returns Object containing proposal message and associated credential record\n */\n public async acceptProposal(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n credentialFormats,\n comment,\n autoAcceptCredential,\n }: CredentialProtocolOptions.AcceptCredentialProposalOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<V1OfferCredentialMessage>> {\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.ProposalReceived)\n if (credentialFormats) this.assertOnlyIndyFormat(credentialFormats)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n const proposalMessage = await didCommMessageRepository.getAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommProposeCredentialV1Message,\n role: DidCommMessageRole.Receiver,\n })\n\n // NOTE: We set the credential attributes from the proposal on the record as we've 'accepted' them\n // and can now use them to create the offer in the format services. It may be overwritten later on\n // if the user provided other attributes in the credentialFormats array.\n credentialExchangeRecord.credentialAttributes = proposalMessage.credentialPreview?.attributes\n\n const { attachment, previewAttributes } = await this.indyCredentialFormat.acceptProposal(agentContext, {\n attachmentId: INDY_CREDENTIAL_OFFER_ATTACHMENT_ID,\n credentialFormats,\n credentialExchangeRecord,\n proposalAttachment: new DidCommAttachment({\n data: new DidCommAttachmentData({\n json: JsonTransformer.toJSON(this.rfc0592ProposalFromV1ProposeMessage(proposalMessage)),\n }),\n }),\n })\n\n if (!previewAttributes) {\n throw new CredoError('Missing required credential preview attributes from indy format service')\n }\n\n const message = new V1OfferCredentialMessage({\n comment,\n offerAttachments: [attachment],\n credentialPreview: new DidCommCredentialV1Preview({\n attributes: previewAttributes,\n }),\n attachments: credentialExchangeRecord.linkedAttachments,\n })\n\n message.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n\n credentialExchangeRecord.credentialAttributes = message.credentialPreview.attributes\n credentialExchangeRecord.autoAcceptCredential =\n autoAcceptCredential ?? credentialExchangeRecord.autoAcceptCredential\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.OfferSent)\n\n await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {\n agentMessage: message,\n role: DidCommMessageRole.Sender,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n return { credentialExchangeRecord, message }\n }\n\n /**\n * Negotiate a credential proposal as issuer (by sending a credential offer message) to the connection\n * associated with the credential record.\n *\n * @param options configuration for the offer see {@link NegotiateCredentialProposalOptions}\n * @returns Credential record associated with the credential offer and the corresponding new offer message\n *\n */\n public async negotiateProposal(\n agentContext: AgentContext,\n {\n credentialFormats,\n credentialExchangeRecord,\n comment,\n autoAcceptCredential,\n }: CredentialProtocolOptions.NegotiateCredentialProposalOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<V1OfferCredentialMessage>> {\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.ProposalReceived)\n this.assertOnlyIndyFormat(credentialFormats)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n const { attachment, previewAttributes } = await this.indyCredentialFormat.createOffer(agentContext, {\n attachmentId: INDY_CREDENTIAL_OFFER_ATTACHMENT_ID,\n credentialFormats,\n credentialExchangeRecord,\n })\n\n if (!previewAttributes) {\n throw new CredoError('Missing required credential preview attributes from indy format service')\n }\n\n const message = new V1OfferCredentialMessage({\n comment,\n offerAttachments: [attachment],\n credentialPreview: new DidCommCredentialV1Preview({\n attributes: previewAttributes,\n }),\n attachments: credentialExchangeRecord.linkedAttachments,\n })\n message.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n\n credentialExchangeRecord.credentialAttributes = message.credentialPreview.attributes\n credentialExchangeRecord.autoAcceptCredential =\n autoAcceptCredential ?? credentialExchangeRecord.autoAcceptCredential\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.OfferSent)\n\n await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {\n agentMessage: message,\n role: DidCommMessageRole.Sender,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n return { credentialExchangeRecord, message }\n }\n\n /**\n * Create a {@link OfferCredentialMessage} not bound to an existing credential exchange.\n * To create an offer as response to an existing credential exchange, use {@link DidCommCredentialV1Protocol#createOfferAsResponse}.\n *\n * @param options The options containing config params for creating the credential offer\n * @returns Object containing offer message and associated credential record\n *\n */\n public async createOffer(\n agentContext: AgentContext,\n {\n credentialFormats,\n autoAcceptCredential,\n comment,\n connectionRecord,\n }: CredentialProtocolOptions.CreateCredentialOfferOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<V1OfferCredentialMessage>> {\n // Assert\n this.assertOnlyIndyFormat(credentialFormats)\n\n const credentialRepository = agentContext.dependencyManager.resolve(DidCommCredentialExchangeRepository)\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n if (!credentialFormats.indy) {\n throw new CredoError('Missing indy credential format data for v1 create offer')\n }\n\n // Create record\n const credentialExchangeRecord = new DidCommCredentialExchangeRecord({\n connectionId: connectionRecord?.id,\n threadId: utils.uuid(),\n linkedAttachments: credentialFormats.indy.linkedAttachments?.map(\n (linkedAttachments) => linkedAttachments.attachment\n ),\n state: DidCommCredentialState.OfferSent,\n role: DidCommCredentialRole.Issuer,\n autoAcceptCredential,\n protocolVersion: 'v1',\n })\n\n const { attachment, previewAttributes } = await this.indyCredentialFormat.createOffer(agentContext, {\n attachmentId: INDY_CREDENTIAL_OFFER_ATTACHMENT_ID,\n credentialFormats,\n credentialExchangeRecord,\n })\n\n if (!previewAttributes) {\n throw new CredoError('Missing required credential preview from indy format service')\n }\n\n // Construct offer message\n const message = new V1OfferCredentialMessage({\n id: credentialExchangeRecord.threadId,\n credentialPreview: new DidCommCredentialV1Preview({\n attributes: previewAttributes,\n }),\n comment,\n offerAttachments: [attachment],\n attachments: credentialFormats.indy.linkedAttachments?.map((linkedAttachments) => linkedAttachments.attachment),\n })\n\n await didCommMessageRepository.saveAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n agentMessage: message,\n role: DidCommMessageRole.Sender,\n })\n\n credentialExchangeRecord.credentialAttributes = message.credentialPreview.attributes\n await credentialRepository.save(agentContext, credentialExchangeRecord)\n this.emitStateChangedEvent(agentContext, credentialExchangeRecord, null)\n\n return { message, credentialExchangeRecord }\n }\n\n /**\n * Process a received {@link OfferCredentialMessage}. This will not accept the credential offer\n * or send a credential request. It will only create a new credential record with\n * the information from the credential offer message. Use {@link createRequest}\n * after calling this method to create a credential request.\n *\n * @param messageContext The message context containing a credential request message\n * @returns credential record associated with the credential offer message\n *\n */\n public async processOffer(\n messageContext: DidCommInboundMessageContext<V1OfferCredentialMessage>\n ): Promise<DidCommCredentialExchangeRecord> {\n const { message: offerMessage, connection, agentContext } = messageContext\n\n const credentialRepository = agentContext.dependencyManager.resolve(DidCommCredentialExchangeRepository)\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n // TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it\n // only depends on the public api, rather than the internal API (this helps with breaking changes)\n const connectionService = agentContext.dependencyManager.resolve(DidCommConnectionService)\n\n agentContext.config.logger.debug(`Processing credential offer with id ${offerMessage.id}`)\n\n let credentialExchangeRecord = await this.findByProperties(agentContext, {\n threadId: offerMessage.threadId,\n role: DidCommCredentialRole.Holder,\n connectionId: connection?.id,\n })\n\n const offerAttachment = offerMessage.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n if (!offerAttachment) {\n throw new CredoError(`Indy attachment with id ${INDY_CREDENTIAL_OFFER_ATTACHMENT_ID} not found in offer message`)\n }\n\n if (credentialExchangeRecord) {\n const lastSentMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommProposeCredentialV1Message,\n role: DidCommMessageRole.Sender,\n })\n const lastReceivedMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Receiver,\n })\n\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.ProposalSent)\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {\n lastReceivedMessage,\n lastSentMessage,\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n\n await this.indyCredentialFormat.processOffer(messageContext.agentContext, {\n credentialExchangeRecord,\n attachment: offerAttachment,\n })\n\n await didCommMessageRepository.saveOrUpdateAgentMessage(messageContext.agentContext, {\n agentMessage: offerMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n await this.updateState(\n messageContext.agentContext,\n credentialExchangeRecord,\n DidCommCredentialState.OfferReceived\n )\n\n return credentialExchangeRecord\n }\n // Assert\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext)\n\n // No credential record exists with thread id\n credentialExchangeRecord = new DidCommCredentialExchangeRecord({\n connectionId: connection?.id,\n threadId: offerMessage.threadId,\n parentThreadId: offerMessage.thread?.parentThreadId,\n state: DidCommCredentialState.OfferReceived,\n role: DidCommCredentialRole.Holder,\n protocolVersion: 'v1',\n })\n\n await this.indyCredentialFormat.processOffer(messageContext.agentContext, {\n credentialExchangeRecord,\n attachment: offerAttachment,\n })\n\n // Save in repository\n await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {\n agentMessage: offerMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n await credentialRepository.save(messageContext.agentContext, credentialExchangeRecord)\n this.emitStateChangedEvent(messageContext.agentContext, credentialExchangeRecord, null)\n\n return credentialExchangeRecord\n }\n\n /**\n * Create a {@link RequestCredentialMessage} as response to a received credential offer.\n *\n * @param options configuration to use for the credential request\n * @returns Object containing request message and associated credential record\n *\n */\n public async acceptOffer(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n credentialFormats,\n comment,\n autoAcceptCredential,\n }: CredentialProtocolOptions.AcceptCredentialOfferOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommRequestCredentialV1Message>> {\n // Assert credential\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.OfferReceived)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n const offerMessage = await didCommMessageRepository.getAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Receiver,\n })\n\n const offerAttachment = offerMessage.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n if (!offerAttachment) {\n throw new CredoError(`Indy attachment with id ${INDY_CREDENTIAL_OFFER_ATTACHMENT_ID} not found in offer message`)\n }\n\n const { attachment } = await this.indyCredentialFormat.acceptOffer(agentContext, {\n credentialExchangeRecord,\n credentialFormats,\n attachmentId: INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID,\n offerAttachment,\n })\n\n const requestMessage = new DidCommRequestCredentialV1Message({\n comment,\n requestAttachments: [attachment],\n attachments: offerMessage.appendedAttachments?.filter((attachment) => isLinkedAttachment(attachment)),\n })\n requestMessage.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n\n credentialExchangeRecord.credentialAttributes = offerMessage.credentialPreview.attributes\n credentialExchangeRecord.autoAcceptCredential =\n autoAcceptCredential ?? credentialExchangeRecord.autoAcceptCredential\n credentialExchangeRecord.linkedAttachments = offerMessage.appendedAttachments?.filter((attachment) =>\n isLinkedAttachment(attachment)\n )\n\n await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {\n agentMessage: requestMessage,\n associatedRecordId: credentialExchangeRecord.id,\n role: DidCommMessageRole.Sender,\n })\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.RequestSent)\n\n return { message: requestMessage, credentialExchangeRecord }\n }\n\n /**\n * Process a received {@link RequestCredentialMessage}. This will not accept the credential request\n * or send a credential. It will only update the existing credential record with\n * the information from the credential request message. Use {@link createCredential}\n * after calling this method to create a credential.\n *\n * @param messageContext The message context containing a credential request message\n * @returns credential record associated with the credential request message\n *\n */\n public async negotiateOffer(\n agentContext: AgentContext,\n {\n credentialFormats,\n credentialExchangeRecord,\n autoAcceptCredential,\n comment,\n }: CredentialProtocolOptions.NegotiateCredentialOfferOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommMessage>> {\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.OfferReceived)\n this.assertOnlyIndyFormat(credentialFormats)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n if (!credentialExchangeRecord.connectionId) {\n throw new CredoError(\n `No connectionId found for credential record '${credentialExchangeRecord.id}'. Connection-less issuance does not support negotiation.`\n )\n }\n\n if (!credentialFormats.indy) {\n throw new CredoError('Missing indy credential format in v1 negotiate proposal call.')\n }\n\n const { linkedAttachments } = credentialFormats.indy\n\n // call create proposal for validation of the proposal and addition of linked attachments\n // As the format is different for v1 of the issue credential protocol we won't be using the attachment\n const { previewAttributes, attachment } = await this.indyCredentialFormat.createProposal(agentContext, {\n credentialFormats,\n credentialExchangeRecord,\n })\n\n // Transform the attachment into the attachment payload and use that to construct the v1 message\n const indyCredentialProposal = JsonTransformer.fromJSON(attachment.getDataAsJson(), AnonCredsCredentialProposal)\n\n const credentialProposal = previewAttributes\n ? new DidCommCredentialV1Preview({\n attributes: previewAttributes,\n })\n : undefined\n\n // Create message\n const message = new DidCommProposeCredentialV1Message({\n ...indyCredentialProposal,\n credentialPreview: credentialProposal,\n comment,\n })\n\n message.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n\n await didCommMessageRepository.saveOrUpdateAgentMessage(agentContext, {\n agentMessage: message,\n role: DidCommMessageRole.Sender,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n // Update record\n credentialExchangeRecord.credentialAttributes = message.credentialPreview?.attributes\n credentialExchangeRecord.linkedAttachments = linkedAttachments?.map((attachment) => attachment.attachment)\n credentialExchangeRecord.autoAcceptCredential =\n autoAcceptCredential ?? credentialExchangeRecord.autoAcceptCredential\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.ProposalSent)\n\n return { credentialExchangeRecord, message }\n }\n\n /**\n * Starting from a request is not supported in v1 of the issue credential protocol\n * because indy doesn't allow to start from a request\n */\n public async createRequest(): Promise<\n CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommRequestCredentialV1Message>\n > {\n throw new CredoError('Starting from a request is not supported for v1 issue credential protocol')\n }\n\n public async processRequest(\n messageContext: DidCommInboundMessageContext<DidCommRequestCredentialV1Message>\n ): Promise<DidCommCredentialExchangeRecord> {\n const { message: requestMessage, connection, agentContext } = messageContext\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n // TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it\n // only depends on the public api, rather than the internal API (this helps with breaking changes)\n const connectionService = agentContext.dependencyManager.resolve(DidCommConnectionService)\n\n agentContext.config.logger.debug(`Processing credential request with id ${requestMessage.id}`)\n\n const credentialExchangeRecord = await this.getByProperties(messageContext.agentContext, {\n threadId: requestMessage.threadId,\n role: DidCommCredentialRole.Issuer,\n })\n\n agentContext.config.logger.trace(\n 'Credential record found when processing credential request',\n credentialExchangeRecord\n )\n\n const proposalMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommProposeCredentialV1Message,\n role: DidCommMessageRole.Receiver,\n })\n const offerMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Sender,\n })\n\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.OfferSent)\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {\n lastReceivedMessage: proposalMessage ?? undefined,\n lastSentMessage: offerMessage ?? undefined,\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n\n // This makes sure that the sender of the incoming message is authorized to do so.\n if (!credentialExchangeRecord.connectionId) {\n await connectionService.matchIncomingMessageToRequestMessageInOutOfBandExchange(messageContext, {\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n credentialExchangeRecord.connectionId = connection?.id\n }\n\n const requestAttachment = requestMessage.getRequestAttachmentById(INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID)\n\n if (!requestAttachment) {\n throw new CredoError(\n `Indy attachment with id ${INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID} not found in request message`\n )\n }\n\n await this.indyCredentialFormat.processRequest(messageContext.agentContext, {\n credentialExchangeRecord,\n attachment: requestAttachment,\n })\n\n await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {\n agentMessage: requestMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n await this.updateState(\n messageContext.agentContext,\n credentialExchangeRecord,\n DidCommCredentialState.RequestReceived\n )\n\n return credentialExchangeRecord\n }\n\n /**\n * Create a {@link DidCommIssueCredentialV1Message} as response to a received credential request.\n *\n * @returns Object containing issue credential message and associated credential record\n *\n */\n public async acceptRequest(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n credentialFormats,\n comment,\n autoAcceptCredential,\n }: CredentialProtocolOptions.AcceptCredentialRequestOptions<[LegacyIndyDidCommCredentialFormatService]>\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommIssueCredentialV1Message>> {\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.RequestReceived)\n if (credentialFormats) this.assertOnlyIndyFormat(credentialFormats)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n const offerMessage = await didCommMessageRepository.getAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Sender,\n })\n const requestMessage = await didCommMessageRepository.getAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommRequestCredentialV1Message,\n role: DidCommMessageRole.Receiver,\n })\n\n const offerAttachment = offerMessage.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n const requestAttachment = requestMessage.getRequestAttachmentById(INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID)\n\n if (!offerAttachment || !requestAttachment) {\n throw new CredoError(\n `Missing data payload in offer or request attachment in credential Record ${credentialExchangeRecord.id}`\n )\n }\n\n const { attachment } = await this.indyCredentialFormat.acceptRequest(agentContext, {\n credentialExchangeRecord,\n requestAttachment,\n offerAttachment,\n attachmentId: INDY_CREDENTIAL_ATTACHMENT_ID,\n credentialFormats,\n })\n\n const issueMessage = new DidCommIssueCredentialV1Message({\n comment,\n credentialAttachments: [attachment],\n attachments: credentialExchangeRecord.linkedAttachments,\n })\n\n issueMessage.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n issueMessage.setPleaseAck()\n\n await didCommMessageRepository.saveAgentMessage(agentContext, {\n agentMessage: issueMessage,\n associatedRecordId: credentialExchangeRecord.id,\n role: DidCommMessageRole.Sender,\n })\n\n credentialExchangeRecord.autoAcceptCredential =\n autoAcceptCredential ?? credentialExchangeRecord.autoAcceptCredential\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.CredentialIssued)\n\n return { message: issueMessage, credentialExchangeRecord }\n }\n\n /**\n * Process an incoming {@link DidCommIssueCredentialV1Message}\n *\n * @param messageContext The message context containing a credential acknowledgement message\n * @returns credential record associated with the credential acknowledgement message\n *\n */\n public async processCredential(\n messageContext: DidCommInboundMessageContext<DidCommIssueCredentialV1Message>\n ): Promise<DidCommCredentialExchangeRecord> {\n const { message: issueMessage, connection, agentContext } = messageContext\n\n agentContext.config.logger.debug(`Processing credential with id ${issueMessage.id}`)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n // TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it\n // only depends on the public api, rather than the internal API (this helps with breaking changes)\n const connectionService = agentContext.dependencyManager.resolve(DidCommConnectionService)\n\n const credentialExchangeRecord = await this.getByProperties(messageContext.agentContext, {\n threadId: issueMessage.threadId,\n role: DidCommCredentialRole.Holder,\n connectionId: connection?.id,\n })\n\n const requestCredentialMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommRequestCredentialV1Message,\n role: DidCommMessageRole.Sender,\n })\n const offerCredentialMessage = await didCommMessageRepository.findAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: V1OfferCredentialMessage,\n role: DidCommMessageRole.Receiver,\n })\n\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.RequestSent)\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {\n lastReceivedMessage: offerCredentialMessage,\n lastSentMessage: requestCredentialMessage,\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n\n const issueAttachment = issueMessage.getCredentialAttachmentById(INDY_CREDENTIAL_ATTACHMENT_ID)\n if (!issueAttachment) {\n throw new CredoError('Missing indy credential attachment in processCredential')\n }\n\n const requestAttachment = requestCredentialMessage?.getRequestAttachmentById(INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID)\n if (!requestAttachment) {\n throw new CredoError('Missing indy credential request attachment in processCredential')\n }\n\n const offerAttachment = offerCredentialMessage?.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n if (!offerAttachment) {\n throw new CredoError('Missing indy credential request attachment in processCredential')\n }\n\n await this.indyCredentialFormat.processCredential(messageContext.agentContext, {\n offerAttachment,\n attachment: issueAttachment,\n credentialExchangeRecord,\n requestAttachment,\n })\n\n await didCommMessageRepository.saveAgentMessage(messageContext.agentContext, {\n agentMessage: issueMessage,\n role: DidCommMessageRole.Receiver,\n associatedRecordId: credentialExchangeRecord.id,\n })\n\n await this.updateState(\n messageContext.agentContext,\n credentialExchangeRecord,\n DidCommCredentialState.CredentialReceived\n )\n\n return credentialExchangeRecord\n }\n\n /**\n * Create a {@link CredentialAckMessage} as response to a received credential.\n *\n * @param credentialExchangeRecord The credential record for which to create the credential acknowledgement\n * @returns Object containing credential acknowledgement message and associated credential record\n *\n */\n public async acceptCredential(\n agentContext: AgentContext,\n { credentialExchangeRecord }: CredentialProtocolOptions.AcceptCredentialOptions\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommCredentialV1AckMessage>> {\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.CredentialReceived)\n\n // Create message\n const ackMessage = new DidCommCredentialV1AckMessage({\n status: AckStatus.OK,\n threadId: credentialExchangeRecord.threadId,\n })\n\n ackMessage.setThread({\n threadId: credentialExchangeRecord.threadId,\n parentThreadId: credentialExchangeRecord.parentThreadId,\n })\n\n await this.updateState(agentContext, credentialExchangeRecord, DidCommCredentialState.Done)\n\n return { message: ackMessage, credentialExchangeRecord }\n }\n\n /**\n * Process a received {@link CredentialAckMessage}.\n *\n * @param messageContext The message context containing a credential acknowledgement message\n * @returns credential record associated with the credential acknowledgement message\n *\n */\n public async processAck(\n messageContext: DidCommInboundMessageContext<DidCommCredentialV1AckMessage>\n ): Promise<DidCommCredentialExchangeRecord> {\n const { message: ackMessage, connection, agentContext } = messageContext\n\n agentContext.config.logger.debug(`Processing credential ack with id ${ackMessage.id}`)\n\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n // TODO: with this method, we should update the credential protocol to use the ConnectionApi, so it\n // only depends on the public api, rather than the internal API (this helps with breaking changes)\n const connectionService = agentContext.dependencyManager.resolve(DidCommConnectionService)\n\n const credentialExchangeRecord = await this.getByProperties(messageContext.agentContext, {\n threadId: ackMessage.threadId,\n\n role: DidCommCredentialRole.Issuer,\n connectionId: connection?.id,\n })\n\n const requestCredentialMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommRequestCredentialV1Message,\n role: DidCommMessageRole.Receiver,\n })\n const issueCredentialMessage = await didCommMessageRepository.getAgentMessage(messageContext.agentContext, {\n associatedRecordId: credentialExchangeRecord.id,\n messageClass: DidCommIssueCredentialV1Message,\n role: DidCommMessageRole.Sender,\n })\n\n // Assert\n credentialExchangeRecord.assertProtocolVersion('v1')\n credentialExchangeRecord.assertState(DidCommCredentialState.CredentialIssued)\n await connectionService.assertConnectionOrOutOfBandExchange(messageContext, {\n lastReceivedMessage: requestCredentialMessage,\n lastSentMessage: issueCredentialMessage,\n expectedConnectionId: credentialExchangeRecord.connectionId,\n })\n\n // Update record\n await this.updateState(messageContext.agentContext, credentialExchangeRecord, DidCommCredentialState.Done)\n\n return credentialExchangeRecord\n }\n\n /**\n * Create a {@link DidCommCredentialV1ProblemReportMessage} to be sent.\n *\n * @param message message to send\n * @returns a {@link DidCommCredentialV1ProblemReportMessage}\n *\n */\n public async createProblemReport(\n _agentContext: AgentContext,\n { credentialExchangeRecord, description }: CredentialProtocolOptions.CreateCredentialProblemReportOptions\n ): Promise<CredentialProtocolOptions.CredentialProtocolMsgReturnType<DidCommProblemReportMessage>> {\n const message = new DidCommCredentialV1ProblemReportMessage({\n description: {\n en: description,\n code: DidCommCredentialProblemReportReason.IssuanceAbandoned,\n },\n })\n\n return { message, credentialExchangeRecord }\n }\n\n // AUTO RESPOND METHODS\n public async shouldAutoRespondToProposal(\n agentContext: AgentContext,\n options: {\n credentialExchangeRecord: DidCommCredentialExchangeRecord\n proposalMessage: DidCommProposeCredentialV1Message\n }\n ) {\n const { credentialExchangeRecord, proposalMessage } = options\n\n const credentialsModuleConfig = agentContext.dependencyManager.resolve(DidCommCredentialsModuleConfig)\n\n const autoAccept = composeCredentialAutoAccept(\n credentialExchangeRecord.autoAcceptCredential,\n credentialsModuleConfig.autoAcceptCredentials\n )\n\n // Handle always / never cases\n if (autoAccept === DidCommAutoAcceptCredential.Always) return true\n if (autoAccept === DidCommAutoAcceptCredential.Never) return false\n\n const offerMessage = await this.findOfferMessage(agentContext, credentialExchangeRecord.id)\n\n // Do not auto accept if missing properties\n if (!offerMessage || !offerMessage.credentialPreview) return false\n if (!proposalMessage.credentialPreview || !proposalMessage.credentialDefinitionId) return false\n\n const credentialOfferJson = offerMessage.indyCredentialOffer\n\n // Check if credential definition id matches\n if (!credentialOfferJson) return false\n if (credentialOfferJson.cred_def_id !== proposalMessage.credentialDefinitionId) return false\n\n // Check if preview values match\n return areCredentialPreviewAttributesEqual(\n proposalMessage.credentialPreview.attributes,\n offerMessage.credentialPreview.attributes\n )\n }\n\n public async shouldAutoRespondToOffer(\n agentContext: AgentContext,\n options: {\n credentialExchangeRecord: DidCommCredentialExchangeRecord\n offerMessage: V1OfferCredentialMessage\n }\n ) {\n const { credentialExchangeRecord, offerMessage } = options\n\n const credentialsModuleConfig = agentContext.dependencyManager.resolve(DidCommCredentialsModuleConfig)\n\n const autoAccept = composeCredentialAutoAccept(\n credentialExchangeRecord.autoAcceptCredential,\n credentialsModuleConfig.autoAcceptCredentials\n )\n\n // Handle always / never cases\n if (autoAccept === DidCommAutoAcceptCredential.Always) return true\n if (autoAccept === DidCommAutoAcceptCredential.Never) return false\n\n const proposalMessage = await this.findProposalMessage(agentContext, credentialExchangeRecord.id)\n\n // Do not auto accept if missing properties\n if (!offerMessage.credentialPreview) return false\n if (!proposalMessage || !proposalMessage.credentialPreview || !proposalMessage.credentialDefinitionId) return false\n\n const credentialOfferJson = offerMessage.indyCredentialOffer\n\n // Check if credential definition id matches\n if (!credentialOfferJson) return false\n if (credentialOfferJson.cred_def_id !== proposalMessage.credentialDefinitionId) return false\n\n // Check if preview values match\n return areCredentialPreviewAttributesEqual(\n proposalMessage.credentialPreview.attributes,\n offerMessage.credentialPreview.attributes\n )\n }\n\n public async shouldAutoRespondToRequest(\n agentContext: AgentContext,\n options: {\n credentialExchangeRecord: DidCommCredentialExchangeRecord\n requestMessage: DidCommRequestCredentialV1Message\n }\n ) {\n const { credentialExchangeRecord, requestMessage } = options\n\n const credentialsModuleConfig = agentContext.dependencyManager.resolve(DidCommCredentialsModuleConfig)\n\n const autoAccept = composeCredentialAutoAccept(\n credentialExchangeRecord.autoAcceptCredential,\n credentialsModuleConfig.autoAcceptCredentials\n )\n\n // Handle always / never cases\n if (autoAccept === DidCommAutoAcceptCredential.Always) return true\n if (autoAccept === DidCommAutoAcceptCredential.Never) return false\n\n const offerMessage = await this.findOfferMessage(agentContext, credentialExchangeRecord.id)\n if (!offerMessage) return false\n\n const offerAttachment = offerMessage.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n const requestAttachment = requestMessage.getRequestAttachmentById(INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID)\n\n if (!offerAttachment || !requestAttachment) return false\n\n return this.indyCredentialFormat.shouldAutoRespondToRequest(agentContext, {\n credentialExchangeRecord,\n offerAttachment,\n requestAttachment,\n })\n }\n\n public async shouldAutoRespondToCredential(\n agentContext: AgentContext,\n options: {\n credentialExchangeRecord: DidCommCredentialExchangeRecord\n credentialMessage: DidCommIssueCredentialV1Message\n }\n ) {\n const { credentialExchangeRecord, credentialMessage } = options\n\n const credentialsModuleConfig = agentContext.dependencyManager.resolve(DidCommCredentialsModuleConfig)\n\n const autoAccept = composeCredentialAutoAccept(\n credentialExchangeRecord.autoAcceptCredential,\n credentialsModuleConfig.autoAcceptCredentials\n )\n\n // Handle always / never cases\n if (autoAccept === DidCommAutoAcceptCredential.Always) return true\n if (autoAccept === DidCommAutoAcceptCredential.Never) return false\n\n const requestMessage = await this.findRequestMessage(agentContext, credentialExchangeRecord.id)\n const offerMessage = await this.findOfferMessage(agentContext, credentialExchangeRecord.id)\n\n const credentialAttachment = credentialMessage.getCredentialAttachmentById(INDY_CREDENTIAL_ATTACHMENT_ID)\n if (!credentialAttachment) return false\n\n const requestAttachment = requestMessage?.getRequestAttachmentById(INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID)\n if (!requestAttachment) return false\n\n const offerAttachment = offerMessage?.getOfferAttachmentById(INDY_CREDENTIAL_OFFER_ATTACHMENT_ID)\n\n return this.indyCredentialFormat.shouldAutoRespondToCredential(agentContext, {\n credentialExchangeRecord,\n credentialAttachment,\n requestAttachment,\n offerAttachment,\n })\n }\n\n public async findProposalMessage(agentContext: AgentContext, credentialExchangeId: string) {\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n return await didCommMessageRepository.findAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeId,\n messageClass: DidCommProposeCredentialV1Message,\n })\n }\n\n public async findOfferMessage(agentContext: AgentContext, credentialExchangeId: string) {\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n return await didCommMessageRepository.findAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeId,\n messageClass: V1OfferCredentialMessage,\n })\n }\n\n public async findRequestMessage(agentContext: AgentContext, credentialExchangeId: string) {\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n return await didCommMessageRepository.findAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeId,\n messageClass: DidCommRequestCredentialV1Message,\n })\n }\n\n public async findCredentialMessage(agentContext: AgentContext, credentialExchangeId: string) {\n const didCommMessageRepository = agentContext.dependencyManager.resolve(DidCommMessageRepository)\n\n return await didCommMessageRepository.findAgentMessage(agentContext, {\n associatedRecordId: credentialExchangeId,\n messageClass: DidCommIssueCredentialV1Message,\n })\n }\n\n public async getFormatData(\n agentContext: AgentContext,\n credentialExchangeId: string\n ): Promise<\n CredentialProtocolOptions.GetCredentialFormatDataReturn<\n ExtractCredentialFormats<[LegacyIndyDidCommCredentialFormatService]>\n >\n > {\n // TODO: we could looking at fetching all record using a single query and then filtering based on the type of the message.\n const [proposalMessage, offerMessage, requestMessage, credentialMessage] = await Promise.all([\n this.findProposalMessage(agentContext, credentialExchangeId),\n this.findOfferMessage(agentContext, credentialExchangeId),\n this.findRequestMessage(agentContext, credentialExchangeId),\n this.findCredentialMessage(agentContext, credentialExchangeId),\n ])\n\n const indyProposal = proposalMessage\n ? JsonTransformer.toJSON(this.rfc0592ProposalFromV1ProposeMessage(proposalMessage))\n : undefined\n\n const indyOffer = offerMessage?.indyCredentialOffer ?? undefined\n const indyRequest = requestMessage?.indyCredentialRequest ?? undefined\n const indyCredential = credentialMessage?.indyCredential ?? undefined\n\n return {\n proposalAttributes: proposalMessage?.credentialPreview?.attributes,\n proposal: proposalMessage\n ? {\n indy: indyProposal,\n }\n : undefined,\n offerAttributes: offerMessage?.credentialPreview?.attributes,\n offer: offerMessage\n ? {\n indy: indyOffer,\n }\n : undefined,\n request: requestMessage\n ? {\n indy: indyRequest,\n }\n : undefined,\n credential: credentialMessage\n ? {\n indy: indyCredential,\n }\n : undefined,\n }\n }\n\n private rfc0592ProposalFromV1ProposeMessage(proposalMessage: DidCommProposeCredentialV1Message) {\n const indyCredentialProposal = new AnonCredsCredentialProposal({\n credentialDefinitionId: proposalMessage.credentialDefinitionId,\n schemaId: proposalMessage.schemaId,\n issuerDid: proposalMessage.issuerDid,\n schemaIssuerDid: proposalMessage.schemaIssuerDid,\n schemaName: proposalMessage.schemaName,\n schemaVersion: proposalMessage.schemaVersion,\n })\n\n return indyCredentialProposal\n }\n\n private assertOnlyIndyFormat(credentialFormats: Record<string, unknown>) {\n const formatKeys = Object.keys(credentialFormats)\n\n // It's fine to not have any formats in some cases, if indy is required the method that calls this should check for this\n if (formatKeys.length === 0) return\n\n if (formatKeys.length !== 1 || !formatKeys.includes('indy')) {\n throw new CredoError('Only indy credential format is supported for issue credential v1 protocol')\n }\n }\n\n public getFormatServiceForRecordType(credentialRecordType: string) {\n if (credentialRecordType !== this.indyCredentialFormat.credentialRecordType) {\n throw new CredoError(\n `Unsupported credential record type ${credentialRecordType} for v1 issue credential protocol (need ${this.indyCredentialFormat.credentialRecordType})`\n )\n }\n\n return this.indyCredentialFormat\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4DA,IAAa,8BAAb,cACU,8BAEV;CAGE,AAAO,YAAY,EAAE,wBAA2D;AAC9E,SAAO;OASO,UAAU;AANxB,OAAK,uBAAuB;;;;;CAW9B,AAAO,SAAS,wBAAuD,iBAAyC;AAE9G,yBAAuB,wBAAwB;GAC7C,IAAI,kCAAkC,KAAK;GAC3C,IAAI,gCAAgC,KAAK;GACzC,IAAI,kCAAkC,KAAK;GAC3C,IAAI,gCAAgC,KAAK;GACzC,IAAI,8BAA8B,KAAK;GACvC,IAAI,wCAAwC,KAAK;GAClD,CAAC;AAGF,kBAAgB,SACd,IAAI,gBAAgB;GAClB,IAAI;GACJ,OAAO,CAAC,UAAU,SAAS;GAC5B,CAAC,CACH;;;;;;;;;;CAWH,MAAa,eACX,cACA,EACE,kBACA,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,aACP,GACD;GACJ,YAAY,oBACR,EACE,MAAM,gBACP,GACD;GACL;;CAGH,AAAQ,oCAAoC,iBAAoD;AAU9F,SAT+B,IAAI,4BAA4B;GAC7D,wBAAwB,gBAAgB;GACxC,UAAU,gBAAgB;GAC1B,WAAW,gBAAgB;GAC3B,iBAAiB,gBAAgB;GACjC,YAAY,gBAAgB;GAC5B,eAAe,gBAAgB;GAChC,CAAC;;CAKJ,AAAQ,qBAAqB,mBAA4C;EACvE,MAAM,aAAa,OAAO,KAAK,kBAAkB;AAGjD,MAAI,WAAW,WAAW,EAAG;AAE7B,MAAI,WAAW,WAAW,KAAK,CAAC,WAAW,SAAS,OAAO,CACzD,OAAM,IAAI,WAAW,4EAA4E;;CAIrG,AAAO,8BAA8B,sBAA8B;AACjE,MAAI,yBAAyB,KAAK,qBAAqB,qBACrD,OAAM,IAAI,WACR,sCAAsC,qBAAqB,0CAA0C,KAAK,qBAAqB,qBAAqB,GACrJ;AAGH,SAAO,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidCommIssueCredentialV1Handler.mjs","names":[],"sources":["../../../../../src/protocols/credentials/v1/handlers/DidCommIssueCredentialV1Handler.ts"],"sourcesContent":["import type {\n DidCommCredentialExchangeRecord,\n DidCommMessageHandler,\n DidCommMessageHandlerInboundMessage,\n} from '@credo-ts/didcomm'\nimport
|
|
1
|
+
{"version":3,"file":"DidCommIssueCredentialV1Handler.mjs","names":[],"sources":["../../../../../src/protocols/credentials/v1/handlers/DidCommIssueCredentialV1Handler.ts"],"sourcesContent":["import { CredoError } from '@credo-ts/core'\nimport type {\n DidCommCredentialExchangeRecord,\n DidCommMessageHandler,\n DidCommMessageHandlerInboundMessage,\n} from '@credo-ts/didcomm'\nimport { getOutboundDidCommMessageContext } from '@credo-ts/didcomm'\nimport type { DidCommCredentialV1Protocol } from '../DidCommCredentialV1Protocol'\n\nimport { DidCommIssueCredentialV1Message } from '../messages'\n\nexport class DidCommIssueCredentialV1Handler implements DidCommMessageHandler {\n private credentialProtocol: DidCommCredentialV1Protocol\n\n public supportedMessages = [DidCommIssueCredentialV1Message]\n\n public constructor(credentialProtocol: DidCommCredentialV1Protocol) {\n this.credentialProtocol = credentialProtocol\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<DidCommIssueCredentialV1Handler>) {\n const credentialExchangeRecord = await this.credentialProtocol.processCredential(messageContext)\n\n const shouldAutoRespond = await this.credentialProtocol.shouldAutoRespondToCredential(messageContext.agentContext, {\n credentialExchangeRecord,\n credentialMessage: messageContext.message,\n })\n\n if (shouldAutoRespond) {\n return await this.acceptCredential(credentialExchangeRecord, messageContext)\n }\n }\n\n private async acceptCredential(\n credentialExchangeRecord: DidCommCredentialExchangeRecord,\n messageContext: DidCommMessageHandlerInboundMessage<DidCommIssueCredentialV1Handler>\n ) {\n messageContext.agentContext.config.logger.info('Automatically sending acknowledgement with autoAccept')\n const { message } = await this.credentialProtocol.acceptCredential(messageContext.agentContext, {\n credentialExchangeRecord,\n })\n\n const requestMessage = await this.credentialProtocol.findRequestMessage(\n messageContext.agentContext,\n credentialExchangeRecord.id\n )\n if (!requestMessage) {\n throw new CredoError(`No request message found for credential record with id '${credentialExchangeRecord.id}'`)\n }\n\n return getOutboundDidCommMessageContext(messageContext.agentContext, {\n connectionRecord: messageContext.connection,\n message,\n associatedRecord: credentialExchangeRecord,\n lastReceivedMessage: messageContext.message,\n lastSentMessage: requestMessage,\n })\n }\n}\n"],"mappings":";;;;;;AAWA,IAAa,kCAAb,MAA8E;CAK5E,AAAO,YAAY,oBAAiD;OAF7D,oBAAoB,CAAC,gCAAgC;AAG1D,OAAK,qBAAqB;;CAG5B,MAAa,OAAO,gBAAsF;EACxG,MAAM,2BAA2B,MAAM,KAAK,mBAAmB,kBAAkB,eAAe;AAOhG,MAL0B,MAAM,KAAK,mBAAmB,8BAA8B,eAAe,cAAc;GACjH;GACA,mBAAmB,eAAe;GACnC,CAAC,CAGA,QAAO,MAAM,KAAK,iBAAiB,0BAA0B,eAAe;;CAIhF,MAAc,iBACZ,0BACA,gBACA;AACA,iBAAe,aAAa,OAAO,OAAO,KAAK,wDAAwD;EACvG,MAAM,EAAE,YAAY,MAAM,KAAK,mBAAmB,iBAAiB,eAAe,cAAc,EAC9F,0BACD,CAAC;EAEF,MAAM,iBAAiB,MAAM,KAAK,mBAAmB,mBACnD,eAAe,cACf,yBAAyB,GAC1B;AACD,MAAI,CAAC,eACH,OAAM,IAAI,WAAW,2DAA2D,yBAAyB,GAAG,GAAG;AAGjH,SAAO,iCAAiC,eAAe,cAAc;GACnE,kBAAkB,eAAe;GACjC;GACA,kBAAkB;GAClB,qBAAqB,eAAe;GACpC,iBAAiB;GAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidCommOfferCredentialV1Handler.mjs","names":["DidCommOfferCredentialV1Message"],"sources":["../../../../../src/protocols/credentials/v1/handlers/DidCommOfferCredentialV1Handler.ts"],"sourcesContent":["import type {\n DidCommCredentialExchangeRecord,\n DidCommMessageHandler,\n DidCommMessageHandlerInboundMessage,\n} from '@credo-ts/didcomm'\nimport
|
|
1
|
+
{"version":3,"file":"DidCommOfferCredentialV1Handler.mjs","names":["DidCommOfferCredentialV1Message"],"sources":["../../../../../src/protocols/credentials/v1/handlers/DidCommOfferCredentialV1Handler.ts"],"sourcesContent":["import type {\n DidCommCredentialExchangeRecord,\n DidCommMessageHandler,\n DidCommMessageHandlerInboundMessage,\n} from '@credo-ts/didcomm'\nimport { getOutboundDidCommMessageContext } from '@credo-ts/didcomm'\nimport type { DidCommCredentialV1Protocol } from '../DidCommCredentialV1Protocol'\n\nimport { V1OfferCredentialMessage as DidCommOfferCredentialV1Message } from '../messages'\n\nexport class DidCommOfferCredentialV1Handler implements DidCommMessageHandler {\n private credentialProtocol: DidCommCredentialV1Protocol\n public supportedMessages = [DidCommOfferCredentialV1Message]\n\n public constructor(credentialProtocol: DidCommCredentialV1Protocol) {\n this.credentialProtocol = credentialProtocol\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<DidCommOfferCredentialV1Handler>) {\n const credentialExchangeRecord = await this.credentialProtocol.processOffer(messageContext)\n\n const shouldAutoRespond = await this.credentialProtocol.shouldAutoRespondToOffer(messageContext.agentContext, {\n credentialExchangeRecord,\n offerMessage: messageContext.message,\n })\n\n if (shouldAutoRespond) {\n return await this.acceptOffer(credentialExchangeRecord, messageContext)\n }\n }\n\n private async acceptOffer(\n credentialExchangeRecord: DidCommCredentialExchangeRecord,\n messageContext: DidCommMessageHandlerInboundMessage<DidCommOfferCredentialV1Handler>\n ) {\n messageContext.agentContext.config.logger.info('Automatically sending request with autoAccept')\n const { message } = await this.credentialProtocol.acceptOffer(messageContext.agentContext, {\n credentialExchangeRecord,\n })\n\n return getOutboundDidCommMessageContext(messageContext.agentContext, {\n connectionRecord: messageContext.connection,\n message,\n associatedRecord: credentialExchangeRecord,\n lastReceivedMessage: messageContext.message,\n })\n }\n}\n"],"mappings":";;;;;AAUA,IAAa,kCAAb,MAA8E;CAI5E,AAAO,YAAY,oBAAiD;OAF7D,oBAAoB,CAACA,yBAAgC;AAG1D,OAAK,qBAAqB;;CAG5B,MAAa,OAAO,gBAAsF;EACxG,MAAM,2BAA2B,MAAM,KAAK,mBAAmB,aAAa,eAAe;AAO3F,MAL0B,MAAM,KAAK,mBAAmB,yBAAyB,eAAe,cAAc;GAC5G;GACA,cAAc,eAAe;GAC9B,CAAC,CAGA,QAAO,MAAM,KAAK,YAAY,0BAA0B,eAAe;;CAI3E,MAAc,YACZ,0BACA,gBACA;AACA,iBAAe,aAAa,OAAO,OAAO,KAAK,gDAAgD;EAC/F,MAAM,EAAE,YAAY,MAAM,KAAK,mBAAmB,YAAY,eAAe,cAAc,EACzF,0BACD,CAAC;AAEF,SAAO,iCAAiC,eAAe,cAAc;GACnE,kBAAkB,eAAe;GACjC;GACA,kBAAkB;GAClB,qBAAqB,eAAe;GACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidCommProposeCredentialV1Handler.mjs","names":[],"sources":["../../../../../src/protocols/credentials/v1/handlers/DidCommProposeCredentialV1Handler.ts"],"sourcesContent":["import type {\n DidCommCredentialExchangeRecord,\n DidCommMessageHandler,\n DidCommMessageHandlerInboundMessage,\n} from '@credo-ts/didcomm'\nimport
|
|
1
|
+
{"version":3,"file":"DidCommProposeCredentialV1Handler.mjs","names":[],"sources":["../../../../../src/protocols/credentials/v1/handlers/DidCommProposeCredentialV1Handler.ts"],"sourcesContent":["import type {\n DidCommCredentialExchangeRecord,\n DidCommMessageHandler,\n DidCommMessageHandlerInboundMessage,\n} from '@credo-ts/didcomm'\nimport { getOutboundDidCommMessageContext } from '@credo-ts/didcomm'\nimport type { DidCommCredentialV1Protocol } from '../DidCommCredentialV1Protocol'\n\nimport { DidCommProposeCredentialV1Message } from '../messages'\n\nexport class DidCommProposeCredentialV1Handler implements DidCommMessageHandler {\n private credentialProtocol: DidCommCredentialV1Protocol\n public supportedMessages = [DidCommProposeCredentialV1Message]\n\n public constructor(credentialProtocol: DidCommCredentialV1Protocol) {\n this.credentialProtocol = credentialProtocol\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<DidCommProposeCredentialV1Handler>) {\n const credentialExchangeRecord = await this.credentialProtocol.processProposal(messageContext)\n\n const shouldAutoAcceptProposal = await this.credentialProtocol.shouldAutoRespondToProposal(\n messageContext.agentContext,\n {\n credentialExchangeRecord,\n proposalMessage: messageContext.message,\n }\n )\n\n if (shouldAutoAcceptProposal) {\n return await this.acceptProposal(credentialExchangeRecord, messageContext)\n }\n }\n\n private async acceptProposal(\n credentialExchangeRecord: DidCommCredentialExchangeRecord,\n messageContext: DidCommMessageHandlerInboundMessage<DidCommProposeCredentialV1Handler>\n ) {\n messageContext.agentContext.config.logger.info('Automatically sending offer with autoAccept')\n\n if (!messageContext.connection) {\n messageContext.agentContext.config.logger.error('No connection on the messageContext, aborting auto accept')\n return\n }\n\n const { message } = await this.credentialProtocol.acceptProposal(messageContext.agentContext, {\n credentialExchangeRecord,\n })\n\n return getOutboundDidCommMessageContext(messageContext.agentContext, {\n message,\n connectionRecord: messageContext.connection,\n associatedRecord: credentialExchangeRecord,\n })\n }\n}\n"],"mappings":";;;;;AAUA,IAAa,oCAAb,MAAgF;CAI9E,AAAO,YAAY,oBAAiD;OAF7D,oBAAoB,CAAC,kCAAkC;AAG5D,OAAK,qBAAqB;;CAG5B,MAAa,OAAO,gBAAwF;EAC1G,MAAM,2BAA2B,MAAM,KAAK,mBAAmB,gBAAgB,eAAe;AAU9F,MARiC,MAAM,KAAK,mBAAmB,4BAC7D,eAAe,cACf;GACE;GACA,iBAAiB,eAAe;GACjC,CACF,CAGC,QAAO,MAAM,KAAK,eAAe,0BAA0B,eAAe;;CAI9E,MAAc,eACZ,0BACA,gBACA;AACA,iBAAe,aAAa,OAAO,OAAO,KAAK,8CAA8C;AAE7F,MAAI,CAAC,eAAe,YAAY;AAC9B,kBAAe,aAAa,OAAO,OAAO,MAAM,4DAA4D;AAC5G;;EAGF,MAAM,EAAE,YAAY,MAAM,KAAK,mBAAmB,eAAe,eAAe,cAAc,EAC5F,0BACD,CAAC;AAEF,SAAO,iCAAiC,eAAe,cAAc;GACnE;GACA,kBAAkB,eAAe;GACjC,kBAAkB;GACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidCommRequestCredentialV1Handler.mjs","names":[],"sources":["../../../../../src/protocols/credentials/v1/handlers/DidCommRequestCredentialV1Handler.ts"],"sourcesContent":["import type {\n DidCommCredentialExchangeRecord,\n DidCommMessageHandler,\n DidCommMessageHandlerInboundMessage,\n} from '@credo-ts/didcomm'\nimport
|
|
1
|
+
{"version":3,"file":"DidCommRequestCredentialV1Handler.mjs","names":[],"sources":["../../../../../src/protocols/credentials/v1/handlers/DidCommRequestCredentialV1Handler.ts"],"sourcesContent":["import { CredoError } from '@credo-ts/core'\nimport type {\n DidCommCredentialExchangeRecord,\n DidCommMessageHandler,\n DidCommMessageHandlerInboundMessage,\n} from '@credo-ts/didcomm'\nimport { getOutboundDidCommMessageContext } from '@credo-ts/didcomm'\nimport type { DidCommCredentialV1Protocol } from '../DidCommCredentialV1Protocol'\n\nimport { DidCommRequestCredentialV1Message } from '../messages'\n\nexport class DidCommRequestCredentialV1Handler implements DidCommMessageHandler {\n private credentialProtocol: DidCommCredentialV1Protocol\n public supportedMessages = [DidCommRequestCredentialV1Message]\n\n public constructor(credentialProtocol: DidCommCredentialV1Protocol) {\n this.credentialProtocol = credentialProtocol\n }\n\n public async handle(messageContext: DidCommMessageHandlerInboundMessage<DidCommRequestCredentialV1Handler>) {\n const credentialExchangeRecord = await this.credentialProtocol.processRequest(messageContext)\n\n const shouldAutoRespond = await this.credentialProtocol.shouldAutoRespondToRequest(messageContext.agentContext, {\n credentialExchangeRecord,\n requestMessage: messageContext.message,\n })\n\n if (shouldAutoRespond) {\n return await this.acceptRequest(credentialExchangeRecord, messageContext)\n }\n }\n\n private async acceptRequest(\n credentialExchangeRecord: DidCommCredentialExchangeRecord,\n messageContext: DidCommMessageHandlerInboundMessage<DidCommRequestCredentialV1Handler>\n ) {\n messageContext.agentContext.config.logger.info('Automatically sending credential with autoAccept')\n\n const offerMessage = await this.credentialProtocol.findOfferMessage(\n messageContext.agentContext,\n credentialExchangeRecord.id\n )\n if (!offerMessage) {\n throw new CredoError(`Could not find offer message for credential record with id ${credentialExchangeRecord.id}`)\n }\n\n const { message } = await this.credentialProtocol.acceptRequest(messageContext.agentContext, {\n credentialExchangeRecord,\n })\n\n return getOutboundDidCommMessageContext(messageContext.agentContext, {\n connectionRecord: messageContext.connection,\n message,\n associatedRecord: credentialExchangeRecord,\n lastReceivedMessage: messageContext.message,\n lastSentMessage: offerMessage,\n })\n }\n}\n"],"mappings":";;;;;;AAWA,IAAa,oCAAb,MAAgF;CAI9E,AAAO,YAAY,oBAAiD;OAF7D,oBAAoB,CAAC,kCAAkC;AAG5D,OAAK,qBAAqB;;CAG5B,MAAa,OAAO,gBAAwF;EAC1G,MAAM,2BAA2B,MAAM,KAAK,mBAAmB,eAAe,eAAe;AAO7F,MAL0B,MAAM,KAAK,mBAAmB,2BAA2B,eAAe,cAAc;GAC9G;GACA,gBAAgB,eAAe;GAChC,CAAC,CAGA,QAAO,MAAM,KAAK,cAAc,0BAA0B,eAAe;;CAI7E,MAAc,cACZ,0BACA,gBACA;AACA,iBAAe,aAAa,OAAO,OAAO,KAAK,mDAAmD;EAElG,MAAM,eAAe,MAAM,KAAK,mBAAmB,iBACjD,eAAe,cACf,yBAAyB,GAC1B;AACD,MAAI,CAAC,aACH,OAAM,IAAI,WAAW,8DAA8D,yBAAyB,KAAK;EAGnH,MAAM,EAAE,YAAY,MAAM,KAAK,mBAAmB,cAAc,eAAe,cAAc,EAC3F,0BACD,CAAC;AAEF,SAAO,iCAAiC,eAAe,cAAc;GACnE,kBAAkB,eAAe;GACjC;GACA,kBAAkB;GAClB,qBAAqB,eAAe;GACpC,iBAAiB;GAClB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_DidCommCredentialV1AckHandler = require('./DidCommCredentialV1AckHandler.js');
|
|
2
|
+
const require_DidCommCredentialV1ProblemReportHandler = require('./DidCommCredentialV1ProblemReportHandler.js');
|
|
2
3
|
const require_DidCommIssueCredentialV1Handler = require('./DidCommIssueCredentialV1Handler.js');
|
|
3
4
|
const require_DidCommOfferCredentialV1Handler = require('./DidCommOfferCredentialV1Handler.js');
|
|
4
5
|
const require_DidCommProposeCredentialV1Handler = require('./DidCommProposeCredentialV1Handler.js');
|
|
5
6
|
const require_DidCommRequestCredentialV1Handler = require('./DidCommRequestCredentialV1Handler.js');
|
|
6
|
-
const require_DidCommCredentialV1ProblemReportHandler = require('./DidCommCredentialV1ProblemReportHandler.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DidCommCredentialV1AckHandler } from "./DidCommCredentialV1AckHandler.mjs";
|
|
2
|
+
import { DidCommCredentialV1ProblemReportHandler } from "./DidCommCredentialV1ProblemReportHandler.mjs";
|
|
2
3
|
import { DidCommIssueCredentialV1Handler } from "./DidCommIssueCredentialV1Handler.mjs";
|
|
3
4
|
import { DidCommOfferCredentialV1Handler } from "./DidCommOfferCredentialV1Handler.mjs";
|
|
4
5
|
import { DidCommProposeCredentialV1Handler } from "./DidCommProposeCredentialV1Handler.mjs";
|
|
5
6
|
import { DidCommRequestCredentialV1Handler } from "./DidCommRequestCredentialV1Handler.mjs";
|
|
6
|
-
import { DidCommCredentialV1ProblemReportHandler } from "./DidCommCredentialV1ProblemReportHandler.mjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_DidCommCredentialV1AckMessage = require('./messages/DidCommCredentialV1AckMessage.js');
|
|
2
2
|
const require_DidCommCredentialV1Preview = require('./messages/DidCommCredentialV1Preview.js');
|
|
3
|
-
const
|
|
3
|
+
const require_DidCommCredentialV1ProblemReportMessage = require('./messages/DidCommCredentialV1ProblemReportMessage.js');
|
|
4
4
|
const require_DidCommIssueCredentialV1Message = require('./messages/DidCommIssueCredentialV1Message.js');
|
|
5
5
|
const require_DidCommOfferCredentialV1Message = require('./messages/DidCommOfferCredentialV1Message.js');
|
|
6
6
|
const require_DidCommProposeCredentialV1Message = require('./messages/DidCommProposeCredentialV1Message.js');
|
|
7
|
-
const
|
|
7
|
+
const require_DidCommRequestCredentialV1Message = require('./messages/DidCommRequestCredentialV1Message.js');
|
|
8
8
|
require('./messages/index.js');
|
|
9
9
|
const require_DidCommCredentialV1Protocol = require('./DidCommCredentialV1Protocol.js');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DidCommCredentialV1AckMessage } from "./messages/DidCommCredentialV1AckMessage.mjs";
|
|
2
2
|
import { DidCommCredentialV1Preview } from "./messages/DidCommCredentialV1Preview.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { DidCommCredentialV1ProblemReportMessage } from "./messages/DidCommCredentialV1ProblemReportMessage.mjs";
|
|
4
4
|
import { DidCommIssueCredentialV1Message, INDY_CREDENTIAL_ATTACHMENT_ID } from "./messages/DidCommIssueCredentialV1Message.mjs";
|
|
5
5
|
import { INDY_CREDENTIAL_OFFER_ATTACHMENT_ID, V1OfferCredentialMessage } from "./messages/DidCommOfferCredentialV1Message.mjs";
|
|
6
6
|
import { DidCommProposeCredentialV1Message } from "./messages/DidCommProposeCredentialV1Message.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { DidCommRequestCredentialV1Message, INDY_CREDENTIAL_REQUEST_ATTACHMENT_ID } from "./messages/DidCommRequestCredentialV1Message.mjs";
|
|
8
8
|
import "./messages/index.mjs";
|
|
9
9
|
import { DidCommCredentialV1Protocol } from "./DidCommCredentialV1Protocol.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm1 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommAckMessage, DidCommAckMessageOptions } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.ts
|
|
@@ -9,7 +9,7 @@ type V1CredentialAckMessageOptions = DidCommAckMessageOptions;
|
|
|
9
9
|
declare class DidCommCredentialV1AckMessage extends DidCommAckMessage {
|
|
10
10
|
readonly allowDidSovPrefix = true;
|
|
11
11
|
readonly type: string;
|
|
12
|
-
static readonly type:
|
|
12
|
+
static readonly type: _credo_ts_didcomm1.ParsedMessageType;
|
|
13
13
|
}
|
|
14
14
|
//#endregion
|
|
15
15
|
export { DidCommCredentialV1AckMessage, V1CredentialAckMessageOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm1 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommAckMessage, DidCommAckMessageOptions } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.ts
|
|
@@ -9,7 +9,7 @@ type V1CredentialAckMessageOptions = DidCommAckMessageOptions;
|
|
|
9
9
|
declare class DidCommCredentialV1AckMessage extends DidCommAckMessage {
|
|
10
10
|
readonly allowDidSovPrefix = true;
|
|
11
11
|
readonly type: string;
|
|
12
|
-
static readonly type:
|
|
12
|
+
static readonly type: _credo_ts_didcomm1.ParsedMessageType;
|
|
13
13
|
}
|
|
14
14
|
//#endregion
|
|
15
15
|
export { DidCommCredentialV1AckMessage, V1CredentialAckMessageOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm2 from "@credo-ts/didcomm";
|
|
2
2
|
import { CredentialPreviewOptions, DidCommCredentialPreviewAttribute } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.ts
|
|
@@ -12,8 +12,8 @@ import { CredentialPreviewOptions, DidCommCredentialPreviewAttribute } from "@cr
|
|
|
12
12
|
*/
|
|
13
13
|
declare class DidCommCredentialV1Preview {
|
|
14
14
|
constructor(options: CredentialPreviewOptions);
|
|
15
|
+
static readonly type: _credo_ts_didcomm2.ParsedMessageType;
|
|
15
16
|
readonly type: string;
|
|
16
|
-
static readonly type: _credo_ts_didcomm7.ParsedMessageType;
|
|
17
17
|
attributes: DidCommCredentialPreviewAttribute[];
|
|
18
18
|
toJSON(): Record<string, unknown>;
|
|
19
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidCommCredentialV1Preview.d.mts","names":[],"sources":["../../../../../src/protocols/credentials/v1/messages/DidCommCredentialV1Preview.ts"],"sourcesContent":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"DidCommCredentialV1Preview.d.mts","names":[],"sources":["../../../../../src/protocols/credentials/v1/messages/DidCommCredentialV1Preview.ts"],"sourcesContent":[],"mappings":";;;;;;;AAkBA;;;;;AAqBmB,cArBN,0BAAA,CAqBM;aAagB,CAAA,OAAA,EAjCL,wBAiCK;kBAAsB,IAAA,EAjCH,kBAAA,CAMzB,iBA2B4B;EAAA,SAAA,IAAA,EAAA,MAAA;cAfnC;YAEH;;;;;;;;;;4BAagB,yBAAsB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm2 from "@credo-ts/didcomm";
|
|
2
2
|
import { CredentialPreviewOptions, DidCommCredentialPreviewAttribute } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.ts
|
|
@@ -12,8 +12,8 @@ import { CredentialPreviewOptions, DidCommCredentialPreviewAttribute } from "@cr
|
|
|
12
12
|
*/
|
|
13
13
|
declare class DidCommCredentialV1Preview {
|
|
14
14
|
constructor(options: CredentialPreviewOptions);
|
|
15
|
+
static readonly type: _credo_ts_didcomm2.ParsedMessageType;
|
|
15
16
|
readonly type: string;
|
|
16
|
-
static readonly type: _credo_ts_didcomm1.ParsedMessageType;
|
|
17
17
|
attributes: DidCommCredentialPreviewAttribute[];
|
|
18
18
|
toJSON(): Record<string, unknown>;
|
|
19
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidCommCredentialV1Preview.d.ts","names":[],"sources":["../../../../../src/protocols/credentials/v1/messages/DidCommCredentialV1Preview.ts"],"sourcesContent":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"DidCommCredentialV1Preview.d.ts","names":[],"sources":["../../../../../src/protocols/credentials/v1/messages/DidCommCredentialV1Preview.ts"],"sourcesContent":[],"mappings":";;;;;;;AAkBA;;;;;AAqBmB,cArBN,0BAAA,CAqBM;aAagB,CAAA,OAAA,EAjCL,wBAiCK;kBAAsB,IAAA,EAjCH,kBAAA,CAMzB,iBA2B4B;EAAA,SAAA,IAAA,EAAA,MAAA;cAfnC;YAEH;;;;;;;;;;4BAagB,yBAAsB"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
|
|
2
2
|
const require_decorateMetadata = require('../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateMetadata.js');
|
|
3
3
|
const require_decorate = require('../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js');
|
|
4
|
-
let class_transformer = require("class-transformer");
|
|
5
|
-
class_transformer = require_rolldown_runtime.__toESM(class_transformer);
|
|
6
|
-
let class_validator = require("class-validator");
|
|
7
|
-
class_validator = require_rolldown_runtime.__toESM(class_validator);
|
|
8
4
|
let __credo_ts_core = require("@credo-ts/core");
|
|
9
5
|
__credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);
|
|
10
6
|
let __credo_ts_didcomm = require("@credo-ts/didcomm");
|
|
11
7
|
__credo_ts_didcomm = require_rolldown_runtime.__toESM(__credo_ts_didcomm);
|
|
8
|
+
let class_validator = require("class-validator");
|
|
9
|
+
class_validator = require_rolldown_runtime.__toESM(class_validator);
|
|
10
|
+
let class_transformer = require("class-transformer");
|
|
11
|
+
class_transformer = require_rolldown_runtime.__toESM(class_transformer);
|
|
12
12
|
|
|
13
13
|
//#region src/protocols/credentials/v1/messages/DidCommCredentialV1Preview.ts
|
|
14
14
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __decorateMetadata } from "../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateMetadata.mjs";
|
|
2
2
|
import { __decorate } from "../../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.mjs";
|
|
3
|
-
import { Expose, Transform, Type } from "class-transformer";
|
|
4
|
-
import { IsInstance, ValidateNested } from "class-validator";
|
|
5
3
|
import { JsonTransformer } from "@credo-ts/core";
|
|
6
4
|
import { DidCommCredentialPreviewAttribute, IsValidMessageType, parseMessageType, replaceLegacyDidSovPrefix } from "@credo-ts/didcomm";
|
|
5
|
+
import { IsInstance, ValidateNested } from "class-validator";
|
|
6
|
+
import { Expose, Transform, Type } from "class-transformer";
|
|
7
7
|
|
|
8
8
|
//#region src/protocols/credentials/v1/messages/DidCommCredentialV1Preview.ts
|
|
9
9
|
/**
|