Skip to content

Commit

Permalink
fix: address pex fixes (openwallet-foundation#2104)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra authored Nov 24, 2024
1 parent e128d55 commit e70a2ce
Show file tree
Hide file tree
Showing 9 changed files with 546 additions and 205 deletions.
5 changes: 2 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@sd-jwt/sd-jwt-vc": "^0.7.0",
"@sd-jwt/types": "^0.7.0",
"@sd-jwt/utils": "^0.7.0",
"@sphereon/pex": "5.0.0-unstable.25",
"@animo-id/pex": "4.1.1-alpha.0",
"@sphereon/pex-models": "^2.3.1",
"@sphereon/ssi-types": "0.30.2-next.135",
"@stablelib/ed25519": "^1.0.2",
Expand All @@ -54,7 +54,7 @@
"class-transformer": "0.5.1",
"class-validator": "0.14.1",
"did-resolver": "^4.1.0",
"jsonpath": "^1.1.1",
"@astronautlabs/jsonpath": "^1.1.2",
"lru_map": "^0.4.1",
"luxon": "^3.5.0",
"make-error": "^1.3.6",
Expand All @@ -70,7 +70,6 @@
},
"devDependencies": {
"@types/events": "^3.0.0",
"@types/jsonpath": "^0.2.4",
"@types/luxon": "^3.2.0",
"@types/object-inspect": "^1.8.0",
"@types/uuid": "^9.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import type { VerificationMethod } from '../dids'
import type { SdJwtVcRecord } from '../sd-jwt-vc'
import type { W3cCredentialRecord } from '../vc'
import type { IAnonCredsDataIntegrityService } from '../vc/data-integrity/models/IAnonCredsDataIntegrityService'
import type { PresentationSignCallBackParams, Validated, VerifiablePresentationResult } from '@sphereon/pex'
import type { PresentationSignCallBackParams, Validated, VerifiablePresentationResult } from '@animo-id/pex'
import type { InputDescriptorV2 } from '@sphereon/pex-models'
import type {
SdJwtDecodedVerifiableCredential,
W3CVerifiablePresentation as SphereonW3cVerifiablePresentation,
W3CVerifiablePresentation,
} from '@sphereon/ssi-types'

import { PEVersion, PEX, PresentationSubmissionLocation, Status } from '@sphereon/pex'
import { PartialSdJwtDecodedVerifiableCredential } from '@sphereon/pex/dist/main/lib'
import { PEVersion, PEX, PresentationSubmissionLocation, Status } from '@animo-id/pex'
import { PartialSdJwtDecodedVerifiableCredential } from '@animo-id/pex/dist/main/lib'
import { injectable } from 'tsyringe'

import { Hasher, getJwkFromKey } from '../../crypto'
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { SdJwtVc } from '../../sd-jwt-vc'
import type { W3cVerifiableCredential, W3cVerifiablePresentation } from '../../vc'
import type { PresentationDefinitionV1, PresentationDefinitionV2, PresentationSubmission } from '@sphereon/pex-models'

import { PresentationSubmissionLocation } from '@sphereon/pex'
import { PresentationSubmissionLocation } from '@animo-id/pex'

// Re-export some types from sphereon library, but under more explicit names
export type DifPresentationExchangeDefinition = PresentationDefinitionV1 | PresentationDefinitionV2
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
VerifiablePresentation,
} from '../models'

import { default as jp } from 'jsonpath'
import { JSONPath } from '@astronautlabs/jsonpath'

import { CredoError } from '../../../error'
import { MdocDeviceResponse } from '../../mdoc'
Expand All @@ -21,7 +21,7 @@ export function extractPresentationsWithDescriptorsFromSubmission(
definition: DifPresentationExchangeDefinition
) {
return submission.descriptor_map.map((descriptor) => {
const [presentation] = jp.query(presentations, descriptor.path) as [VerifiablePresentation | undefined]
const [presentation] = JSONPath.query(presentations, descriptor.path) as [VerifiablePresentation | undefined]
const inputDescriptor = definition.input_descriptors.find(({ id }) => id === descriptor.id)

if (!presentation) {
Expand Down Expand Up @@ -61,7 +61,7 @@ export function extractPresentationsWithDescriptorsFromSubmission(
)
}

const [verifiableCredential] = jp.query(
const [verifiableCredential] = JSONPath.query(
// Path is `$.vp.verifiableCredential[]` in case of jwt vp
presentation.claimFormat === ClaimFormat.JwtVp ? { vp: presentation } : presentation,
descriptor.path_nested.path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ import type {

import { Jwt } from '../../../crypto'
import { JsonTransformer } from '../../../utils'
import { MdocDeviceResponse } from '../../mdoc'
import { MdocDeviceResponse, MdocRecord } from '../../mdoc'
import { SdJwtVcApi } from '../../sd-jwt-vc'
import { W3cCredentialRecord, W3cJsonLdVerifiablePresentation, W3cJwtVerifiablePresentation } from '../../vc'

export function getSphereonOriginalVerifiableCredential(
credentialRecord: W3cCredentialRecord | SdJwtVcRecord
credentialRecord: W3cCredentialRecord | SdJwtVcRecord | MdocRecord
): SphereonOriginalVerifiableCredential {
if (credentialRecord instanceof W3cCredentialRecord) {
return credentialRecord.credential.encoded as SphereonOriginalVerifiableCredential
} else if (credentialRecord instanceof MdocRecord) {
return credentialRecord.base64Url
} else {
return credentialRecord.compactSdJwtVc
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { DifPresentationExchangeDefinitionV1 } from '../../../../dif-presen
import type { ProofFormatService } from '../../ProofFormatService'
import type { DifPresentationExchangeProofFormat } from '../DifPresentationExchangeProofFormat'

import { PresentationSubmissionLocation } from '@sphereon/pex'
import { PresentationSubmissionLocation } from '@animo-id/pex'

import { getInMemoryAgentOptions } from '../../../../../../tests'
import { Agent } from '../../../../../agent/Agent'
Expand Down
81 changes: 26 additions & 55 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e70a2ce

Please sign in to comment.