Skip to content

Commit

Permalink
chore: use PresentationEvaluationResults & fixe build:clean scipts
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Aug 30, 2024
1 parent 74fb1ba commit c69a72c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages/did-auth-siop-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"build:clean": "tsc --build --clean && tsc --build",
"clean": "rimraf dist coverage"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import {
EvaluationResults,
IPresentationDefinition,
KeyEncoding,
PEX,
PresentationSubmissionLocation,
SelectResults,
Status,
VerifiablePresentationFromOpts,
VerifiablePresentationResult,
} from '@sphereon/pex'
import { Format, PresentationDefinitionV1, PresentationDefinitionV2, PresentationSubmission } from '@sphereon/pex-models'
VerifiablePresentationResult
} from '@sphereon/pex';
import {
Format,
PresentationDefinitionV1,
PresentationDefinitionV2,
PresentationSubmission
} from '@sphereon/pex-models';
import {
CredentialMapper,
Hasher,
Expand All @@ -18,18 +22,19 @@ import {
OriginalVerifiableCredential,
OriginalVerifiablePresentation,
W3CVerifiablePresentation,
WrappedVerifiablePresentation,
} from '@sphereon/ssi-types'
WrappedVerifiablePresentation
} from '@sphereon/ssi-types';

import { extractDataFromPath, getWithUrl } from '../helpers'
import { AuthorizationRequestPayload, SIOPErrors, SupportedVersion } from '../types'
import { extractDataFromPath, getWithUrl } from '../helpers';
import { AuthorizationRequestPayload, SIOPErrors, SupportedVersion } from '../types';

import {
PresentationDefinitionLocation,
PresentationDefinitionWithLocation,
PresentationSignCallback,
PresentationVerificationCallback,
} from './types'
PresentationVerificationCallback
} from './types';
import { PresentationEvaluationResults } from '@sphereon/pex/dist/main/lib/evaluation/core/evaluationResults';

export class PresentationExchange {
readonly pex: PEX
Expand Down Expand Up @@ -133,7 +138,7 @@ export class PresentationExchange {
presentationSubmission?: PresentationSubmission
hasher?: Hasher
},
): Promise<EvaluationResults> {
): Promise<PresentationEvaluationResults> {
const wvp: WrappedVerifiablePresentation =
typeof verifiablePresentation === 'object' && 'original' in verifiablePresentation
? (verifiablePresentation as WrappedVerifiablePresentation)
Expand All @@ -149,7 +154,7 @@ export class PresentationExchange {
throw new Error(SIOPErrors.NO_VERIFIABLE_PRESENTATION_NO_CREDENTIALS)
}
// console.log(`Presentation (validate): ${JSON.stringify(verifiablePresentation)}`);
const evaluationResults: EvaluationResults = new PEX({ hasher: opts?.hasher }).evaluatePresentation(presentationDefinition, wvp.original, opts)
const evaluationResults: PresentationEvaluationResults = new PEX({ hasher: opts?.hasher }).evaluatePresentation(presentationDefinition, wvp.original, opts)
if (evaluationResults.errors.length) {
throw new Error(`message: ${SIOPErrors.COULD_NOT_FIND_VCS_MATCHING_PD}, details: ${JSON.stringify(evaluationResults.errors)}`)
}
Expand Down
1 change: 1 addition & 0 deletions packages/siop-oid4vp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"types": "dist/index.d.ts",
"scripts": {
"build": "pnpm build:schemaGenerator && tsc",
"build:clean": "pnpm build:schemaGenerator && tsc --build --clean && tsc --build",
"build:main": "tsc -p tsconfig.build.json",
"build:schemaGenerator": "node --loader=tsimp/loader ./lib/generator/schemaGenerator.ts",
"clean": "rimraf dist coverage",
Expand Down

0 comments on commit c69a72c

Please sign in to comment.