@credo-ts/anoncreds 0.6.0-pr-2444-20251010162514 → 0.6.0-pr-2454-20251015095608
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/AnonCredsApi.d.mts +4 -4
- package/build/AnonCredsApi.d.mts.map +1 -1
- package/build/AnonCredsApi.d.ts +4 -4
- package/build/AnonCredsApi.d.ts.map +1 -1
- package/build/AnonCredsApi.js +14 -14
- package/build/AnonCredsApi.mjs +14 -14
- package/build/AnonCredsApi.mjs.map +1 -1
- package/build/AnonCredsModule.d.mts.map +1 -1
- package/build/AnonCredsModule.d.ts.map +1 -1
- package/build/AnonCredsModule.js +7 -7
- package/build/AnonCredsModule.mjs +7 -7
- package/build/AnonCredsModule.mjs.map +1 -1
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.js +1 -1
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.mjs +1 -1
- package/build/anoncreds-rs/AnonCredsDataIntegrityService.mjs.map +1 -1
- package/build/anoncreds-rs/AnonCredsRsHolderService.js +6 -6
- package/build/anoncreds-rs/AnonCredsRsHolderService.mjs +6 -6
- package/build/anoncreds-rs/AnonCredsRsHolderService.mjs.map +1 -1
- package/build/anoncreds-rs/AnonCredsRsIssuerService.js +3 -3
- package/build/anoncreds-rs/AnonCredsRsIssuerService.mjs +3 -3
- package/build/anoncreds-rs/AnonCredsRsIssuerService.mjs.map +1 -1
- package/build/anoncreds-rs/AnonCredsRsVerifierService.mjs.map +1 -1
- package/build/anoncreds-rs/utils.js +1 -1
- package/build/anoncreds-rs/utils.mjs +1 -1
- package/build/anoncreds-rs/utils.mjs.map +1 -1
- package/build/error/index.js +1 -1
- package/build/error/index.mjs +1 -1
- package/build/formats/AnonCredsDidCommCredentialFormatService.d.mts.map +1 -1
- package/build/formats/AnonCredsDidCommCredentialFormatService.d.ts.map +1 -1
- package/build/formats/AnonCredsDidCommCredentialFormatService.js +5 -5
- package/build/formats/AnonCredsDidCommCredentialFormatService.mjs +5 -5
- package/build/formats/AnonCredsDidCommCredentialFormatService.mjs.map +1 -1
- package/build/formats/AnonCredsDidCommProofFormat.d.mts +1 -1
- package/build/formats/AnonCredsDidCommProofFormat.d.ts +1 -1
- package/build/formats/AnonCredsDidCommProofFormatService.d.mts.map +1 -1
- package/build/formats/AnonCredsDidCommProofFormatService.d.ts.map +1 -1
- package/build/formats/AnonCredsDidCommProofFormatService.js +5 -5
- package/build/formats/AnonCredsDidCommProofFormatService.mjs +5 -5
- package/build/formats/AnonCredsDidCommProofFormatService.mjs.map +1 -1
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.mts +4 -18
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.mts.map +1 -1
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.ts +4 -18
- package/build/formats/DataIntegrityDidCommCredentialFormatService.d.ts.map +1 -1
- package/build/formats/DataIntegrityDidCommCredentialFormatService.js +16 -16
- package/build/formats/DataIntegrityDidCommCredentialFormatService.mjs +16 -16
- package/build/formats/DataIntegrityDidCommCredentialFormatService.mjs.map +1 -1
- package/build/formats/LegacyIndyDidCommCredentialFormatService.d.mts.map +1 -1
- package/build/formats/LegacyIndyDidCommCredentialFormatService.d.ts.map +1 -1
- package/build/formats/LegacyIndyDidCommCredentialFormatService.js +3 -3
- package/build/formats/LegacyIndyDidCommCredentialFormatService.mjs +3 -3
- package/build/formats/LegacyIndyDidCommCredentialFormatService.mjs.map +1 -1
- package/build/formats/LegacyIndyDidCommProofFormat.d.mts +1 -1
- package/build/formats/LegacyIndyDidCommProofFormat.d.ts +1 -1
- package/build/formats/LegacyIndyDidCommProofFormatService.d.mts.map +1 -1
- package/build/formats/LegacyIndyDidCommProofFormatService.d.ts.map +1 -1
- package/build/formats/LegacyIndyDidCommProofFormatService.js +8 -8
- package/build/formats/LegacyIndyDidCommProofFormatService.mjs +8 -8
- package/build/formats/LegacyIndyDidCommProofFormatService.mjs.map +1 -1
- package/build/formats/index.js +1 -1
- package/build/formats/index.mjs +1 -1
- package/build/index.d.mts +30 -30
- package/build/index.d.ts +30 -30
- package/build/index.js +25 -25
- package/build/index.mjs +25 -25
- package/build/models/AnonCredsCredentialProposal.js +2 -2
- package/build/models/AnonCredsCredentialProposal.mjs +1 -1
- package/build/models/AnonCredsProofRequest.js +2 -2
- package/build/models/AnonCredsProofRequest.mjs +1 -1
- package/build/models/AnonCredsProofRequest.mjs.map +1 -1
- package/build/models/AnonCredsRequestedAttribute.js +2 -2
- package/build/models/AnonCredsRequestedAttribute.mjs +1 -1
- package/build/models/AnonCredsRequestedAttribute.mjs.map +1 -1
- package/build/models/AnonCredsRequestedPredicate.js +3 -3
- package/build/models/AnonCredsRequestedPredicate.mjs +2 -2
- package/build/models/AnonCredsRequestedPredicate.mjs.map +1 -1
- package/build/models/AnonCredsRestriction.js +2 -2
- package/build/models/AnonCredsRestriction.mjs +1 -1
- package/build/models/AnonCredsRestrictionWrapper.js +2 -2
- package/build/models/AnonCredsRestrictionWrapper.mjs +1 -1
- package/build/models/exchange.mjs.map +1 -1
- package/build/models/index.js +1 -1
- package/build/models/index.mjs +1 -1
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.mts +1 -1
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.mts.map +1 -1
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.ts +1 -1
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.ts.map +1 -1
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.js +4 -4
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.mjs +4 -4
- package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.mjs.map +1 -1
- package/build/protocols/credentials/v1/handlers/DidCommIssueCredentialV1Handler.mjs.map +1 -1
- package/build/protocols/credentials/v1/handlers/DidCommOfferCredentialV1Handler.mjs.map +1 -1
- package/build/protocols/credentials/v1/handlers/DidCommProposeCredentialV1Handler.mjs.map +1 -1
- package/build/protocols/credentials/v1/handlers/DidCommRequestCredentialV1Handler.mjs.map +1 -1
- package/build/protocols/credentials/v1/handlers/index.js +1 -1
- package/build/protocols/credentials/v1/handlers/index.mjs +1 -1
- package/build/protocols/credentials/v1/index.js +2 -2
- package/build/protocols/credentials/v1/index.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.mts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.ts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.js +4 -4
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.mjs.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.mts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.ts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.js +4 -4
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.mjs.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.mts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.ts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.js +4 -4
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.mjs.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.mts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.js +4 -4
- package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.mts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.mts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.ts +2 -2
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.ts.map +1 -1
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.js +4 -4
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.mjs +2 -2
- package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.mjs.map +1 -1
- package/build/protocols/credentials/v1/messages/index.js +2 -2
- package/build/protocols/credentials/v1/messages/index.mjs +2 -2
- package/build/protocols/index.js +5 -5
- package/build/protocols/index.mjs +5 -5
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.mts +2 -2
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.mts.map +1 -1
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.ts +2 -2
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.ts.map +1 -1
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.js +6 -6
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.mjs +6 -6
- package/build/protocols/proofs/v1/DidCommProofV1Protocol.mjs.map +1 -1
- package/build/protocols/proofs/v1/handlers/DidCommPresentationV1Handler.mjs.map +1 -1
- package/build/protocols/proofs/v1/handlers/DidCommProposePresentationV1Handler.mjs.map +1 -1
- package/build/protocols/proofs/v1/handlers/DidCommRequestPresentationV1Handler.mjs.map +1 -1
- package/build/protocols/proofs/v1/handlers/index.js +1 -1
- package/build/protocols/proofs/v1/handlers/index.mjs +1 -1
- package/build/protocols/proofs/v1/index.js +4 -4
- package/build/protocols/proofs/v1/index.mjs +4 -4
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.d.mts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.d.ts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.mts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.mts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.ts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.ts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.js +4 -4
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.mjs +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.mjs.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.d.mts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.d.mts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.mts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.mts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.ts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.ts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.js +4 -4
- package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.mjs +2 -2
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.mts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.mts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.ts +2 -2
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.ts.map +1 -1
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.js +4 -4
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.mjs +2 -2
- package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.mjs.map +1 -1
- package/build/protocols/proofs/v1/messages/index.js +3 -3
- package/build/protocols/proofs/v1/messages/index.mjs +3 -3
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.mts +1 -1
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.mts.map +1 -1
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.ts +2 -2
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.ts.map +1 -1
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.js +6 -6
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.mjs +4 -4
- package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.mjs.map +1 -1
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.js +2 -2
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.mjs +2 -2
- package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.mjs.map +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.d.mts.map +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.d.ts.map +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.js +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.mjs +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRecord.mjs.map +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRepository.js +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRepository.mjs +1 -1
- package/build/repository/AnonCredsCredentialDefinitionRepository.mjs.map +1 -1
- package/build/repository/AnonCredsCredentialRecord.d.mts.map +1 -1
- package/build/repository/AnonCredsCredentialRecord.d.ts.map +1 -1
- package/build/repository/AnonCredsCredentialRecord.mjs.map +1 -1
- package/build/repository/AnonCredsCredentialRepository.js +1 -1
- package/build/repository/AnonCredsCredentialRepository.mjs +1 -1
- package/build/repository/AnonCredsCredentialRepository.mjs.map +1 -1
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.js +1 -1
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.mjs +1 -1
- package/build/repository/AnonCredsKeyCorrectnessProofRepository.mjs.map +1 -1
- package/build/repository/AnonCredsLinkSecretRepository.js +1 -1
- package/build/repository/AnonCredsLinkSecretRepository.mjs +1 -1
- package/build/repository/AnonCredsLinkSecretRepository.mjs.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.mts.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.ts.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.js +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.mjs +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.mjs.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.mts.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.ts.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.mjs.map +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.js +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.mjs +1 -1
- package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.mjs.map +1 -1
- package/build/repository/AnonCredsSchemaRecord.d.mts.map +1 -1
- package/build/repository/AnonCredsSchemaRecord.d.ts.map +1 -1
- package/build/repository/AnonCredsSchemaRecord.js +1 -1
- package/build/repository/AnonCredsSchemaRecord.mjs +1 -1
- package/build/repository/AnonCredsSchemaRecord.mjs.map +1 -1
- package/build/repository/AnonCredsSchemaRepository.js +1 -1
- package/build/repository/AnonCredsSchemaRepository.mjs +1 -1
- package/build/repository/AnonCredsSchemaRepository.mjs.map +1 -1
- package/build/repository/index.js +6 -6
- package/build/repository/index.mjs +6 -6
- package/build/services/AnonCredsHolderService.d.mts +1 -1
- package/build/services/AnonCredsHolderService.d.ts +1 -1
- package/build/services/AnonCredsHolderServiceOptions.d.mts +1 -1
- package/build/services/AnonCredsHolderServiceOptions.d.ts +1 -1
- package/build/services/index.js +3 -3
- package/build/services/index.mjs +3 -3
- package/build/services/registry/AnonCredsRegistryService.d.mts.map +1 -1
- package/build/services/registry/AnonCredsRegistryService.d.ts.map +1 -1
- package/build/services/registry/AnonCredsRegistryService.js +1 -1
- package/build/services/registry/AnonCredsRegistryService.mjs +1 -1
- package/build/services/registry/AnonCredsRegistryService.mjs.map +1 -1
- package/build/services/tails/BasicTailsFileService.d.mts.map +1 -1
- package/build/services/tails/BasicTailsFileService.d.ts.map +1 -1
- package/build/services/tails/BasicTailsFileService.mjs.map +1 -1
- package/build/updates/0.3.1-0.4/credentialDefinition.js +1 -1
- package/build/updates/0.3.1-0.4/credentialDefinition.mjs +1 -1
- package/build/updates/0.3.1-0.4/credentialDefinition.mjs.map +1 -1
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.js +3 -3
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.mjs +3 -3
- package/build/updates/0.4-0.5/anonCredsCredentialRecord.mjs.map +1 -1
- package/build/utils/anonCredsObjects.d.mts.map +1 -1
- package/build/utils/anonCredsObjects.d.ts.map +1 -1
- package/build/utils/anonCredsObjects.mjs.map +1 -1
- package/build/utils/areRequestsEqual.mjs.map +1 -1
- package/build/utils/bytesToBigint.mjs.map +1 -1
- package/build/utils/createRequestFromPreview.mjs.map +1 -1
- package/build/utils/credential.d.mts.map +1 -1
- package/build/utils/credential.d.ts.map +1 -1
- package/build/utils/credential.mjs.map +1 -1
- package/build/utils/getCredentialsForAnonCredsRequest.js +3 -3
- package/build/utils/getCredentialsForAnonCredsRequest.mjs +3 -3
- package/build/utils/getCredentialsForAnonCredsRequest.mjs.map +1 -1
- package/build/utils/getRevocationRegistries.mjs.map +1 -1
- package/build/utils/hasDuplicateGroupNames.mjs.map +1 -1
- package/build/utils/index.js +9 -9
- package/build/utils/index.mjs +9 -9
- package/build/utils/indyIdentifiers.d.mts.map +1 -1
- package/build/utils/indyIdentifiers.d.ts.map +1 -1
- package/build/utils/indyIdentifiers.mjs.map +1 -1
- package/build/utils/isMap.mjs.map +1 -1
- package/build/utils/revocationInterval.d.mts.map +1 -1
- package/build/utils/revocationInterval.d.ts.map +1 -1
- package/build/utils/revocationInterval.mjs.map +1 -1
- package/build/utils/w3cAnonCredsUtils.d.mts.map +1 -1
- package/build/utils/w3cAnonCredsUtils.d.ts.map +1 -1
- package/build/utils/w3cAnonCredsUtils.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anonCredsCredentialRecord.mjs","names":["cachedNymResponse: Record<string, string> | null","indyNamespace: string | undefined","qualifiedSchemaId: string","qualifiedSchemaIssuerId: string","qualifiedCredentialDefinitionId: string","qualifiedIssuerId: string","qualifiedRevocationRegistryId: string | undefined","anonCredsCredentialMetadata: W3cAnonCredsCredentialMetadata"],"sources":["../../../src/updates/0.4-0.5/anonCredsCredentialRecord.ts"],"sourcesContent":["import type { AgentContext, BaseAgent } from '@credo-ts/core'\nimport type { AnonCredsHolderService } from '../../services'\nimport type { W3cAnonCredsCredentialMetadata } from '../../utils/metadata'\n\nimport { CacheModuleConfig, CredoError, W3cCredentialRepository, W3cCredentialService } from '@credo-ts/core'\nimport { DidCommCredentialExchangeRepository } from '@credo-ts/didcomm'\n\nimport { type AnonCredsCredentialRecord, AnonCredsCredentialRepository } from '../../repository'\nimport { AnonCredsHolderServiceSymbol } from '../../services'\nimport { fetchCredentialDefinition } from '../../utils/anonCredsObjects'\nimport {\n getIndyNamespaceFromIndyDid,\n getQualifiedDidIndyDid,\n getUnqualifiedRevocationRegistryDefinitionId,\n isIndyDid,\n isUnqualifiedCredentialDefinitionId,\n isUnqualifiedIndyDid,\n parseIndyRevocationRegistryId,\n} from '../../utils/indyIdentifiers'\nimport { W3cAnonCredsCredentialMetadataKey } from '../../utils/metadata'\nimport { getW3cRecordAnonCredsTags } from '../../utils/w3cAnonCredsUtils'\n\nasync function getIndyNamespace(\n agentContext: AgentContext,\n legacyCredentialDefinitionId: string,\n legacyIssuerId: string\n) {\n const cacheModuleConfig = agentContext.dependencyManager.resolve(CacheModuleConfig)\n const cache = cacheModuleConfig.cache\n\n const indyCacheKey = `IndyVdrPoolService:${legacyIssuerId}`\n const sovCacheKey = `IndySdkPoolService:${legacyIssuerId}`\n\n const cachedNymResponse: Record<string, string> | null =\n (await cache.get(agentContext, indyCacheKey)) ?? (await cache.get(agentContext, sovCacheKey))\n\n if (!cachedNymResponse?.indyNamespace || typeof cachedNymResponse?.indyNamespace !== 'string') {\n const credentialDefinitionReturn = await fetchCredentialDefinition(agentContext, legacyCredentialDefinitionId)\n const namespace = credentialDefinitionReturn.indyNamespace\n\n if (!namespace) {\n throw new CredoError(\n 'Could not determine the indyNamespace required for storing anoncreds in the new w3c format.'\n )\n }\n\n return namespace\n }\n return cachedNymResponse.indyNamespace\n}\n\nasync function migrateLegacyToW3cCredential(agentContext: AgentContext, legacyRecord: AnonCredsCredentialRecord) {\n const legacyTags = legacyRecord.getTags()\n\n let indyNamespace: string | undefined\n let qualifiedSchemaId: string\n let qualifiedSchemaIssuerId: string\n let qualifiedCredentialDefinitionId: string\n let qualifiedIssuerId: string\n let qualifiedRevocationRegistryId: string | undefined\n\n if (\n !isUnqualifiedCredentialDefinitionId(legacyTags.credentialDefinitionId) &&\n !isUnqualifiedIndyDid(legacyTags.issuerId)\n ) {\n if (isIndyDid(legacyTags.issuerId)) {\n indyNamespace = getIndyNamespaceFromIndyDid(legacyTags.issuerId)\n }\n } else {\n indyNamespace = await getIndyNamespace(agentContext, legacyTags.credentialDefinitionId, legacyTags.issuerId)\n }\n\n if (indyNamespace) {\n qualifiedCredentialDefinitionId = getQualifiedDidIndyDid(legacyTags.credentialDefinitionId, indyNamespace)\n qualifiedIssuerId = getQualifiedDidIndyDid(legacyTags.issuerId, indyNamespace)\n qualifiedRevocationRegistryId = legacyTags.revocationRegistryId\n ? getQualifiedDidIndyDid(legacyTags.revocationRegistryId, indyNamespace)\n : undefined\n qualifiedSchemaId = getQualifiedDidIndyDid(legacyTags.schemaId, indyNamespace)\n qualifiedSchemaIssuerId = getQualifiedDidIndyDid(legacyTags.schemaIssuerId, indyNamespace)\n } else {\n qualifiedCredentialDefinitionId = legacyTags.credentialDefinitionId\n qualifiedIssuerId = legacyTags.issuerId\n qualifiedRevocationRegistryId = legacyTags.revocationRegistryId\n qualifiedSchemaId = legacyTags.schemaId\n qualifiedSchemaIssuerId = legacyTags.schemaIssuerId\n }\n\n const anonCredsHolderService =\n agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n const w3cJsonLdCredential = await anonCredsHolderService.legacyToW3cCredential(agentContext, {\n credential: legacyRecord.credential,\n issuerId: qualifiedIssuerId,\n })\n\n if (Array.isArray(w3cJsonLdCredential.credentialSubject)) {\n throw new CredoError('Credential subject must be an object, not an array.')\n }\n\n const anonCredsTags = getW3cRecordAnonCredsTags({\n credentialSubject: w3cJsonLdCredential.credentialSubject,\n issuerId: w3cJsonLdCredential.issuerId,\n schemaId: qualifiedSchemaId,\n schema: {\n issuerId: qualifiedSchemaIssuerId,\n name: legacyTags.schemaName,\n version: legacyTags.schemaVersion,\n },\n credentialRevocationId: legacyTags.credentialRevocationId,\n revocationRegistryId: qualifiedRevocationRegistryId,\n credentialDefinitionId: qualifiedCredentialDefinitionId,\n linkSecretId: legacyTags.linkSecretId,\n methodName: legacyTags.methodName,\n })\n\n const w3cCredentialService = agentContext.dependencyManager.resolve(W3cCredentialService)\n const w3cCredentialRecord = await w3cCredentialService.storeCredential(agentContext, {\n credential: w3cJsonLdCredential,\n })\n\n for (const [key, meta] of Object.entries(legacyRecord.metadata.data)) {\n w3cCredentialRecord.metadata.set(key, meta)\n }\n\n const anonCredsCredentialMetadata: W3cAnonCredsCredentialMetadata = {\n credentialRevocationId: anonCredsTags.anonCredsCredentialRevocationId,\n linkSecretId: anonCredsTags.anonCredsLinkSecretId,\n methodName: anonCredsTags.anonCredsMethodName,\n }\n\n w3cCredentialRecord.setTags(anonCredsTags)\n w3cCredentialRecord.metadata.set(W3cAnonCredsCredentialMetadataKey, anonCredsCredentialMetadata)\n\n const w3cCredentialRepository = agentContext.dependencyManager.resolve(W3cCredentialRepository)\n await w3cCredentialRepository.update(agentContext, w3cCredentialRecord)\n\n // Find the credential exchange record bound to this anoncreds credential and update it to point to the newly created w3c record\n const credentialExchangeRepository = agentContext.dependencyManager.resolve(DidCommCredentialExchangeRepository)\n const [relatedCredentialExchangeRecord] = await credentialExchangeRepository.findByQuery(agentContext, {\n credentialIds: [legacyRecord.credentialId],\n })\n\n if (relatedCredentialExchangeRecord) {\n // Replace the related binding by the new one\n const credentialBindingIndex = relatedCredentialExchangeRecord.credentials.findIndex(\n (binding) => binding.credentialRecordId === legacyRecord.credentialId\n )\n if (credentialBindingIndex !== -1) {\n relatedCredentialExchangeRecord.credentials[credentialBindingIndex] = {\n credentialRecordType: 'w3c',\n credentialRecordId: w3cCredentialRecord.id,\n }\n\n // If using Indy dids, store both qualified/unqualified revRegId forms\n // to allow retrieving it from revocation notification service\n if (legacyTags.revocationRegistryId && indyNamespace) {\n const { credentialDefinitionTag, namespaceIdentifier, revocationRegistryTag, schemaSeqNo } =\n parseIndyRevocationRegistryId(legacyTags.revocationRegistryId)\n\n relatedCredentialExchangeRecord.setTags({\n anonCredsRevocationRegistryId: getQualifiedDidIndyDid(legacyTags.revocationRegistryId, indyNamespace),\n anonCredsUnqualifiedRevocationRegistryId: getUnqualifiedRevocationRegistryDefinitionId(\n namespaceIdentifier,\n schemaSeqNo,\n credentialDefinitionTag,\n revocationRegistryTag\n ),\n })\n }\n\n await credentialExchangeRepository.update(agentContext, relatedCredentialExchangeRecord)\n }\n }\n}\n\n/**\n * Stores all anoncreds credentials in the new w3c format\n */\nexport async function storeAnonCredsInW3cFormatV0_5<Agent extends BaseAgent>(agent: Agent) {\n agent.config.logger.info('Migration of legacy AnonCreds records to the new W3C format version 0.5')\n\n const anoncredsRepository = agent.dependencyManager.resolve(AnonCredsCredentialRepository)\n\n agent.config.logger.debug('Fetching all anoncreds credential records from storage')\n const records = await anoncredsRepository.getAll(agent.context)\n\n agent.config.logger.debug(`Found a total of ${records.length} legacy anonCreds credential records to update.`)\n\n for (const record of records) {\n agent.config.logger.debug(\n `Re-saving anonCreds credential record with id ${record.id} in the new w3c format, and deleting the legacy record`\n )\n try {\n await migrateLegacyToW3cCredential(agent.context, record)\n await anoncredsRepository.delete(agent.context, record)\n agent.config.logger.debug(\n `Successfully migrated w3c credential record with id ${record.id} to storage version 0.5`\n )\n } catch (error) {\n agent.config.logger.error(\n `Failed to migrate w3c credential record with id ${record.id} to storage version 0.5`,\n error\n )\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAsBA,eAAe,iBACb,cACA,8BACA,gBACA;CAEA,MAAM,QADoB,aAAa,kBAAkB,QAAQ,kBAAkB,CACnD;CAEhC,MAAM,eAAe,sBAAsB;CAC3C,MAAM,cAAc,sBAAsB;CAE1C,MAAMA,oBACH,MAAM,MAAM,IAAI,cAAc,aAAa,IAAM,MAAM,MAAM,IAAI,cAAc,YAAY;AAE9F,KAAI,CAAC,mBAAmB,iBAAiB,OAAO,mBAAmB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kBAAkB,QAAQ,8BAA8B;AAE1F,OAAM,OAAO,OAAO,MAAM,yDAAyD;CACnF,MAAM,UAAU,MAAM,oBAAoB,OAAO,MAAM,QAAQ;AAE/D,OAAM,OAAO,OAAO,MAAM,oBAAoB,QAAQ,OAAO,iDAAiD;AAE9G,MAAK,MAAM,UAAU,SAAS;AAC5B,QAAM,OAAO,OAAO,MAClB,iDAAiD,OAAO,GAAG,wDAC5D;AACD,MAAI;AACF,SAAM,6BAA6B,MAAM,SAAS,OAAO;AACzD,SAAM,oBAAoB,OAAO,MAAM,SAAS,OAAO;AACvD,SAAM,OAAO,OAAO,MAClB,uDAAuD,OAAO,GAAG,yBAClE;WACM,OAAO;AACd,SAAM,OAAO,OAAO,MAClB,mDAAmD,OAAO,GAAG,0BAC7D,MACD"}
|
|
1
|
+
{"version":3,"file":"anonCredsCredentialRecord.mjs","names":["cachedNymResponse: Record<string, string> | null","indyNamespace: string | undefined","qualifiedSchemaId: string","qualifiedSchemaIssuerId: string","qualifiedCredentialDefinitionId: string","qualifiedIssuerId: string","qualifiedRevocationRegistryId: string | undefined","anonCredsCredentialMetadata: W3cAnonCredsCredentialMetadata"],"sources":["../../../src/updates/0.4-0.5/anonCredsCredentialRecord.ts"],"sourcesContent":["import type { AgentContext, BaseAgent } from '@credo-ts/core'\nimport { CacheModuleConfig, CredoError, W3cCredentialRepository, W3cCredentialService } from '@credo-ts/core'\nimport { DidCommCredentialExchangeRepository } from '@credo-ts/didcomm'\nimport { type AnonCredsCredentialRecord, AnonCredsCredentialRepository } from '../../repository'\nimport type { AnonCredsHolderService } from '../../services'\nimport { AnonCredsHolderServiceSymbol } from '../../services'\nimport { fetchCredentialDefinition } from '../../utils/anonCredsObjects'\nimport {\n getIndyNamespaceFromIndyDid,\n getQualifiedDidIndyDid,\n getUnqualifiedRevocationRegistryDefinitionId,\n isIndyDid,\n isUnqualifiedCredentialDefinitionId,\n isUnqualifiedIndyDid,\n parseIndyRevocationRegistryId,\n} from '../../utils/indyIdentifiers'\nimport type { W3cAnonCredsCredentialMetadata } from '../../utils/metadata'\nimport { W3cAnonCredsCredentialMetadataKey } from '../../utils/metadata'\nimport { getW3cRecordAnonCredsTags } from '../../utils/w3cAnonCredsUtils'\n\nasync function getIndyNamespace(\n agentContext: AgentContext,\n legacyCredentialDefinitionId: string,\n legacyIssuerId: string\n) {\n const cacheModuleConfig = agentContext.dependencyManager.resolve(CacheModuleConfig)\n const cache = cacheModuleConfig.cache\n\n const indyCacheKey = `IndyVdrPoolService:${legacyIssuerId}`\n const sovCacheKey = `IndySdkPoolService:${legacyIssuerId}`\n\n const cachedNymResponse: Record<string, string> | null =\n (await cache.get(agentContext, indyCacheKey)) ?? (await cache.get(agentContext, sovCacheKey))\n\n if (!cachedNymResponse?.indyNamespace || typeof cachedNymResponse?.indyNamespace !== 'string') {\n const credentialDefinitionReturn = await fetchCredentialDefinition(agentContext, legacyCredentialDefinitionId)\n const namespace = credentialDefinitionReturn.indyNamespace\n\n if (!namespace) {\n throw new CredoError(\n 'Could not determine the indyNamespace required for storing anoncreds in the new w3c format.'\n )\n }\n\n return namespace\n }\n return cachedNymResponse.indyNamespace\n}\n\nasync function migrateLegacyToW3cCredential(agentContext: AgentContext, legacyRecord: AnonCredsCredentialRecord) {\n const legacyTags = legacyRecord.getTags()\n\n let indyNamespace: string | undefined\n let qualifiedSchemaId: string\n let qualifiedSchemaIssuerId: string\n let qualifiedCredentialDefinitionId: string\n let qualifiedIssuerId: string\n let qualifiedRevocationRegistryId: string | undefined\n\n if (\n !isUnqualifiedCredentialDefinitionId(legacyTags.credentialDefinitionId) &&\n !isUnqualifiedIndyDid(legacyTags.issuerId)\n ) {\n if (isIndyDid(legacyTags.issuerId)) {\n indyNamespace = getIndyNamespaceFromIndyDid(legacyTags.issuerId)\n }\n } else {\n indyNamespace = await getIndyNamespace(agentContext, legacyTags.credentialDefinitionId, legacyTags.issuerId)\n }\n\n if (indyNamespace) {\n qualifiedCredentialDefinitionId = getQualifiedDidIndyDid(legacyTags.credentialDefinitionId, indyNamespace)\n qualifiedIssuerId = getQualifiedDidIndyDid(legacyTags.issuerId, indyNamespace)\n qualifiedRevocationRegistryId = legacyTags.revocationRegistryId\n ? getQualifiedDidIndyDid(legacyTags.revocationRegistryId, indyNamespace)\n : undefined\n qualifiedSchemaId = getQualifiedDidIndyDid(legacyTags.schemaId, indyNamespace)\n qualifiedSchemaIssuerId = getQualifiedDidIndyDid(legacyTags.schemaIssuerId, indyNamespace)\n } else {\n qualifiedCredentialDefinitionId = legacyTags.credentialDefinitionId\n qualifiedIssuerId = legacyTags.issuerId\n qualifiedRevocationRegistryId = legacyTags.revocationRegistryId\n qualifiedSchemaId = legacyTags.schemaId\n qualifiedSchemaIssuerId = legacyTags.schemaIssuerId\n }\n\n const anonCredsHolderService =\n agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n const w3cJsonLdCredential = await anonCredsHolderService.legacyToW3cCredential(agentContext, {\n credential: legacyRecord.credential,\n issuerId: qualifiedIssuerId,\n })\n\n if (Array.isArray(w3cJsonLdCredential.credentialSubject)) {\n throw new CredoError('Credential subject must be an object, not an array.')\n }\n\n const anonCredsTags = getW3cRecordAnonCredsTags({\n credentialSubject: w3cJsonLdCredential.credentialSubject,\n issuerId: w3cJsonLdCredential.issuerId,\n schemaId: qualifiedSchemaId,\n schema: {\n issuerId: qualifiedSchemaIssuerId,\n name: legacyTags.schemaName,\n version: legacyTags.schemaVersion,\n },\n credentialRevocationId: legacyTags.credentialRevocationId,\n revocationRegistryId: qualifiedRevocationRegistryId,\n credentialDefinitionId: qualifiedCredentialDefinitionId,\n linkSecretId: legacyTags.linkSecretId,\n methodName: legacyTags.methodName,\n })\n\n const w3cCredentialService = agentContext.dependencyManager.resolve(W3cCredentialService)\n const w3cCredentialRecord = await w3cCredentialService.storeCredential(agentContext, {\n credential: w3cJsonLdCredential,\n })\n\n for (const [key, meta] of Object.entries(legacyRecord.metadata.data)) {\n w3cCredentialRecord.metadata.set(key, meta)\n }\n\n const anonCredsCredentialMetadata: W3cAnonCredsCredentialMetadata = {\n credentialRevocationId: anonCredsTags.anonCredsCredentialRevocationId,\n linkSecretId: anonCredsTags.anonCredsLinkSecretId,\n methodName: anonCredsTags.anonCredsMethodName,\n }\n\n w3cCredentialRecord.setTags(anonCredsTags)\n w3cCredentialRecord.metadata.set(W3cAnonCredsCredentialMetadataKey, anonCredsCredentialMetadata)\n\n const w3cCredentialRepository = agentContext.dependencyManager.resolve(W3cCredentialRepository)\n await w3cCredentialRepository.update(agentContext, w3cCredentialRecord)\n\n // Find the credential exchange record bound to this anoncreds credential and update it to point to the newly created w3c record\n const credentialExchangeRepository = agentContext.dependencyManager.resolve(DidCommCredentialExchangeRepository)\n const [relatedCredentialExchangeRecord] = await credentialExchangeRepository.findByQuery(agentContext, {\n credentialIds: [legacyRecord.credentialId],\n })\n\n if (relatedCredentialExchangeRecord) {\n // Replace the related binding by the new one\n const credentialBindingIndex = relatedCredentialExchangeRecord.credentials.findIndex(\n (binding) => binding.credentialRecordId === legacyRecord.credentialId\n )\n if (credentialBindingIndex !== -1) {\n relatedCredentialExchangeRecord.credentials[credentialBindingIndex] = {\n credentialRecordType: 'w3c',\n credentialRecordId: w3cCredentialRecord.id,\n }\n\n // If using Indy dids, store both qualified/unqualified revRegId forms\n // to allow retrieving it from revocation notification service\n if (legacyTags.revocationRegistryId && indyNamespace) {\n const { credentialDefinitionTag, namespaceIdentifier, revocationRegistryTag, schemaSeqNo } =\n parseIndyRevocationRegistryId(legacyTags.revocationRegistryId)\n\n relatedCredentialExchangeRecord.setTags({\n anonCredsRevocationRegistryId: getQualifiedDidIndyDid(legacyTags.revocationRegistryId, indyNamespace),\n anonCredsUnqualifiedRevocationRegistryId: getUnqualifiedRevocationRegistryDefinitionId(\n namespaceIdentifier,\n schemaSeqNo,\n credentialDefinitionTag,\n revocationRegistryTag\n ),\n })\n }\n\n await credentialExchangeRepository.update(agentContext, relatedCredentialExchangeRecord)\n }\n }\n}\n\n/**\n * Stores all anoncreds credentials in the new w3c format\n */\nexport async function storeAnonCredsInW3cFormatV0_5<Agent extends BaseAgent>(agent: Agent) {\n agent.config.logger.info('Migration of legacy AnonCreds records to the new W3C format version 0.5')\n\n const anoncredsRepository = agent.dependencyManager.resolve(AnonCredsCredentialRepository)\n\n agent.config.logger.debug('Fetching all anoncreds credential records from storage')\n const records = await anoncredsRepository.getAll(agent.context)\n\n agent.config.logger.debug(`Found a total of ${records.length} legacy anonCreds credential records to update.`)\n\n for (const record of records) {\n agent.config.logger.debug(\n `Re-saving anonCreds credential record with id ${record.id} in the new w3c format, and deleting the legacy record`\n )\n try {\n await migrateLegacyToW3cCredential(agent.context, record)\n await anoncredsRepository.delete(agent.context, record)\n agent.config.logger.debug(\n `Successfully migrated w3c credential record with id ${record.id} to storage version 0.5`\n )\n } catch (error) {\n agent.config.logger.error(\n `Failed to migrate w3c credential record with id ${record.id} to storage version 0.5`,\n error\n )\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,eAAe,iBACb,cACA,8BACA,gBACA;CAEA,MAAM,QADoB,aAAa,kBAAkB,QAAQ,kBAAkB,CACnD;CAEhC,MAAM,eAAe,sBAAsB;CAC3C,MAAM,cAAc,sBAAsB;CAE1C,MAAMA,oBACH,MAAM,MAAM,IAAI,cAAc,aAAa,IAAM,MAAM,MAAM,IAAI,cAAc,YAAY;AAE9F,KAAI,CAAC,mBAAmB,iBAAiB,OAAO,mBAAmB,kBAAkB,UAAU;EAE7F,MAAM,aAD6B,MAAM,0BAA0B,cAAc,6BAA6B,EACjE;AAE7C,MAAI,CAAC,UACH,OAAM,IAAI,WACR,8FACD;AAGH,SAAO;;AAET,QAAO,kBAAkB;;AAG3B,eAAe,6BAA6B,cAA4B,cAAyC;CAC/G,MAAM,aAAa,aAAa,SAAS;CAEzC,IAAIC;CACJ,IAAIC;CACJ,IAAIC;CACJ,IAAIC;CACJ,IAAIC;CACJ,IAAIC;AAEJ,KACE,CAAC,oCAAo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AAM,oBAAoB,OAAO,MAAM,SAAS,OAAO;AACvD,SAAM,OAAO,OAAO,MAClB,uDAAuD,OAAO,GAAG,yBAClE;WACM,OAAO;AACd,SAAM,OAAO,OAAO,MAClB,mDAAmD,OAAO,GAAG,0BAC7D,MACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anonCredsObjects.d.mts","names":[],"sources":["../../src/utils/anonCredsObjects.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"anonCredsObjects.d.mts","names":[],"sources":["../../src/utils/anonCredsObjects.ts"],"sourcesContent":[],"mappings":";;;;iBAMsB,WAAA,eAA0B,iCAA8B;;EAAxD,QAAA,EAAA,MAAW;EAAA,aAAA,EAAA,MAAA,GAAA,SAAA;;iBAkBX,yBAAA,eAAwC,+CAA4C;sBAlB5B,+BAAA;EAAA,sBAAA,EAAA,MAAA;EAkBxD,aAAA,EAAA,MAAA,GAAA,SAAyB;CAAA,CAAA;AAAe,iBAsBxC,iCAAA,CAtBwC,YAAA,EAuB9C,YAvB8C,EAAA,8BAAA,EAAA,MAAA,CAAA,EAwBtB,OAxBsB,CAAA;gCAuBlC;gCAvB8E,EAAA,MAAA;EAAA,aAAA,EAAA,MAAA,GAAA,SAAA;AAsB1G,CAAA,CAAA;AAAuD,iBAyBjC,yBAAA,CAzBiC,YAAA,EA0BvC,YA1BuC,EAAA,oBAAA,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,CAAA,EA6BpD,OA7BoD,CAAA;sBACvC,EA4BmB,6BA5BnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anonCredsObjects.d.ts","names":[],"sources":["../../src/utils/anonCredsObjects.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"anonCredsObjects.d.ts","names":[],"sources":["../../src/utils/anonCredsObjects.ts"],"sourcesContent":[],"mappings":";;;;iBAMsB,WAAA,eAA0B,iCAA8B;;EAAxD,QAAA,EAAA,MAAW;EAAA,aAAA,EAAA,MAAA,GAAA,SAAA;;iBAkBX,yBAAA,eAAwC,+CAA4C;sBAlB5B,+BAAA;EAAA,sBAAA,EAAA,MAAA;EAkBxD,aAAA,EAAA,MAAA,GAAA,SAAyB;CAAA,CAAA;AAAe,iBAsBxC,iCAAA,CAtBwC,YAAA,EAuB9C,YAvB8C,EAAA,8BAAA,EAAA,MAAA,CAAA,EAwBtB,OAxBsB,CAAA;gCAuBlC;gCAvB8E,EAAA,MAAA;EAAA,aAAA,EAAA,MAAA,GAAA,SAAA;AAsB1G,CAAA,CAAA;AAAuD,iBAyBjC,yBAAA,CAzBiC,YAAA,EA0BvC,YA1BuC,EAAA,oBAAA,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,CAAA,EA6BpD,OA7BoD,CAAA;sBACvC,EA4BmB,6BA5BnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anonCredsObjects.mjs","names":[],"sources":["../../src/utils/anonCredsObjects.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport
|
|
1
|
+
{"version":3,"file":"anonCredsObjects.mjs","names":[],"sources":["../../src/utils/anonCredsObjects.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport { CredoError } from '@credo-ts/core'\nimport type { AnonCredsCredentialDefinition, AnonCredsRevocationStatusList, AnonCredsSchema } from '../models'\n\nimport { AnonCredsRegistryService } from '../services'\n\nexport async function fetchSchema(agentContext: AgentContext, schemaId: string) {\n const registryService = agentContext.dependencyManager.resolve(AnonCredsRegistryService)\n\n const result = await registryService\n .getRegistryForIdentifier(agentContext, schemaId)\n .getSchema(agentContext, schemaId)\n\n if (!result || !result.schema) {\n throw new CredoError(`Schema not found for id ${schemaId}: ${result.resolutionMetadata.message}`)\n }\n\n return {\n schema: result.schema,\n schemaId: result.schemaId,\n indyNamespace: result.schemaMetadata.didIndyNamespace as string | undefined,\n }\n}\n\nexport async function fetchCredentialDefinition(agentContext: AgentContext, credentialDefinitionId: string) {\n const registryService = agentContext.dependencyManager.resolve(AnonCredsRegistryService)\n\n const result = await registryService\n .getRegistryForIdentifier(agentContext, credentialDefinitionId)\n .getCredentialDefinition(agentContext, credentialDefinitionId)\n\n if (!result || !result.credentialDefinition) {\n throw new CredoError(\n `Credential definition not found for id ${credentialDefinitionId}: ${result.resolutionMetadata.message}`\n )\n }\n\n const indyNamespace = result.credentialDefinitionMetadata.didIndyNamespace\n\n return {\n credentialDefinition: result.credentialDefinition,\n credentialDefinitionId,\n indyNamespace: indyNamespace && typeof indyNamespace === 'string' ? indyNamespace : undefined,\n }\n}\n\nexport async function fetchRevocationRegistryDefinition(\n agentContext: AgentContext,\n revocationRegistryDefinitionId: string\n) {\n const registryService = agentContext.dependencyManager.resolve(AnonCredsRegistryService)\n\n const result = await registryService\n .getRegistryForIdentifier(agentContext, revocationRegistryDefinitionId)\n .getRevocationRegistryDefinition(agentContext, revocationRegistryDefinitionId)\n\n if (!result || !result.revocationRegistryDefinition) {\n throw new CredoError(\n `RevocationRegistryDefinition not found for id ${revocationRegistryDefinitionId}: ${result.resolutionMetadata.message}`\n )\n }\n\n const indyNamespace = result.revocationRegistryDefinitionMetadata.didIndyNamespace\n\n return {\n revocationRegistryDefinition: result.revocationRegistryDefinition,\n revocationRegistryDefinitionId,\n indyNamespace: indyNamespace && typeof indyNamespace === 'string' ? indyNamespace : undefined,\n }\n}\n\nexport async function fetchRevocationStatusList(\n agentContext: AgentContext,\n revocationRegistryId: string,\n timestamp: number\n): Promise<{ revocationStatusList: AnonCredsRevocationStatusList }> {\n const registry = agentContext.dependencyManager\n .resolve(AnonCredsRegistryService)\n .getRegistryForIdentifier(agentContext, revocationRegistryId)\n\n const { revocationStatusList, resolutionMetadata } = await registry.getRevocationStatusList(\n agentContext,\n revocationRegistryId,\n timestamp\n )\n\n if (!revocationStatusList) {\n throw new CredoError(\n `Could not retrieve revocation status list for revocation registry ${revocationRegistryId}: ${resolutionMetadata.message}`\n )\n }\n\n return { revocationStatusList }\n}\n\nexport async function fetchSchemas(agentContext: AgentContext, schemaIds: Set<string>) {\n const schemaFetchPromises = [...schemaIds].map(async (schemaId): Promise<[string, AnonCredsSchema]> => {\n const { schema } = await fetchSchema(agentContext, schemaId)\n return [schemaId, schema]\n })\n\n const schemas = Object.fromEntries(await Promise.all(schemaFetchPromises))\n return schemas\n}\n\nexport async function fetchCredentialDefinitions(agentContext: AgentContext, credentialDefinitionIds: Set<string>) {\n const credentialDefinitionEntries = [...credentialDefinitionIds].map(\n async (credentialDefinitionId): Promise<[string, AnonCredsCredentialDefinition]> => {\n const { credentialDefinition } = await fetchCredentialDefinition(agentContext, credentialDefinitionId)\n return [credentialDefinitionId, credentialDefinition]\n }\n )\n\n const credentialDefinitions = Object.fromEntries(await Promise.all(credentialDefinitionEntries))\n return credentialDefinitions\n}\n"],"mappings":";;;;;AAMA,eAAsB,YAAY,cAA4B,UAAkB;CAG9E,MAAM,SAAS,MAFS,aAAa,kBAAkB,QAAQ,yBAAyB,CAGrF,yBAAyB,cAAc,SAAS,CAChD,UAAU,cAAc,SAAS;AAEpC,KAAI,CAAC,UAAU,CAAC,OAAO,OACrB,OAAM,IAAI,WAAW,2BAA2B,SAAS,IAAI,OAAO,mBAAmB,UAAU;AAGnG,QAAO;EACL,QAAQ,OAAO;EACf,UAAU,OAAO;EACjB,eAAe,OAAO,eAAe;EACtC;;AAGH,eAAsB,0BAA0B,cAA4B,wBAAgC;CAG1G,MAAM,SAAS,MAFS,aAAa,kBAAkB,QAAQ,yBAAyB,CAGrF,yBAAyB,cAAc,uBAAuB,CAC9D,wBAAwB,cAAc,uBAAuB;AAEhE,KAAI,CAAC,UAAU,CAAC,OAAO,qBACrB,OAAM,IAAI,WACR,0CAA0C,uBAAuB,IAAI,OAAO,mBAAmB,UAChG;CAGH,MAAM,gBAAgB,OAAO,6BAA6B;AAE1D,QAAO;EACL,sBAAsB,OAAO;EAC7B;EACA,eAAe,iBAAiB,OAAO,kBAAkB,WA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ual.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:
|
|
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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AQ,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytesToBigint.mjs","names":[],"sources":["../../src/utils/bytesToBigint.ts"],"sourcesContent":["
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRequestFromPreview.mjs","names":["proofRequest: AnonCredsProofRequest","attributesByReferent: Record<string, AnonCredsPresentationPreviewAttribute[]>"],"sources":["../../src/utils/createRequestFromPreview.ts"],"sourcesContent":["import type {\n AnonCredsPresentationPreviewAttribute,\n AnonCredsPresentationPreviewPredicate,\n} from '../formats/AnonCredsDidCommProofFormat'\nimport type { AnonCredsNonRevokedInterval, AnonCredsProofRequest } from '../models'\n\
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential.d.mts","names":[],"sources":["../../src/utils/credential.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"credential.d.mts","names":[],"sources":["../../src/utils/credential.ts"],"sourcesContent":[],"mappings":";;;KAOY,oBAAA,GAAuB;AAAvB,UAEK,wBAAA,CAFkB;EAElB,GAAA,EAAA,MAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential.d.ts","names":[],"sources":["../../src/utils/credential.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"credential.d.ts","names":[],"sources":["../../src/utils/credential.ts"],"sourcesContent":[],"mappings":";;;KAOY,oBAAA,GAAuB;AAAvB,UAEK,wBAAA,CAFkB;EAElB,GAAA,EAAA,MAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential.mjs","names":["value","credentialValues: Record<string, AnonCredsCredentialValue>"],"sources":["../../src/utils/credential.ts"],"sourcesContent":["import type { DidCommCredentialPreviewAttributeOptions, DidCommLinkedAttachment } from '@credo-ts/didcomm'\nimport type { AnonCredsCredentialValues, AnonCredsSchema } from '../models'\n\nimport { CredoError, Hasher, TypedArrayEncoder } from '@credo-ts/core'\nimport { encodeAttachment } from '@credo-ts/didcomm'\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 // biome-ignore lint/style/noParameterAssign: <explanation>\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 // biome-ignore lint/style/noParameterAssign: <explanation>\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\n/**\n * Adds attribute(s) to the credential preview that is linked to the given attachment(s)\n *\n * @param attachments a list of the attachments that need to be linked to a credential\n * @param preview the credential previews where the new linked credential has to be appended to\n *\n * @returns a modified version of the credential preview with the linked credentials\n * */\nexport function createAndLinkAttachmentsToPreview(\n attachments: DidCommLinkedAttachment[],\n previewAttributes: DidCommCredentialPreviewAttributeOptions[]\n) {\n const credentialPreviewAttributeNames = previewAttributes.map((attribute) => attribute.name)\n const newPreviewAttributes = [...previewAttributes]\n\n for (const linkedAttachment of attachments) {\n if (credentialPreviewAttributeNames.includes(linkedAttachment.attributeName)) {\n throw new CredoError(`linkedAttachment ${linkedAttachment.attributeName} already exists in the preview`)\n }\n newPreviewAttributes.push({\n name: linkedAttachment.attributeName,\n mimeType: linkedAttachment.attachment.mimeType,\n value: encodeAttachment(linkedAttachment.attachment),\n })\n }\n\n return newPreviewAttributes\n}\n"],"mappings":";;;;;AAeA,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,CAEjB,SAAQ,MAAM,UAAU;AAI1B,KAAI,UAAU,QAAQ,UAAU,OAE9B,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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W,iBAAiB,GAChI;;;;;;;;;;AAYL,SAAgB,kCACd,aACA,mBACA;CACA,MAAM,kCAAkC,kBAAkB,KAAK,cAAc,UAAU,KAAK;CAC5F,MAAM,uBAAuB,CAAC,GAAG,kBAAkB;AAEnD,MAAK,MAAM,oBAAoB,aAAa;AAC1C,MAAI,gCAAgC,SAAS,iBAAiB,cAAc,CAC1E,OAAM,IAAI,WAAW,oBAAoB,iBAAiB,cAAc,gCAAgC;AAE1G,uBAAqB,KAAK;GACxB,MAAM,iBAAiB;GACvB,UAAU,iBAAiB,WAAW;GACtC,OAAO,iBAAiB,iBAAiB,WAAW;GACrD,CAAC;;AAGJ,QAAO"}
|
|
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, DidCommLinkedAttachment } from '@credo-ts/didcomm'\nimport { encodeAttachment } 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\n/**\n * Adds attribute(s) to the credential preview that is linked to the given attachment(s)\n *\n * @param attachments a list of the attachments that need to be linked to a credential\n * @param preview the credential previews where the new linked credential has to be appended to\n *\n * @returns a modified version of the credential preview with the linked credentials\n * */\nexport function createAndLinkAttachmentsToPreview(\n attachments: DidCommLinkedAttachment[],\n previewAttributes: DidCommCredentialPreviewAttributeOptions[]\n) {\n const credentialPreviewAttributeNames = previewAttributes.map((attribute) => attribute.name)\n const newPreviewAttributes = [...previewAttributes]\n\n for (const linkedAttachment of attachments) {\n if (credentialPreviewAttributeNames.includes(linkedAttachment.attributeName)) {\n throw new CredoError(`linkedAttachment ${linkedAttachment.attributeName} already exists in the preview`)\n }\n newPreviewAttributes.push({\n name: linkedAttachment.attributeName,\n mimeType: linkedAttachment.attachment.mimeType,\n value: encodeAttachment(linkedAttachment.attachment),\n })\n }\n\n return newPreviewAttributes\n}\n"],"mappings":";;;;;AAcA,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,U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AAW;GACtC,OAAO,iBAAiB,iBAAiB,WAAW;GACrD,CAAC;;AAGJ,QAAO"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_AnonCredsHolderService = require('../services/AnonCredsHolderService.js');
|
|
2
2
|
require('../services/index.js');
|
|
3
|
-
const
|
|
3
|
+
const require_anonCredsObjects = require('./anonCredsObjects.js');
|
|
4
4
|
const require_revocationInterval = require('./revocationInterval.js');
|
|
5
|
+
const require_sortRequestedCredentialsMatches = require('./sortRequestedCredentialsMatches.js');
|
|
5
6
|
const require_timestamp = require('./timestamp.js');
|
|
6
|
-
const require_anonCredsObjects = require('./anonCredsObjects.js');
|
|
7
7
|
|
|
8
8
|
//#region src/utils/getCredentialsForAnonCredsRequest.ts
|
|
9
9
|
const getCredentialsForProofRequestReferent = async (agentContext, proofRequest, attributeReferent) => {
|
|
@@ -23,7 +23,7 @@ const getRevocationStatus = async (agentContext, proofRequest, requestedItem, cr
|
|
|
23
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
24
|
require_revocationInterval.assertBestPracticeRevocationInterval(requestNonRevoked);
|
|
25
25
|
const { revocationStatusList } = await require_anonCredsObjects.fetchRevocationStatusList(agentContext, revocationRegistryId, requestNonRevoked.to ?? require_timestamp.dateToTimestamp(/* @__PURE__ */ new Date()));
|
|
26
|
-
const isRevoked = revocationStatusList.revocationList[Number.parseInt(credentialRevocationId)] === 1;
|
|
26
|
+
const isRevoked = revocationStatusList.revocationList[Number.parseInt(credentialRevocationId, 10)] === 1;
|
|
27
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
28
|
return {
|
|
29
29
|
isRevoked,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AnonCredsHolderServiceSymbol } from "../services/AnonCredsHolderService.mjs";
|
|
2
2
|
import "../services/index.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { fetchRevocationStatusList } from "./anonCredsObjects.mjs";
|
|
4
4
|
import { assertBestPracticeRevocationInterval } from "./revocationInterval.mjs";
|
|
5
|
+
import { sortRequestedCredentialsMatches } from "./sortRequestedCredentialsMatches.mjs";
|
|
5
6
|
import { dateToTimestamp } from "./timestamp.mjs";
|
|
6
|
-
import { fetchRevocationStatusList } from "./anonCredsObjects.mjs";
|
|
7
7
|
|
|
8
8
|
//#region src/utils/getCredentialsForAnonCredsRequest.ts
|
|
9
9
|
const getCredentialsForProofRequestReferent = async (agentContext, proofRequest, attributeReferent) => {
|
|
@@ -23,7 +23,7 @@ const getRevocationStatus = async (agentContext, proofRequest, requestedItem, cr
|
|
|
23
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
24
|
assertBestPracticeRevocationInterval(requestNonRevoked);
|
|
25
25
|
const { revocationStatusList } = await fetchRevocationStatusList(agentContext, revocationRegistryId, requestNonRevoked.to ?? dateToTimestamp(/* @__PURE__ */ new Date()));
|
|
26
|
-
const isRevoked = revocationStatusList.revocationList[Number.parseInt(credentialRevocationId)] === 1;
|
|
26
|
+
const isRevoked = revocationStatusList.revocationList[Number.parseInt(credentialRevocationId, 10)] === 1;
|
|
27
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
28
|
return {
|
|
29
29
|
isRevoked,
|
|
@@ -1 +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)] === 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,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRevocationRegistries.mjs","names":["revocationRegistries: CreateProofOptions['revocationRegistries']","revocationRegistries: VerifyProofOptions['revocationRegistries']"],"sources":["../../src/utils/getRevocationRegistries.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport type { AnonCredsProof, AnonCredsProofRequest, AnonCredsSelectedCredentials } from '../models'\nimport type { CreateProofOptions, VerifyProofOptions } from '../services'\n\nimport { CredoError } from '@credo-ts/core'\n\nimport { AnonCredsModuleConfig } from '../AnonCredsModuleConfig'\nimport { AnonCredsRegistryService } from '../services'\n\nimport { assertBestPracticeRevocationInterval } from './revocationInterval'\n\nexport async function getRevocationRegistriesForRequest(\n agentContext: AgentContext,\n proofRequest: AnonCredsProofRequest,\n selectedCredentials: AnonCredsSelectedCredentials\n) {\n const revocationRegistries: CreateProofOptions['revocationRegistries'] = {}\n\n // NOTE: we don't want to mutate this object, when modifying we need to always deeply clone objects firsts.\n let updatedSelectedCredentials = selectedCredentials\n\n try {\n agentContext.config.logger.debug('Retrieving revocation registries for proof request', {\n proofRequest,\n selectedCredentials,\n })\n\n const referentCredentials = []\n\n // Retrieve information for referents and push to single array\n for (const [referent, selectedCredential] of Object.entries(selectedCredentials.attributes)) {\n referentCredentials.push({\n type: 'attributes' as const,\n referent,\n selectedCredential,\n nonRevoked: proofRequest.requested_attributes[referent].non_revoked ?? proofRequest.non_revoked,\n })\n }\n for (const [referent, selectedCredential] of Object.entries(selectedCredentials.predicates)) {\n referentCredentials.push({\n type: 'predicates' as const,\n referent,\n selectedCredential,\n nonRevoked: proofRequest.requested_predicates[referent].non_revoked ?? proofRequest.non_revoked,\n })\n }\n\n const revocationRegistryPromises = []\n for (const { referent, selectedCredential, nonRevoked, type } of referentCredentials) {\n if (!selectedCredential.credentialInfo) {\n throw new CredoError(\n `Credential for referent '${referent} does not have credential info for revocation state creation`\n )\n }\n\n // Prefer referent-specific revocation interval over global revocation interval\n const credentialRevocationId = selectedCredential.credentialInfo.credentialRevocationId\n const revocationRegistryId = selectedCredential.credentialInfo.revocationRegistryId\n const timestamp = selectedCredential.timestamp\n\n // If revocation interval is present and the credential is revocable then create revocation state\n if (nonRevoked && credentialRevocationId && revocationRegistryId) {\n agentContext.config.logger.trace(\n `Presentation is requesting proof of non revocation for referent '${referent}', creating revocation state for credential`,\n {\n nonRevoked,\n credentialRevocationId,\n revocationRegistryId,\n timestamp,\n }\n )\n\n // Make sure the revocation interval follows best practices from Aries RFC 0441\n assertBestPracticeRevocationInterval(nonRevoked)\n\n const registry = agentContext.dependencyManager\n .resolve(AnonCredsRegistryService)\n .getRegistryForIdentifier(agentContext, revocationRegistryId)\n\n const getRevocationRegistry = async () => {\n // Fetch revocation registry definition if not in revocation registries list yet\n if (!revocationRegistries[revocationRegistryId]) {\n const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(\n agentContext,\n revocationRegistryId\n )\n if (!revocationRegistryDefinition) {\n throw new CredoError(\n `Could not retrieve revocation registry definition for revocation registry ${revocationRegistryId}: ${resolutionMetadata.message}`\n )\n }\n\n const tailsFileService = agentContext.dependencyManager.resolve(AnonCredsModuleConfig).tailsFileService\n const { tailsFilePath } = await tailsFileService.getTailsFile(agentContext, {\n revocationRegistryDefinition,\n })\n\n // const tails = await this.indyUtilitiesService.downloadTails(tailsHash, tailsLocation)\n revocationRegistries[revocationRegistryId] = {\n definition: revocationRegistryDefinition,\n tailsFilePath,\n revocationStatusLists: {},\n }\n }\n\n // In most cases we will have a timestamp, but if it's not defined, we use the nonRevoked.to value\n const timestampToFetch = timestamp ?? nonRevoked.to\n\n // Fetch revocation status list if we don't already have a revocation status list for the given timestamp\n if (!revocationRegistries[revocationRegistryId].revocationStatusLists[timestampToFetch]) {\n const { revocationStatusList, resolutionMetadata: statusListResolutionMetadata } =\n await registry.getRevocationStatusList(agentContext, revocationRegistryId, timestampToFetch)\n\n if (!revocationStatusList) {\n throw new CredoError(\n `Could not retrieve revocation status list for revocation registry ${revocationRegistryId}: ${statusListResolutionMetadata.message}`\n )\n }\n\n revocationRegistries[revocationRegistryId].revocationStatusLists[revocationStatusList.timestamp] =\n revocationStatusList\n\n // If we don't have a timestamp on the selected credential, we set it to the timestamp of the revocation status list\n // this way we know which revocation status list to use when creating the proof.\n if (!timestamp) {\n updatedSelectedCredentials = {\n ...updatedSelectedCredentials,\n [type]: {\n ...updatedSelectedCredentials[type],\n [referent]: {\n ...updatedSelectedCredentials[type][referent],\n timestamp: revocationStatusList.timestamp,\n },\n },\n }\n }\n }\n }\n revocationRegistryPromises.push(getRevocationRegistry())\n }\n }\n // await all revocation registry statuses asynchronously\n await Promise.all(revocationRegistryPromises)\n agentContext.config.logger.debug('Retrieved revocation registries for proof request', {\n revocationRegistries,\n })\n\n return { revocationRegistries, updatedSelectedCredentials }\n } catch (error) {\n agentContext.config.logger.error('Error retrieving revocation registry for proof request', {\n error,\n proofRequest,\n selectedCredentials,\n })\n\n throw error\n }\n}\n\nexport async function getRevocationRegistriesForProof(agentContext: AgentContext, proof: AnonCredsProof) {\n const revocationRegistries: VerifyProofOptions['revocationRegistries'] = {}\n\n const revocationRegistryPromises = []\n for (const identifier of proof.identifiers) {\n const revocationRegistryId = identifier.rev_reg_id\n const timestamp = identifier.timestamp\n\n // Skip if no revocation registry id is present\n if (!revocationRegistryId || !timestamp) continue\n\n const registry = agentContext.dependencyManager\n .resolve(AnonCredsRegistryService)\n .getRegistryForIdentifier(agentContext, revocationRegistryId)\n\n const getRevocationRegistry = async () => {\n // Fetch revocation registry definition if not already fetched\n if (!revocationRegistries[revocationRegistryId]) {\n const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(\n agentContext,\n revocationRegistryId\n )\n if (!revocationRegistryDefinition) {\n throw new CredoError(\n `Could not retrieve revocation registry definition for revocation registry ${revocationRegistryId}: ${resolutionMetadata.message}`\n )\n }\n\n revocationRegistries[revocationRegistryId] = {\n definition: revocationRegistryDefinition,\n revocationStatusLists: {},\n }\n }\n\n // Fetch revocation status list by timestamp if not already fetched\n if (!revocationRegistries[revocationRegistryId].revocationStatusLists[timestamp]) {\n const { revocationStatusList, resolutionMetadata: statusListResolutionMetadata } =\n await registry.getRevocationStatusList(agentContext, revocationRegistryId, timestamp)\n\n if (!revocationStatusList) {\n throw new CredoError(\n `Could not retrieve revocation status list for revocation registry ${revocationRegistryId}: ${statusListResolutionMetadata.message}`\n )\n }\n\n revocationRegistries[revocationRegistryId].revocationStatusLists[timestamp] = revocationStatusList\n }\n }\n revocationRegistryPromises.push(getRevocationRegistry())\n }\n await Promise.all(revocationRegistryPromises)\n return revocationRegistries\n}\n"],"mappings":";;;;;;;AAWA,eAAsB,kCACpB,cACA,cACA,qBACA;CACA,MAAMA,uBAAmE,EAAE;CAG3E,IAAI,6BAA6B;AAEjC,KAAI;AACF,eAAa,OAAO,OAAO,MAAM,sDAAsD;GACrF;GACA;GACD,CAAC;EAEF,MAAM,sBAAsB,EAAE;AAG9B,OAAK,MAAM,CAAC,UAAU,uBAAuB,OAAO,QAAQ,oBAAoB,WAAW,CACzF,qBAAoB,KAAK;GACvB,MAAM;GACN;GACA;GACA,YAAY,aAAa,qBAAqB,UAAU,eAAe,aAAa;GACrF,CAAC;AAEJ,OAAK,MAAM,CAAC,UAAU,uBAAuB,OAAO,QAAQ,oBAAoB,WAAW,CACzF,qBAAoB,KAAK;GACvB,MAAM;GACN;GACA;GACA,YAAY,aAAa,qBAAqB,UAAU,eAAe,aAAa;GACrF,CAAC;EAGJ,MAAM,6BAA6B,EAAE;AACrC,OAAK,MAAM,EAAE,UAAU,oBAAoB,YAAY,UAAU,qBAAqB;AACpF,OAAI,CAAC,mBAAmB,eACtB,OAAM,IAAI,WACR,4BAA4B,SAAS,8DACtC;GAIH,MAAM,yBAAyB,mBAAmB,eAAe;GACjE,MAAM,uBAAuB,mBAAmB,eAAe;GAC/D,MAAM,YAAY,mBAAmB;AAGrC,OAAI,cAAc,0BAA0B,sBAAsB;AAChE,iBAAa,OAAO,OAAO,MACzB,oEAAoE,SAAS,8CAC7E;KACE;KACA;KACA;KACA;KACD,CACF;AAGD,yCAAqC,WAAW;IAEhD,MAAM,WAAW,aAAa,kBAC3B,QAAQ,yBAAyB,CACjC,yBAAyB,cAAc,qBAAqB;IAE/D,MAAM,wBAAwB,YAAY;AA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W;AAG7B,MAAI,CAAC,wBAAwB,CAAC,UAAW;EAEzC,MAAM,WAAW,aAAa,kBAC3B,QAAQ,yBAAyB,CACjC,yBAAyB,cAAc,qBAAqB;EAE/D,MAAM,wBAAwB,YAAY;AAExC,OAAI,CAAC,qBAAqB,uBAAuB;IAC/C,MAAM,EAAE,8BAA8B,uBAAuB,MAAM,SAAS,gCAC1E,cACA,qBACD;AACD,QAAI,CAAC,6BACH,OAAM,IAAI,WACR,6EAA6E,qBAAqB,IAAI,mBAAmB,UAC1H;AAGH,yBAAqB,wBAAwB;KAC3C,YAAY;KACZ,uBAAuB,EAAE;KAC1B;;AAIH,OAAI,CAAC,qBAAqB,sBAAsB,sBAAsB,YAAY;IAChF,MAAM,EAAE,sBAAsB,oBAAoB,iCAChD,MAAM,SAAS,wBAAwB,cAAc,sBAAsB,UAAU;AAEvF,QAAI,CAAC,qBACH,OAAM,IAAI,WACR,qEAAqE,qBAAqB,IAAI,6BAA6B,UAC5H;AAGH,yBAAqB,sBAAsB,sBAAsB,aAAa;;;AAGlF,6BAA2B,KAAK,uBAAuB,CAAC;;AAE1D,OAAM,QAAQ,IAAI,2BAA2B;AAC7C,QAAO"}
|
|
1
|
+
{"version":3,"file":"getRevocationRegistries.mjs","names":["revocationRegistries: CreateProofOptions['revocationRegistries']","revocationRegistries: VerifyProofOptions['revocationRegistries']"],"sources":["../../src/utils/getRevocationRegistries.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport { CredoError } from '@credo-ts/core'\nimport { AnonCredsModuleConfig } from '../AnonCredsModuleConfig'\nimport type { AnonCredsProof, AnonCredsProofRequest, AnonCredsSelectedCredentials } from '../models'\nimport type { CreateProofOptions, VerifyProofOptions } from '../services'\nimport { AnonCredsRegistryService } from '../services'\n\nimport { assertBestPracticeRevocationInterval } from './revocationInterval'\n\nexport async function getRevocationRegistriesForRequest(\n agentContext: AgentContext,\n proofRequest: AnonCredsProofRequest,\n selectedCredentials: AnonCredsSelectedCredentials\n) {\n const revocationRegistries: CreateProofOptions['revocationRegistries'] = {}\n\n // NOTE: we don't want to mutate this object, when modifying we need to always deeply clone objects firsts.\n let updatedSelectedCredentials = selectedCredentials\n\n try {\n agentContext.config.logger.debug('Retrieving revocation registries for proof request', {\n proofRequest,\n selectedCredentials,\n })\n\n const referentCredentials = []\n\n // Retrieve information for referents and push to single array\n for (const [referent, selectedCredential] of Object.entries(selectedCredentials.attributes)) {\n referentCredentials.push({\n type: 'attributes' as const,\n referent,\n selectedCredential,\n nonRevoked: proofRequest.requested_attributes[referent].non_revoked ?? proofRequest.non_revoked,\n })\n }\n for (const [referent, selectedCredential] of Object.entries(selectedCredentials.predicates)) {\n referentCredentials.push({\n type: 'predicates' as const,\n referent,\n selectedCredential,\n nonRevoked: proofRequest.requested_predicates[referent].non_revoked ?? proofRequest.non_revoked,\n })\n }\n\n const revocationRegistryPromises = []\n for (const { referent, selectedCredential, nonRevoked, type } of referentCredentials) {\n if (!selectedCredential.credentialInfo) {\n throw new CredoError(\n `Credential for referent '${referent} does not have credential info for revocation state creation`\n )\n }\n\n // Prefer referent-specific revocation interval over global revocation interval\n const credentialRevocationId = selectedCredential.credentialInfo.credentialRevocationId\n const revocationRegistryId = selectedCredential.credentialInfo.revocationRegistryId\n const timestamp = selectedCredential.timestamp\n\n // If revocation interval is present and the credential is revocable then create revocation state\n if (nonRevoked && credentialRevocationId && revocationRegistryId) {\n agentContext.config.logger.trace(\n `Presentation is requesting proof of non revocation for referent '${referent}', creating revocation state for credential`,\n {\n nonRevoked,\n credentialRevocationId,\n revocationRegistryId,\n timestamp,\n }\n )\n\n // Make sure the revocation interval follows best practices from Aries RFC 0441\n assertBestPracticeRevocationInterval(nonRevoked)\n\n const registry = agentContext.dependencyManager\n .resolve(AnonCredsRegistryService)\n .getRegistryForIdentifier(agentContext, revocationRegistryId)\n\n const getRevocationRegistry = async () => {\n // Fetch revocation registry definition if not in revocation registries list yet\n if (!revocationRegistries[revocationRegistryId]) {\n const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(\n agentContext,\n revocationRegistryId\n )\n if (!revocationRegistryDefinition) {\n throw new CredoError(\n `Could not retrieve revocation registry definition for revocation registry ${revocationRegistryId}: ${resolutionMetadata.message}`\n )\n }\n\n const tailsFileService = agentContext.dependencyManager.resolve(AnonCredsModuleConfig).tailsFileService\n const { tailsFilePath } = await tailsFileService.getTailsFile(agentContext, {\n revocationRegistryDefinition,\n })\n\n // const tails = await this.indyUtilitiesService.downloadTails(tailsHash, tailsLocation)\n revocationRegistries[revocationRegistryId] = {\n definition: revocationRegistryDefinition,\n tailsFilePath,\n revocationStatusLists: {},\n }\n }\n\n // In most cases we will have a timestamp, but if it's not defined, we use the nonRevoked.to value\n const timestampToFetch = timestamp ?? nonRevoked.to\n\n // Fetch revocation status list if we don't already have a revocation status list for the given timestamp\n if (!revocationRegistries[revocationRegistryId].revocationStatusLists[timestampToFetch]) {\n const { revocationStatusList, resolutionMetadata: statusListResolutionMetadata } =\n await registry.getRevocationStatusList(agentContext, revocationRegistryId, timestampToFetch)\n\n if (!revocationStatusList) {\n throw new CredoError(\n `Could not retrieve revocation status list for revocation registry ${revocationRegistryId}: ${statusListResolutionMetadata.message}`\n )\n }\n\n revocationRegistries[revocationRegistryId].revocationStatusLists[revocationStatusList.timestamp] =\n revocationStatusList\n\n // If we don't have a timestamp on the selected credential, we set it to the timestamp of the revocation status list\n // this way we know which revocation status list to use when creating the proof.\n if (!timestamp) {\n updatedSelectedCredentials = {\n ...updatedSelectedCredentials,\n [type]: {\n ...updatedSelectedCredentials[type],\n [referent]: {\n ...updatedSelectedCredentials[type][referent],\n timestamp: revocationStatusList.timestamp,\n },\n },\n }\n }\n }\n }\n revocationRegistryPromises.push(getRevocationRegistry())\n }\n }\n // await all revocation registry statuses asynchronously\n await Promise.all(revocationRegistryPromises)\n agentContext.config.logger.debug('Retrieved revocation registries for proof request', {\n revocationRegistries,\n })\n\n return { revocationRegistries, updatedSelectedCredentials }\n } catch (error) {\n agentContext.config.logger.error('Error retrieving revocation registry for proof request', {\n error,\n proofRequest,\n selectedCredentials,\n })\n\n throw error\n }\n}\n\nexport async function getRevocationRegistriesForProof(agentContext: AgentContext, proof: AnonCredsProof) {\n const revocationRegistries: VerifyProofOptions['revocationRegistries'] = {}\n\n const revocationRegistryPromises = []\n for (const identifier of proof.identifiers) {\n const revocationRegistryId = identifier.rev_reg_id\n const timestamp = identifier.timestamp\n\n // Skip if no revocation registry id is present\n if (!revocationRegistryId || !timestamp) continue\n\n const registry = agentContext.dependencyManager\n .resolve(AnonCredsRegistryService)\n .getRegistryForIdentifier(agentContext, revocationRegistryId)\n\n const getRevocationRegistry = async () => {\n // Fetch revocation registry definition if not already fetched\n if (!revocationRegistries[revocationRegistryId]) {\n const { revocationRegistryDefinition, resolutionMetadata } = await registry.getRevocationRegistryDefinition(\n agentContext,\n revocationRegistryId\n )\n if (!revocationRegistryDefinition) {\n throw new CredoError(\n `Could not retrieve revocation registry definition for revocation registry ${revocationRegistryId}: ${resolutionMetadata.message}`\n )\n }\n\n revocationRegistries[revocationRegistryId] = {\n definition: revocationRegistryDefinition,\n revocationStatusLists: {},\n }\n }\n\n // Fetch revocation status list by timestamp if not already fetched\n if (!revocationRegistries[revocationRegistryId].revocationStatusLists[timestamp]) {\n const { revocationStatusList, resolutionMetadata: statusListResolutionMetadata } =\n await registry.getRevocationStatusList(agentContext, revocationRegistryId, timestamp)\n\n if (!revocationStatusList) {\n throw new CredoError(\n `Could not retrieve revocation status list for revocation registry ${revocationRegistryId}: ${statusListResolutionMetadata.message}`\n )\n }\n\n revocationRegistries[revocationRegistryId].revocationStatusLists[timestamp] = revocationStatusList\n }\n }\n revocationRegistryPromises.push(getRevocationRegistry())\n }\n await Promise.all(revocationRegistryPromises)\n return revocationRegistries\n}\n"],"mappings":";;;;;;;AASA,eAAsB,kCACpB,cACA,cACA,qBACA;CACA,MAAMA,uBAAmE,EAAE;CAG3E,IAAI,6BAA6B;AAEjC,KAAI;A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AAmB,UAC1H;AAGH,yBAAqB,wBAAwB;KAC3C,YAAY;KACZ,uBAAuB,EAAE;KAC1B;;AAIH,OAAI,CAAC,qBAAqB,sBAAsB,sBAAsB,YAAY;IAChF,MAAM,EAAE,sBAAsB,oBAAoB,iCAChD,MAAM,SAAS,wBAAwB,cAAc,sBAAsB,UAAU;AAEvF,QAAI,CAAC,qBACH,OAAM,IAAI,WACR,qEAAqE,qBAAqB,IAAI,6BAA6B,UAC5H;AAGH,yBAAqB,sBAAsB,sBAAsB,aAAa;;;AAGlF,6BAA2B,KAAK,uBAAuB,CAAC;;AAE1D,OAAM,QAAQ,IAAI,2BAA2B;AAC7C,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasDuplicateGroupNames.mjs","names":[],"sources":["../../src/utils/hasDuplicateGroupNames.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"hasDuplicateGroupNames.mjs","names":[],"sources":["../../src/utils/hasDuplicateGroupNames.ts"],"sourcesContent":["import { CredoError } from '@credo-ts/core'\nimport type { AnonCredsProofRequest } from '../models'\n\nfunction attributeNamesToArray(proofRequest: AnonCredsProofRequest) {\n // Attributes can contain either a `name` string value or an `names` string array. We reduce it to a single array\n // containing all attribute names from the requested attributes.\n return Object.values(proofRequest.requested_attributes).reduce<string[]>((names, a) => {\n if (a.name) {\n names.push(a.name)\n } else if (a.names) {\n names.push(...a.names) // Push all names if `a.names` is an array\n }\n return names\n }, [])\n}\n\nfunction predicateNamesToArray(proofRequest: AnonCredsProofRequest) {\n return Array.from(new Set(Object.values(proofRequest.requested_predicates).map((a) => a.name)))\n}\n\n// TODO: This is still not ideal. The requested groups can specify different credentials using restrictions.\nexport function assertNoDuplicateGroupsNamesInProofRequest(proofRequest: AnonCredsProofRequest) {\n const attributes = attributeNamesToArray(proofRequest)\n const predicates = predicateNamesToArray(proofRequest)\n\n const duplicates = predicates.filter((item) => attributes.indexOf(item) !== -1)\n if (duplicates.length > 0) {\n throw new CredoError(`The proof request contains duplicate predicates and attributes: ${duplicates.toString()}`)\n }\n}\n"],"mappings":";;;AAGA,SAAS,sBAAsB,cAAqC;AAGlE,QAAO,OAAO,OAAO,aAAa,qBAAqB,CAAC,QAAkB,OAAO,MAAM;AACrF,MAAI,EAAE,KACJ,OAAM,KAAK,EAAE,KAAK;WACT,EAAE,MACX,OAAM,KAAK,GAAG,EAAE,MAAM;AAExB,SAAO;IACN,EAAE,CAAC;;AAGR,SAAS,sBAAsB,cAAqC;AAClE,QAAO,MAAM,KAAK,IAAI,IAAI,OAAO,OAAO,aAAa,qBAAqB,CAAC,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC;;AAIjG,SAAgB,2CAA2C,cAAqC;CAC9F,MAAM,aAAa,sBAAsB,aAAa;CAGtD,MAAM,aAFa,sBAAsB,aAAa,CAExB,QAAQ,SAAS,WAAW,QAAQ,KAAK,KAAK,GAAG;AAC/E,KAAI,WAAW,SAAS,EACtB,OAAM,IAAI,WAAW,mEAAmE,WAAW,UAAU,GAAG"}
|
package/build/utils/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
const require_indyIdentifiers = require('./indyIdentifiers.js');
|
|
2
|
-
const
|
|
3
|
-
const require_sortRequestedCredentialsMatches = require('./sortRequestedCredentialsMatches.js');
|
|
4
|
-
const require_hasDuplicateGroupNames = require('./hasDuplicateGroupNames.js');
|
|
2
|
+
const require_anonCredsObjects = require('./anonCredsObjects.js');
|
|
5
3
|
const require_areRequestsEqual = require('./areRequestsEqual.js');
|
|
6
|
-
const require_revocationInterval = require('./revocationInterval.js');
|
|
7
|
-
const require_getRevocationRegistries = require('./getRevocationRegistries.js');
|
|
8
|
-
const require_credential = require('./credential.js');
|
|
9
|
-
const require_isMap = require('./isMap.js');
|
|
10
4
|
const require_composeAutoAccept = require('./composeAutoAccept.js');
|
|
5
|
+
const require_createRequestFromPreview = require('./createRequestFromPreview.js');
|
|
6
|
+
const require_credential = require('./credential.js');
|
|
11
7
|
const require_credentialPreviewAttributes = require('./credentialPreviewAttributes.js');
|
|
8
|
+
const require_revocationInterval = require('./revocationInterval.js');
|
|
9
|
+
const require_sortRequestedCredentialsMatches = require('./sortRequestedCredentialsMatches.js');
|
|
12
10
|
const require_timestamp = require('./timestamp.js');
|
|
11
|
+
const require_getCredentialsForAnonCredsRequest = require('./getCredentialsForAnonCredsRequest.js');
|
|
12
|
+
const require_getRevocationRegistries = require('./getRevocationRegistries.js');
|
|
13
|
+
const require_hasDuplicateGroupNames = require('./hasDuplicateGroupNames.js');
|
|
14
|
+
const require_isMap = require('./isMap.js');
|
|
13
15
|
const require_linkSecret = require('./linkSecret.js');
|
|
14
|
-
const require_anonCredsObjects = require('./anonCredsObjects.js');
|
|
15
16
|
const require_metadata = require('./metadata.js');
|
|
16
17
|
const require_w3cAnonCredsUtils = require('./w3cAnonCredsUtils.js');
|
|
17
|
-
const require_getCredentialsForAnonCredsRequest = require('./getCredentialsForAnonCredsRequest.js');
|
package/build/utils/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { unqualifiedCredentialDefinitionIdRegex, unqualifiedIndyDidRegex, unqualifiedSchemaIdRegex, unqualifiedSchemaVersionRegex } from "./indyIdentifiers.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { sortRequestedCredentialsMatches } from "./sortRequestedCredentialsMatches.mjs";
|
|
4
|
-
import { assertNoDuplicateGroupsNamesInProofRequest } from "./hasDuplicateGroupNames.mjs";
|
|
2
|
+
import { fetchCredentialDefinition, fetchRevocationRegistryDefinition, fetchRevocationStatusList, fetchSchema } from "./anonCredsObjects.mjs";
|
|
5
3
|
import { areAnonCredsProofRequestsEqual } from "./areRequestsEqual.mjs";
|
|
6
|
-
import { assertBestPracticeRevocationInterval } from "./revocationInterval.mjs";
|
|
7
|
-
import { getRevocationRegistriesForProof, getRevocationRegistriesForRequest } from "./getRevocationRegistries.mjs";
|
|
8
|
-
import { checkValidCredentialValueEncoding } from "./credential.mjs";
|
|
9
|
-
import { IsMap } from "./isMap.mjs";
|
|
10
4
|
import { composeCredentialAutoAccept, composeProofAutoAccept } from "./composeAutoAccept.mjs";
|
|
5
|
+
import { createRequestFromPreview } from "./createRequestFromPreview.mjs";
|
|
6
|
+
import { checkValidCredentialValueEncoding } from "./credential.mjs";
|
|
11
7
|
import { areCredentialPreviewAttributesEqual } from "./credentialPreviewAttributes.mjs";
|
|
8
|
+
import { assertBestPracticeRevocationInterval } from "./revocationInterval.mjs";
|
|
9
|
+
import { sortRequestedCredentialsMatches } from "./sortRequestedCredentialsMatches.mjs";
|
|
12
10
|
import { dateToTimestamp } from "./timestamp.mjs";
|
|
11
|
+
import { getCredentialsForAnonCredsProofRequest } from "./getCredentialsForAnonCredsRequest.mjs";
|
|
12
|
+
import { getRevocationRegistriesForProof, getRevocationRegistriesForRequest } from "./getRevocationRegistries.mjs";
|
|
13
|
+
import { assertNoDuplicateGroupsNamesInProofRequest } from "./hasDuplicateGroupNames.mjs";
|
|
14
|
+
import { IsMap } from "./isMap.mjs";
|
|
13
15
|
import { storeLinkSecret } from "./linkSecret.mjs";
|
|
14
|
-
import { fetchCredentialDefinition, fetchRevocationRegistryDefinition, fetchRevocationStatusList, fetchSchema } from "./anonCredsObjects.mjs";
|
|
15
16
|
import { AnonCredsCredentialMetadataKey, AnonCredsCredentialRequestMetadataKey, W3cAnonCredsCredentialMetadataKey } from "./metadata.mjs";
|
|
16
17
|
import { getW3cRecordAnonCredsTags } from "./w3cAnonCredsUtils.mjs";
|
|
17
|
-
import { getCredentialsForAnonCredsProofRequest } from "./getCredentialsForAnonCredsRequest.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indyIdentifiers.d.mts","names":[],"sources":["../../src/utils/indyIdentifiers.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"indyIdentifiers.d.mts","names":[],"sources":["../../src/utils/indyIdentifiers.ts"],"sourcesContent":[],"mappings":";;;cAOa,0BAAwB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AyCgB,MAAA,EAzCkB,eAyClB,EAAA,SAAA,EAAA,MAAA,CAAA,EAzCuD,eAyCvD;AAYhB,iBA1CA,wCAAA,CA0CgD,6BAChC,EA3CwD,6BA2CnB,CAAA,EAAA,OAAA;AAQrD,iBA5CA,yCAAA,CA4CiD,6BAAA,EA3ChC,6BA2CgC,CAAA,EA1C9D,6BA0C8D;AAAA,iBA/BjD,sCAAA,CA+BiD,6BAAA,EA/BqB,6BA+BrB,CAAA,EAAA,OAAA;AACjC,iBAzBhB,uCAAA,CAyBgB,6BAAA,EAxBC,6BAwBD,EAAA,SAAA,EAAA,MAAA,CAAA,EAtB7B,6BAsB6B;AAC7B,iBAXa,gDAAA,CAWb,4BAAA,EAV6B,qCAU7B,CAAA,EAAA,OAAA;AAAqC,iBAFxB,iDAAA,CAEwB,4BAAA,EADR,qCACQ,CAAA,EAArC,qCAAqC;AAWxB,iBAAA,uCAAA,CACgB,4BAAA,EAAA,qCAAqC,CAAA,EAAA,OAAA;AAQrD,iBAAA,+CAAA,CAA+C,4BAAA,EAC/B,qCAD+B,EAAA,SAAA,EAAA,MAAA,CAAA,EAG5D,qCAH4D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indyIdentifiers.d.ts","names":[],"sources":["../../src/utils/indyIdentifiers.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"indyIdentifiers.d.ts","names":[],"sources":["../../src/utils/indyIdentifiers.ts"],"sourcesContent":[],"mappings":";;;cAOa,0BAAwB;cAExB,sBAAoB;AAFpB,cAIA,6BAJoE,EAIvC,MAJuC;AAEpE,cAGA,uBAHoB,EAGG,MAHoE;AAE3F,cAIA,sCAJ4D,EAItB,MAJsB;AAC5D,cAKA,kCAL2D,EAKzB,MALyB;AAG3D,cAOA,oCAPsC,EAOF,MAPqD;AAEzF,cAQA,gCARkC,EAQF,MAN5C;AAGY,cAOA,YAPA,EAOY,MAPZ;AAGA,iBAMG,sBAAA,CAJf,cAA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