@pagopa/io-react-native-wallet 1.1.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +3 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/presentation/01-start-flow.js +7 -5
- package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/commonjs/credential/presentation/03-get-request-object.js +47 -0
- package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -0
- package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js +82 -0
- package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js.map +1 -0
- package/lib/commonjs/credential/presentation/05-verify-request-object.js +35 -0
- package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -0
- package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js +63 -0
- package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js.map +1 -0
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +169 -0
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -0
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js +202 -0
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -0
- package/lib/commonjs/credential/presentation/README.md +43 -4
- package/lib/commonjs/credential/presentation/errors.js +52 -1
- package/lib/commonjs/credential/presentation/errors.js.map +1 -1
- package/lib/commonjs/credential/presentation/index.js +27 -6
- package/lib/commonjs/credential/presentation/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js +69 -4
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/entity/trust/types.js +4 -1
- package/lib/commonjs/entity/trust/types.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +3 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/presentation/01-start-flow.js +8 -6
- package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/module/credential/presentation/03-get-request-object.js +39 -0
- package/lib/module/credential/presentation/03-get-request-object.js.map +1 -0
- package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +75 -0
- package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -0
- package/lib/module/credential/presentation/05-verify-request-object.js +28 -0
- package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -0
- package/lib/module/credential/presentation/06-fetch-presentation-definition.js +56 -0
- package/lib/module/credential/presentation/06-fetch-presentation-definition.js.map +1 -0
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +161 -0
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -0
- package/lib/module/credential/presentation/08-send-authorization-response.js +188 -0
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -0
- package/lib/module/credential/presentation/README.md +43 -4
- package/lib/module/credential/presentation/errors.js +48 -0
- package/lib/module/credential/presentation/errors.js.map +1 -1
- package/lib/module/credential/presentation/index.js +7 -4
- package/lib/module/credential/presentation/index.js.map +1 -1
- package/lib/module/credential/presentation/types.js +67 -3
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/entity/trust/types.js +4 -1
- package/lib/module/entity/trust/types.js.map +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/{04-get-request-object.d.ts → 03-get-request-object.d.ts} +3 -5
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/{03-retrieve-jwks.d.ts → 04-retrieve-rp-jwks.d.ts} +5 -4
- package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +8 -0
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts +26 -0
- package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +27 -0
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +99 -0
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/errors.d.ts +33 -0
- package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/index.d.ts +8 -5
- package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +612 -9
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
- package/lib/typescript/entity/trust/index.d.ts +152 -0
- package/lib/typescript/entity/trust/index.d.ts.map +1 -1
- package/lib/typescript/entity/trust/types.d.ts +2088 -0
- package/lib/typescript/entity/trust/types.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/credential/issuance/04-complete-user-authorization.ts +2 -2
- package/src/credential/presentation/01-start-flow.ts +10 -6
- package/src/credential/presentation/{04-get-request-object.ts → 03-get-request-object.ts} +6 -51
- package/src/credential/presentation/{03-retrieve-jwks.ts → 04-retrieve-rp-jwks.ts} +39 -24
- package/src/credential/presentation/05-verify-request-object.ts +35 -0
- package/src/credential/presentation/06-fetch-presentation-definition.ts +78 -0
- package/src/credential/presentation/07-evaluate-input-descriptor.ts +204 -0
- package/src/credential/presentation/08-send-authorization-response.ts +251 -0
- package/src/credential/presentation/README.md +43 -4
- package/src/credential/presentation/errors.ts +48 -0
- package/src/credential/presentation/index.ts +27 -9
- package/src/credential/presentation/types.ts +59 -3
- package/src/entity/trust/types.ts +3 -0
- package/lib/commonjs/credential/presentation/03-retrieve-jwks.js +0 -68
- package/lib/commonjs/credential/presentation/03-retrieve-jwks.js.map +0 -1
- package/lib/commonjs/credential/presentation/04-get-request-object.js +0 -82
- package/lib/commonjs/credential/presentation/04-get-request-object.js.map +0 -1
- package/lib/commonjs/credential/presentation/05-send-authorization-response.js +0 -139
- package/lib/commonjs/credential/presentation/05-send-authorization-response.js.map +0 -1
- package/lib/module/credential/presentation/03-retrieve-jwks.js +0 -61
- package/lib/module/credential/presentation/03-retrieve-jwks.js.map +0 -1
- package/lib/module/credential/presentation/04-get-request-object.js +0 -74
- package/lib/module/credential/presentation/04-get-request-object.js.map +0 -1
- package/lib/module/credential/presentation/05-send-authorization-response.js +0 -128
- package/lib/module/credential/presentation/05-send-authorization-response.js.map +0 -1
- package/lib/typescript/credential/presentation/03-retrieve-jwks.d.ts.map +0 -1
- package/lib/typescript/credential/presentation/04-get-request-object.d.ts.map +0 -1
- package/lib/typescript/credential/presentation/05-send-authorization-response.d.ts +0 -34
- package/lib/typescript/credential/presentation/05-send-authorization-response.d.ts.map +0 -1
- package/src/credential/presentation/05-send-authorization-response.ts +0 -168
@@ -33,7 +33,9 @@ const buildAuthorizationUrl = async (issuerRequestUri, clientId, issuerConf, idp
|
|
33
33
|
const params = new URLSearchParams({
|
34
34
|
client_id: clientId,
|
35
35
|
request_uri: issuerRequestUri,
|
36
|
-
|
36
|
+
...(idpHint && {
|
37
|
+
idphint: idpHint
|
38
|
+
})
|
37
39
|
});
|
38
40
|
const authUrl = `${authzRequestEndpoint}?${params}`;
|
39
41
|
return {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","_ioReactNativeJwt","_types","_reactNativeUuid","_types2","_decoder","_errors2","obj","__esModule","default","buildAuthorizationUrl","issuerRequestUri","clientId","issuerConf","idpHint","authzRequestEndpoint","authorization_endpoint","params","URLSearchParams","client_id","request_uri","idphint","authUrl","exports","completeUserAuthorizationWithQueryMode","authRedirectUrl","query","parseUrl","parseAuthorizationResponse","getRequestedCredentialToBePresented","appFetch","arguments","length","undefined","fetch","requestObject","toString","method","then","hasStatusOrThrow","IssuerResponseError","res","text","jws","decode","reqObj","RequestObject","safeParse","payload","success","ValidationFailed","message","reason","error","data","completeUserAuthorizationWithFormPostJwtMode","ctx","wiaCryptoContext","pidCryptoContext","pid","walletInstanceAttestation","wiaWpToken","SignJWT","setProtectedHeader","alg","typ","setPayload","vp","jti","uuid","v4","nonce","setIssuedAt","setExpirationTime","setAudience","response_uri","sign","pidWpToken","presentationSubmission","definition_id","id","descriptor_map","path","format","authzResponsePayload","encodeBase64","JSON","stringify","state","presentation_submission","vp_token","body","response","resUriRes","headers","reqUri","json","responseUri","ResponseUriResultShape","redirect_uri","getJwtFromFormPost","cbRes","decodedJwt","authRes","authResParsed","AuthorizationResultShape","authErr","AuthorizationErrorShape","AuthorizationError","AuthorizationIdpError","error_description"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,iBAAA,GAAAL,OAAA;AAMA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AAAqE,SAAAG,uBAAAQ,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAErE;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,qBAA4C,GAAG,MAAAA,CAC1DC,gBAAgB,EAChBC,QAAQ,EACRC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,oBAAoB,GAAGF,UAAU,CAACG,sBAAsB;EAE9D,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC;IACjCC,SAAS,EAAEP,QAAQ;IACnBQ,WAAW,EAAET,gBAAgB;
|
1
|
+
{"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","_ioReactNativeJwt","_types","_reactNativeUuid","_types2","_decoder","_errors2","obj","__esModule","default","buildAuthorizationUrl","issuerRequestUri","clientId","issuerConf","idpHint","authzRequestEndpoint","authorization_endpoint","params","URLSearchParams","client_id","request_uri","idphint","authUrl","exports","completeUserAuthorizationWithQueryMode","authRedirectUrl","query","parseUrl","parseAuthorizationResponse","getRequestedCredentialToBePresented","appFetch","arguments","length","undefined","fetch","requestObject","toString","method","then","hasStatusOrThrow","IssuerResponseError","res","text","jws","decode","reqObj","RequestObject","safeParse","payload","success","ValidationFailed","message","reason","error","data","completeUserAuthorizationWithFormPostJwtMode","ctx","wiaCryptoContext","pidCryptoContext","pid","walletInstanceAttestation","wiaWpToken","SignJWT","setProtectedHeader","alg","typ","setPayload","vp","jti","uuid","v4","nonce","setIssuedAt","setExpirationTime","setAudience","response_uri","sign","pidWpToken","presentationSubmission","definition_id","id","descriptor_map","path","format","authzResponsePayload","encodeBase64","JSON","stringify","state","presentation_submission","vp_token","body","response","resUriRes","headers","reqUri","json","responseUri","ResponseUriResultShape","redirect_uri","getJwtFromFormPost","cbRes","decodedJwt","authRes","authResParsed","AuthorizationResultShape","authErr","AuthorizationErrorShape","AuthorizationError","AuthorizationIdpError","error_description"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,iBAAA,GAAAL,OAAA;AAMA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,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,CAACtD,OAAO,CAAC,CAAC;AAC1E,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AANAzB,OAAA,CAAAgC,4CAAA,GAAAA,4CAAA;AAOO,MAAM3B,0BAA0B,GACrC2E,OAAgB,IACQ;EACxB,MAAMC,aAAa,GAAGC,8BAAwB,CAAC1D,SAAS,CAACwD,OAAO,CAAC;EACjE,IAAI,CAACC,aAAa,CAACvD,OAAO,EAAE;IAC1B,MAAMyD,OAAO,GAAGC,6BAAuB,CAAC5D,SAAS,CAACwD,OAAO,CAAC;IAC1D,IAAI,CAACG,OAAO,CAACzD,OAAO,EAAE;MACpB,MAAM,IAAI2D,2BAAkB,CAACJ,aAAa,CAACnD,KAAK,CAACF,OAAO,CAAC,CAAC,CAAC;IAC7D;;IACA,MAAM,IAAI0D,8BAAqB,CAC7BH,OAAO,CAACpD,IAAI,CAACD,KAAK,EAClBqD,OAAO,CAACpD,IAAI,CAACwD,iBACf,CAAC;EACH;EACA,OAAON,aAAa,CAAClD,IAAI;AAC3B,CAAC;AAAC/B,OAAA,CAAAK,0BAAA,GAAAA,0BAAA"}
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.startFlowFromQR = void 0;
|
7
7
|
var z = _interopRequireWildcard(require("zod"));
|
8
|
-
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
9
8
|
var _errors = require("./errors");
|
10
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
11
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -35,10 +34,13 @@ const QRCodePayload = z.object({
|
|
35
34
|
const startFlowFromQR = qrcode => {
|
36
35
|
let decodedUrl;
|
37
36
|
try {
|
38
|
-
|
39
|
-
|
37
|
+
var _originalQrCode$;
|
38
|
+
// splitting qrcode to identify which is link format
|
39
|
+
const originalQrCode = qrcode.split("://");
|
40
|
+
const replacedQrcode = (_originalQrCode$ = originalQrCode[1]) !== null && _originalQrCode$ !== void 0 && _originalQrCode$.startsWith("?") ? qrcode.replace(`${originalQrCode[0]}://`, "https://wallet.example/") : qrcode;
|
41
|
+
decodedUrl = new URL(replacedQrcode);
|
40
42
|
} catch (error) {
|
41
|
-
throw new _errors.
|
43
|
+
throw new _errors.InvalidQRCodeError(`Failed to decode QR code: ${qrcode}`);
|
42
44
|
}
|
43
45
|
const protocol = decodedUrl.protocol;
|
44
46
|
const resource = decodedUrl.hostname;
|
@@ -53,7 +55,7 @@ const startFlowFromQR = qrcode => {
|
|
53
55
|
if (result.success) {
|
54
56
|
return result.data;
|
55
57
|
} else {
|
56
|
-
throw new _errors.
|
58
|
+
throw new _errors.InvalidQRCodeError(`${result.error.message}, ${decodedUrl}`);
|
57
59
|
}
|
58
60
|
};
|
59
61
|
exports.startFlowFromQR = startFlowFromQR;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["z","_interopRequireWildcard","require","
|
1
|
+
{"version":3,"names":["z","_interopRequireWildcard","require","_errors","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","QRCodePayload","object","protocol","string","resource","clientId","requestURI","startFlowFromQR","qrcode","decodedUrl","_originalQrCode$","originalQrCode","split","replacedQrcode","startsWith","replace","URL","error","InvalidQRCodeError","hostname","searchParams","result","safeParse","success","data","message","exports"],"sourceRoot":"../../../../src","sources":["credential/presentation/01-start-flow.ts"],"mappings":";;;;;;AAAA,IAAAA,CAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAA8C,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CA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;EACpC,MAAMb,UAAU,GAAGG,UAAU,CAACW,YAAY,CAAChC,GAAG,CAAC,aAAa,CAAC;EAC7D,MAAMiB,QAAQ,GAAGI,UAAU,CAACW,YAAY,CAAChC,GAAG,CAAC,WAAW,CAAC;EAEzD,MAAMiC,MAAM,GAAGrB,aAAa,CAACsB,SAAS,CAAC;IACrCpB,QAAQ;IACRE,QAAQ;IACRE,UAAU;IACVD;EACF,CAAC,CAAC;EAEF,IAAIgB,MAAM,CAACE,OAAO,EAAE;IAClB,OAAOF,MAAM,CAACG,IAAI;EACpB,CAAC,MAAM;IACL,MAAM,IAAIN,0BAAkB,CAAE,GAAEG,MAAM,CAACJ,KAAK,CAACQ,OAAQ,KAAIhB,UAAW,EAAC,CAAC;EACxE;AACF,CAAC;AAACiB,OAAA,CAAAnB,eAAA,GAAAA,eAAA"}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getRequestObject = void 0;
|
7
|
+
var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
|
8
|
+
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
9
|
+
var _dpop = require("../../utils/dpop");
|
10
|
+
var _misc = require("../../utils/misc");
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
+
/**
|
13
|
+
* Obtain the Request Object for RP authentication
|
14
|
+
* @see https://italia.github.io/eudi-wallet-it-docs/versione-corrente/en/relying-party-solution.html
|
15
|
+
*
|
16
|
+
* @param requestUri The url for the Relying Party to connect with
|
17
|
+
* @param rpConf The Relying Party's configuration
|
18
|
+
* @param context.wiaCryptoContext The context to access the key associated with the Wallet Instance Attestation
|
19
|
+
* @param context.walletInstanceAttestation The Wallet Instance Attestation token
|
20
|
+
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
21
|
+
* @returns The Request Object that describes the presentation
|
22
|
+
*/
|
23
|
+
const getRequestObject = async (requestUri, _ref) => {
|
24
|
+
let {
|
25
|
+
wiaCryptoContext,
|
26
|
+
appFetch = fetch,
|
27
|
+
walletInstanceAttestation
|
28
|
+
} = _ref;
|
29
|
+
const signedWalletInstanceDPoP = await (0, _dpop.createDPopToken)({
|
30
|
+
jti: `${_reactNativeUuid.default.v4()}`,
|
31
|
+
htm: "GET",
|
32
|
+
htu: requestUri,
|
33
|
+
ath: await (0, _ioReactNativeJwt.sha256ToBase64)(walletInstanceAttestation)
|
34
|
+
}, wiaCryptoContext);
|
35
|
+
const requestObjectEncodedJwt = await appFetch(requestUri, {
|
36
|
+
method: "GET",
|
37
|
+
headers: {
|
38
|
+
Authorization: `DPoP ${walletInstanceAttestation}`,
|
39
|
+
DPoP: signedWalletInstanceDPoP
|
40
|
+
}
|
41
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.text());
|
42
|
+
return {
|
43
|
+
requestObjectEncodedJwt
|
44
|
+
};
|
45
|
+
};
|
46
|
+
exports.getRequestObject = getRequestObject;
|
47
|
+
//# sourceMappingURL=03-get-request-object.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactNativeUuid","_interopRequireDefault","require","_ioReactNativeJwt","_dpop","_misc","obj","__esModule","default","getRequestObject","requestUri","_ref","wiaCryptoContext","appFetch","fetch","walletInstanceAttestation","signedWalletInstanceDPoP","createDPopToken","jti","uuid","v4","htm","htu","ath","sha256ToBase64","requestObjectEncodedJwt","method","headers","Authorization","DPoP","then","hasStatusOrThrow","res","text","exports"],"sourceRoot":"../../../../src","sources":["credential/presentation/03-get-request-object.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAA8D,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAY9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,gBAAkC,GAAG,MAAAA,CAChDC,UAAU,EAAAC,IAAA,KAEP;EAAA,IADH;IAAEC,gBAAgB;IAAEC,QAAQ,GAAGC,KAAK;IAAEC;EAA0B,CAAC,GAAAJ,IAAA;EAEjE,MAAMK,wBAAwB,GAAG,MAAM,IAAAC,qBAAe,EACpD;IACEC,GAAG,EAAG,GAAEC,wBAAI,CAACC,EAAE,CAAC,CAAE,EAAC;IACnBC,GAAG,EAAE,KAAK;IACVC,GAAG,EAAEZ,UAAU;IACfa,GAAG,EAAE,MAAM,IAAAC,gCAAc,EAACT,yBAAyB;EACrD,CAAC,EACDH,gBACF,CAAC;EAED,MAAMa,uBAAuB,GAAG,MAAMZ,QAAQ,CAACH,UAAU,EAAE;IACzDgB,MAAM,EAAE,KAAK;IACbC,OAAO,EAAE;MACPC,aAAa,EAAG,QAAOb,yBAA0B,EAAC;MAClDc,IAAI,EAAEb;IACR;EACF,CAAC,CAAC,CACCc,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,CAAC,CAAC,CAC3BD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;EAE5B,OAAO;IACLR;EACF,CAAC;AACH,CAAC;AAACS,OAAA,CAAAzB,gBAAA,GAAAA,gBAAA"}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.fetchJwksFromRequestObject = exports.fetchJwksFromConfig = void 0;
|
7
|
+
var _jwk = require("../../utils/jwk");
|
8
|
+
var _misc = require("../../utils/misc");
|
9
|
+
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
10
|
+
var _errors = require("./errors");
|
11
|
+
/**
|
12
|
+
* Defines the signature for a function that retrieves JSON Web Key Sets (JWKS) from a client.
|
13
|
+
*
|
14
|
+
* @template T - The tuple type representing the function arguments.
|
15
|
+
* @param args - The arguments passed to the function.
|
16
|
+
* @returns A promise resolving to an object containing an array of JWKs.
|
17
|
+
*/
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Retrieves the JSON Web Key Set (JWKS) from the specified client's well-known endpoint.
|
21
|
+
* It is formed using `{issUrl.base}/.well-known/jar-issuer${issUrl.pah}` as explained in SD-JWT VC issuer metadata section
|
22
|
+
*
|
23
|
+
* @param requestObjectEncodedJwt - Request Object in JWT format.
|
24
|
+
* @param options - Optional context containing a custom fetch implementation.
|
25
|
+
* @param options.context - Optional context object.
|
26
|
+
* @param options.context.appFetch - Optional custom fetch function to use instead of the global `fetch`.
|
27
|
+
* @returns A promise resolving to an object containing an array of JWKs.
|
28
|
+
* @throws Will throw an error if the JWKS retrieval fails.
|
29
|
+
*/
|
30
|
+
const fetchJwksFromRequestObject = async function (requestObjectEncodedJwt) {
|
31
|
+
var _requestObjectJwt$pro, _requestObjectJwt$pay;
|
32
|
+
let {
|
33
|
+
context = {}
|
34
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
35
|
+
const {
|
36
|
+
appFetch = fetch
|
37
|
+
} = context;
|
38
|
+
const requestObjectJwt = (0, _ioReactNativeJwt.decode)(requestObjectEncodedJwt);
|
39
|
+
|
40
|
+
// 1. check if request object jwt contains the 'jwk' attribute
|
41
|
+
if ((_requestObjectJwt$pro = requestObjectJwt.protectedHeader) !== null && _requestObjectJwt$pro !== void 0 && _requestObjectJwt$pro.jwk) {
|
42
|
+
return {
|
43
|
+
keys: [_jwk.JWK.parse(requestObjectJwt.protectedHeader.jwk)]
|
44
|
+
};
|
45
|
+
}
|
46
|
+
|
47
|
+
// 2. According to Potential profile, retrieve from RP endpoint using iss claim
|
48
|
+
const issClaimValue = (_requestObjectJwt$pay = requestObjectJwt.payload) === null || _requestObjectJwt$pay === void 0 ? void 0 : _requestObjectJwt$pay.iss;
|
49
|
+
if (issClaimValue) {
|
50
|
+
const issUrl = new URL(issClaimValue);
|
51
|
+
const wellKnownUrl = new URL(`/.well-known/jar-issuer${issUrl.pathname}`, `${issUrl.protocol}//${issUrl.host}`).toString();
|
52
|
+
|
53
|
+
// Fetches the JWKS from a specific endpoint of the entity's well-known configuration
|
54
|
+
const jwks = await appFetch(wellKnownUrl, {
|
55
|
+
method: "GET"
|
56
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(raw => raw.json()).then(json => _jwk.JWKS.parse(json.jwks));
|
57
|
+
return {
|
58
|
+
keys: jwks.keys
|
59
|
+
};
|
60
|
+
}
|
61
|
+
throw new _errors.NoSuitableKeysFoundInEntityConfiguration("Request Object signature verification");
|
62
|
+
};
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Retrieves the JSON Web Key Set (JWKS) from a Relying Party's entity configuration.
|
66
|
+
*
|
67
|
+
* @param rpConfig - The configuration object of the Relying Party entity.
|
68
|
+
* @returns An object containing an array of JWKs.
|
69
|
+
* @throws Will throw an error if the configuration is invalid or if JWKS is not found.
|
70
|
+
*/
|
71
|
+
exports.fetchJwksFromRequestObject = fetchJwksFromRequestObject;
|
72
|
+
const fetchJwksFromConfig = async rpConfig => {
|
73
|
+
const jwks = rpConfig.wallet_relying_party.jwks;
|
74
|
+
if (!jwks || !Array.isArray(jwks.keys)) {
|
75
|
+
throw new Error("JWKS not found in Relying Party configuration.");
|
76
|
+
}
|
77
|
+
return {
|
78
|
+
keys: jwks.keys
|
79
|
+
};
|
80
|
+
};
|
81
|
+
exports.fetchJwksFromConfig = fetchJwksFromConfig;
|
82
|
+
//# sourceMappingURL=04-retrieve-rp-jwks.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_jwk","require","_misc","_ioReactNativeJwt","_errors","fetchJwksFromRequestObject","requestObjectEncodedJwt","_requestObjectJwt$pro","_requestObjectJwt$pay","context","arguments","length","undefined","appFetch","fetch","requestObjectJwt","decodeJwt","protectedHeader","jwk","keys","JWK","parse","issClaimValue","payload","iss","issUrl","URL","wellKnownUrl","pathname","protocol","host","toString","jwks","method","then","hasStatusOrThrow","raw","json","JWKS","NoSuitableKeysFoundInEntityConfiguration","exports","fetchJwksFromConfig","rpConfig","wallet_relying_party","Array","isArray","Error"],"sourceRoot":"../../../../src","sources":["credential/presentation/04-retrieve-rp-jwks.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMI,0BAEZ,GAAG,eAAAA,CAAOC,uBAAuB,EAA4B;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EAAA,IAA1B;IAAEC,OAAO,GAAG,CAAC;EAAE,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACvD,MAAM;IAAEG,QAAQ,GAAGC;EAAM,CAAC,GAAGL,OAAO;EACpC,MAAMM,gBAAgB,GAAG,IAAAC,wBAAS,EAACV,uBAAuB,CAAC;;EAE3D;EACA,KAAAC,qBAAA,GAAIQ,gBAAgB,CAACE,eAAe,cAAAV,qBAAA,eAAhCA,qBAAA,CAAkCW,GAAG,EAAE;IACzC,OAAO;MACLC,IAAI,EAAE,CAACC,QAAG,CAACC,KAAK,CAACN,gBAAgB,CAACE,eAAe,CAACC,GAAG,CAAC;IACxD,CAAC;EACH;;EAEA;EACA,MAAMI,aAAa,IAAAd,qBAAA,GAAGO,gBAAgB,CAACQ,OAAO,cAAAf,qBAAA,uBAAxBA,qBAAA,CAA0BgB,GAAa;EAC7D,IAAIF,aAAa,EAAE;IACjB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yRequestObjectSignature = void 0;
|
7
|
+
var _errors = require("./errors");
|
8
|
+
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
9
|
+
var _types = require("./types");
|
10
|
+
const verifyRequestObjectSignature = async (requestObjectEncodedJwt, jwkKeys) => {
|
11
|
+
const requestObjectJwt = (0, _ioReactNativeJwt.decode)(requestObjectEncodedJwt);
|
12
|
+
|
13
|
+
// verify token signature to ensure the request object is authentic
|
14
|
+
const pubKey = jwkKeys === null || jwkKeys === void 0 ? void 0 : jwkKeys.find(_ref => {
|
15
|
+
let {
|
16
|
+
kid
|
17
|
+
} = _ref;
|
18
|
+
return kid === requestObjectJwt.protectedHeader.kid;
|
19
|
+
});
|
20
|
+
if (!pubKey) {
|
21
|
+
throw new _errors.UnverifiedEntityError("Request Object signature verification!");
|
22
|
+
}
|
23
|
+
await (0, _ioReactNativeJwt.verify)(requestObjectEncodedJwt, pubKey);
|
24
|
+
const requestObject = _types.RequestObject.parse(requestObjectJwt.payload);
|
25
|
+
// Check if exp exists and is expired
|
26
|
+
// exp is typically in seconds since epoch, Get current time in seconds
|
27
|
+
if (requestObject.exp && requestObject.exp <= Date.now() / 1000) {
|
28
|
+
throw new _errors.UnverifiedEntityError("Request Object is expired!");
|
29
|
+
}
|
30
|
+
return {
|
31
|
+
requestObject
|
32
|
+
};
|
33
|
+
};
|
34
|
+
exports.verifyRequestObjectSignature = verifyRequestObjectSignature;
|
35
|
+
//# sourceMappingURL=05-verify-request-object.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_errors","require","_ioReactNativeJwt","_types","verifyRequestObjectSignature","requestObjectEncodedJwt","jwkKeys","requestObjectJwt","decodeJwt","pubKey","find","_ref","kid","protectedHeader","UnverifiedEntityError","verify","requestObject","RequestObject","parse","payload","exp","Date","now","exports"],"sourceRoot":"../../../../src","sources":["credential/presentation/05-verify-request-object.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AASO,MAAMG,4BAA0D,GACrE,MAAAA,CAAOC,uBAAuB,EAAEC,OAAO,KAAK;EAC1C,MAAMC,gBAAgB,GAAG,IAAAC,wBAAS,EAACH,uBAAuB,CAAC;;EAE3D;EACA,MAAMI,MAAM,GAAGH,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,IAAI,CAC1BC,IAAA;IAAA,IAAC;MAAEC;IAAI,CAAC,GAAAD,IAAA;IAAA,OAAKC,GAAG,KAAKL,gBAAgB,CAACM,eAAe,CAACD,GAAG;EAAA,CAC3D,CAAC;EAED,IAAI,CAACH,MAAM,EAAE;IACX,MAAM,IAAIK,6BAAqB,CAAC,wCAAwC,CAAC;EAC3E;EACA,MAAM,IAAAC,wBAAM,EAACV,uBAAuB,EAAEI,MAAM,CAAC;EAE7C,MAAMO,aAAa,GAAGC,oBAAa,CAACC,KAAK,CAACX,gBAAgB,CAACY,OAAO,CAAC;EACnE;EACA;EACA,IAAIH,aAAa,CAACI,GAAG,IAAIJ,aAAa,CAACI,GAAG,IAAIC,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE;IAC/D,MAAM,IAAIR,6BAAqB,CAAC,4BAA4B,CAAC;EAC/D;EAEA,OAAO;IAAEE;EAAc,CAAC;AAC1B,CAAC;AAACO,OAAA,CAAAnB,4BAAA,GAAAA,4BAAA"}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.fetchPresentDefinition = void 0;
|
7
|
+
var _types = require("./types");
|
8
|
+
var _misc = require("../../utils/misc");
|
9
|
+
/**
|
10
|
+
* Retrieves a PresentationDefinition based on the given parameters.
|
11
|
+
*
|
12
|
+
* The method attempts the following strategies in order:
|
13
|
+
* 1. Checks if `presentation_definition` is directly available in the request object.
|
14
|
+
* 2. Fetches the `presentation_definition` from the URI provided in the relying party configuration.
|
15
|
+
* 3. Uses a pre-configured `presentation_definition` from the relying party configuration if the `scope` is present in the request object.
|
16
|
+
*
|
17
|
+
* If none of the above conditions are met, the function throws an error indicating the definition could not be found.
|
18
|
+
*
|
19
|
+
* @param {RequestObject} requestObject - The request object containing the presentation definition or references to it.
|
20
|
+
* @param {RelyingPartyEntityConfiguration["payload"]["metadata"]} [rpConf] - Optional relying party configuration.
|
21
|
+
* @param {Object} [context] - Optional context for providing a custom fetch implementation.
|
22
|
+
* @param {GlobalFetch["fetch"]} [context.appFetch] - Custom fetch function, defaults to global `fetch`.
|
23
|
+
* @returns {Promise<{ presentationDefinition: PresentationDefinition }>} - Resolves with the presentation definition.
|
24
|
+
* @throws {Error} - Throws if the presentation definition cannot be found or fetched.
|
25
|
+
*/
|
26
|
+
const fetchPresentDefinition = async function (requestObject) {
|
27
|
+
var _rpConf$wallet_relyin, _rpConf$wallet_relyin2;
|
28
|
+
let {
|
29
|
+
appFetch = fetch
|
30
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
31
|
+
let rpConf = arguments.length > 2 ? arguments[2] : undefined;
|
32
|
+
// Check if `presentation_definition` is directly available in the request object
|
33
|
+
if (requestObject.presentation_definition) {
|
34
|
+
return {
|
35
|
+
presentationDefinition: requestObject.presentation_definition
|
36
|
+
};
|
37
|
+
}
|
38
|
+
|
39
|
+
// Check if `presentation_definition_uri` is provided in the relying party configuration
|
40
|
+
if (rpConf !== null && rpConf !== void 0 && (_rpConf$wallet_relyin = rpConf.wallet_relying_party) !== null && _rpConf$wallet_relyin !== void 0 && _rpConf$wallet_relyin.presentation_definition_uri) {
|
41
|
+
try {
|
42
|
+
// Fetch the presentation definition from the provided URI
|
43
|
+
const presentationDefinition = await appFetch(rpConf === null || rpConf === void 0 ? void 0 : rpConf.wallet_relying_party.presentation_definition_uri, {
|
44
|
+
method: "GET"
|
45
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(raw => raw.json()).then(json => _types.PresentationDefinition.parse(json));
|
46
|
+
return {
|
47
|
+
presentationDefinition
|
48
|
+
};
|
49
|
+
} catch (error) {
|
50
|
+
throw new Error(`Failed to fetch presentation definition: ${error}`);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
// Check if `scope` is present in the request object and a pre-configured presentation definition exists
|
55
|
+
if (requestObject.scope && rpConf !== null && rpConf !== void 0 && (_rpConf$wallet_relyin2 = rpConf.wallet_relying_party) !== null && _rpConf$wallet_relyin2 !== void 0 && _rpConf$wallet_relyin2.presentation_definition) {
|
56
|
+
return {
|
57
|
+
presentationDefinition: rpConf.wallet_relying_party.presentation_definition
|
58
|
+
};
|
59
|
+
}
|
60
|
+
throw new Error("Presentation definition not found");
|
61
|
+
};
|
62
|
+
exports.fetchPresentDefinition = fetchPresentDefinition;
|
63
|
+
//# sourceMappingURL=06-fetch-presentation-definition.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_types","require","_misc","fetchPresentDefinition","requestObject","_rpConf$wallet_relyin","_rpConf$wallet_relyin2","appFetch","fetch","arguments","length","undefined","rpConf","presentation_definition","presentationDefinition","wallet_relying_party","presentation_definition_uri","method","then","hasStatusOrThrow","raw","json","PresentationDefinition","parse","error","Error","scope","exports"],"sourceRoot":"../../../../src","sources":["credential/presentation/06-fetch-presentation-definition.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,sBAAmD,GAAG,eAAAA,CACjEC,aAAa,EAGV;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAAA,IAFH;IAAEC,QAAQ,GAAGC;EAAM,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;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, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.evaluateInputDescriptorForSdJwt4VC = void 0;
|
7
|
+
var _jsonpathPlus = require("jsonpath-plus");
|
8
|
+
var _errors = require("./errors");
|
9
|
+
var _ajv = _interopRequireDefault(require("ajv"));
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
const ajv = new _ajv.default({
|
12
|
+
allErrors: true
|
13
|
+
});
|
14
|
+
const INDEX_CLAIM_NAME = 1;
|
15
|
+
/**
|
16
|
+
* Transforms an array of DisclosureWithEncoded objects into a key-value map.
|
17
|
+
* @param disclosures - An array of DisclosureWithEncoded, each containing a decoded property with [?, claimName, claimValue].
|
18
|
+
* @returns An object mapping claim names to their corresponding values.
|
19
|
+
*/
|
20
|
+
const mapDisclosuresToObject = disclosures => {
|
21
|
+
return disclosures.reduce((obj, _ref) => {
|
22
|
+
let {
|
23
|
+
decoded
|
24
|
+
} = _ref;
|
25
|
+
const [, claimName, claimValue] = decoded;
|
26
|
+
obj[claimName] = claimValue;
|
27
|
+
return obj;
|
28
|
+
}, {});
|
29
|
+
};
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Finds a claim within the payload based on provided JSONPath expressions.
|
33
|
+
* @param paths - An array of JSONPath expressions to search for in the payload.
|
34
|
+
* @param payload - The object to search within using JSONPath.
|
35
|
+
* @returns A tuple with the first matched JSONPath and its corresponding value, or [undefined, undefined] if not found.
|
36
|
+
*/
|
37
|
+
const findMatchedClaim = (paths, payload) => {
|
38
|
+
let matchedPath;
|
39
|
+
let matchedValue;
|
40
|
+
paths.some(singlePath => {
|
41
|
+
try {
|
42
|
+
const result = (0, _jsonpathPlus.JSONPath)({
|
43
|
+
path: singlePath,
|
44
|
+
json: payload
|
45
|
+
});
|
46
|
+
if (result.length > 0) {
|
47
|
+
matchedPath = singlePath;
|
48
|
+
matchedValue = result[0];
|
49
|
+
return true;
|
50
|
+
}
|
51
|
+
} catch (error) {
|
52
|
+
throw new _errors.MissingDataError(`JSONPath for "${singlePath}" does not match the provided payload.`);
|
53
|
+
}
|
54
|
+
return false;
|
55
|
+
});
|
56
|
+
return [matchedPath, matchedValue];
|
57
|
+
};
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Extracts the claim name from a path that can be in one of the following formats:
|
61
|
+
* 1. $.propertyName
|
62
|
+
* 2. $["propertyName"] or $['propertyName']
|
63
|
+
*
|
64
|
+
* @param path - The path string containing the claim reference.
|
65
|
+
* @returns The extracted claim name if matched; otherwise, throws an exception.
|
66
|
+
*/
|
67
|
+
const extractClaimName = path => {
|
68
|
+
// Define a regular expression that matches both formats:
|
69
|
+
// 1. $.propertyName
|
70
|
+
// 2. $["propertyName"] or $['propertyName']
|
71
|
+
const regex = /^\$\.(\w+)$|^\$\[(?:'|")(\w+)(?:'|")\]$/;
|
72
|
+
const match = path.match(regex);
|
73
|
+
if (match) {
|
74
|
+
// match[1] corresponds to the first capture group (\w+) after $.
|
75
|
+
// match[2] corresponds to the second capture group (\w+) inside [""] or ['']
|
76
|
+
return match[1] || match[2];
|
77
|
+
}
|
78
|
+
|
79
|
+
// If the input doesn't match any of the expected formats, return null
|
80
|
+
|
81
|
+
throw new Error(`Invalid input format: "${path}". Expected formats are "$.propertyName", "$['propertyName']", or '$["propertyName"]'.`);
|
82
|
+
};
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Evaluates an InputDescriptor for an SD-JWT-based verifiable credential.
|
86
|
+
*
|
87
|
+
* - Checks each field in the InputDescriptor against the provided `payloadCredential`
|
88
|
+
* and `disclosures` (selectively disclosed claims).
|
89
|
+
* - Validates whether required fields are present (unless marked optional)
|
90
|
+
* and match any specified JSONPath.
|
91
|
+
* - If a field includes a JSON Schema filter, validates the claim value against that schema.
|
92
|
+
* - Enforces `limit_disclosure` rules by returning only disclosures matching the specified fields
|
93
|
+
* if set to "required". Otherwise return the array of all disclosures.
|
94
|
+
* - Throws an error if a required field is invalid or missing.
|
95
|
+
*
|
96
|
+
* @param inputDescriptor - Describes constraints (fields, filters, etc.) that must be satisfied.
|
97
|
+
* @param payloadCredential - The credential payload to check against.
|
98
|
+
* @param disclosures - An array of DisclosureWithEncoded objects representing selective disclosures.
|
99
|
+
* @returns A filtered list of disclosures satisfying the descriptor constraints, or throws an error if not.
|
100
|
+
* @throws Will throw an error if any required constraint fails or if JSONPath lookups are invalid.
|
101
|
+
*/
|
102
|
+
const evaluateInputDescriptorForSdJwt4VC = (inputDescriptor, payloadCredential, disclosures) => {
|
103
|
+
var _inputDescriptor$cons;
|
104
|
+
if (!(inputDescriptor !== null && inputDescriptor !== void 0 && (_inputDescriptor$cons = inputDescriptor.constraints) !== null && _inputDescriptor$cons !== void 0 && _inputDescriptor$cons.fields)) {
|
105
|
+
// No validation, all field are optional
|
106
|
+
return {
|
107
|
+
requiredDisclosures: [],
|
108
|
+
optionalDisclosures: disclosures
|
109
|
+
};
|
110
|
+
}
|
111
|
+
const requiredClaimNames = [];
|
112
|
+
const optionalClaimNames = [];
|
113
|
+
|
114
|
+
// Transform disclosures to find claim using JSONPath
|
115
|
+
const disclosuresAsPayload = mapDisclosuresToObject(disclosures);
|
116
|
+
|
117
|
+
// For each field, we need at least one matching path
|
118
|
+
// If we succeed, we push the matched disclosure in matchedDisclosures and stop checking further paths
|
119
|
+
const allFieldsValid = inputDescriptor.constraints.fields.every(field => {
|
120
|
+
// For Potential profile, selectively disclosed claims will always be built as an individual object property, by using a name-value pair.
|
121
|
+
// Hence that selective claim for array element and recursive disclosures are not supported by Potential for the first iteration of Piloting.
|
122
|
+
// We need to check inside disclosures or inside credential payload. Example path: "$.given_name"
|
123
|
+
let [matchedPath, matchedValue] = findMatchedClaim(field.path, disclosuresAsPayload);
|
124
|
+
if (!matchedPath) {
|
125
|
+
[matchedPath, matchedValue] = findMatchedClaim(field.path, payloadCredential);
|
126
|
+
if (!matchedPath) {
|
127
|
+
// Path could be optional, in this case no need to validate! continue to next field
|
128
|
+
return field === null || field === void 0 ? void 0 : field.optional;
|
129
|
+
}
|
130
|
+
} else {
|
131
|
+
// if match a disclouse we save which is required or optional
|
132
|
+
const claimName = extractClaimName(matchedPath);
|
133
|
+
if (claimName) {
|
134
|
+
(field !== null && field !== void 0 && field.optional ? optionalClaimNames : requiredClaimNames).push(claimName);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
// FILTER validation
|
139
|
+
// If this field has a "filter" (JSON Schema), validate the claimValue
|
140
|
+
if (field.filter) {
|
141
|
+
try {
|
142
|
+
const validateSchema = ajv.compile(field.filter);
|
143
|
+
if (!validateSchema(matchedValue)) {
|
144
|
+
throw new _errors.MissingDataError(`Claim value "${matchedValue}" for path "${matchedPath}" does not match the provided JSON Schema.`);
|
145
|
+
}
|
146
|
+
} catch (error) {
|
147
|
+
return false;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
// Submission Requirements validation
|
151
|
+
// TODO: [EUDIW-216] Read rule value if “all” o “pick” and validate
|
152
|
+
|
153
|
+
return true;
|
154
|
+
});
|
155
|
+
if (!allFieldsValid) {
|
156
|
+
throw new _errors.MissingDataError("Credential validation failed: Required fields are missing or do not match the input descriptor.");
|
157
|
+
}
|
158
|
+
|
159
|
+
// Categorizes disclosures into required and optional based on claim names and disclosure constraints.
|
160
|
+
const isNotLimitDisclosure = !(inputDescriptor.constraints.limit_disclosure === "required");
|
161
|
+
const requiredDisclosures = disclosures.filter(disclosure => requiredClaimNames.includes(disclosure.decoded[INDEX_CLAIM_NAME]));
|
162
|
+
const optionalDisclosures = disclosures.filter(disclosure => optionalClaimNames.includes(disclosure.decoded[INDEX_CLAIM_NAME]) || isNotLimitDisclosure && !requiredClaimNames.includes(disclosure.decoded[INDEX_CLAIM_NAME]));
|
163
|
+
return {
|
164
|
+
requiredDisclosures,
|
165
|
+
optionalDisclosures
|
166
|
+
};
|
167
|
+
};
|
168
|
+
exports.evaluateInputDescriptorForSdJwt4VC = evaluateInputDescriptorForSdJwt4VC;
|
169
|
+
//# sourceMappingURL=07-evaluate-input-descriptor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_jsonpathPlus","require","_errors","_ajv","_interopRequireDefault","obj","__esModule","default","ajv","Ajv","allErrors","INDEX_CLAIM_NAME","mapDisclosuresToObject","disclosures","reduce","_ref","decoded","claimName","claimValue","findMatchedClaim","paths","payload","matchedPath","matchedValue","some","singlePath","result","JSONPath","path","json","length","error","MissingDataError","extractClaimName","regex","match","Error","evaluateInputDescriptorForSdJwt4VC","inputDescriptor","payloadCredential","_inputDescriptor$cons","constraints","fields","requiredDisclosures","optionalDisclosures","requiredClaimNames","optionalClaimNames","disclosuresAsPayload","allFieldsValid","every","field","optional","push","filter","validateSchema","compile","isNotLimitDisclosure","limit_disclosure","disclosure","includes","exports"],"sourceRoot":"../../../../src","sources":["credential/presentation/07-evaluate-input-descriptor.ts"],"mappings":";;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAsB,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AACtB,MAAMG,GAAG,GAAG,IAAIC,YAAG,CAAC;EAAEC,SAAS,EAAE;AAAK,CAAC,CAAC;AACxC,MAAMC,gBAAgB,GAAG,CAAC;AAa1B;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAC1BC,WAAoC,IACR;EAC5B,OAAOA,WAAW,CAACC,MAAM,CAAC,CAACT,GAAG,EAAAU,IAAA,KAAkB;IAAA,IAAhB;MAAEC;IAAQ,CAAC,GAAAD,IAAA;IACzC,MAAM,GAAGE,SAAS,EAAEC,UAAU,CAAC,GAAGF,OAAO;IACzCX,GAAG,CAACY,SAAS,CAAC,GAAGC,UAAU;IAC3B,OAAOb,GAAG;EACZ,CAAC,EAAE,CAAC,CAA4B,CAAC;AACnC,CAAC;;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