@credo-ts/anoncreds 0.6.1-pr-2091-20241119140918 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/AnonCredsApi.d.mts +113 -0
- package/build/AnonCredsApi.d.mts.map +1 -0
- package/build/AnonCredsApi.mjs +439 -0
- package/build/AnonCredsApi.mjs.map +1 -0
- package/build/AnonCredsApiOptions.d.mts +28 -0
- package/build/AnonCredsApiOptions.d.mts.map +1 -0
- package/build/AnonCredsModule.d.mts +29 -0
- package/build/AnonCredsModule.d.mts.map +1 -0
- package/build/AnonCredsModule.mjs +62 -0
- package/build/AnonCredsModule.mjs.map +1 -0
- package/build/AnonCredsModuleConfig.d.mts +79 -0
- package/build/AnonCredsModuleConfig.d.mts.map +1 -0
- package/build/AnonCredsModuleConfig.mjs +31 -0
- package/build/AnonCredsModuleConfig.mjs.map +1 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorate.mjs +10 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateMetadata.mjs +7 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateParam.mjs +9 -0
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.mjs +203 -0
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.mjs.map +1 -0
- package/build/anoncreds-rs/AnonCredsRsHolderService.mjs +488 -0
- package/build/anoncreds-rs/AnonCredsRsHolderService.mjs.map +1 -0
- package/build/anoncreds-rs/AnonCredsRsIssuerService.mjs +213 -0
- package/build/anoncreds-rs/AnonCredsRsIssuerService.mjs.map +1 -0
- package/build/anoncreds-rs/AnonCredsRsVerifierService.mjs +122 -0
- package/build/anoncreds-rs/AnonCredsRsVerifierService.mjs.map +1 -0
- package/build/anoncreds-rs/index.mjs +3 -0
- package/build/anoncreds-rs/utils.mjs +60 -0
- package/build/anoncreds-rs/utils.mjs.map +1 -0
- package/build/error/AnonCredsError.d.mts +13 -0
- package/build/error/AnonCredsError.d.mts.map +1 -0
- package/build/error/AnonCredsError.mjs +12 -0
- package/build/error/AnonCredsError.mjs.map +1 -0
- package/build/error/AnonCredsRsError.d.mts +13 -0
- package/build/error/AnonCredsRsError.d.mts.map +1 -0
- package/build/error/AnonCredsRsError.mjs +12 -0
- package/build/error/AnonCredsRsError.mjs.map +1 -0
- package/build/error/AnonCredsStoreRecordError.d.mts +13 -0
- package/build/error/AnonCredsStoreRecordError.d.mts.map +1 -0
- package/build/error/AnonCredsStoreRecordError.mjs +12 -0
- package/build/error/AnonCredsStoreRecordError.mjs.map +1 -0
- package/build/error/index.d.mts +3 -0
- package/build/error/index.mjs +3 -0
- package/build/formats/AnonCredsDidCommCredentialFormat.d.mts +82 -0
- package/build/formats/AnonCredsDidCommCredentialFormat.d.mts.map +1 -0
- package/build/formats/AnonCredsDidCommCredentialFormatService.d.mts +120 -0
- package/build/formats/AnonCredsDidCommCredentialFormatService.d.mts.map +1 -0
- package/build/formats/AnonCredsDidCommCredentialFormatService.mjs +331 -0
- package/build/formats/AnonCredsDidCommCredentialFormatService.mjs.map +1 -0
- package/build/formats/AnonCredsDidCommProofFormat.d.mts +77 -0
- package/build/formats/AnonCredsDidCommProofFormat.d.mts.map +1 -0
- package/build/formats/AnonCredsDidCommProofFormatService.d.mts +93 -0
- package/build/formats/AnonCredsDidCommProofFormatService.d.mts.map +1 -0
- package/build/formats/AnonCredsDidCommProofFormatService.mjs +250 -0
- package/build/formats/AnonCredsDidCommProofFormatService.mjs.map +1 -0
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.mts +118 -0
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.mts.map +1 -0
- package/build/formats/DataIntegrityDidCommCredentialFormatService.mjs +587 -0
- package/build/formats/DataIntegrityDidCommCredentialFormatService.mjs.map +1 -0
- package/build/formats/LegacyIndyDidCommCredentialFormat.d.mts +38 -0
- package/build/formats/LegacyIndyDidCommCredentialFormat.d.mts.map +1 -0
- package/build/formats/LegacyIndyDidCommCredentialFormatService.d.mts +122 -0
- package/build/formats/LegacyIndyDidCommCredentialFormatService.d.mts.map +1 -0
- package/build/formats/LegacyIndyDidCommCredentialFormatService.mjs +309 -0
- package/build/formats/LegacyIndyDidCommCredentialFormatService.mjs.map +1 -0
- package/build/formats/LegacyIndyDidCommProofFormat.d.mts +36 -0
- package/build/formats/LegacyIndyDidCommProofFormat.d.mts.map +1 -0
- package/build/formats/LegacyIndyDidCommProofFormatService.d.mts +98 -0
- package/build/formats/LegacyIndyDidCommProofFormatService.d.mts.map +1 -0
- package/build/formats/LegacyIndyDidCommProofFormatService.mjs +322 -0
- package/build/formats/LegacyIndyDidCommProofFormatService.mjs.map +1 -0
- package/build/formats/index.d.mts +9 -0
- package/build/formats/index.mjs +5 -0
- package/build/index.d.mts +86 -0
- package/build/index.mjs +69 -0
- package/build/models/AnonCredsCredentialProposal.mjs +75 -0
- package/build/models/AnonCredsCredentialProposal.mjs.map +1 -0
- package/build/models/AnonCredsProofRequest.mjs +62 -0
- package/build/models/AnonCredsProofRequest.mjs.map +1 -0
- package/build/models/AnonCredsRequestedAttribute.mjs +50 -0
- package/build/models/AnonCredsRequestedAttribute.mjs.map +1 -0
- package/build/models/AnonCredsRequestedPredicate.mjs +53 -0
- package/build/models/AnonCredsRequestedPredicate.mjs.map +1 -0
- package/build/models/AnonCredsRestriction.d.mts +29 -0
- package/build/models/AnonCredsRestriction.d.mts.map +1 -0
- package/build/models/AnonCredsRestriction.mjs +137 -0
- package/build/models/AnonCredsRestriction.mjs.map +1 -0
- package/build/models/AnonCredsRestrictionWrapper.d.mts +9 -0
- package/build/models/AnonCredsRestrictionWrapper.d.mts.map +1 -0
- package/build/models/AnonCredsRestrictionWrapper.mjs +18 -0
- package/build/models/AnonCredsRestrictionWrapper.mjs.map +1 -0
- package/build/models/AnonCredsRevocationInterval.mjs +27 -0
- package/build/models/AnonCredsRevocationInterval.mjs.map +1 -0
- package/build/models/exchange.d.mts +104 -0
- package/build/models/exchange.d.mts.map +1 -0
- package/build/models/exchange.mjs +11 -0
- package/build/models/exchange.mjs.map +1 -0
- package/build/models/index.d.mts +4 -0
- package/build/models/index.mjs +2 -0
- package/build/models/internal.d.mts +40 -0
- package/build/models/internal.d.mts.map +1 -0
- package/build/models/registry.d.mts +44 -0
- package/build/models/registry.d.mts.map +1 -0
- package/build/models/utils.d.mts +27 -0
- package/build/models/utils.d.mts.map +1 -0
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.mts +215 -0
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.mts.map +1 -0
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.mjs +827 -0
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommCredentialV1AckHandler.mjs +17 -0
- package/build/protocols/credentials/v1/handlers/DidCommCredentialV1AckHandler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommCredentialV1ProblemReportHandler.mjs +17 -0
- package/build/protocols/credentials/v1/handlers/DidCommCredentialV1ProblemReportHandler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommIssueCredentialV1Handler.mjs +36 -0
- package/build/protocols/credentials/v1/handlers/DidCommIssueCredentialV1Handler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommOfferCredentialV1Handler.mjs +32 -0
- package/build/protocols/credentials/v1/handlers/DidCommOfferCredentialV1Handler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommProposeCredentialV1Handler.mjs +35 -0
- package/build/protocols/credentials/v1/handlers/DidCommProposeCredentialV1Handler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/DidCommRequestCredentialV1Handler.mjs +36 -0
- package/build/protocols/credentials/v1/handlers/DidCommRequestCredentialV1Handler.mjs.map +1 -0
- package/build/protocols/credentials/v1/handlers/index.mjs +6 -0
- package/build/protocols/credentials/v1/index.d.mts +9 -0
- package/build/protocols/credentials/v1/index.mjs +9 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.mts +16 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.mjs +21 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.mts +32 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.mjs +57 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.d.mts +16 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.mjs +21 -0
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.mts +26 -0
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.mjs +46 -0
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.mts +34 -0
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.mjs +61 -0
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.mts +64 -0
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.mjs +95 -0
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.mts +26 -0
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.mts.map +1 -0
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.mjs +46 -0
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.mjs.map +1 -0
- package/build/protocols/credentials/v1/messages/index.d.mts +7 -0
- package/build/protocols/credentials/v1/messages/index.mjs +7 -0
- package/build/protocols/index.d.mts +18 -0
- package/build/protocols/index.mjs +18 -0
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.mts +105 -0
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.mts.map +1 -0
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.mjs +723 -0
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.mjs.map +1 -0
- package/build/protocols/proofs/v1/errors/DidCommPresentationV1ProblemReportError.d.mts +18 -0
- package/build/protocols/proofs/v1/errors/DidCommPresentationV1ProblemReportError.d.mts.map +1 -0
- package/build/protocols/proofs/v1/errors/DidCommPresentationV1ProblemReportError.mjs +19 -0
- package/build/protocols/proofs/v1/errors/DidCommPresentationV1ProblemReportError.mjs.map +1 -0
- package/build/protocols/proofs/v1/errors/index.d.mts +1 -0
- package/build/protocols/proofs/v1/errors/index.mjs +1 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1AckHandler.mjs +17 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1AckHandler.mjs.map +1 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1Handler.mjs +36 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1Handler.mjs.map +1 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1ProblemReportHandler.mjs +16 -0
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1ProblemReportHandler.mjs.map +1 -0
- package/build/protocols/proofs/v1/handlers/DidCommProposePresentationV1Handler.mjs +35 -0
- package/build/protocols/proofs/v1/handlers/DidCommProposePresentationV1Handler.mjs.map +1 -0
- package/build/protocols/proofs/v1/handlers/DidCommRequestPresentationV1Handler.mjs +32 -0
- package/build/protocols/proofs/v1/handlers/DidCommRequestPresentationV1Handler.mjs.map +1 -0
- package/build/protocols/proofs/v1/handlers/index.mjs +5 -0
- package/build/protocols/proofs/v1/index.d.mts +11 -0
- package/build/protocols/proofs/v1/index.mjs +11 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.d.mts +12 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.d.mts.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.mjs +18 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.mjs.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.mts +38 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.mts.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.mjs +52 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.mjs.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.d.mts +16 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.d.mts.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.mjs +21 -0
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.mjs.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.mts +32 -0
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.mts.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.mjs +44 -0
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.mjs.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.mts +36 -0
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.mts.map +1 -0
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.mjs +50 -0
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.mjs.map +1 -0
- package/build/protocols/proofs/v1/messages/index.d.mts +5 -0
- package/build/protocols/proofs/v1/messages/index.mjs +5 -0
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.mts +57 -0
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.mts.map +1 -0
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.mjs +113 -0
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.mjs.map +1 -0
- package/build/protocols/proofs/v1/models/index.d.mts +1 -0
- package/build/protocols/proofs/v1/models/index.mjs +1 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.d.mts +25 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.mjs +26 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.mjs.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.d.mts +12 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.mjs +28 -0
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.mjs.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionRecord.d.mts +44 -0
- package/build/repository/AnonCredsCredentialDefinitionRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionRecord.mjs +38 -0
- package/build/repository/AnonCredsCredentialDefinitionRecord.mjs.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionRepository.d.mts +12 -0
- package/build/repository/AnonCredsCredentialDefinitionRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialDefinitionRepository.mjs +28 -0
- package/build/repository/AnonCredsCredentialDefinitionRepository.mjs.map +1 -0
- package/build/repository/AnonCredsCredentialRecord.d.mts +53 -0
- package/build/repository/AnonCredsCredentialRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialRecord.mjs +46 -0
- package/build/repository/AnonCredsCredentialRecord.mjs.map +1 -0
- package/build/repository/AnonCredsCredentialRepository.d.mts +14 -0
- package/build/repository/AnonCredsCredentialRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsCredentialRepository.mjs +34 -0
- package/build/repository/AnonCredsCredentialRepository.mjs.map +1 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.d.mts +25 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.mjs +26 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.mjs.map +1 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.d.mts +12 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.mjs +28 -0
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.mjs.map +1 -0
- package/build/repository/AnonCredsLinkSecretRecord.d.mts +28 -0
- package/build/repository/AnonCredsLinkSecretRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsLinkSecretRecord.mjs +25 -0
- package/build/repository/AnonCredsLinkSecretRecord.mjs.map +1 -0
- package/build/repository/AnonCredsLinkSecretRepository.d.mts +14 -0
- package/build/repository/AnonCredsLinkSecretRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsLinkSecretRepository.mjs +34 -0
- package/build/repository/AnonCredsLinkSecretRepository.mjs.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.d.mts +37 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.mjs +35 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.mjs.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.mts +13 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.mjs +34 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.mjs.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.mts +30 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.mjs +27 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.mjs.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.d.mts +13 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.mjs +31 -0
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.mjs.map +1 -0
- package/build/repository/AnonCredsSchemaRecord.d.mts +44 -0
- package/build/repository/AnonCredsSchemaRecord.d.mts.map +1 -0
- package/build/repository/AnonCredsSchemaRecord.mjs +38 -0
- package/build/repository/AnonCredsSchemaRecord.mjs.map +1 -0
- package/build/repository/AnonCredsSchemaRepository.d.mts +12 -0
- package/build/repository/AnonCredsSchemaRepository.d.mts.map +1 -0
- package/build/repository/AnonCredsSchemaRepository.mjs +28 -0
- package/build/repository/AnonCredsSchemaRepository.mjs.map +1 -0
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.d.mts +14 -0
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.d.mts.map +1 -0
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.mjs +10 -0
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.mjs.map +1 -0
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.d.mts +14 -0
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.d.mts.map +1 -0
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.mjs +10 -0
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.mjs.map +1 -0
- package/build/repository/anonCredsSchemaRecordMetadataTypes.d.mts +14 -0
- package/build/repository/anonCredsSchemaRecordMetadataTypes.d.mts.map +1 -0
- package/build/repository/index.d.mts +16 -0
- package/build/repository/index.mjs +16 -0
- package/build/services/AnonCredsHolderService.d.mts +28 -0
- package/build/services/AnonCredsHolderService.d.mts.map +1 -0
- package/build/services/AnonCredsHolderService.mjs +6 -0
- package/build/services/AnonCredsHolderService.mjs.map +1 -0
- package/build/services/AnonCredsHolderServiceOptions.d.mts +107 -0
- package/build/services/AnonCredsHolderServiceOptions.d.mts.map +1 -0
- package/build/services/AnonCredsIssuerService.d.mts +19 -0
- package/build/services/AnonCredsIssuerService.d.mts.map +1 -0
- package/build/services/AnonCredsIssuerService.mjs +6 -0
- package/build/services/AnonCredsIssuerService.mjs.map +1 -0
- package/build/services/AnonCredsIssuerServiceOptions.d.mts +66 -0
- package/build/services/AnonCredsIssuerServiceOptions.d.mts.map +1 -0
- package/build/services/AnonCredsVerifierService.d.mts +12 -0
- package/build/services/AnonCredsVerifierService.d.mts.map +1 -0
- package/build/services/AnonCredsVerifierService.mjs +6 -0
- package/build/services/AnonCredsVerifierService.mjs.map +1 -0
- package/build/services/AnonCredsVerifierServiceOptions.d.mts +30 -0
- package/build/services/AnonCredsVerifierServiceOptions.d.mts.map +1 -0
- package/build/services/index.d.mts +17 -0
- package/build/services/index.mjs +7 -0
- package/build/services/registry/AnonCredsRegistry.d.mts +43 -0
- package/build/services/registry/AnonCredsRegistry.d.mts.map +1 -0
- package/build/services/registry/AnonCredsRegistryService.d.mts +27 -0
- package/build/services/registry/AnonCredsRegistryService.d.mts.map +1 -0
- package/build/services/registry/AnonCredsRegistryService.mjs +226 -0
- package/build/services/registry/AnonCredsRegistryService.mjs.map +1 -0
- package/build/services/registry/CredentialDefinitionOptions.d.mts +39 -0
- package/build/services/registry/CredentialDefinitionOptions.d.mts.map +1 -0
- package/build/services/registry/RevocationRegistryDefinitionOptions.d.mts +39 -0
- package/build/services/registry/RevocationRegistryDefinitionOptions.d.mts.map +1 -0
- package/build/services/registry/RevocationStatusListOptions.d.mts +37 -0
- package/build/services/registry/RevocationStatusListOptions.d.mts.map +1 -0
- package/build/services/registry/SchemaOptions.d.mts +39 -0
- package/build/services/registry/SchemaOptions.d.mts.map +1 -0
- package/build/services/registry/base.d.mts +65 -0
- package/build/services/registry/base.d.mts.map +1 -0
- package/build/services/registry/index.d.mts +7 -0
- package/build/services/registry/index.mjs +1 -0
- package/build/services/tails/BasicTailsFileService.d.mts +29 -0
- package/build/services/tails/BasicTailsFileService.d.mts.map +1 -0
- package/build/services/tails/BasicTailsFileService.mjs +52 -0
- package/build/services/tails/BasicTailsFileService.mjs.map +1 -0
- package/build/services/tails/TailsFileService.d.mts +48 -0
- package/build/services/tails/TailsFileService.d.mts.map +1 -0
- package/build/services/tails/index.d.mts +2 -0
- package/build/services/tails/index.mjs +1 -0
- package/build/updates/0.3.1-0.4/credentialDefinition.mjs +49 -0
- package/build/updates/0.3.1-0.4/credentialDefinition.mjs.map +1 -0
- package/build/updates/0.3.1-0.4/credentialExchangeRecord.mjs +118 -0
- package/build/updates/0.3.1-0.4/credentialExchangeRecord.mjs.map +1 -0
- package/build/updates/0.3.1-0.4/index.d.mts +7 -0
- package/build/updates/0.3.1-0.4/index.d.mts.map +1 -0
- package/build/updates/0.3.1-0.4/index.mjs +16 -0
- package/build/updates/0.3.1-0.4/index.mjs.map +1 -0
- package/build/updates/0.3.1-0.4/linkSecret.mjs +21 -0
- package/build/updates/0.3.1-0.4/linkSecret.mjs.map +1 -0
- package/build/updates/0.3.1-0.4/schema.mjs +39 -0
- package/build/updates/0.3.1-0.4/schema.mjs.map +1 -0
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.mjs +126 -0
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.mjs.map +1 -0
- package/build/updates/0.4-0.5/index.d.mts +7 -0
- package/build/updates/0.4-0.5/index.d.mts.map +1 -0
- package/build/updates/0.4-0.5/index.mjs +10 -0
- package/build/updates/0.4-0.5/index.mjs.map +1 -0
- package/build/utils/anonCredsObjects.d.mts +27 -0
- package/build/utils/anonCredsObjects.d.mts.map +1 -0
- package/build/utils/anonCredsObjects.mjs +57 -0
- package/build/utils/anonCredsObjects.mjs.map +1 -0
- package/build/utils/areRequestsEqual.d.mts +1 -0
- package/build/utils/areRequestsEqual.mjs +86 -0
- package/build/utils/areRequestsEqual.mjs.map +1 -0
- package/build/utils/bytesToBigint.mjs +11 -0
- package/build/utils/bytesToBigint.mjs.map +1 -0
- package/build/utils/composeAutoAccept.d.mts +1 -0
- package/build/utils/composeAutoAccept.mjs +25 -0
- package/build/utils/composeAutoAccept.mjs.map +1 -0
- package/build/utils/createRequestFromPreview.d.mts +2 -0
- package/build/utils/createRequestFromPreview.mjs +50 -0
- package/build/utils/createRequestFromPreview.mjs.map +1 -0
- package/build/utils/credential.d.mts +12 -0
- package/build/utils/credential.d.mts.map +1 -0
- package/build/utils/credential.mjs +119 -0
- package/build/utils/credential.mjs.map +1 -0
- package/build/utils/credentialPreviewAttributes.d.mts +1 -0
- package/build/utils/credentialPreviewAttributes.mjs +21 -0
- package/build/utils/credentialPreviewAttributes.mjs.map +1 -0
- package/build/utils/getCredentialsForAnonCredsRequest.d.mts +11 -0
- package/build/utils/getCredentialsForAnonCredsRequest.d.mts.map +1 -0
- package/build/utils/getCredentialsForAnonCredsRequest.mjs +70 -0
- package/build/utils/getCredentialsForAnonCredsRequest.mjs.map +1 -0
- package/build/utils/getRevocationRegistries.d.mts +4 -0
- package/build/utils/getRevocationRegistries.mjs +121 -0
- package/build/utils/getRevocationRegistries.mjs.map +1 -0
- package/build/utils/hasDuplicateGroupNames.d.mts +1 -0
- package/build/utils/hasDuplicateGroupNames.mjs +22 -0
- package/build/utils/hasDuplicateGroupNames.mjs.map +1 -0
- package/build/utils/index.d.mts +17 -0
- package/build/utils/index.mjs +17 -0
- package/build/utils/indyIdentifiers.d.mts +71 -0
- package/build/utils/indyIdentifiers.d.mts.map +1 -0
- package/build/utils/indyIdentifiers.mjs +249 -0
- package/build/utils/indyIdentifiers.mjs.map +1 -0
- package/build/utils/isMap.d.mts +1 -0
- package/build/utils/isMap.mjs +19 -0
- package/build/utils/isMap.mjs.map +1 -0
- package/build/utils/linkSecret.d.mts +13 -0
- package/build/utils/linkSecret.d.mts.map +1 -0
- package/build/utils/linkSecret.mjs +35 -0
- package/build/utils/linkSecret.mjs.map +1 -0
- package/build/utils/metadata.d.mts +30 -0
- package/build/utils/metadata.d.mts.map +1 -0
- package/build/utils/metadata.mjs +23 -0
- package/build/utils/metadata.mjs.map +1 -0
- package/build/utils/proofRequest.mjs +10 -0
- package/build/utils/proofRequest.mjs.map +1 -0
- package/build/utils/proverDid.d.mts +12 -0
- package/build/utils/proverDid.d.mts.map +1 -0
- package/build/utils/proverDid.mjs +17 -0
- package/build/utils/proverDid.mjs.map +1 -0
- package/build/utils/revocationInterval.d.mts +12 -0
- package/build/utils/revocationInterval.d.mts.map +1 -0
- package/build/utils/revocationInterval.mjs +11 -0
- package/build/utils/revocationInterval.mjs.map +1 -0
- package/build/utils/sortRequestedCredentialsMatches.d.mts +1 -0
- package/build/utils/sortRequestedCredentialsMatches.mjs +22 -0
- package/build/utils/sortRequestedCredentialsMatches.mjs.map +1 -0
- package/build/utils/timestamp.d.mts +5 -0
- package/build/utils/timestamp.d.mts.map +1 -0
- package/build/utils/timestamp.mjs +6 -0
- package/build/utils/timestamp.mjs.map +1 -0
- package/build/utils/w3cAnonCredsUtils.d.mts +28 -0
- package/build/utils/w3cAnonCredsUtils.d.mts.map +1 -0
- package/build/utils/w3cAnonCredsUtils.mjs +101 -0
- package/build/utils/w3cAnonCredsUtils.mjs.map +1 -0
- package/package.json +20 -21
- package/build/AnonCredsApi.d.ts +0 -97
- package/build/AnonCredsApi.js +0 -582
- package/build/AnonCredsApi.js.map +0 -1
- package/build/AnonCredsApiOptions.d.ts +0 -24
- package/build/AnonCredsApiOptions.js +0 -3
- package/build/AnonCredsApiOptions.js.map +0 -1
- package/build/AnonCredsModule.d.ts +0 -24
- package/build/AnonCredsModule.js +0 -56
- package/build/AnonCredsModule.js.map +0 -1
- package/build/AnonCredsModuleConfig.d.ts +0 -72
- package/build/AnonCredsModuleConfig.js +0 -31
- package/build/AnonCredsModuleConfig.js.map +0 -1
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.d.ts +0 -27
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.js +0 -241
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.js.map +0 -1
- package/build/anoncreds-rs/AnonCredsRsHolderService.d.ts +0 -38
- package/build/anoncreds-rs/AnonCredsRsHolderService.js +0 -622
- package/build/anoncreds-rs/AnonCredsRsHolderService.js.map +0 -1
- package/build/anoncreds-rs/AnonCredsRsIssuerService.d.ts +0 -12
- package/build/anoncreds-rs/AnonCredsRsIssuerService.js +0 -253
- package/build/anoncreds-rs/AnonCredsRsIssuerService.js.map +0 -1
- package/build/anoncreds-rs/AnonCredsRsVerifierService.d.ts +0 -8
- package/build/anoncreds-rs/AnonCredsRsVerifierService.js +0 -157
- package/build/anoncreds-rs/AnonCredsRsVerifierService.js.map +0 -1
- package/build/anoncreds-rs/index.d.ts +0 -3
- package/build/anoncreds-rs/index.js +0 -10
- package/build/anoncreds-rs/index.js.map +0 -1
- package/build/anoncreds-rs/utils.d.ts +0 -23
- package/build/anoncreds-rs/utils.js +0 -71
- package/build/anoncreds-rs/utils.js.map +0 -1
- package/build/error/AnonCredsError.d.ts +0 -6
- package/build/error/AnonCredsError.js +0 -11
- package/build/error/AnonCredsError.js.map +0 -1
- package/build/error/AnonCredsRsError.d.ts +0 -6
- package/build/error/AnonCredsRsError.js +0 -11
- package/build/error/AnonCredsRsError.js.map +0 -1
- package/build/error/AnonCredsStoreRecordError.d.ts +0 -6
- package/build/error/AnonCredsStoreRecordError.js +0 -11
- package/build/error/AnonCredsStoreRecordError.js.map +0 -1
- package/build/error/index.d.ts +0 -3
- package/build/error/index.js +0 -20
- package/build/error/index.js.map +0 -1
- package/build/formats/AnonCredsCredentialFormat.d.ts +0 -79
- package/build/formats/AnonCredsCredentialFormat.js +0 -3
- package/build/formats/AnonCredsCredentialFormat.js.map +0 -1
- package/build/formats/AnonCredsCredentialFormatService.d.ts +0 -80
- package/build/formats/AnonCredsCredentialFormatService.js +0 -433
- package/build/formats/AnonCredsCredentialFormatService.js.map +0 -1
- package/build/formats/AnonCredsProofFormat.d.ts +0 -70
- package/build/formats/AnonCredsProofFormat.js +0 -3
- package/build/formats/AnonCredsProofFormat.js.map +0 -1
- package/build/formats/AnonCredsProofFormatService.d.ts +0 -55
- package/build/formats/AnonCredsProofFormatService.js +0 -289
- package/build/formats/AnonCredsProofFormatService.js.map +0 -1
- package/build/formats/DataIntegrityCredentialFormatService.d.ts +0 -89
- package/build/formats/DataIntegrityCredentialFormatService.js +0 -773
- package/build/formats/DataIntegrityCredentialFormatService.js.map +0 -1
- package/build/formats/LegacyIndyCredentialFormat.d.ts +0 -32
- package/build/formats/LegacyIndyCredentialFormat.js +0 -3
- package/build/formats/LegacyIndyCredentialFormat.js.map +0 -1
- package/build/formats/LegacyIndyCredentialFormatService.d.ts +0 -80
- package/build/formats/LegacyIndyCredentialFormatService.js +0 -379
- package/build/formats/LegacyIndyCredentialFormatService.js.map +0 -1
- package/build/formats/LegacyIndyProofFormat.d.ts +0 -29
- package/build/formats/LegacyIndyProofFormat.js +0 -3
- package/build/formats/LegacyIndyProofFormat.js.map +0 -1
- package/build/formats/LegacyIndyProofFormatService.d.ts +0 -58
- package/build/formats/LegacyIndyProofFormatService.js +0 -374
- package/build/formats/LegacyIndyProofFormatService.js.map +0 -1
- package/build/formats/index.d.ts +0 -9
- package/build/formats/index.js +0 -32
- package/build/formats/index.js.map +0 -1
- package/build/index.d.ts +0 -21
- package/build/index.js +0 -54
- package/build/index.js.map +0 -1
- package/build/models/AnonCredsCredentialProposal.d.ts +0 -62
- package/build/models/AnonCredsCredentialProposal.js +0 -81
- package/build/models/AnonCredsCredentialProposal.js.map +0 -1
- package/build/models/AnonCredsProofRequest.d.ts +0 -27
- package/build/models/AnonCredsProofRequest.js +0 -82
- package/build/models/AnonCredsProofRequest.js.map +0 -1
- package/build/models/AnonCredsRequestedAttribute.d.ts +0 -16
- package/build/models/AnonCredsRequestedAttribute.js +0 -56
- package/build/models/AnonCredsRequestedAttribute.js.map +0 -1
- package/build/models/AnonCredsRequestedPredicate.d.ts +0 -19
- package/build/models/AnonCredsRequestedPredicate.js +0 -61
- package/build/models/AnonCredsRequestedPredicate.js.map +0 -1
- package/build/models/AnonCredsRestriction.d.ts +0 -55
- package/build/models/AnonCredsRestriction.js +0 -160
- package/build/models/AnonCredsRestriction.js.map +0 -1
- package/build/models/AnonCredsRestrictionWrapper.d.ts +0 -4
- package/build/models/AnonCredsRestrictionWrapper.js +0 -25
- package/build/models/AnonCredsRestrictionWrapper.js.map +0 -1
- package/build/models/AnonCredsRevocationInterval.d.ts +0 -5
- package/build/models/AnonCredsRevocationInterval.js +0 -33
- package/build/models/AnonCredsRevocationInterval.js.map +0 -1
- package/build/models/exchange.d.ts +0 -99
- package/build/models/exchange.js +0 -5
- package/build/models/exchange.js.map +0 -1
- package/build/models/index.d.ts +0 -4
- package/build/models/index.js +0 -21
- package/build/models/index.js.map +0 -1
- package/build/models/internal.d.ts +0 -35
- package/build/models/internal.js +0 -3
- package/build/models/internal.js.map +0 -1
- package/build/models/registry.d.ts +0 -39
- package/build/models/registry.js +0 -3
- package/build/models/registry.js.map +0 -1
- package/build/models/utils.d.ts +0 -22
- package/build/models/utils.js +0 -3
- package/build/models/utils.js.map +0 -1
- package/build/protocols/credentials/v1/V1CredentialProtocol.d.ts +0 -162
- package/build/protocols/credentials/v1/V1CredentialProtocol.js +0 -948
- package/build/protocols/credentials/v1/V1CredentialProtocol.js.map +0 -1
- package/build/protocols/credentials/v1/errors/V1CredentialProblemReportError.d.ts +0 -10
- package/build/protocols/credentials/v1/errors/V1CredentialProblemReportError.js +0 -18
- package/build/protocols/credentials/v1/errors/V1CredentialProblemReportError.js.map +0 -1
- package/build/protocols/credentials/v1/errors/index.d.ts +0 -1
- package/build/protocols/credentials/v1/errors/index.js +0 -6
- package/build/protocols/credentials/v1/errors/index.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1CredentialAckHandler.d.ts +0 -9
- package/build/protocols/credentials/v1/handlers/V1CredentialAckHandler.js +0 -15
- package/build/protocols/credentials/v1/handlers/V1CredentialAckHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1CredentialProblemReportHandler.d.ts +0 -9
- package/build/protocols/credentials/v1/handlers/V1CredentialProblemReportHandler.js +0 -15
- package/build/protocols/credentials/v1/handlers/V1CredentialProblemReportHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1IssueCredentialHandler.d.ts +0 -10
- package/build/protocols/credentials/v1/handlers/V1IssueCredentialHandler.js +0 -40
- package/build/protocols/credentials/v1/handlers/V1IssueCredentialHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1OfferCredentialHandler.d.ts +0 -10
- package/build/protocols/credentials/v1/handlers/V1OfferCredentialHandler.js +0 -33
- package/build/protocols/credentials/v1/handlers/V1OfferCredentialHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1ProposeCredentialHandler.d.ts +0 -10
- package/build/protocols/credentials/v1/handlers/V1ProposeCredentialHandler.js +0 -38
- package/build/protocols/credentials/v1/handlers/V1ProposeCredentialHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/V1RequestCredentialHandler.d.ts +0 -10
- package/build/protocols/credentials/v1/handlers/V1RequestCredentialHandler.js +0 -40
- package/build/protocols/credentials/v1/handlers/V1RequestCredentialHandler.js.map +0 -1
- package/build/protocols/credentials/v1/handlers/index.d.ts +0 -6
- package/build/protocols/credentials/v1/handlers/index.js +0 -23
- package/build/protocols/credentials/v1/handlers/index.js.map +0 -1
- package/build/protocols/credentials/v1/index.d.ts +0 -2
- package/build/protocols/credentials/v1/index.js +0 -19
- package/build/protocols/credentials/v1/index.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1CredentialAckMessage.d.ts +0 -16
- package/build/protocols/credentials/v1/messages/V1CredentialAckMessage.js +0 -34
- package/build/protocols/credentials/v1/messages/V1CredentialAckMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1CredentialPreview.d.ts +0 -26
- package/build/protocols/credentials/v1/messages/V1CredentialPreview.js +0 -69
- package/build/protocols/credentials/v1/messages/V1CredentialPreview.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1CredentialProblemReportMessage.d.ts +0 -16
- package/build/protocols/credentials/v1/messages/V1CredentialProblemReportMessage.js +0 -34
- package/build/protocols/credentials/v1/messages/V1CredentialProblemReportMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1IssueCredentialMessage.d.ts +0 -19
- package/build/protocols/credentials/v1/messages/V1IssueCredentialMessage.js +0 -62
- package/build/protocols/credentials/v1/messages/V1IssueCredentialMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1OfferCredentialMessage.d.ts +0 -27
- package/build/protocols/credentials/v1/messages/V1OfferCredentialMessage.js +0 -75
- package/build/protocols/credentials/v1/messages/V1OfferCredentialMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1ProposeCredentialMessage.d.ts +0 -59
- package/build/protocols/credentials/v1/messages/V1ProposeCredentialMessage.js +0 -109
- package/build/protocols/credentials/v1/messages/V1ProposeCredentialMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/V1RequestCredentialMessage.d.ts +0 -19
- package/build/protocols/credentials/v1/messages/V1RequestCredentialMessage.js +0 -61
- package/build/protocols/credentials/v1/messages/V1RequestCredentialMessage.js.map +0 -1
- package/build/protocols/credentials/v1/messages/index.d.ts +0 -7
- package/build/protocols/credentials/v1/messages/index.js +0 -24
- package/build/protocols/credentials/v1/messages/index.js.map +0 -1
- package/build/protocols/index.d.ts +0 -2
- package/build/protocols/index.js +0 -19
- package/build/protocols/index.js.map +0 -1
- package/build/protocols/proofs/v1/V1ProofProtocol.d.ts +0 -50
- package/build/protocols/proofs/v1/V1ProofProtocol.js +0 -864
- package/build/protocols/proofs/v1/V1ProofProtocol.js.map +0 -1
- package/build/protocols/proofs/v1/errors/V1PresentationProblemReportError.d.ts +0 -12
- package/build/protocols/proofs/v1/errors/V1PresentationProblemReportError.js +0 -19
- package/build/protocols/proofs/v1/errors/V1PresentationProblemReportError.js.map +0 -1
- package/build/protocols/proofs/v1/errors/index.d.ts +0 -1
- package/build/protocols/proofs/v1/errors/index.js +0 -18
- package/build/protocols/proofs/v1/errors/index.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/V1PresentationAckHandler.d.ts +0 -9
- package/build/protocols/proofs/v1/handlers/V1PresentationAckHandler.js +0 -15
- package/build/protocols/proofs/v1/handlers/V1PresentationAckHandler.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/V1PresentationHandler.d.ts +0 -10
- package/build/protocols/proofs/v1/handlers/V1PresentationHandler.js +0 -40
- package/build/protocols/proofs/v1/handlers/V1PresentationHandler.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/V1PresentationProblemReportHandler.d.ts +0 -9
- package/build/protocols/proofs/v1/handlers/V1PresentationProblemReportHandler.js +0 -15
- package/build/protocols/proofs/v1/handlers/V1PresentationProblemReportHandler.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/V1ProposePresentationHandler.d.ts +0 -11
- package/build/protocols/proofs/v1/handlers/V1ProposePresentationHandler.js +0 -38
- package/build/protocols/proofs/v1/handlers/V1ProposePresentationHandler.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/V1RequestPresentationHandler.d.ts +0 -10
- package/build/protocols/proofs/v1/handlers/V1RequestPresentationHandler.js +0 -35
- package/build/protocols/proofs/v1/handlers/V1RequestPresentationHandler.js.map +0 -1
- package/build/protocols/proofs/v1/handlers/index.d.ts +0 -5
- package/build/protocols/proofs/v1/handlers/index.js +0 -22
- package/build/protocols/proofs/v1/handlers/index.js.map +0 -1
- package/build/protocols/proofs/v1/index.d.ts +0 -4
- package/build/protocols/proofs/v1/index.js +0 -21
- package/build/protocols/proofs/v1/index.js.map +0 -1
- package/build/protocols/proofs/v1/messages/V1PresentationAckMessage.d.ts +0 -8
- package/build/protocols/proofs/v1/messages/V1PresentationAckMessage.js +0 -27
- package/build/protocols/proofs/v1/messages/V1PresentationAckMessage.js.map +0 -1
- package/build/protocols/proofs/v1/messages/V1PresentationMessage.d.ts +0 -31
- package/build/protocols/proofs/v1/messages/V1PresentationMessage.js +0 -67
- package/build/protocols/proofs/v1/messages/V1PresentationMessage.js.map +0 -1
- package/build/protocols/proofs/v1/messages/V1PresentationProblemReportMessage.d.ts +0 -16
- package/build/protocols/proofs/v1/messages/V1PresentationProblemReportMessage.js +0 -34
- package/build/protocols/proofs/v1/messages/V1PresentationProblemReportMessage.js.map +0 -1
- package/build/protocols/proofs/v1/messages/V1ProposePresentationMessage.d.ts +0 -26
- package/build/protocols/proofs/v1/messages/V1ProposePresentationMessage.js +0 -53
- package/build/protocols/proofs/v1/messages/V1ProposePresentationMessage.js.map +0 -1
- package/build/protocols/proofs/v1/messages/V1RequestPresentationMessage.d.ts +0 -29
- package/build/protocols/proofs/v1/messages/V1RequestPresentationMessage.js +0 -65
- package/build/protocols/proofs/v1/messages/V1RequestPresentationMessage.js.map +0 -1
- package/build/protocols/proofs/v1/messages/index.d.ts +0 -5
- package/build/protocols/proofs/v1/messages/index.js +0 -22
- package/build/protocols/proofs/v1/messages/index.js.map +0 -1
- package/build/protocols/proofs/v1/models/V1PresentationPreview.d.ts +0 -50
- package/build/protocols/proofs/v1/models/V1PresentationPreview.js +0 -130
- package/build/protocols/proofs/v1/models/V1PresentationPreview.js.map +0 -1
- package/build/protocols/proofs/v1/models/index.d.ts +0 -1
- package/build/protocols/proofs/v1/models/index.js +0 -18
- package/build/protocols/proofs/v1/models/index.js.map +0 -1
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.d.ts +0 -21
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.js +0 -23
- package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.js.map +0 -1
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.d.ts +0 -8
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.js +0 -35
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.js.map +0 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.d.ts +0 -39
- package/build/repository/AnonCredsCredentialDefinitionRecord.js +0 -30
- package/build/repository/AnonCredsCredentialDefinitionRecord.js.map +0 -1
- package/build/repository/AnonCredsCredentialDefinitionRepository.d.ts +0 -8
- package/build/repository/AnonCredsCredentialDefinitionRepository.js +0 -53
- package/build/repository/AnonCredsCredentialDefinitionRepository.js.map +0 -1
- package/build/repository/AnonCredsCredentialRecord.d.ts +0 -48
- package/build/repository/AnonCredsCredentialRecord.js +0 -37
- package/build/repository/AnonCredsCredentialRecord.js.map +0 -1
- package/build/repository/AnonCredsCredentialRepository.d.ts +0 -10
- package/build/repository/AnonCredsCredentialRepository.js +0 -41
- package/build/repository/AnonCredsCredentialRepository.js.map +0 -1
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.d.ts +0 -21
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.js +0 -23
- package/build/repository/AnonCredsKeyCorrectnessProofRecord.js.map +0 -1
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.d.ts +0 -8
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.js +0 -35
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.js.map +0 -1
- package/build/repository/AnonCredsLinkSecretRecord.d.ts +0 -23
- package/build/repository/AnonCredsLinkSecretRecord.js +0 -22
- package/build/repository/AnonCredsLinkSecretRecord.js.map +0 -1
- package/build/repository/AnonCredsLinkSecretRepository.d.ts +0 -10
- package/build/repository/AnonCredsLinkSecretRepository.js +0 -41
- package/build/repository/AnonCredsLinkSecretRepository.js.map +0 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.d.ts +0 -34
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.js +0 -30
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.js.map +0 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.ts +0 -10
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.js +0 -38
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.js.map +0 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.ts +0 -25
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.js +0 -23
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.js.map +0 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.d.ts +0 -9
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.js +0 -38
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.js.map +0 -1
- package/build/repository/AnonCredsSchemaRecord.d.ts +0 -39
- package/build/repository/AnonCredsSchemaRecord.js +0 -30
- package/build/repository/AnonCredsSchemaRecord.js.map +0 -1
- package/build/repository/AnonCredsSchemaRepository.d.ts +0 -8
- package/build/repository/AnonCredsSchemaRepository.js +0 -53
- package/build/repository/AnonCredsSchemaRepository.js.map +0 -1
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.d.ts +0 -9
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.js +0 -9
- package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.js.map +0 -1
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.d.ts +0 -9
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.js +0 -9
- package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.js.map +0 -1
- package/build/repository/anonCredsSchemaRecordMetadataTypes.d.ts +0 -9
- package/build/repository/anonCredsSchemaRecordMetadataTypes.js +0 -9
- package/build/repository/anonCredsSchemaRecordMetadataTypes.js.map +0 -1
- package/build/repository/index.d.ts +0 -16
- package/build/repository/index.js +0 -33
- package/build/repository/index.js.map +0 -1
- package/build/services/AnonCredsHolderService.d.ts +0 -18
- package/build/services/AnonCredsHolderService.js +0 -5
- package/build/services/AnonCredsHolderService.js.map +0 -1
- package/build/services/AnonCredsHolderServiceOptions.d.ts +0 -101
- package/build/services/AnonCredsHolderServiceOptions.js +0 -3
- package/build/services/AnonCredsHolderServiceOptions.js.map +0 -1
- package/build/services/AnonCredsIssuerService.d.ts +0 -14
- package/build/services/AnonCredsIssuerService.js +0 -5
- package/build/services/AnonCredsIssuerService.js.map +0 -1
- package/build/services/AnonCredsIssuerServiceOptions.d.ts +0 -61
- package/build/services/AnonCredsIssuerServiceOptions.js +0 -3
- package/build/services/AnonCredsIssuerServiceOptions.js.map +0 -1
- package/build/services/AnonCredsVerifierService.d.ts +0 -7
- package/build/services/AnonCredsVerifierService.js +0 -5
- package/build/services/AnonCredsVerifierService.js.map +0 -1
- package/build/services/AnonCredsVerifierServiceOptions.d.ts +0 -25
- package/build/services/AnonCredsVerifierServiceOptions.js +0 -3
- package/build/services/AnonCredsVerifierServiceOptions.js.map +0 -1
- package/build/services/index.d.ts +0 -8
- package/build/services/index.js +0 -27
- package/build/services/index.js.map +0 -1
- package/build/services/registry/AnonCredsRegistry.d.ts +0 -25
- package/build/services/registry/AnonCredsRegistry.js +0 -3
- package/build/services/registry/AnonCredsRegistry.js.map +0 -1
- package/build/services/registry/AnonCredsRegistryService.d.ts +0 -10
- package/build/services/registry/AnonCredsRegistryService.js +0 -33
- package/build/services/registry/AnonCredsRegistryService.js.map +0 -1
- package/build/services/registry/CredentialDefinitionOptions.d.ts +0 -34
- package/build/services/registry/CredentialDefinitionOptions.js +0 -3
- package/build/services/registry/CredentialDefinitionOptions.js.map +0 -1
- package/build/services/registry/RevocationRegistryDefinitionOptions.d.ts +0 -34
- package/build/services/registry/RevocationRegistryDefinitionOptions.js +0 -3
- package/build/services/registry/RevocationRegistryDefinitionOptions.js.map +0 -1
- package/build/services/registry/RevocationStatusListOptions.d.ts +0 -32
- package/build/services/registry/RevocationStatusListOptions.js +0 -3
- package/build/services/registry/RevocationStatusListOptions.js.map +0 -1
- package/build/services/registry/SchemaOptions.d.ts +0 -34
- package/build/services/registry/SchemaOptions.js +0 -3
- package/build/services/registry/SchemaOptions.js.map +0 -1
- package/build/services/registry/base.d.ts +0 -19
- package/build/services/registry/base.js +0 -3
- package/build/services/registry/base.js.map +0 -1
- package/build/services/registry/index.d.ts +0 -7
- package/build/services/registry/index.js +0 -23
- package/build/services/registry/index.js.map +0 -1
- package/build/services/tails/BasicTailsFileService.d.ts +0 -23
- package/build/services/tails/BasicTailsFileService.js +0 -65
- package/build/services/tails/BasicTailsFileService.js.map +0 -1
- package/build/services/tails/TailsFileService.d.ts +0 -42
- package/build/services/tails/TailsFileService.js +0 -3
- package/build/services/tails/TailsFileService.js.map +0 -1
- package/build/services/tails/index.d.ts +0 -2
- package/build/services/tails/index.js +0 -19
- package/build/services/tails/index.js.map +0 -1
- package/build/updates/0.3.1-0.4/credentialDefinition.d.ts +0 -18
- package/build/updates/0.3.1-0.4/credentialDefinition.js +0 -56
- package/build/updates/0.3.1-0.4/credentialDefinition.js.map +0 -1
- package/build/updates/0.3.1-0.4/credentialExchangeRecord.d.ts +0 -69
- package/build/updates/0.3.1-0.4/credentialExchangeRecord.js +0 -121
- package/build/updates/0.3.1-0.4/credentialExchangeRecord.js.map +0 -1
- package/build/updates/0.3.1-0.4/index.d.ts +0 -2
- package/build/updates/0.3.1-0.4/index.js +0 -14
- package/build/updates/0.3.1-0.4/index.js.map +0 -1
- package/build/updates/0.3.1-0.4/linkSecret.d.ts +0 -6
- package/build/updates/0.3.1-0.4/linkSecret.js +0 -35
- package/build/updates/0.3.1-0.4/linkSecret.js.map +0 -1
- package/build/updates/0.3.1-0.4/schema.d.ts +0 -15
- package/build/updates/0.3.1-0.4/schema.js +0 -41
- package/build/updates/0.3.1-0.4/schema.js.map +0 -1
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.d.ts +0 -5
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.js +0 -149
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.js.map +0 -1
- package/build/updates/0.4-0.5/index.d.ts +0 -2
- package/build/updates/0.4-0.5/index.js +0 -8
- package/build/updates/0.4-0.5/index.js.map +0 -1
- package/build/utils/anonCredsObjects.d.ts +0 -26
- package/build/utils/anonCredsObjects.js +0 -81
- package/build/utils/anonCredsObjects.js.map +0 -1
- package/build/utils/areRequestsEqual.d.ts +0 -6
- package/build/utils/areRequestsEqual.js +0 -135
- package/build/utils/areRequestsEqual.js.map +0 -1
- package/build/utils/composeAutoAccept.d.ts +0 -15
- package/build/utils/composeAutoAccept.js +0 -26
- package/build/utils/composeAutoAccept.js.map +0 -1
- package/build/utils/createRequestFromPreview.d.ts +0 -10
- package/build/utils/createRequestFromPreview.js +0 -71
- package/build/utils/createRequestFromPreview.js.map +0 -1
- package/build/utils/credential.d.ts +0 -68
- package/build/utils/credential.js +0 -188
- package/build/utils/credential.js.map +0 -1
- package/build/utils/credentialPreviewAttributes.d.ts +0 -2
- package/build/utils/credentialPreviewAttributes.js +0 -24
- package/build/utils/credentialPreviewAttributes.js.map +0 -1
- package/build/utils/getCredentialsForAnonCredsRequest.d.ts +0 -4
- package/build/utils/getCredentialsForAnonCredsRequest.js +0 -81
- package/build/utils/getCredentialsForAnonCredsRequest.js.map +0 -1
- package/build/utils/getRevocationRegistries.d.ts +0 -14
- package/build/utils/getRevocationRegistries.js +0 -151
- package/build/utils/getRevocationRegistries.js.map +0 -1
- package/build/utils/hasDuplicateGroupNames.d.ts +0 -2
- package/build/utils/hasDuplicateGroupNames.js +0 -22
- package/build/utils/hasDuplicateGroupNames.js.map +0 -1
- package/build/utils/index.d.ts +0 -17
- package/build/utils/index.js +0 -48
- package/build/utils/index.js.map +0 -1
- package/build/utils/indyIdentifiers.d.ts +0 -66
- package/build/utils/indyIdentifiers.js +0 -298
- package/build/utils/indyIdentifiers.js.map +0 -1
- package/build/utils/isMap.d.ts +0 -5
- package/build/utils/isMap.js +0 -17
- package/build/utils/isMap.js.map +0 -1
- package/build/utils/linkSecret.d.ts +0 -9
- package/build/utils/linkSecret.js +0 -43
- package/build/utils/linkSecret.js.map +0 -1
- package/build/utils/metadata.d.ts +0 -35
- package/build/utils/metadata.js +0 -24
- package/build/utils/metadata.js.map +0 -1
- package/build/utils/proofRequest.d.ts +0 -2
- package/build/utils/proofRequest.js +0 -21
- package/build/utils/proofRequest.js.map +0 -1
- package/build/utils/proverDid.d.ts +0 -8
- package/build/utils/proverDid.js +0 -15
- package/build/utils/proverDid.js.map +0 -1
- package/build/utils/revocationInterval.d.ts +0 -7
- package/build/utils/revocationInterval.js +0 -14
- package/build/utils/revocationInterval.js.map +0 -1
- package/build/utils/sortRequestedCredentialsMatches.d.ts +0 -8
- package/build/utils/sortRequestedCredentialsMatches.js +0 -31
- package/build/utils/sortRequestedCredentialsMatches.js.map +0 -1
- package/build/utils/timestamp.d.ts +0 -1
- package/build/utils/timestamp.js +0 -7
- package/build/utils/timestamp.js.map +0 -1
- package/build/utils/w3cAnonCredsUtils.d.ts +0 -37
- package/build/utils/w3cAnonCredsUtils.js +0 -132
- package/build/utils/w3cAnonCredsUtils.js.map +0 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//#region src/utils/areRequestsEqual.ts
|
|
2
|
+
function areObjectsEqual(a, b) {
|
|
3
|
+
if (typeof a === "object" && a != null && typeof b === "object" && b != null) {
|
|
4
|
+
if (Object.keys(a).length !== Object.keys(b).length) return false;
|
|
5
|
+
for (const key in a) if (!(key in b) || !areObjectsEqual(a[key], b[key])) return false;
|
|
6
|
+
for (const key in b) if (!(key in a) || !areObjectsEqual(b[key], a[key])) return false;
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
return a === b;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Checks whether two `names` arrays are equal. The order of the names doesn't matter.
|
|
13
|
+
*/
|
|
14
|
+
function areNamesEqual(namesA, namesB) {
|
|
15
|
+
if (namesA === void 0) return namesB === void 0 || namesB.length === 0;
|
|
16
|
+
if (namesB === void 0) return namesA.length === 0;
|
|
17
|
+
if (new Set(namesA).size !== namesA.length || new Set(namesB).size !== namesB.length) return false;
|
|
18
|
+
if (namesA.length !== namesB.length) return false;
|
|
19
|
+
return namesA.every((a) => namesB.includes(a));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Checks whether two proof requests are semantically equal. The `name`, `version` and `nonce`, `ver` fields are ignored.
|
|
23
|
+
* In addition the group names don't have to be the same between the different requests.
|
|
24
|
+
*/
|
|
25
|
+
function areAnonCredsProofRequestsEqual(requestA, requestB) {
|
|
26
|
+
if (!isNonRevokedEqual(requestA.non_revoked, requestB.non_revoked)) return false;
|
|
27
|
+
const attributeAList = Object.values(requestA.requested_attributes);
|
|
28
|
+
const attributeBList = Object.values(requestB.requested_attributes);
|
|
29
|
+
if (attributeAList.length !== attributeBList.length) return false;
|
|
30
|
+
if (!attributeAList.every((a) => {
|
|
31
|
+
const bIndex = attributeBList.findIndex((b) => {
|
|
32
|
+
return b.name === a.name && areNamesEqual(a.names, b.names) && isNonRevokedEqual(a.non_revoked, b.non_revoked) && areRestrictionsEqual(a.restrictions, b.restrictions);
|
|
33
|
+
});
|
|
34
|
+
if (bIndex !== -1) {
|
|
35
|
+
attributeBList.splice(bIndex, 1);
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
})) return false;
|
|
40
|
+
const predicatesA = Object.values(requestA.requested_predicates);
|
|
41
|
+
const predicatesB = Object.values(requestB.requested_predicates);
|
|
42
|
+
if (predicatesA.length !== predicatesB.length) return false;
|
|
43
|
+
if (!predicatesA.every((a) => {
|
|
44
|
+
const bIndex = predicatesB.findIndex((b) => {
|
|
45
|
+
return a.name === b.name && a.p_type === b.p_type && a.p_value === b.p_value && isNonRevokedEqual(a.non_revoked, b.non_revoked) && areRestrictionsEqual(a.restrictions, b.restrictions);
|
|
46
|
+
});
|
|
47
|
+
if (bIndex !== -1) {
|
|
48
|
+
predicatesB.splice(bIndex, 1);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
})) return false;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Checks whether two non-revocation intervals are semantically equal. They are considered equal if:
|
|
57
|
+
* - Both are undefined
|
|
58
|
+
* - Both are empty objects
|
|
59
|
+
* - One if undefined and the other is an empty object
|
|
60
|
+
* - Both have the same from and to values
|
|
61
|
+
*/
|
|
62
|
+
function isNonRevokedEqual(nonRevokedA, nonRevokedB) {
|
|
63
|
+
if (nonRevokedA === void 0) return nonRevokedB === void 0 || nonRevokedB.from === void 0 && nonRevokedB.to === void 0;
|
|
64
|
+
if (nonRevokedB === void 0) return nonRevokedA.from === void 0 && nonRevokedA.to === void 0;
|
|
65
|
+
return nonRevokedA.from === nonRevokedB.from && nonRevokedA.to === nonRevokedB.to;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Check if two restriction lists are equal. The order of the restrictions does not matter.
|
|
69
|
+
*/
|
|
70
|
+
function areRestrictionsEqual(restrictionsA, restrictionsB) {
|
|
71
|
+
if (restrictionsA === void 0) return restrictionsB === void 0 || restrictionsB.length === 0;
|
|
72
|
+
if (restrictionsB === void 0) return restrictionsA.length === 0;
|
|
73
|
+
const bList = [...restrictionsB];
|
|
74
|
+
return restrictionsA.every((a) => {
|
|
75
|
+
const bIndex = restrictionsB.findIndex((b) => areObjectsEqual(a, b));
|
|
76
|
+
if (bIndex !== -1) {
|
|
77
|
+
bList.splice(bIndex, 1);
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
export { areAnonCredsProofRequestsEqual };
|
|
86
|
+
//# sourceMappingURL=areRequestsEqual.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areRequestsEqual.mjs","names":[],"sources":["../../src/utils/areRequestsEqual.ts"],"sourcesContent":["import type { AnonCredsNonRevokedInterval, AnonCredsProofRequest, AnonCredsProofRequestRestriction } from '../models'\n\n// Copied from the core package so we don't have to export these silly utils. We should probably move these to a separate package.\n// biome-ignore lint/suspicious/noExplicitAny: no explanation\nfunction areObjectsEqual(a: any, b: any): boolean {\n if (typeof a === 'object' && a != null && typeof b === 'object' && b != null) {\n if (Object.keys(a).length !== Object.keys(b).length) return false\n for (const key in a) {\n if (!(key in b) || !areObjectsEqual(a[key], b[key])) {\n return false\n }\n }\n for (const key in b) {\n if (!(key in a) || !areObjectsEqual(b[key], a[key])) {\n return false\n }\n }\n return true\n }\n return a === b\n}\n\n/**\n * Checks whether two `names` arrays are equal. The order of the names doesn't matter.\n */\nfunction areNamesEqual(namesA: string[] | undefined, namesB: string[] | undefined) {\n if (namesA === undefined) return namesB === undefined || namesB.length === 0\n if (namesB === undefined) return namesA.length === 0\n\n // Check if there are any duplicates\n if (new Set(namesA).size !== namesA.length || new Set(namesB).size !== namesB.length) return false\n\n // Check if the number of names is equal between A & B\n if (namesA.length !== namesB.length) return false\n\n return namesA.every((a) => namesB.includes(a))\n}\n\n/**\n * Checks whether two proof requests are semantically equal. The `name`, `version` and `nonce`, `ver` fields are ignored.\n * In addition the group names don't have to be the same between the different requests.\n */\nexport function areAnonCredsProofRequestsEqual(\n requestA: AnonCredsProofRequest,\n requestB: AnonCredsProofRequest\n): boolean {\n // Check if the top-level non-revocation interval is equal\n if (!isNonRevokedEqual(requestA.non_revoked, requestB.non_revoked)) return false\n\n const attributeAList = Object.values(requestA.requested_attributes)\n const attributeBList = Object.values(requestB.requested_attributes)\n\n // Check if the number of attribute groups is equal in both requests\n if (attributeAList.length !== attributeBList.length) return false\n\n // Check if all attribute groups in A are also in B\n const attributesMatch = attributeAList.every((a) => {\n // find an attribute in B that matches this attribute\n const bIndex = attributeBList.findIndex((b) => {\n return (\n b.name === a.name &&\n areNamesEqual(a.names, b.names) &&\n isNonRevokedEqual(a.non_revoked, b.non_revoked) &&\n areRestrictionsEqual(a.restrictions, b.restrictions)\n )\n })\n\n // Match found\n if (bIndex !== -1) {\n attributeBList.splice(bIndex, 1)\n return true\n }\n\n // Match not found\n return false\n })\n\n if (!attributesMatch) return false\n\n const predicatesA = Object.values(requestA.requested_predicates)\n const predicatesB = Object.values(requestB.requested_predicates)\n\n if (predicatesA.length !== predicatesB.length) return false\n const predicatesMatch = predicatesA.every((a) => {\n // find a predicate in B that matches this predicate\n const bIndex = predicatesB.findIndex((b) => {\n return (\n a.name === b.name &&\n a.p_type === b.p_type &&\n a.p_value === b.p_value &&\n isNonRevokedEqual(a.non_revoked, b.non_revoked) &&\n areRestrictionsEqual(a.restrictions, b.restrictions)\n )\n })\n\n if (bIndex !== -1) {\n predicatesB.splice(bIndex, 1)\n return true\n }\n\n return false\n })\n\n if (!predicatesMatch) return false\n\n return true\n}\n\n/**\n * Checks whether two non-revocation intervals are semantically equal. They are considered equal if:\n * - Both are undefined\n * - Both are empty objects\n * - One if undefined and the other is an empty object\n * - Both have the same from and to values\n */\nfunction isNonRevokedEqual(\n nonRevokedA: AnonCredsNonRevokedInterval | undefined,\n nonRevokedB: AnonCredsNonRevokedInterval | undefined\n) {\n // Having an empty non-revoked object is the same as not having one\n if (nonRevokedA === undefined)\n return nonRevokedB === undefined || (nonRevokedB.from === undefined && nonRevokedB.to === undefined)\n if (nonRevokedB === undefined) return nonRevokedA.from === undefined && nonRevokedA.to === undefined\n\n return nonRevokedA.from === nonRevokedB.from && nonRevokedA.to === nonRevokedB.to\n}\n\n/**\n * Check if two restriction lists are equal. The order of the restrictions does not matter.\n */\nfunction areRestrictionsEqual(\n restrictionsA: AnonCredsProofRequestRestriction[] | undefined,\n restrictionsB: AnonCredsProofRequestRestriction[] | undefined\n) {\n // Having an undefined restrictions property or an empty array is the same\n if (restrictionsA === undefined) return restrictionsB === undefined || restrictionsB.length === 0\n if (restrictionsB === undefined) return restrictionsA.length === 0\n\n // Clone array to not modify input object\n const bList = [...restrictionsB]\n\n // Check if all restrictions in A are also in B\n return restrictionsA.every((a) => {\n const bIndex = restrictionsB.findIndex((b) => areObjectsEqual(a, b))\n\n // Match found\n if (bIndex !== -1) {\n bList.splice(bIndex, 1)\n return true\n }\n\n // Match not found\n return false\n })\n}\n"],"mappings":";AAIA,SAAS,gBAAgB,GAAQ,GAAiB;AAChD,KAAI,OAAO,MAAM,YAAY,KAAK,QAAQ,OAAO,MAAM,YAAY,KAAK,MAAM;AAC5E,MAAI,OAAO,KAAK,EAAE,CAAC,WAAW,OAAO,KAAK,EAAE,CAAC,OAAQ,QAAO;AAC5D,OAAK,MAAM,OAAO,EAChB,KAAI,EAAE,OAAO,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,CACjD,QAAO;AAGX,OAAK,MAAM,OAAO,EAChB,KAAI,EAAE,OAAO,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,CACjD,QAAO;AAGX,SAAO;;AAET,QAAO,MAAM;;;;;AAMf,SAAS,cAAc,QAA8B,QAA8B;AACjF,KAAI,WAAW,OAAW,QAAO,WAAW,UAAa,OAAO,WAAW;AAC3E,KAAI,WAAW,OAAW,QAAO,OAAO,WAAW;AAGnD,KAAI,IAAI,IAAI,OAAO,CAAC,SAAS,OAAO,UAAU,IAAI,IAAI,OAAO,CAAC,SAAS,OAAO,OAAQ,QAAO;AAG7F,KAAI,OAAO,WAAW,OAAO,OAAQ,QAAO;AAE5C,QAAO,OAAO,OAAO,MAAM,OAAO,SAAS,EAAE,CAAC;;;;;;AAOhD,SAAgB,+BACd,UACA,UACS;AAET,KAAI,CAAC,kBAAkB,SAAS,aAAa,SAAS,YAAY,CAAE,QAAO;CAE3E,MAAM,iBAAiB,OAAO,OAAO,SAAS,qBAAqB;CACnE,MAAM,iBAAiB,OAAO,OAAO,SAAS,qBAAqB;AAGnE,KAAI,eAAe,WAAW,eAAe,OAAQ,QAAO;AAwB5D,KAAI,CArBoB,eAAe,OAAO,MAAM;EAElD,MAAM,SAAS,eAAe,WAAW,MAAM;AAC7C,UACE,EAAE,SAAS,EAAE,QACb,cAAc,EAAE,OAAO,EAAE,MAAM,IAC/B,kBAAkB,EAAE,aAAa,EAAE,YAAY,IAC/C,qBAAqB,EAAE,cAAc,EAAE,aAAa;IAEtD;AAGF,MAAI,WAAW,IAAI;AACjB,kBAAe,OAAO,QAAQ,EAAE;AAChC,UAAO;;AAIT,SAAO;GACP,CAEoB,QAAO;CAE7B,MAAM,cAAc,OAAO,OAAO,SAAS,qBAAqB;CAChE,MAAM,cAAc,OAAO,OAAO,SAAS,qBAAqB;AAEhE,KAAI,YAAY,WAAW,YAAY,OAAQ,QAAO;AAqBtD,KAAI,CApBoB,YAAY,OAAO,MAAM;EAE/C,MAAM,SAAS,YAAY,WAAW,MAAM;AAC1C,UACE,EAAE,SAAS,EAAE,QACb,EAAE,WAAW,EAAE,UACf,EAAE,YAAY,EAAE,WAChB,kBAAkB,EAAE,aAAa,EAAE,YAAY,IAC/C,qBAAqB,EAAE,cAAc,EAAE,aAAa;IAEtD;AAEF,MAAI,WAAW,IAAI;AACjB,eAAY,OAAO,QAAQ,EAAE;AAC7B,UAAO;;AAGT,SAAO;GACP,CAEoB,QAAO;AAE7B,QAAO;;;;;;;;;AAUT,SAAS,kBACP,aACA,aACA;AAEA,KAAI,gBAAgB,OAClB,QAAO,gBAAgB,UAAc,YAAY,SAAS,UAAa,YAAY,OAAO;AAC5F,KAAI,gBAAgB,OAAW,QAAO,YAAY,SAAS,UAAa,YAAY,OAAO;AAE3F,QAAO,YAAY,SAAS,YAAY,QAAQ,YAAY,OAAO,YAAY;;;;;AAMjF,SAAS,qBACP,eACA,eACA;AAEA,KAAI,kBAAkB,OAAW,QAAO,kBAAkB,UAAa,cAAc,WAAW;AAChG,KAAI,kBAAkB,OAAW,QAAO,cAAc,WAAW;CAGjE,MAAM,QAAQ,CAAC,GAAG,cAAc;AAGhC,QAAO,cAAc,OAAO,MAAM;EAChC,MAAM,SAAS,cAAc,WAAW,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAGpE,MAAI,WAAW,IAAI;AACjB,SAAM,OAAO,QAAQ,EAAE;AACvB,UAAO;;AAIT,SAAO;GACP"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/utils/bytesToBigint.ts
|
|
2
|
+
function bytesToBigint(b) {
|
|
3
|
+
if (b.length === 0) throw new Error("Empty byte array is not supported");
|
|
4
|
+
let value = 0n;
|
|
5
|
+
for (let i = 0; i < b.length; i++) value = value << 8n | BigInt(b[i]);
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { bytesToBigint };
|
|
11
|
+
//# sourceMappingURL=bytesToBigint.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytesToBigint.mjs","names":[],"sources":["../../src/utils/bytesToBigint.ts"],"sourcesContent":["import type { AnyUint8Array } from '@credo-ts/core'\n\nexport function bytesToBigint(b: AnyUint8Array): bigint {\n if (b.length === 0) {\n throw new Error('Empty byte array is not supported')\n }\n\n let value = 0n\n for (let i = 0; i < b.length; i++) {\n value = (value << 8n) | BigInt(b[i])\n }\n\n return value\n}\n"],"mappings":";AAEA,SAAgB,cAAc,GAA0B;AACtD,KAAI,EAAE,WAAW,EACf,OAAM,IAAI,MAAM,oCAAoC;CAGtD,IAAI,QAAQ;AACZ,MAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,IAC5B,SAAS,SAAS,KAAM,OAAO,EAAE,GAAG;AAGtC,QAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { DidCommAutoAcceptCredential, DidCommAutoAcceptProof } from "@credo-ts/didcomm";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DidCommAutoAcceptCredential, DidCommAutoAcceptProof } from "@credo-ts/didcomm";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/composeAutoAccept.ts
|
|
4
|
+
/**
|
|
5
|
+
* Returns the credential auto accept config based on priority:
|
|
6
|
+
* - The record config takes first priority
|
|
7
|
+
* - Otherwise the agent config
|
|
8
|
+
* - Otherwise {@link DidCommAutoAcceptCredential.Never} is returned
|
|
9
|
+
*/
|
|
10
|
+
function composeCredentialAutoAccept(recordConfig, agentConfig) {
|
|
11
|
+
return recordConfig ?? agentConfig ?? DidCommAutoAcceptCredential.Never;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Returns the proof auto accept config based on priority:
|
|
15
|
+
* - The record config takes first priority
|
|
16
|
+
* - Otherwise the agent config
|
|
17
|
+
* - Otherwise {@link DidCommAutoAcceptProof.Never} is returned
|
|
18
|
+
*/
|
|
19
|
+
function composeProofAutoAccept(recordConfig, agentConfig) {
|
|
20
|
+
return recordConfig ?? agentConfig ?? DidCommAutoAcceptProof.Never;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { composeCredentialAutoAccept, composeProofAutoAccept };
|
|
25
|
+
//# sourceMappingURL=composeAutoAccept.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeAutoAccept.mjs","names":[],"sources":["../../src/utils/composeAutoAccept.ts"],"sourcesContent":["import { DidCommAutoAcceptCredential, DidCommAutoAcceptProof } from '@credo-ts/didcomm'\n\n/**\n * Returns the credential auto accept config based on priority:\n *\t- The record config takes first priority\n *\t- Otherwise the agent config\n *\t- Otherwise {@link DidCommAutoAcceptCredential.Never} is returned\n */\nexport function composeCredentialAutoAccept(\n recordConfig?: DidCommAutoAcceptCredential,\n agentConfig?: DidCommAutoAcceptCredential\n) {\n return recordConfig ?? agentConfig ?? DidCommAutoAcceptCredential.Never\n}\n\n/**\n * Returns the proof auto accept config based on priority:\n *\t- The record config takes first priority\n *\t- Otherwise the agent config\n *\t- Otherwise {@link DidCommAutoAcceptProof.Never} is returned\n */\nexport function composeProofAutoAccept(recordConfig?: DidCommAutoAcceptProof, agentConfig?: DidCommAutoAcceptProof) {\n return recordConfig ?? agentConfig ?? DidCommAutoAcceptProof.Never\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,4BACd,cACA,aACA;AACA,QAAO,gBAAgB,eAAe,4BAA4B;;;;;;;;AASpE,SAAgB,uBAAuB,cAAuC,aAAsC;AAClH,QAAO,gBAAgB,eAAe,uBAAuB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { utils } from "@credo-ts/core";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/createRequestFromPreview.ts
|
|
4
|
+
function createRequestFromPreview({ name, version, nonce, attributes, predicates, nonRevokedInterval }) {
|
|
5
|
+
const proofRequest = {
|
|
6
|
+
name,
|
|
7
|
+
version,
|
|
8
|
+
nonce,
|
|
9
|
+
requested_attributes: {},
|
|
10
|
+
requested_predicates: {}
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Create mapping of attributes by referent. This required the
|
|
14
|
+
* attributes to come from the same credential.
|
|
15
|
+
* @see https://github.com/hyperledger/aries-rfcs/blob/master/features/0037-present-proof/README.md#referent
|
|
16
|
+
*
|
|
17
|
+
* {
|
|
18
|
+
* "referent1": [Attribute1, Attribute2],
|
|
19
|
+
* "referent2": [Attribute3]
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
const attributesByReferent = {};
|
|
23
|
+
for (const proposedAttributes of attributes ?? []) {
|
|
24
|
+
const referent = proposedAttributes.referent ?? utils.uuid();
|
|
25
|
+
const referentAttributes = attributesByReferent[referent];
|
|
26
|
+
if (referentAttributes) referentAttributes.push(proposedAttributes);
|
|
27
|
+
else attributesByReferent[referent] = [proposedAttributes];
|
|
28
|
+
}
|
|
29
|
+
for (const [referent, proposedAttributes] of Object.entries(attributesByReferent)) {
|
|
30
|
+
const attributeName = proposedAttributes.length === 1 ? proposedAttributes[0].name : void 0;
|
|
31
|
+
const attributeNames = proposedAttributes.length > 1 ? proposedAttributes.map((a) => a.name) : void 0;
|
|
32
|
+
proofRequest.requested_attributes[referent] = {
|
|
33
|
+
name: attributeName,
|
|
34
|
+
names: attributeNames,
|
|
35
|
+
restrictions: [{ cred_def_id: proposedAttributes[0].credentialDefinitionId }]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
for (const proposedPredicate of predicates ?? []) proofRequest.requested_predicates[utils.uuid()] = {
|
|
39
|
+
name: proposedPredicate.name,
|
|
40
|
+
p_type: proposedPredicate.predicate,
|
|
41
|
+
p_value: proposedPredicate.threshold,
|
|
42
|
+
restrictions: [{ cred_def_id: proposedPredicate.credentialDefinitionId }]
|
|
43
|
+
};
|
|
44
|
+
if (nonRevokedInterval) proofRequest.non_revoked = nonRevokedInterval;
|
|
45
|
+
return proofRequest;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { createRequestFromPreview };
|
|
50
|
+
//# sourceMappingURL=createRequestFromPreview.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRequestFromPreview.mjs","names":["proofRequest: AnonCredsProofRequest","attributesByReferent: Record<string, AnonCredsPresentationPreviewAttribute[]>"],"sources":["../../src/utils/createRequestFromPreview.ts"],"sourcesContent":["import { utils } from '@credo-ts/core'\nimport type {\n AnonCredsPresentationPreviewAttribute,\n AnonCredsPresentationPreviewPredicate,\n} from '../formats/AnonCredsDidCommProofFormat'\nimport type { AnonCredsNonRevokedInterval, AnonCredsProofRequest } from '../models'\n\nexport function createRequestFromPreview({\n name,\n version,\n nonce,\n attributes,\n predicates,\n nonRevokedInterval,\n}: {\n name: string\n version: string\n nonce: string\n attributes: AnonCredsPresentationPreviewAttribute[]\n predicates: AnonCredsPresentationPreviewPredicate[]\n nonRevokedInterval?: AnonCredsNonRevokedInterval\n}): AnonCredsProofRequest {\n const proofRequest: AnonCredsProofRequest = {\n name,\n version,\n nonce,\n requested_attributes: {},\n requested_predicates: {},\n }\n\n /**\n * Create mapping of attributes by referent. This required the\n * attributes to come from the same credential.\n * @see https://github.com/hyperledger/aries-rfcs/blob/master/features/0037-present-proof/README.md#referent\n *\n * {\n * \"referent1\": [Attribute1, Attribute2],\n * \"referent2\": [Attribute3]\n * }\n */\n const attributesByReferent: Record<string, AnonCredsPresentationPreviewAttribute[]> = {}\n for (const proposedAttributes of attributes ?? []) {\n const referent = proposedAttributes.referent ?? utils.uuid()\n\n const referentAttributes = attributesByReferent[referent]\n\n // Referent key already exist, add to list\n if (referentAttributes) {\n referentAttributes.push(proposedAttributes)\n }\n\n // Referent key does not exist yet, create new entry\n else {\n attributesByReferent[referent] = [proposedAttributes]\n }\n }\n\n // Transform attributes by referent to requested attributes\n for (const [referent, proposedAttributes] of Object.entries(attributesByReferent)) {\n // Either attributeName or attributeNames will be undefined\n const attributeName = proposedAttributes.length === 1 ? proposedAttributes[0].name : undefined\n const attributeNames = proposedAttributes.length > 1 ? proposedAttributes.map((a) => a.name) : undefined\n\n proofRequest.requested_attributes[referent] = {\n name: attributeName,\n names: attributeNames,\n restrictions: [\n {\n cred_def_id: proposedAttributes[0].credentialDefinitionId,\n },\n ],\n }\n }\n\n // Transform proposed predicates to requested predicates\n for (const proposedPredicate of predicates ?? []) {\n proofRequest.requested_predicates[utils.uuid()] = {\n name: proposedPredicate.name,\n p_type: proposedPredicate.predicate,\n p_value: proposedPredicate.threshold,\n restrictions: [\n {\n cred_def_id: proposedPredicate.credentialDefinitionId,\n },\n ],\n }\n }\n\n // TODO: local non_revoked?\n if (nonRevokedInterval) {\n proofRequest.non_revoked = nonRevokedInterval\n }\n\n return proofRequest\n}\n"],"mappings":";;;AAOA,SAAgB,yBAAyB,EACvC,MACA,SACA,OACA,YACA,YACA,sBAQwB;CACxB,MAAMA,eAAsC;EAC1C;EACA;EACA;EACA,sBAAsB,EAAE;EACxB,sBAAsB,EAAE;EACzB;;;;;;;;;;;CAYD,MAAMC,uBAAgF,EAAE;AACxF,MAAK,MAAM,sBAAsB,cAAc,EAAE,EAAE;EACjD,MAAM,WAAW,mBAAmB,YAAY,MAAM,MAAM;EAE5D,MAAM,qBAAqB,qBAAqB;AAGhD,MAAI,mBACF,oBAAmB,KAAK,mBAAmB;MAK3C,sBAAqB,YAAY,CAAC,mBAAmB;;AAKzD,MAAK,MAAM,CAAC,UAAU,uBAAuB,OAAO,QAAQ,qBAAqB,EAAE;EAEjF,MAAM,gBAAgB,mBAAmB,WAAW,IAAI,mBAAmB,GAAG,OAAO;EACrF,MAAM,iBAAiB,mBAAmB,SAAS,IAAI,mBAAmB,KAAK,MAAM,EAAE,KAAK,GAAG;AAE/F,eAAa,qBAAqB,YAAY;GAC5C,MAAM;GACN,OAAO;GACP,cAAc,CACZ,EACE,aAAa,mBAAmB,GAAG,wBACpC,CACF;GACF;;AAIH,MAAK,MAAM,qBAAqB,cAAc,EAAE,CAC9C,cAAa,qBAAqB,MAAM,MAAM,IAAI;EAChD,MAAM,kBAAkB;EACxB,QAAQ,kBAAkB;EAC1B,SAAS,kBAAkB;EAC3B,cAAc,CACZ,EACE,aAAa,kBAAkB,wBAChC,CACF;EACF;AAIH,KAAI,mBACF,cAAa,cAAc;AAG7B,QAAO"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "../models/index.mjs";
|
|
2
|
+
import { DidCommCredentialPreviewAttributeOptions } from "@credo-ts/didcomm";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/credential.d.ts
|
|
5
|
+
type AnonCredsClaimRecord = Record<string, string | number>;
|
|
6
|
+
interface AnonCredsCredentialValue {
|
|
7
|
+
raw: string;
|
|
8
|
+
encoded: string;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { AnonCredsClaimRecord, AnonCredsCredentialValue };
|
|
12
|
+
//# sourceMappingURL=credential.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential.d.mts","names":[],"sources":["../../src/utils/credential.ts"],"sourcesContent":[],"mappings":";;;;KAMY,oBAAA,GAAuB;UAElB,wBAAA;EAFL,GAAA,EAAA,MAAA;EAEK,OAAA,EAAA,MAAA"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { bytesToBigint } from "./bytesToBigint.mjs";
|
|
2
|
+
import { CredoError, Hasher, TypedArrayEncoder } from "@credo-ts/core";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/credential.ts
|
|
5
|
+
const isString = (value) => typeof value === "string";
|
|
6
|
+
const isNumber = (value) => typeof value === "number";
|
|
7
|
+
const isBoolean = (value) => typeof value === "boolean";
|
|
8
|
+
const isNumeric = (value) => /^-?\d+$/.test(value);
|
|
9
|
+
const isInt32 = (number) => {
|
|
10
|
+
return Number.isInteger(number) && number >= -2147483648 && number <= 2147483647;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Encode value according to the encoding format described in Aries RFC 0036/0037
|
|
14
|
+
*
|
|
15
|
+
* @param value
|
|
16
|
+
* @returns Encoded version of value
|
|
17
|
+
*
|
|
18
|
+
* @see https://github.com/hyperledger/aries-cloudagent-python/blob/0000f924a50b6ac5e6342bff90e64864672ee935/aries_cloudagent/messaging/util.py#L106-L136
|
|
19
|
+
* @see https://github.com/hyperledger/aries-rfcs/blob/be4ad0a6fb2823bb1fc109364c96f077d5d8dffa/features/0037-present-proof/README.md#verifying-claims-of-indy-based-verifiable-credentials
|
|
20
|
+
* @see https://github.com/hyperledger/aries-rfcs/blob/be4ad0a6fb2823bb1fc109364c96f077d5d8dffa/features/0036-issue-credential/README.md#encoding-claims-for-indy-based-verifiable-credentials
|
|
21
|
+
*/
|
|
22
|
+
function encodeCredentialValue(value) {
|
|
23
|
+
const isEmpty = (value$1) => isString(value$1) && value$1 === "";
|
|
24
|
+
if (isBoolean(value)) return Number(value).toString();
|
|
25
|
+
if (isNumber(value) && isInt32(value)) return value.toString();
|
|
26
|
+
if (isString(value) && !isEmpty(value) && !Number.isNaN(Number(value)) && isNumeric(value) && isInt32(Number(value))) return Number(value).toString();
|
|
27
|
+
if (isNumber(value)) value = value.toString();
|
|
28
|
+
if (value === null || value === void 0) value = "None";
|
|
29
|
+
const buffer = TypedArrayEncoder.fromString(String(value));
|
|
30
|
+
return bytesToBigint(Hasher.hash(buffer, "sha-256")).toString();
|
|
31
|
+
}
|
|
32
|
+
const mapAttributeRawValuesToAnonCredsCredentialValues = (record) => {
|
|
33
|
+
const credentialValues = {};
|
|
34
|
+
for (const [key, value] of Object.entries(record)) {
|
|
35
|
+
if (typeof value === "object") throw new CredoError("Unsupported value type: object for W3cAnonCreds Credential");
|
|
36
|
+
credentialValues[key] = {
|
|
37
|
+
raw: value.toString(),
|
|
38
|
+
encoded: encodeCredentialValue(value)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return credentialValues;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Converts int value to string
|
|
45
|
+
* Converts string value:
|
|
46
|
+
* - hash with sha256,
|
|
47
|
+
* - convert to byte array and reverse it
|
|
48
|
+
* - convert it to BigInteger and return as a string
|
|
49
|
+
* @param attributes
|
|
50
|
+
*
|
|
51
|
+
* @returns CredValues
|
|
52
|
+
*/
|
|
53
|
+
function convertAttributesToCredentialValues(attributes) {
|
|
54
|
+
return attributes.reduce((credentialValues, attribute) => {
|
|
55
|
+
credentialValues[attribute.name] = {
|
|
56
|
+
raw: attribute.value,
|
|
57
|
+
encoded: encodeCredentialValue(attribute.value)
|
|
58
|
+
};
|
|
59
|
+
return credentialValues;
|
|
60
|
+
}, {});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Check whether the values of two credentials match (using {@link assertCredentialValuesMatch})
|
|
64
|
+
*
|
|
65
|
+
* @returns a boolean whether the values are equal
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
function checkCredentialValuesMatch(firstValues, secondValues) {
|
|
69
|
+
try {
|
|
70
|
+
assertCredentialValuesMatch(firstValues, secondValues);
|
|
71
|
+
return true;
|
|
72
|
+
} catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Assert two credential values objects match.
|
|
78
|
+
*
|
|
79
|
+
* @param firstValues The first values object
|
|
80
|
+
* @param secondValues The second values object
|
|
81
|
+
*
|
|
82
|
+
* @throws If not all values match
|
|
83
|
+
*/
|
|
84
|
+
function assertCredentialValuesMatch(firstValues, secondValues) {
|
|
85
|
+
const firstValuesKeys = Object.keys(firstValues);
|
|
86
|
+
const secondValuesKeys = Object.keys(secondValues);
|
|
87
|
+
if (firstValuesKeys.length !== secondValuesKeys.length) throw new Error(`Number of values in first entry (${firstValuesKeys.length}) does not match number of values in second entry (${secondValuesKeys.length})`);
|
|
88
|
+
for (const key of firstValuesKeys) {
|
|
89
|
+
const firstValue = firstValues[key];
|
|
90
|
+
const secondValue = secondValues[key];
|
|
91
|
+
if (!secondValue) throw new Error(`Second cred values object has no value for key '${key}'`);
|
|
92
|
+
if (firstValue.encoded !== secondValue.encoded) throw new Error(`Encoded credential values for key '${key}' do not match`);
|
|
93
|
+
if (firstValue.raw !== secondValue.raw) throw new Error(`Raw credential values for key '${key}' do not match`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Check whether the raw value matches the encoded version according to the encoding format described in Aries RFC 0037
|
|
98
|
+
* Use this method to ensure the received proof (over the encoded) value is the same as the raw value of the data.
|
|
99
|
+
*
|
|
100
|
+
* @param raw
|
|
101
|
+
* @param encoded
|
|
102
|
+
* @returns Whether raw and encoded value match
|
|
103
|
+
*
|
|
104
|
+
* @see https://github.com/hyperledger/aries-framework-dotnet/blob/a18bef91e5b9e4a1892818df7408e2383c642dfa/src/Hyperledger.Aries/Utils/CredentialUtils.cs#L78-L89
|
|
105
|
+
* @see https://github.com/hyperledger/aries-rfcs/blob/be4ad0a6fb2823bb1fc109364c96f077d5d8dffa/features/0037-present-proof/README.md#verifying-claims-of-indy-based-verifiable-credentials
|
|
106
|
+
*/
|
|
107
|
+
function checkValidCredentialValueEncoding(raw, encoded) {
|
|
108
|
+
return encoded === encodeCredentialValue(raw);
|
|
109
|
+
}
|
|
110
|
+
function assertAttributesMatch(schema, attributes) {
|
|
111
|
+
const schemaAttributes = schema.attrNames;
|
|
112
|
+
const credAttributes = attributes.map((a) => a.name);
|
|
113
|
+
const difference = credAttributes.filter((x) => !schemaAttributes.includes(x)).concat(schemaAttributes.filter((x) => !credAttributes.includes(x)));
|
|
114
|
+
if (difference.length > 0) throw new CredoError(`The credential preview attributes do not match the schema attributes (difference is: ${difference}, needs: ${schemaAttributes})`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
//#endregion
|
|
118
|
+
export { assertAttributesMatch, assertCredentialValuesMatch, checkCredentialValuesMatch, checkValidCredentialValueEncoding, convertAttributesToCredentialValues, encodeCredentialValue, mapAttributeRawValuesToAnonCredsCredentialValues };
|
|
119
|
+
//# sourceMappingURL=credential.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential.mjs","names":["value","credentialValues: Record<string, AnonCredsCredentialValue>"],"sources":["../../src/utils/credential.ts"],"sourcesContent":["import { CredoError, Hasher, TypedArrayEncoder } from '@credo-ts/core'\nimport type { DidCommCredentialPreviewAttributeOptions } from '@credo-ts/didcomm'\nimport type { AnonCredsCredentialValues, AnonCredsSchema } from '../models'\n\nimport { bytesToBigint } from './bytesToBigint'\n\nexport type AnonCredsClaimRecord = Record<string, string | number>\n\nexport interface AnonCredsCredentialValue {\n raw: string\n encoded: string // Raw value as number in string\n}\n\nconst isString = (value: unknown): value is string => typeof value === 'string'\nconst isNumber = (value: unknown): value is number => typeof value === 'number'\nconst isBoolean = (value: unknown): value is boolean => typeof value === 'boolean'\nconst isNumeric = (value: string) => /^-?\\d+$/.test(value)\n\nconst isInt32 = (number: number) => {\n const minI32 = -2147483648\n const maxI32 = 2147483647\n\n // Check if number is integer and in range of int32\n return Number.isInteger(number) && number >= minI32 && number <= maxI32\n}\n\n// TODO: this function can only encode strings\n// If encoding numbers we run into problems with 0.0 representing the same value as 0 and is implicitly converted to 0\n/**\n * Encode value according to the encoding format described in Aries RFC 0036/0037\n *\n * @param value\n * @returns Encoded version of value\n *\n * @see https://github.com/hyperledger/aries-cloudagent-python/blob/0000f924a50b6ac5e6342bff90e64864672ee935/aries_cloudagent/messaging/util.py#L106-L136\n * @see https://github.com/hyperledger/aries-rfcs/blob/be4ad0a6fb2823bb1fc109364c96f077d5d8dffa/features/0037-present-proof/README.md#verifying-claims-of-indy-based-verifiable-credentials\n * @see https://github.com/hyperledger/aries-rfcs/blob/be4ad0a6fb2823bb1fc109364c96f077d5d8dffa/features/0036-issue-credential/README.md#encoding-claims-for-indy-based-verifiable-credentials\n */\nexport function encodeCredentialValue(value: unknown) {\n const isEmpty = (value: unknown) => isString(value) && value === ''\n\n // If bool return bool as number string\n if (isBoolean(value)) {\n return Number(value).toString()\n }\n\n // If value is int32 return as number string\n if (isNumber(value) && isInt32(value)) {\n return value.toString()\n }\n\n // If value is an int32 number string return as number string\n if (\n isString(value) &&\n !isEmpty(value) &&\n !Number.isNaN(Number(value)) &&\n isNumeric(value) &&\n isInt32(Number(value))\n ) {\n return Number(value).toString()\n }\n\n if (isNumber(value)) {\n value = value.toString()\n }\n\n // If value is null we must use the string value 'None'\n if (value === null || value === undefined) {\n value = 'None'\n }\n\n const buffer = TypedArrayEncoder.fromString(String(value))\n const hash = Hasher.hash(buffer, 'sha-256')\n\n return bytesToBigint(hash).toString()\n}\n\nexport const mapAttributeRawValuesToAnonCredsCredentialValues = (\n record: AnonCredsClaimRecord\n): Record<string, AnonCredsCredentialValue> => {\n const credentialValues: Record<string, AnonCredsCredentialValue> = {}\n\n for (const [key, value] of Object.entries(record)) {\n if (typeof value === 'object') {\n throw new CredoError('Unsupported value type: object for W3cAnonCreds Credential')\n }\n credentialValues[key] = {\n raw: value.toString(),\n encoded: encodeCredentialValue(value),\n }\n }\n\n return credentialValues\n}\n\n/**\n * Converts int value to string\n * Converts string value:\n * - hash with sha256,\n * - convert to byte array and reverse it\n * - convert it to BigInteger and return as a string\n * @param attributes\n *\n * @returns CredValues\n */\nexport function convertAttributesToCredentialValues(\n attributes: DidCommCredentialPreviewAttributeOptions[]\n): AnonCredsCredentialValues {\n return attributes.reduce<AnonCredsCredentialValues>((credentialValues, attribute) => {\n credentialValues[attribute.name] = {\n raw: attribute.value,\n encoded: encodeCredentialValue(attribute.value),\n }\n return credentialValues\n }, {})\n}\n\n/**\n * Check whether the values of two credentials match (using {@link assertCredentialValuesMatch})\n *\n * @returns a boolean whether the values are equal\n *\n */\nexport function checkCredentialValuesMatch(\n firstValues: AnonCredsCredentialValues,\n secondValues: AnonCredsCredentialValues\n): boolean {\n try {\n assertCredentialValuesMatch(firstValues, secondValues)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Assert two credential values objects match.\n *\n * @param firstValues The first values object\n * @param secondValues The second values object\n *\n * @throws If not all values match\n */\nexport function assertCredentialValuesMatch(\n firstValues: AnonCredsCredentialValues,\n secondValues: AnonCredsCredentialValues\n) {\n const firstValuesKeys = Object.keys(firstValues)\n const secondValuesKeys = Object.keys(secondValues)\n\n if (firstValuesKeys.length !== secondValuesKeys.length) {\n throw new Error(\n `Number of values in first entry (${firstValuesKeys.length}) does not match number of values in second entry (${secondValuesKeys.length})`\n )\n }\n\n for (const key of firstValuesKeys) {\n const firstValue = firstValues[key]\n const secondValue = secondValues[key]\n\n if (!secondValue) {\n throw new Error(`Second cred values object has no value for key '${key}'`)\n }\n\n if (firstValue.encoded !== secondValue.encoded) {\n throw new Error(`Encoded credential values for key '${key}' do not match`)\n }\n\n if (firstValue.raw !== secondValue.raw) {\n throw new Error(`Raw credential values for key '${key}' do not match`)\n }\n }\n}\n\n/**\n * Check whether the raw value matches the encoded version according to the encoding format described in Aries RFC 0037\n * Use this method to ensure the received proof (over the encoded) value is the same as the raw value of the data.\n *\n * @param raw\n * @param encoded\n * @returns Whether raw and encoded value match\n *\n * @see https://github.com/hyperledger/aries-framework-dotnet/blob/a18bef91e5b9e4a1892818df7408e2383c642dfa/src/Hyperledger.Aries/Utils/CredentialUtils.cs#L78-L89\n * @see https://github.com/hyperledger/aries-rfcs/blob/be4ad0a6fb2823bb1fc109364c96f077d5d8dffa/features/0037-present-proof/README.md#verifying-claims-of-indy-based-verifiable-credentials\n */\nexport function checkValidCredentialValueEncoding(raw: unknown, encoded: string) {\n return encoded === encodeCredentialValue(raw)\n}\n\nexport function assertAttributesMatch(schema: AnonCredsSchema, attributes: DidCommCredentialPreviewAttributeOptions[]) {\n const schemaAttributes = schema.attrNames\n const credAttributes = attributes.map((a) => a.name)\n\n const difference = credAttributes\n .filter((x) => !schemaAttributes.includes(x))\n .concat(schemaAttributes.filter((x) => !credAttributes.includes(x)))\n\n if (difference.length > 0) {\n throw new CredoError(\n `The credential preview attributes do not match the schema attributes (difference is: ${difference}, needs: ${schemaAttributes})`\n )\n }\n}\n"],"mappings":";;;;AAaA,MAAM,YAAY,UAAoC,OAAO,UAAU;AACvE,MAAM,YAAY,UAAoC,OAAO,UAAU;AACvE,MAAM,aAAa,UAAqC,OAAO,UAAU;AACzE,MAAM,aAAa,UAAkB,UAAU,KAAK,MAAM;AAE1D,MAAM,WAAW,WAAmB;AAKlC,QAAO,OAAO,UAAU,OAAO,IAAI,UAJpB,eAIwC,UAHxC;;;;;;;;;;;;AAkBjB,SAAgB,sBAAsB,OAAgB;CACpD,MAAM,WAAW,YAAmB,SAASA,QAAM,IAAIA,YAAU;AAGjE,KAAI,UAAU,MAAM,CAClB,QAAO,OAAO,MAAM,CAAC,UAAU;AAIjC,KAAI,SAAS,MAAM,IAAI,QAAQ,MAAM,CACnC,QAAO,MAAM,UAAU;AAIzB,KACE,SAAS,MAAM,IACf,CAAC,QAAQ,MAAM,IACf,CAAC,OAAO,MAAM,OAAO,MAAM,CAAC,IAC5B,UAAU,MAAM,IAChB,QAAQ,OAAO,MAAM,CAAC,CAEtB,QAAO,OAAO,MAAM,CAAC,UAAU;AAGjC,KAAI,SAAS,MAAM,CACjB,SAAQ,MAAM,UAAU;AAI1B,KAAI,UAAU,QAAQ,UAAU,OAC9B,SAAQ;CAGV,MAAM,SAAS,kBAAkB,WAAW,OAAO,MAAM,CAAC;AAG1D,QAAO,cAFM,OAAO,KAAK,QAAQ,UAAU,CAEjB,CAAC,UAAU;;AAGvC,MAAa,oDACX,WAC6C;CAC7C,MAAMC,mBAA6D,EAAE;AAErE,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,EAAE;AACjD,MAAI,OAAO,UAAU,SACnB,OAAM,IAAI,WAAW,6DAA6D;AAEpF,mBAAiB,OAAO;GACtB,KAAK,MAAM,UAAU;GACrB,SAAS,sBAAsB,MAAM;GACtC;;AAGH,QAAO;;;;;;;;;;;;AAaT,SAAgB,oCACd,YAC2B;AAC3B,QAAO,WAAW,QAAmC,kBAAkB,cAAc;AACnF,mBAAiB,UAAU,QAAQ;GACjC,KAAK,UAAU;GACf,SAAS,sBAAsB,UAAU,MAAM;GAChD;AACD,SAAO;IACN,EAAE,CAAC;;;;;;;;AASR,SAAgB,2BACd,aACA,cACS;AACT,KAAI;AACF,8BAA4B,aAAa,aAAa;AACtD,SAAO;SACD;AACN,SAAO;;;;;;;;;;;AAYX,SAAgB,4BACd,aACA,cACA;CACA,MAAM,kBAAkB,OAAO,KAAK,YAAY;CAChD,MAAM,mBAAmB,OAAO,KAAK,aAAa;AAElD,KAAI,gBAAgB,WAAW,iBAAiB,OAC9C,OAAM,IAAI,MACR,oCAAoC,gBAAgB,OAAO,qDAAqD,iBAAiB,OAAO,GACzI;AAGH,MAAK,MAAM,OAAO,iBAAiB;EACjC,MAAM,aAAa,YAAY;EAC/B,MAAM,cAAc,aAAa;AAEjC,MAAI,CAAC,YACH,OAAM,IAAI,MAAM,mDAAmD,IAAI,GAAG;AAG5E,MAAI,WAAW,YAAY,YAAY,QACrC,OAAM,IAAI,MAAM,sCAAsC,IAAI,gBAAgB;AAG5E,MAAI,WAAW,QAAQ,YAAY,IACjC,OAAM,IAAI,MAAM,kCAAkC,IAAI,gBAAgB;;;;;;;;;;;;;;AAgB5E,SAAgB,kCAAkC,KAAc,SAAiB;AAC/E,QAAO,YAAY,sBAAsB,IAAI;;AAG/C,SAAgB,sBAAsB,QAAyB,YAAwD;CACrH,MAAM,mBAAmB,OAAO;CAChC,MAAM,iBAAiB,WAAW,KAAK,MAAM,EAAE,KAAK;CAEpD,MAAM,aAAa,eAChB,QAAQ,MAAM,CAAC,iBAAiB,SAAS,EAAE,CAAC,CAC5C,OAAO,iBAAiB,QAAQ,MAAM,CAAC,eAAe,SAAS,EAAE,CAAC,CAAC;AAEtE,KAAI,WAAW,SAAS,EACtB,OAAM,IAAI,WACR,wFAAwF,WAAW,WAAW,iBAAiB,GAChI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { DidCommCredentialPreviewAttributeOptions } from "@credo-ts/didcomm";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/utils/credentialPreviewAttributes.ts
|
|
2
|
+
function areCredentialPreviewAttributesEqual(firstAttributes, secondAttributes) {
|
|
3
|
+
if (firstAttributes.length !== secondAttributes.length) return false;
|
|
4
|
+
const secondAttributeMap = secondAttributes.reduce((attributeMap, attribute) => {
|
|
5
|
+
attributeMap[attribute.name] = attribute;
|
|
6
|
+
return attributeMap;
|
|
7
|
+
}, {});
|
|
8
|
+
if (new Set(firstAttributes.map((attribute) => attribute.name)).size !== firstAttributes.length) return false;
|
|
9
|
+
if (new Set(secondAttributes.map((attribute) => attribute.name)).size !== secondAttributes.length) return false;
|
|
10
|
+
for (const firstAttribute of firstAttributes) {
|
|
11
|
+
const secondAttribute = secondAttributeMap[firstAttribute.name];
|
|
12
|
+
if (!secondAttribute) return false;
|
|
13
|
+
if (firstAttribute.value !== secondAttribute.value) return false;
|
|
14
|
+
if (firstAttribute.mimeType !== secondAttribute.mimeType) return false;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { areCredentialPreviewAttributesEqual };
|
|
21
|
+
//# sourceMappingURL=credentialPreviewAttributes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentialPreviewAttributes.mjs","names":[],"sources":["../../src/utils/credentialPreviewAttributes.ts"],"sourcesContent":["import type { DidCommCredentialPreviewAttributeOptions } from '@credo-ts/didcomm'\n\nexport function areCredentialPreviewAttributesEqual(\n firstAttributes: DidCommCredentialPreviewAttributeOptions[],\n secondAttributes: DidCommCredentialPreviewAttributeOptions[]\n) {\n if (firstAttributes.length !== secondAttributes.length) return false\n\n const secondAttributeMap = secondAttributes.reduce<Record<string, DidCommCredentialPreviewAttributeOptions>>(\n (attributeMap, attribute) => {\n attributeMap[attribute.name] = attribute\n return attributeMap\n },\n {}\n )\n\n // check if no duplicate keys exist\n if (new Set(firstAttributes.map((attribute) => attribute.name)).size !== firstAttributes.length) return false\n if (new Set(secondAttributes.map((attribute) => attribute.name)).size !== secondAttributes.length) return false\n\n for (const firstAttribute of firstAttributes) {\n const secondAttribute = secondAttributeMap[firstAttribute.name]\n\n if (!secondAttribute) return false\n if (firstAttribute.value !== secondAttribute.value) return false\n if (firstAttribute.mimeType !== secondAttribute.mimeType) return false\n }\n\n return true\n}\n"],"mappings":";AAEA,SAAgB,oCACd,iBACA,kBACA;AACA,KAAI,gBAAgB,WAAW,iBAAiB,OAAQ,QAAO;CAE/D,MAAM,qBAAqB,iBAAiB,QACzC,cAAc,cAAc;AAC3B,eAAa,UAAU,QAAQ;AAC/B,SAAO;IAET,EAAE,CACH;AAGD,KAAI,IAAI,IAAI,gBAAgB,KAAK,cAAc,UAAU,KAAK,CAAC,CAAC,SAAS,gBAAgB,OAAQ,QAAO;AACxG,KAAI,IAAI,IAAI,iBAAiB,KAAK,cAAc,UAAU,KAAK,CAAC,CAAC,SAAS,iBAAiB,OAAQ,QAAO;AAE1G,MAAK,MAAM,kBAAkB,iBAAiB;EAC5C,MAAM,kBAAkB,mBAAmB,eAAe;AAE1D,MAAI,CAAC,gBAAiB,QAAO;AAC7B,MAAI,eAAe,UAAU,gBAAgB,MAAO,QAAO;AAC3D,MAAI,eAAe,aAAa,gBAAgB,SAAU,QAAO;;AAGnE,QAAO"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AnonCredsProofRequest } from "../models/exchange.mjs";
|
|
2
|
+
import "../models/index.mjs";
|
|
3
|
+
import { AnonCredsCredentialsForProofRequest, AnonCredsGetCredentialsForProofRequestOptions } from "../formats/AnonCredsDidCommProofFormat.mjs";
|
|
4
|
+
import "../formats/index.mjs";
|
|
5
|
+
import { AgentContext } from "@credo-ts/core";
|
|
6
|
+
|
|
7
|
+
//#region src/utils/getCredentialsForAnonCredsRequest.d.ts
|
|
8
|
+
declare const getCredentialsForAnonCredsProofRequest: (agentContext: AgentContext, proofRequest: AnonCredsProofRequest, options: AnonCredsGetCredentialsForProofRequestOptions) => Promise<AnonCredsCredentialsForProofRequest>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getCredentialsForAnonCredsProofRequest };
|
|
11
|
+
//# sourceMappingURL=getCredentialsForAnonCredsRequest.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCredentialsForAnonCredsRequest.d.mts","names":[],"sources":["../../src/utils/getCredentialsForAnonCredsRequest.ts"],"sourcesContent":[],"mappings":";;;;;;;cA6Ea,uDACG,4BACA,gCACL,kDACR,QAAQ"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { AnonCredsHolderServiceSymbol } from "../services/AnonCredsHolderService.mjs";
|
|
2
|
+
import "../services/index.mjs";
|
|
3
|
+
import { fetchRevocationStatusList } from "./anonCredsObjects.mjs";
|
|
4
|
+
import { assertBestPracticeRevocationInterval } from "./revocationInterval.mjs";
|
|
5
|
+
import { sortRequestedCredentialsMatches } from "./sortRequestedCredentialsMatches.mjs";
|
|
6
|
+
import { dateToTimestamp } from "./timestamp.mjs";
|
|
7
|
+
|
|
8
|
+
//#region src/utils/getCredentialsForAnonCredsRequest.ts
|
|
9
|
+
const getCredentialsForProofRequestReferent = async (agentContext, proofRequest, attributeReferent) => {
|
|
10
|
+
return await agentContext.dependencyManager.resolve(AnonCredsHolderServiceSymbol).getCredentialsForProofRequest(agentContext, {
|
|
11
|
+
proofRequest,
|
|
12
|
+
attributeReferent
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
const getRevocationStatus = async (agentContext, proofRequest, requestedItem, credentialInfo) => {
|
|
16
|
+
const requestNonRevoked = requestedItem.non_revoked ?? proofRequest.non_revoked;
|
|
17
|
+
const credentialRevocationId = credentialInfo.credentialRevocationId;
|
|
18
|
+
const revocationRegistryId = credentialInfo.revocationRegistryId;
|
|
19
|
+
if (!requestNonRevoked || credentialRevocationId === null || !revocationRegistryId) return {
|
|
20
|
+
isRevoked: void 0,
|
|
21
|
+
timestamp: void 0
|
|
22
|
+
};
|
|
23
|
+
agentContext.config.logger.trace(`Fetching credential revocation status for credential revocation id '${credentialRevocationId}' with revocation interval with from '${requestNonRevoked.from}' and to '${requestNonRevoked.to}'`);
|
|
24
|
+
assertBestPracticeRevocationInterval(requestNonRevoked);
|
|
25
|
+
const { revocationStatusList } = await fetchRevocationStatusList(agentContext, revocationRegistryId, requestNonRevoked.to ?? dateToTimestamp(/* @__PURE__ */ new Date()));
|
|
26
|
+
const isRevoked = revocationStatusList.revocationList[Number.parseInt(credentialRevocationId, 10)] === 1;
|
|
27
|
+
agentContext.config.logger.trace(`Credential with credential revocation index '${credentialRevocationId}' is ${isRevoked ? "" : "not "}revoked with revocation interval with to '${requestNonRevoked.to}' & from '${requestNonRevoked.from}'`);
|
|
28
|
+
return {
|
|
29
|
+
isRevoked,
|
|
30
|
+
timestamp: revocationStatusList.timestamp
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const getCredentialsForAnonCredsProofRequest = async (agentContext, proofRequest, options) => {
|
|
34
|
+
const credentialsForProofRequest = {
|
|
35
|
+
attributes: {},
|
|
36
|
+
predicates: {}
|
|
37
|
+
};
|
|
38
|
+
for (const [referent, requestedAttribute] of Object.entries(proofRequest.requested_attributes)) {
|
|
39
|
+
const credentials = await getCredentialsForProofRequestReferent(agentContext, proofRequest, referent);
|
|
40
|
+
credentialsForProofRequest.attributes[referent] = sortRequestedCredentialsMatches(await Promise.all(credentials.map(async (credential) => {
|
|
41
|
+
const { isRevoked, timestamp } = await getRevocationStatus(agentContext, proofRequest, requestedAttribute, credential.credentialInfo);
|
|
42
|
+
return {
|
|
43
|
+
credentialId: credential.credentialInfo.credentialId,
|
|
44
|
+
revealed: true,
|
|
45
|
+
credentialInfo: credential.credentialInfo,
|
|
46
|
+
timestamp,
|
|
47
|
+
revoked: isRevoked
|
|
48
|
+
};
|
|
49
|
+
})));
|
|
50
|
+
if (options.filterByNonRevocationRequirements) credentialsForProofRequest.attributes[referent] = credentialsForProofRequest.attributes[referent].filter((r) => !r.revoked);
|
|
51
|
+
}
|
|
52
|
+
for (const [referent, requestedPredicate] of Object.entries(proofRequest.requested_predicates)) {
|
|
53
|
+
const credentials = await getCredentialsForProofRequestReferent(agentContext, proofRequest, referent);
|
|
54
|
+
credentialsForProofRequest.predicates[referent] = sortRequestedCredentialsMatches(await Promise.all(credentials.map(async (credential) => {
|
|
55
|
+
const { isRevoked, timestamp } = await getRevocationStatus(agentContext, proofRequest, requestedPredicate, credential.credentialInfo);
|
|
56
|
+
return {
|
|
57
|
+
credentialId: credential.credentialInfo.credentialId,
|
|
58
|
+
credentialInfo: credential.credentialInfo,
|
|
59
|
+
timestamp,
|
|
60
|
+
revoked: isRevoked
|
|
61
|
+
};
|
|
62
|
+
})));
|
|
63
|
+
if (options.filterByNonRevocationRequirements) credentialsForProofRequest.predicates[referent] = credentialsForProofRequest.predicates[referent].filter((r) => !r.revoked);
|
|
64
|
+
}
|
|
65
|
+
return credentialsForProofRequest;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { getCredentialsForAnonCredsProofRequest };
|
|
70
|
+
//# sourceMappingURL=getCredentialsForAnonCredsRequest.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCredentialsForAnonCredsRequest.mjs","names":["credentialsForProofRequest: AnonCredsCredentialsForProofRequest"],"sources":["../../src/utils/getCredentialsForAnonCredsRequest.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport type { AnonCredsCredentialsForProofRequest, AnonCredsGetCredentialsForProofRequestOptions } from '../formats'\nimport type {\n AnonCredsCredentialInfo,\n AnonCredsProofRequest,\n AnonCredsRequestedAttribute,\n AnonCredsRequestedAttributeMatch,\n AnonCredsRequestedPredicate,\n AnonCredsRequestedPredicateMatch,\n} from '../models'\nimport type { AnonCredsHolderService, GetCredentialsForProofRequestReturn } from '../services'\n\nimport { AnonCredsHolderServiceSymbol } from '../services'\n\nimport { fetchRevocationStatusList } from './anonCredsObjects'\nimport { assertBestPracticeRevocationInterval } from './revocationInterval'\nimport { sortRequestedCredentialsMatches } from './sortRequestedCredentialsMatches'\nimport { dateToTimestamp } from './timestamp'\n\nconst getCredentialsForProofRequestReferent = async (\n agentContext: AgentContext,\n proofRequest: AnonCredsProofRequest,\n attributeReferent: string\n): Promise<GetCredentialsForProofRequestReturn> => {\n const holderService = agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n const credentials = await holderService.getCredentialsForProofRequest(agentContext, {\n proofRequest,\n attributeReferent,\n })\n\n return credentials\n}\n\nconst getRevocationStatus = async (\n agentContext: AgentContext,\n proofRequest: AnonCredsProofRequest,\n requestedItem: AnonCredsRequestedAttribute | AnonCredsRequestedPredicate,\n credentialInfo: AnonCredsCredentialInfo\n) => {\n const requestNonRevoked = requestedItem.non_revoked ?? proofRequest.non_revoked\n const credentialRevocationId = credentialInfo.credentialRevocationId\n const revocationRegistryId = credentialInfo.revocationRegistryId\n\n // If revocation interval is not present or the credential is not revocable then we\n // don't need to fetch the revocation status\n if (!requestNonRevoked || credentialRevocationId === null || !revocationRegistryId) {\n return { isRevoked: undefined, timestamp: undefined }\n }\n\n agentContext.config.logger.trace(\n `Fetching credential revocation status for credential revocation id '${credentialRevocationId}' with revocation interval with from '${requestNonRevoked.from}' and to '${requestNonRevoked.to}'`\n )\n\n // Make sure the revocation interval follows best practices from Aries RFC 0441\n assertBestPracticeRevocationInterval(requestNonRevoked)\n\n const { revocationStatusList } = await fetchRevocationStatusList(\n agentContext,\n revocationRegistryId,\n requestNonRevoked.to ?? dateToTimestamp(new Date())\n )\n\n const isRevoked = revocationStatusList.revocationList[Number.parseInt(credentialRevocationId, 10)] === 1\n\n agentContext.config.logger.trace(\n `Credential with credential revocation index '${credentialRevocationId}' is ${\n isRevoked ? '' : 'not '\n }revoked with revocation interval with to '${requestNonRevoked.to}' & from '${requestNonRevoked.from}'`\n )\n\n return {\n isRevoked,\n timestamp: revocationStatusList.timestamp,\n }\n}\n\nexport const getCredentialsForAnonCredsProofRequest = async (\n agentContext: AgentContext,\n proofRequest: AnonCredsProofRequest,\n options: AnonCredsGetCredentialsForProofRequestOptions\n): Promise<AnonCredsCredentialsForProofRequest> => {\n const credentialsForProofRequest: AnonCredsCredentialsForProofRequest = {\n attributes: {},\n predicates: {},\n }\n\n for (const [referent, requestedAttribute] of Object.entries(proofRequest.requested_attributes)) {\n const credentials = await getCredentialsForProofRequestReferent(agentContext, proofRequest, referent)\n\n credentialsForProofRequest.attributes[referent] = sortRequestedCredentialsMatches(\n await Promise.all(\n credentials.map(async (credential) => {\n const { isRevoked, timestamp } = await getRevocationStatus(\n agentContext,\n proofRequest,\n requestedAttribute,\n credential.credentialInfo\n )\n\n return {\n credentialId: credential.credentialInfo.credentialId,\n revealed: true,\n credentialInfo: credential.credentialInfo,\n timestamp,\n revoked: isRevoked,\n } satisfies AnonCredsRequestedAttributeMatch\n })\n )\n )\n\n // We only attach revoked state if non-revocation is requested. So if revoked is true it means\n // the credential is not applicable to the proof request\n if (options.filterByNonRevocationRequirements) {\n credentialsForProofRequest.attributes[referent] = credentialsForProofRequest.attributes[referent].filter(\n (r) => !r.revoked\n )\n }\n }\n\n for (const [referent, requestedPredicate] of Object.entries(proofRequest.requested_predicates)) {\n const credentials = await getCredentialsForProofRequestReferent(agentContext, proofRequest, referent)\n\n credentialsForProofRequest.predicates[referent] = sortRequestedCredentialsMatches(\n await Promise.all(\n credentials.map(async (credential) => {\n const { isRevoked, timestamp } = await getRevocationStatus(\n agentContext,\n proofRequest,\n requestedPredicate,\n credential.credentialInfo\n )\n\n return {\n credentialId: credential.credentialInfo.credentialId,\n credentialInfo: credential.credentialInfo,\n timestamp,\n revoked: isRevoked,\n } satisfies AnonCredsRequestedPredicateMatch\n })\n )\n )\n\n // We only attach revoked state if non-revocation is requested. So if revoked is true it means\n // the credential is not applicable to the proof request\n if (options.filterByNonRevocationRequirements) {\n credentialsForProofRequest.predicates[referent] = credentialsForProofRequest.predicates[referent].filter(\n (r) => !r.revoked\n )\n }\n }\n\n return credentialsForProofRequest\n}\n"],"mappings":";;;;;;;;AAmBA,MAAM,wCAAwC,OAC5C,cACA,cACA,sBACiD;AAQjD,QALoB,MAFE,aAAa,kBAAkB,QAAgC,6BAA6B,CAE1E,8BAA8B,cAAc;EAClF;EACA;EACD,CAAC;;AAKJ,MAAM,sBAAsB,OAC1B,cACA,cACA,eACA,mBACG;CACH,MAAM,oBAAoB,cAAc,eAAe,aAAa;CACpE,MAAM,yBAAyB,eAAe;CAC9C,MAAM,uBAAuB,eAAe;AAI5C,KAAI,CAAC,qBAAqB,2BAA2B,QAAQ,CAAC,qBAC5D,QAAO;EAAE,WAAW;EAAW,WAAW;EAAW;AAGvD,cAAa,OAAO,OAAO,MACzB,uEAAuE,uBAAuB,wCAAwC,kBAAkB,KAAK,YAAY,kBAAkB,GAAG,GAC/L;AAGD,sCAAqC,kBAAkB;CAEvD,MAAM,EAAE,yBAAyB,MAAM,0BACrC,cACA,sBACA,kBAAkB,MAAM,gCAAgB,IAAI,MAAM,CAAC,CACpD;CAED,MAAM,YAAY,qBAAqB,eAAe,OAAO,SAAS,wBAAwB,GAAG,MAAM;AAEvG,cAAa,OAAO,OAAO,MACzB,gDAAgD,uBAAuB,OACrE,YAAY,KAAK,OAClB,4CAA4C,kBAAkB,GAAG,YAAY,kBAAkB,KAAK,GACtG;AAED,QAAO;EACL;EACA,WAAW,qBAAqB;EACjC;;AAGH,MAAa,yCAAyC,OACpD,cACA,cACA,YACiD;CACjD,MAAMA,6BAAkE;EACtE,YAAY,EAAE;EACd,YAAY,EAAE;EACf;AAED,MAAK,MAAM,CAAC,UAAU,uBAAuB,OAAO,QAAQ,aAAa,qBAAqB,EAAE;EAC9F,MAAM,cAAc,MAAM,sCAAsC,cAAc,cAAc,SAAS;AAErG,6BAA2B,WAAW,YAAY,gCAChD,MAAM,QAAQ,IACZ,YAAY,IAAI,OAAO,eAAe;GACpC,MAAM,EAAE,WAAW,cAAc,MAAM,oBACrC,cACA,cACA,oBACA,WAAW,eACZ;AAED,UAAO;IACL,cAAc,WAAW,eAAe;IACxC,UAAU;IACV,gBAAgB,WAAW;IAC3B;IACA,SAAS;IACV;IACD,CACH,CACF;AAID,MAAI,QAAQ,kCACV,4BAA2B,WAAW,YAAY,2BAA2B,WAAW,UAAU,QAC/F,MAAM,CAAC,EAAE,QACX;;AAIL,MAAK,MAAM,CAAC,UAAU,uBAAuB,OAAO,QAAQ,aAAa,qBAAqB,EAAE;EAC9F,MAAM,cAAc,MAAM,sCAAsC,cAAc,cAAc,SAAS;AAErG,6BAA2B,WAAW,YAAY,gCAChD,MAAM,QAAQ,IACZ,YAAY,IAAI,OAAO,eAAe;GACpC,MAAM,EAAE,WAAW,cAAc,MAAM,oBACrC,cACA,cACA,oBACA,WAAW,eACZ;AAED,UAAO;IACL,cAAc,WAAW,eAAe;IACxC,gBAAgB,WAAW;IAC3B;IACA,SAAS;IACV;IACD,CACH,CACF;AAID,MAAI,QAAQ,kCACV,4BAA2B,WAAW,YAAY,2BAA2B,WAAW,UAAU,QAC/F,MAAM,CAAC,EAAE,QACX;;AAIL,QAAO"}
|