Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
feat: Use other jsonpath package
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Jul 7, 2023
1 parent 096b0ad commit 3c68df6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 48 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sphereon/did-auth-siop",
"version": "0.3.2-unstable.6",
"version": "0.3.2-jsonpath-test.2",
"source": "src/index.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -29,14 +29,15 @@
},
"dependencies": {
"@sphereon/did-uni-client": "^0.6.0",
"@sphereon/pex": "^2.0.1",
"@sphereon/pex": "^2.0.2-jsonpath-test.1",
"@sphereon/pex-models": "^2.0.2",
"@sphereon/ssi-types": "^0.11.0",
"@sphereon/ssi-types": "^0.13.0",
"@sphereon/wellknown-dids-client": "^0.1.3",
"cross-fetch": "^3.1.6",
"did-jwt": "^6.11.6",
"did-resolver": "^4.1.0",
"events": "^3.3.0",
"@astronautlabs/jsonpath": "^1.1.2",
"language-tags": "^1.0.8",
"multiformats": "^11.0.2",
"querystring": "^0.2.1",
Expand Down
4 changes: 2 additions & 2 deletions src/authorization-response/PresentationExchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ export class PresentationExchange {
const definitionsFromList = extractDataFromPath(authorizationRequestPayload, '$.presentation_definition[*]');
const definitionRefs = extractDataFromPath(authorizationRequestPayload, '$.presentation_definition_uri');
const definitionRefsFromList = extractDataFromPath(authorizationRequestPayload, '$.presentation_definition_uri[*]');
const hasPD = (definitions && definitions.length > 0) || (definitionsFromList && definitionsFromList > 0);
const hasPdRef = (definitionRefs && definitionRefs.length > 0) || (definitionRefsFromList && definitionsFromList > 0);
const hasPD = (definitions && definitions.length > 0) || (definitionsFromList && definitionsFromList.length > 0);
const hasPdRef = (definitionRefs && definitionRefs.length > 0) || (definitionRefsFromList && definitionsFromList.length > 0);
if (hasPD && hasPdRef) {
throw new Error(SIOPErrors.REQUEST_CLAIMS_PRESENTATION_DEFINITION_BY_REF_AND_VALUE_NON_EXCLUSIVE);
}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/ObjectUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import jp from 'jsonpath';
import { JSONPath as jp } from '@astronautlabs/jsonpath';

export function extractDataFromPath(obj: unknown, path: string) {
return jp.nodes(obj, path);
Expand Down
60 changes: 18 additions & 42 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"@jridgewell/gen-mapping" "^0.3.0"
"@jridgewell/trace-mapping" "^0.3.9"

"@astronautlabs/jsonpath@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@astronautlabs/jsonpath/-/jsonpath-1.1.2.tgz#af19bb4a7d13dcfbc60c3c998ee1e73d7c2ddc38"
integrity sha512-FqL/muoreH7iltYC1EB5Tvox5E8NSOOPGkgns4G+qxRKl6k5dxEVljUjB5NcKESzkqwnUqWjSZkL61XGYOuV+A==
dependencies:
static-eval "2.0.2"

"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.21.4":
version "7.21.4"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.21.4.tgz#d0fa9e4413aca81f2b23b9442797bda1826edb39"
Expand Down Expand Up @@ -1129,31 +1136,24 @@
resolved "https://registry.yarnpkg.com/@sphereon/pex-models/-/pex-models-2.0.2.tgz#541b3f77522ab295da70b65baa0994e249073d1b"
integrity sha512-ptHM72tdQrhMYSItHoGCm3HgK+HGF6tI29zYfS47H3M7ZjKhBgfmVHohuxhxA0Q6cL5gqH1jEA8G5Z2tadHmTw==

"@sphereon/pex@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@sphereon/pex/-/pex-2.0.1.tgz#277de5dd1346c30c50b67fbbbfb8919004c05b52"
integrity sha512-9UW1z60ltPMEauqKXa73gTfmU8SrPxH+X7Rx9v7G13ZmeTC8Yjfm2C7Mit01B9BCL49gShV4htG8np3+UKlorg==
"@sphereon/pex@^2.0.2-jsonpath-test.1":
version "2.0.2-jsonpath-test.1"
resolved "https://registry.yarnpkg.com/@sphereon/pex/-/pex-2.0.2-jsonpath-test.1.tgz#0071bb2165274cd250be2ccc7461b62a61ec2ab5"
integrity sha512-AfL6rvjVMSIg5Rc62/e7yuxY1dMr44xH2W+9YlXYzvqCYFCdqfAC/vuq5eW61TrMt2nBV1xR/UD12fhVvTs62A==
dependencies:
"@astronautlabs/jsonpath" "^1.1.2"
"@sphereon/pex-models" "^2.0.2"
"@sphereon/ssi-types" "^0.10.0"
"@sphereon/ssi-types" "^0.13.0"
ajv "^8.12.0"
ajv-formats "^2.1.1"
jsonpath "^1.1.1"
jwt-decode "^3.1.2"
nanoid "^3.3.6"
string.prototype.matchall "^4.0.8"

"@sphereon/ssi-types@^0.10.0":
version "0.10.0"
resolved "https://registry.yarnpkg.com/@sphereon/ssi-types/-/ssi-types-0.10.0.tgz#dbb20d727586b40f1e98c84a1b57da3e899b4850"
integrity sha512-ajAUeaR2fMSvlj/au40ltzSoQ+Qy0CdYouPeK6upFma/8g36RbRh0CI+Ee1qOl3R/SbHBzB3XKWFVGHzooVnNQ==
dependencies:
jwt-decode "^3.1.2"

"@sphereon/ssi-types@^0.11.0":
version "0.11.0"
resolved "https://registry.yarnpkg.com/@sphereon/ssi-types/-/ssi-types-0.11.0.tgz#ab997fe885acdc4388aff606de16ee5c10b8e53b"
integrity sha512-0ZV/X6J8k7UWmrRE2wo4ZIBq9TFYRd1GLT9nWWqDYnkzdaLUjD3mL0qs5wcTjqupxITCgwQqGrZ5YP9bm8feSA==
"@sphereon/ssi-types@^0.13.0":
version "0.13.0"
resolved "https://registry.yarnpkg.com/@sphereon/ssi-types/-/ssi-types-0.13.0.tgz#da75ee21d13e3e7b1e492850082b476262888be9"
integrity sha512-THzkvgY6AN4/0INgGowinzOFX6NeUQJ/KmAcXrBXx2Rny5v5wCp7LhBIlK21KF2/76fbiCyJvwcd/+Yeb0fjwQ==
dependencies:
jwt-decode "^3.1.2"

Expand Down Expand Up @@ -2759,11 +2759,6 @@ espree@^9.5.1:
acorn-jsx "^5.3.2"
eslint-visitor-keys "^3.4.0"

[email protected]:
version "1.2.2"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.2.2.tgz#76a0fd66fcfe154fd292667dc264019750b1657b"
integrity sha512-+JpPZam9w5DuJ3Q67SqsMGtiHKENSMRVoxvArfJZK01/BfLEObtZ6orJa/MtoGNR/rfMgp5837T41PAmTwAv/A==

esprima@^4.0.0, esprima@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
Expand Down Expand Up @@ -4084,15 +4079,6 @@ json5@^2.2.1, json5@^2.2.2, json5@^2.2.3:
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==

jsonpath@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/jsonpath/-/jsonpath-1.1.1.tgz#0ca1ed8fb65bb3309248cc9d5466d12d5b0b9901"
integrity sha512-l6Cg7jRpixfbgoWgkrl77dgEj8RPvND0wMH6TwQmi9Qs4TFfS9u5cUFnbeKTwj5ga5Y3BTGGNI28k117LJ009w==
dependencies:
esprima "1.2.2"
static-eval "2.0.2"
underscore "1.12.1"

jwt-decode@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59"
Expand Down Expand Up @@ -5578,12 +5564,7 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"

[email protected]:
version "4.6.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9"
integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==

typescript@~4.9.3:
[email protected], typescript@~4.9.3:
version "4.9.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
Expand All @@ -5605,11 +5586,6 @@ unbox-primitive@^1.0.2:
has-symbols "^1.0.3"
which-boxed-primitive "^1.0.2"

[email protected]:
version "1.12.1"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.12.1.tgz#7bb8cc9b3d397e201cf8553336d262544ead829e"
integrity sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==

unique-string@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-2.0.0.tgz#39c6451f81afb2749de2b233e3f7c5e8843bd89d"
Expand Down

0 comments on commit 3c68df6

Please sign in to comment.