@pagopa/io-react-native-wallet 0.29.0 → 0.30.0
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/lib/commonjs/credential/presentation/03-get-request-object.js +3 -2
- package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/05-verify-request-object.js +57 -22
- package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +9 -13
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js +85 -3
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/commonjs/credential/presentation/README.md +14 -4
- package/lib/commonjs/credential/presentation/errors.js +18 -11
- package/lib/commonjs/credential/presentation/errors.js.map +1 -1
- package/lib/commonjs/credential/presentation/index.js +6 -0
- package/lib/commonjs/credential/presentation/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js +14 -7
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/utils/error-codes.js +9 -1
- package/lib/commonjs/utils/error-codes.js.map +1 -1
- package/lib/commonjs/utils/errors.js +31 -14
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/module/credential/presentation/03-get-request-object.js +3 -2
- package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/module/credential/presentation/05-verify-request-object.js +58 -23
- package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js +8 -12
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js +82 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/module/credential/presentation/README.md +14 -4
- package/lib/module/credential/presentation/errors.js +9 -9
- package/lib/module/credential/presentation/errors.js.map +1 -1
- package/lib/module/credential/presentation/index.js +2 -2
- package/lib/module/credential/presentation/index.js.map +1 -1
- package/lib/module/credential/presentation/types.js +12 -6
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/utils/error-codes.js +7 -0
- package/lib/module/utils/error-codes.js.map +1 -1
- package/lib/module/utils/errors.js +23 -14
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +2 -1
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +30 -2
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/errors.d.ts +6 -7
- package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/index.d.ts +3 -3
- package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +24 -17
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
- package/lib/typescript/utils/error-codes.d.ts +8 -0
- package/lib/typescript/utils/error-codes.d.ts.map +1 -1
- package/lib/typescript/utils/errors.d.ts +32 -18
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/credential/presentation/03-get-request-object.ts +3 -2
- package/src/credential/presentation/05-verify-request-object.ts +73 -15
- package/src/credential/presentation/07-evaluate-dcql-query.ts +7 -17
- package/src/credential/presentation/08-send-authorization-response.ts +110 -3
- package/src/credential/presentation/README.md +14 -4
- package/src/credential/presentation/errors.ts +9 -9
- package/src/credential/presentation/index.ts +4 -0
- package/src/credential/presentation/types.ts +22 -10
- package/src/utils/error-codes.ts +11 -0
- package/src/utils/errors.ts +59 -29
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.getRequestObject = void 0;
|
7
|
+
var _errors = require("../../utils/errors");
|
7
8
|
var _misc = require("../../utils/misc");
|
8
9
|
var _types = require("./types");
|
9
10
|
/**
|
@@ -39,14 +40,14 @@ const getRequestObject = async function (requestUri) {
|
|
39
40
|
"Content-Type": "application/x-www-form-urlencoded"
|
40
41
|
},
|
41
42
|
body: formUrlEncodedBody.toString()
|
42
|
-
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.text());
|
43
|
+
}).then((0, _misc.hasStatusOrThrow)(200, _errors.RelyingPartyResponseError)).then(res => res.text());
|
43
44
|
return {
|
44
45
|
requestObjectEncodedJwt
|
45
46
|
};
|
46
47
|
}
|
47
48
|
const requestObjectEncodedJwt = await appFetch(requestUri, {
|
48
49
|
method: "GET"
|
49
|
-
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.text());
|
50
|
+
}).then((0, _misc.hasStatusOrThrow)(200, _errors.RelyingPartyResponseError)).then(res => res.text());
|
50
51
|
return {
|
51
52
|
requestObjectEncodedJwt
|
52
53
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_errors","require","_misc","_types","getRequestObject","requestUri","appFetch","fetch","walletCapabilities","arguments","length","undefined","wallet_metadata","wallet_nonce","RequestObjectWalletCapabilities","parse","formUrlEncodedBody","URLSearchParams","JSON","stringify","requestObjectEncodedJwt","method","headers","body","toString","then","hasStatusOrThrow","RelyingPartyResponseError","res","text","exports"],"sourceRoot":"../../../../src","sources":["credential/presentation/03-get-request-object.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,gBAAkC,GAAG,eAAAA,CAChDC,UAAU,EAEP;EAAA,IADH;IAAEC,QAAQ,GAAGC,KAAK;IAAEC;EAAmB,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAE7C,IAAID,kBAAkB,EAAE;IACtB;IACA,MAAM;MAAEI,eAAe;MAAEC;IAAa,CAAC,GACrCC,sCAA+B,CAACC,KAAK,CAACP,kBAAkB,CAAC;IAE3D,MAAMQ,kBAAkB,GAAG,IAAIC,eAAe,CAAC;MAC7CL,eAAe,EAAEM,IAAI,CAACC,SAAS,CAACP,eAAe,CAAC;MAChD,IAAIC,YAAY,IAAI;QAAEA;MAAa,CAAC;IACtC,CAAC,CAAC;IAEF,MAAMO,uBAAuB,GAAG,MAAMd,QAAQ,CAACD,UAAU,EAAE;MACzDgB,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB,CAAC;MACDC,IAAI,EAAEP,kBAAkB,CAACQ,QAAQ,CAAC;IACpC,CAAC,CAAC,CACCC,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,EAAEC,iCAAyB,CAAC,CAAC,CACtDF,IAAI,CAAEG,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;IAE5B,OAAO;MACLT;IACF,CAAC;EACH;EAEA,MAAMA,uBAAuB,GAAG,MAAMd,QAAQ,CAACD,UAAU,EAAE;IACzDgB,MAAM,EAAE;EACV,CAAC,CAAC,CACCI,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,EAAEC,iCAAyB,CAAC,CAAC,CACtDF,IAAI,CAAEG,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;EAE5B,OAAO;IACLT;EACF,CAAC;AACH,CAAC;AAACU,OAAA,CAAA1B,gBAAA,GAAAA,gBAAA"}
|
@@ -9,12 +9,13 @@ var _errors = require("./errors");
|
|
9
9
|
var _types = require("./types");
|
10
10
|
var _retrieveRpJwks = require("./04-retrieve-rp-jwks");
|
11
11
|
/**
|
12
|
-
* Function to verify the Request Object's signature
|
12
|
+
* Function to verify the Request Object's validity, from the signature to the required properties.
|
13
13
|
* @param requestObjectEncodedJwt The Request Object in JWT format
|
14
14
|
* @param context.clientId The client ID to verify
|
15
15
|
* @param context.rpConf The Entity Configuration of the Relying Party
|
16
16
|
* @param context.state Optional state
|
17
17
|
* @returns The verified Request Object
|
18
|
+
* @throws {InvalidRequestObjectError} if the Request Object cannot be validated
|
18
19
|
*/
|
19
20
|
const verifyRequestObject = async (requestObjectEncodedJwt, _ref) => {
|
20
21
|
let {
|
@@ -24,37 +25,71 @@ const verifyRequestObject = async (requestObjectEncodedJwt, _ref) => {
|
|
24
25
|
state
|
25
26
|
} = _ref;
|
26
27
|
const requestObjectJwt = (0, _ioReactNativeJwt.decode)(requestObjectEncodedJwt);
|
27
|
-
const
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
} = _ref2;
|
36
|
-
return kid === requestObjectJwt.protectedHeader.kid;
|
37
|
-
});
|
38
|
-
if (!pubKey) {
|
39
|
-
throw new _errors.UnverifiedEntityError("Request Object signature verification!");
|
28
|
+
const pubKey = getSigPublicKey(rpConf, requestObjectJwt.protectedHeader.kid);
|
29
|
+
try {
|
30
|
+
// Standard claims are verified within `verify`
|
31
|
+
await (0, _ioReactNativeJwt.verify)(requestObjectEncodedJwt, pubKey, {
|
32
|
+
issuer: clientId
|
33
|
+
});
|
34
|
+
} catch (_) {
|
35
|
+
throw new _errors.InvalidRequestObjectError("The Request Object signature verification failed");
|
40
36
|
}
|
41
|
-
|
42
|
-
// Standard claims are verified within `verify`
|
43
|
-
await (0, _ioReactNativeJwt.verify)(requestObjectEncodedJwt, pubKey, {
|
44
|
-
issuer: clientId
|
45
|
-
});
|
46
|
-
const requestObject = _types.RequestObject.parse(requestObjectJwt.payload);
|
37
|
+
const requestObject = validateRequestObjectShape(requestObjectJwt.payload);
|
47
38
|
const isClientIdMatch = clientId === requestObject.client_id && clientId === rpSubject;
|
48
39
|
if (!isClientIdMatch) {
|
49
|
-
throw new _errors.
|
40
|
+
throw new _errors.InvalidRequestObjectError("Client ID does not match Request Object or Entity Configuration");
|
50
41
|
}
|
51
42
|
const isStateMatch = state && requestObject.state ? state === requestObject.state : true;
|
52
43
|
if (!isStateMatch) {
|
53
|
-
throw new _errors.
|
44
|
+
throw new _errors.InvalidRequestObjectError("The provided state does not match the Request Object's");
|
54
45
|
}
|
55
46
|
return {
|
56
47
|
requestObject
|
57
48
|
};
|
58
49
|
};
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Validate the shape of the Request Object to ensure all required properties are present and are of the expected type.
|
53
|
+
*
|
54
|
+
* @param payload The Request Object to validate
|
55
|
+
* @returns A valid Request Object
|
56
|
+
* @throws {InvalidRequestObjectError} when the Request Object cannot be parsed
|
57
|
+
*/
|
59
58
|
exports.verifyRequestObject = verifyRequestObject;
|
59
|
+
const validateRequestObjectShape = payload => {
|
60
|
+
const requestObjectParse = _types.RequestObject.safeParse(payload);
|
61
|
+
if (requestObjectParse.success) {
|
62
|
+
return requestObjectParse.data;
|
63
|
+
}
|
64
|
+
throw new _errors.InvalidRequestObjectError("The Request Object cannot be parsed successfully", formatFlattenedZodErrors(requestObjectParse.error.flatten()));
|
65
|
+
};
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Get the public key to verify the Request Object's signature from the Relying Party's EC.
|
69
|
+
*
|
70
|
+
* @param rpConf The Relying Party's EC
|
71
|
+
* @param kid The identifier of the key to find
|
72
|
+
* @returns The corresponding public key to verify the signature
|
73
|
+
* @throws {InvalidRequestObjectError} when the key cannot be found
|
74
|
+
*/
|
75
|
+
const getSigPublicKey = (rpConf, kid) => {
|
76
|
+
try {
|
77
|
+
const {
|
78
|
+
keys
|
79
|
+
} = (0, _retrieveRpJwks.getJwksFromConfig)(rpConf);
|
80
|
+
const pubKey = keys.find(k => k.kid === kid);
|
81
|
+
if (!pubKey) throw new Error();
|
82
|
+
return pubKey;
|
83
|
+
} catch (_) {
|
84
|
+
throw new _errors.InvalidRequestObjectError(`The public key for signature verification (${kid}) cannot be found in the Entity Configuration`);
|
85
|
+
}
|
86
|
+
};
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Utility to format flattened Zod errors into a simplified string `key1: key1_error, key2: key2_error`
|
90
|
+
*/
|
91
|
+
const formatFlattenedZodErrors = errors => Object.entries(errors.fieldErrors).map(_ref2 => {
|
92
|
+
let [key, error] = _ref2;
|
93
|
+
return `${key}: ${error[0]}`;
|
94
|
+
}).join(", ");
|
60
95
|
//# sourceMappingURL=05-verify-request-object.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_errors","_types","_retrieveRpJwks","verifyRequestObject","requestObjectEncodedJwt","_ref","clientId","rpConf","rpSubject","state","requestObjectJwt","decodeJwt","
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_errors","_types","_retrieveRpJwks","verifyRequestObject","requestObjectEncodedJwt","_ref","clientId","rpConf","rpSubject","state","requestObjectJwt","decodeJwt","pubKey","getSigPublicKey","protectedHeader","kid","verify","issuer","_","InvalidRequestObjectError","requestObject","validateRequestObjectShape","payload","isClientIdMatch","client_id","isStateMatch","exports","requestObjectParse","RequestObject","safeParse","success","data","formatFlattenedZodErrors","error","flatten","keys","getJwksFromConfig","find","k","Error","errors","Object","entries","fieldErrors","map","_ref2","key","join"],"sourceRoot":"../../../../src","sources":["credential/presentation/05-verify-request-object.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMI,mBAAwC,GAAG,MAAAA,CACtDC,uBAAuB,EAAAC,IAAA,KAEpB;EAAA,IADH;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,SAAS;IAAE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,CAAC,CAAC,CAC7D,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMrB,eAAe,GAAGA,CACtBN,MAA8D,EAC9DQ,GAAuB,KACpB;EACH,IAAI;IACF,MAAM;MAAEoB;IAAK,CAAC,GAAG,IAAAC,iCAAiB,EAAC7B,MAAM,CAAC;IAE1C,MAAMK,MAAM,GAAGuB,IAAI,CAACE,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACvB,GAAG,KAAKA,GAAG,CAAC;IAE9C,IAAI,CAACH,MAAM,EAAE,MAAM,IAAI2B,KAAK,CAAC,CAAC;IAE9B,OAAO3B,MAAM;EACf,CAAC,CAAC,OAAOM,CAAC,EAAE;IACV,MAAM,IAAIC,iCAAyB,CAChC,8CAA6CJ,GAAI,+CACpD,CAAC;EACH;AACF,CAAC;;AAED;AACA;AACA;AACA,MAAMiB,wBAAwB,GAC5BQ,MAA+C,IAE/CC,MAAM,CAACC,OAAO,CAACF,MAAM,CAACG,WAAW,CAAC,CAC/BC,GAAG,CAACC,KAAA;EAAA,IAAC,CAACC,GAAG,EAAEb,KAAK,CAAC,GAAAY,KAAA;EAAA,OAAM,GAAEC,GAAI,KAAIb,KAAK,CAAC,CAAC,CAAE,EAAC;AAAA,EAAC,CAC5Cc,IAAI,CAAC,IAAI,CAAC"}
|
@@ -7,9 +7,8 @@ exports.prepareRemotePresentations = exports.evaluateDcqlQuery = void 0;
|
|
7
7
|
var _dcql = require("dcql");
|
8
8
|
var _valibot = require("valibot");
|
9
9
|
var _sdJwt = require("../../sd-jwt");
|
10
|
-
var _errors = require("../../utils/errors");
|
11
10
|
var _crypto = require("../../utils/crypto");
|
12
|
-
var
|
11
|
+
var _errors = require("./errors");
|
13
12
|
/**
|
14
13
|
* The purpose for the credential request by the RP.
|
15
14
|
*/
|
@@ -86,7 +85,7 @@ const evaluateDcqlQuery = (credentialsSdJwt, query) => {
|
|
86
85
|
_dcql.DcqlQuery.validate(parsedQuery);
|
87
86
|
const queryResult = _dcql.DcqlQuery.query(parsedQuery, credentials);
|
88
87
|
if (!queryResult.canBeSatisfied) {
|
89
|
-
throw new
|
88
|
+
throw new _errors.CredentialsNotFoundError(extractMissingCredentials(queryResult, parsedQuery));
|
90
89
|
}
|
91
90
|
|
92
91
|
// Build an object vct:credentialJwt to map matched credentials to their JWT
|
@@ -131,19 +130,16 @@ const evaluateDcqlQuery = (credentialsSdJwt, query) => {
|
|
131
130
|
};
|
132
131
|
});
|
133
132
|
} catch (error) {
|
134
|
-
// Invalid DCQL query structure
|
133
|
+
// Invalid DCQL query structure. Remap to `DcqlError` for consistency.
|
135
134
|
if ((0, _valibot.isValiError)(error)) {
|
136
|
-
throw new
|
137
|
-
message: "
|
138
|
-
|
135
|
+
throw new _dcql.DcqlError({
|
136
|
+
message: "Failed to parse the provided DCQL query",
|
137
|
+
code: "PARSE_ERROR",
|
138
|
+
cause: error.issues
|
139
139
|
});
|
140
140
|
}
|
141
|
-
|
142
|
-
|
143
|
-
}
|
144
|
-
if (error instanceof _dcql.DcqlCredentialSetError) {
|
145
|
-
// TODO [SIW-2110]: handle missing credentials or let the error propagate
|
146
|
-
}
|
141
|
+
|
142
|
+
// Let other errors propagate so they can be caught with `err instanceof DcqlError`
|
147
143
|
throw error;
|
148
144
|
}
|
149
145
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_dcql","require","_valibot","_sdJwt","
|
1
|
+
{"version":3,"names":["_dcql","require","_valibot","_sdJwt","_crypto","_errors","mapCredentialToObject","jwt","sdJwt","disclosures","decode","credentialFormat","header","typ","Error","vct","payload","credential_format","claims","reduce","acc","disclosure","decoded","getDcqlQueryMatches","result","Object","entries","credential_matches","filter","_ref","match","success","getDcqlQueryFailedMatches","_ref2","extractMissingCredentials","queryResult","originalQuery","map","_ref3","_credential$meta","id","credential","credentials","find","c","format","vctValues","meta","vct_values","evaluateDcqlQuery","credentialsSdJwt","query","_ref4","parsedQuery","DcqlQuery","parse","validate","canBeSatisfied","CredentialsNotFoundError","credentialsSdJwtByVct","i","_ref5","_queryResult$credenti","output","purposes","credential_sets","set","_set$matching_options","matching_options","flat","includes","credentialSet","_credentialSet$purpos","description","purpose","toString","required","Boolean","keyTag","requiredDisclosures","values","error","isValiError","DcqlError","message","code","cause","issues","exports","prepareRemotePresentations","nonce","clientId","Promise","all","item","vp_token","prepareVpToken","requestedClaims","createCryptoContextFor","credentialId","vpToken"],"sourceRoot":"../../../../src","sources":["credential/presentation/07-evaluate-dcql-query.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAEA;AACA;AACA;;AAuCA;AACA;AACA;AACA;AACA,MAAMK,qBAAqB,GAAIC,GAAW,IAAK;EAC7C,MAAM;IAAEC,KAAK;IAAEC;EAAY,CAAC,GAAG,IAAAC,aAAM,EAACH,GAAG,CAAC;EAC1C,MAAMI,gBAAgB,GAAGH,KAAK,CAACI,MAAM,CAACC,GAAG;;EAEzC;EACA,IAAIF,gBAAgB,KAAK,WAAW,EAAE;IACpC,MAAM,IAAIG,KAAK,CAAE,kCAAiCH,gBAAiB,EAAC,CAAC;EACvE;EAEA,OAAO;IACLI,GAAG,EAAEP,KAAK,CAACQ,OAAO,CAACD,GAAG;IACtBE,iBAAiB,EAAEN,gBAAgB;IACnCO,MAAM,EAAET,WAAW,CAACU,MAAM,CACxB,CAACC,GAAG,EAAEC,UAAU,MAAM;MACpB,GAAGD,GAAG;MACN,CAACC,UAAU,CAACC,OAAO,CAAC,CAAC,CAAC,GAAGD,UAAU,CAACC;IACtC,CAAC,CAAC,EACF,CAAC,CACH;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA,MAAMC,mBAAmB,GAAIC,MAAuB,IAClDC,MAAM,CAACC,OAAO,CAACF,MAAM,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,EAAEC,QAAQ,EAAE,CACzDG,IAAI,CAACrD,UAAU,EACfqD,IAAI,CAACG,eAAe,EACpB,IAAAC,8BAAsB,EAACJ,IAAI,CAAChB,MAAM,CAAC,CACpC,CAAC;IAEF,OAAO;MACLqB,YAAY,EAAEL,IAAI,CAACtD,EAAE;MACrByD,eAAe,EAAEH,IAAI,CAACG,eAAe;MACrCG,OAAO,EAAEL,QAAQ;MACjBlD,MAAM,EAAE;IACV,CAAC;EACH,CAAC,CACH,CAAC;AACH,CAAC;AAAC2C,OAAA,CAAAC,0BAAA,GAAAA,0BAAA"}
|
@@ -3,13 +3,14 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.sendLegacyAuthorizationResponse = exports.sendAuthorizationResponse = exports.choosePublicKeyToEncrypt = exports.buildDirectPostJwtBody = exports.AuthorizationResponse = void 0;
|
6
|
+
exports.sendLegacyAuthorizationResponse = exports.sendAuthorizationResponse = exports.sendAuthorizationErrorResponse = exports.choosePublicKeyToEncrypt = exports.buildDirectPostJwtBody = exports.buildDirectPostBody = exports.AuthorizationResponse = void 0;
|
7
7
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
8
8
|
var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
|
9
9
|
var _retrieveRpJwks = require("./04-retrieve-rp-jwks");
|
10
10
|
var _errors = require("./errors");
|
11
11
|
var _misc = require("../../utils/misc");
|
12
12
|
var z = _interopRequireWildcard(require("zod"));
|
13
|
+
var _errors2 = require("../../utils/errors");
|
13
14
|
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); }
|
14
15
|
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; }
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -85,13 +86,37 @@ const buildDirectPostJwtBody = async (requestObject, rpConf, payload) => {
|
|
85
86
|
return formBody.toString();
|
86
87
|
};
|
87
88
|
|
89
|
+
/**
|
90
|
+
* Builds a URL-encoded form body for a direct POST response without encryption.
|
91
|
+
*
|
92
|
+
* @param requestObject - Contains state, nonce, and other relevant info.
|
93
|
+
* @param payload - Object that contains either the VP token to encrypt and the stringified mapping of the credential disclosures or the error code
|
94
|
+
* @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
|
95
|
+
*/
|
96
|
+
exports.buildDirectPostJwtBody = buildDirectPostJwtBody;
|
97
|
+
const buildDirectPostBody = async (requestObject, payload) => {
|
98
|
+
const formUrlEncodedBody = new URLSearchParams({
|
99
|
+
...(requestObject.state && {
|
100
|
+
state: requestObject.state
|
101
|
+
}),
|
102
|
+
...Object.entries(payload).reduce((acc, _ref) => {
|
103
|
+
let [key, value] = _ref;
|
104
|
+
return {
|
105
|
+
...acc,
|
106
|
+
[key]: Array.isArray(value) || typeof value === "object" ? JSON.stringify(value) : value
|
107
|
+
};
|
108
|
+
}, {})
|
109
|
+
});
|
110
|
+
return formUrlEncodedBody.toString();
|
111
|
+
};
|
112
|
+
|
88
113
|
/**
|
89
114
|
* Type definition for the function that sends the authorization response
|
90
115
|
* to the Relying Party, completing the presentation flow.
|
91
116
|
* Use with `presentation_definition`.
|
92
117
|
* @deprecated Use `sendAuthorizationResponse`
|
93
118
|
*/
|
94
|
-
exports.
|
119
|
+
exports.buildDirectPostBody = buildDirectPostBody;
|
95
120
|
/**
|
96
121
|
* Sends the authorization response to the Relying Party (RP) using the specified `response_mode`.
|
97
122
|
* This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
|
@@ -164,7 +189,64 @@ const sendAuthorizationResponse = async function (requestObject, remotePresentat
|
|
164
189
|
"Content-Type": "application/x-www-form-urlencoded"
|
165
190
|
},
|
166
191
|
body: requestBody
|
167
|
-
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse);
|
192
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse).catch(handleAuthorizationResponseError);
|
168
193
|
};
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Type definition for the function that sends the authorization response
|
197
|
+
* to the Relying Party, completing the presentation flow.
|
198
|
+
*/
|
169
199
|
exports.sendAuthorizationResponse = sendAuthorizationResponse;
|
200
|
+
/**
|
201
|
+
* Sends the authorization error response to the Relying Party (RP) using the specified `response_mode`.
|
202
|
+
* This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
|
203
|
+
*
|
204
|
+
* @param requestObject - The request details, including presentation requirements.
|
205
|
+
* @param error - The response error value, with description
|
206
|
+
* @param context - Contains optional custom fetch implementation.
|
207
|
+
* @returns Parsed and validated authorization response from the Relying Party.
|
208
|
+
*/
|
209
|
+
const sendAuthorizationErrorResponse = async function (requestObject, _ref2) {
|
210
|
+
let {
|
211
|
+
error,
|
212
|
+
errorDescription
|
213
|
+
} = _ref2;
|
214
|
+
let {
|
215
|
+
appFetch = fetch
|
216
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
217
|
+
const requestBody = await buildDirectPostBody(requestObject, {
|
218
|
+
error,
|
219
|
+
error_description: errorDescription
|
220
|
+
});
|
221
|
+
return await appFetch(requestObject.response_uri, {
|
222
|
+
method: "POST",
|
223
|
+
headers: {
|
224
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
225
|
+
},
|
226
|
+
body: requestBody
|
227
|
+
}).then((0, _misc.hasStatusOrThrow)(200, _errors2.RelyingPartyResponseError)).then(res => res.json()).then(AuthorizationResponse.parse);
|
228
|
+
};
|
229
|
+
|
230
|
+
/**
|
231
|
+
* Handle the the presentation error by mapping it to a custom exception.
|
232
|
+
* If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
|
233
|
+
* @param e - The error to be handled
|
234
|
+
* @throws {RelyingPartyResponseError} with a specific code for more context
|
235
|
+
*/
|
236
|
+
exports.sendAuthorizationErrorResponse = sendAuthorizationErrorResponse;
|
237
|
+
const handleAuthorizationResponseError = e => {
|
238
|
+
if (!(e instanceof _errors2.UnexpectedStatusCodeError)) {
|
239
|
+
throw e;
|
240
|
+
}
|
241
|
+
throw new _errors2.ResponseErrorBuilder(_errors2.RelyingPartyResponseError).handle(400, {
|
242
|
+
code: _errors2.RelyingPartyResponseErrorCodes.InvalidAuthorizationResponse,
|
243
|
+
message: "The Authorization Response contains invalid parameters or it is malformed"
|
244
|
+
}).handle(403, {
|
245
|
+
code: _errors2.RelyingPartyResponseErrorCodes.InvalidAuthorizationResponse,
|
246
|
+
message: "The Authorization Response was forbidden"
|
247
|
+
}).handle("*", {
|
248
|
+
code: _errors2.RelyingPartyResponseErrorCodes.RelyingPartyGenericError,
|
249
|
+
message: "Unable to successfully send the Authorization Response"
|
250
|
+
}).buildFrom(e);
|
251
|
+
};
|
170
252
|
//# sourceMappingURL=08-send-authorization-response.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","_retrieveRpJwks","_errors","_misc","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationResponse","object","status","string","optional","response_code","redirect_uri","exports","choosePublicKeyToEncrypt","rpJwkKeys","encKey","find","jwk","use","NoSuitableKeysFoundInEntityConfiguration","buildDirectPostJwtBody","requestObject","rpConf","payload","authzResponsePayload","JSON","stringify","state","keys","getJwksFromConfig","encPublicJwk","authorization_encrypted_response_alg","authorization_encrypted_response_enc","openid_credential_verifier","defaultAlg","kty","encryptedResponse","EncryptJwe","alg","enc","kid","encrypt","formBody","URLSearchParams","response","toString","sendLegacyAuthorizationResponse","presentationDefinitionId","remotePresentations","_remotePresentations$","appFetch","fetch","arguments","length","undefined","vp_token","vpToken","map","remotePresentation","descriptor_map","index","id","inputDescriptor","path","format","presentation_submission","uuid","v4","definition_id","requestBody","response_uri","method","headers","body","then","hasStatusOrThrow","res","json","parse","sendAuthorizationResponse","
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","_retrieveRpJwks","_errors","_misc","z","_interopRequireWildcard","_errors2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationResponse","object","status","string","optional","response_code","redirect_uri","exports","choosePublicKeyToEncrypt","rpJwkKeys","encKey","find","jwk","use","NoSuitableKeysFoundInEntityConfiguration","buildDirectPostJwtBody","requestObject","rpConf","payload","authzResponsePayload","JSON","stringify","state","keys","getJwksFromConfig","encPublicJwk","authorization_encrypted_response_alg","authorization_encrypted_response_enc","openid_credential_verifier","defaultAlg","kty","encryptedResponse","EncryptJwe","alg","enc","kid","encrypt","formBody","URLSearchParams","response","toString","buildDirectPostBody","formUrlEncodedBody","entries","reduce","acc","_ref","value","Array","isArray","sendLegacyAuthorizationResponse","presentationDefinitionId","remotePresentations","_remotePresentations$","appFetch","fetch","arguments","length","undefined","vp_token","vpToken","map","remotePresentation","descriptor_map","index","id","inputDescriptor","path","format","presentation_submission","uuid","v4","definition_id","requestBody","response_uri","method","headers","body","then","hasStatusOrThrow","res","json","parse","sendAuthorizationResponse","presentation","credentialId","catch","handleAuthorizationResponseError","sendAuthorizationErrorResponse","_ref2","error","errorDescription","error_description","RelyingPartyResponseError","e","UnexpectedStatusCodeError","ResponseErrorBuilder","handle","code","RelyingPartyResponseErrorCodes","InvalidAuthorizationResponse","message","RelyingPartyGenericError","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/presentation/08-send-authorization-response.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAOA,IAAAM,CAAA,GAAAC,uBAAA,CAAAP,OAAA;AAGA,IAAAQ,QAAA,GAAAR,OAAA;AAK4B,SAAAS,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,SAAAH,wBAAAO,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,CAAA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KAAK;IACLE,iBAAiB,EAAED;EACrB,CAAC,CAAC;EAEF,OAAO,MAAMrC,QAAQ,CAACtC,aAAa,CAAC0D,YAAY,EAAE;IAChDC,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE;IAClB,CAAC;IACDC,IAAI,EAAEJ;EACR,CAAC,CAAC,CACCK,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,EAAEc,kCAAyB,CAAC,CAAC,CACtDf,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAAC9E,qBAAqB,CAACkF,KAAK,CAAC;AACtC,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AALA3E,OAAA,CAAAiF,8BAAA,GAAAA,8BAAA;AAMA,MAAMD,gCAAgC,GAAIO,CAAU,IAAK;EACvD,IAAI,EAAEA,CAAC,YAAYC,kCAAyB,CAAC,EAAE;IAC7C,MAAMD,CAAC;EACT;EAEA,MAAM,IAAIE,6BAAoB,CAACH,kCAAyB,CAAC,CACtDI,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,uCAA8B,CAACC,4BAA4B;IACjEC,OAAO,EACL;EACJ,CAAC,CAAC,CACDJ,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,uCAA8B,CAACC,4BAA4B;IACjEC,OAAO,EAAE;EACX,CAAC,CAAC,CACDJ,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,uCAA8B,CAACG,wBAAwB;IAC7DD,OAAO,EAAE;EACX,CAAC,CAAC,CACDE,SAAS,CAACT,CAAC,CAAC;AACjB,CAAC"}
|
@@ -24,10 +24,20 @@ sequenceDiagram
|
|
24
24
|
|
25
25
|
## Mapped results
|
26
26
|
|
27
|
-
|Error|Description|
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
| Error | Description|
|
28
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
29
|
+
| `InvalidRequestObject` | The Request Object is not valid, for instance it is malformed or its signature cannot be verified. |
|
30
|
+
| `DcqlError` | The DCQL query cannot be evaluated because it contains errors. |
|
31
|
+
| `CredentialsNotFoundError` | The presentation cannot be completed because the Wallet does not contain all requested credentials. The missing credentials can be found in `details`. |
|
32
|
+
| `RelyingPartyResponseError` | Error in the Relying Party's response. See the next table for more details. |
|
33
|
+
|
34
|
+
#### RelyingPartyResponseError
|
35
|
+
The following HTTP errors are mapped to a `RelyingPartyResponseError` with specific codes.
|
36
|
+
|
37
|
+
| HTTP Status | Error Code | Description |
|
38
|
+
| ------------ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
39
|
+
| `400`, `403` | `ERR_RP_INVALID_AUTHORIZATION_RESPONSE` | The Relying Party rejected the Authorization Response sent by the Wallet because it was deemed invalid. |
|
40
|
+
| `*` | `ERR_RP_GENERIC_ERROR` | This is a generic error code to map unexpected errors that occurred when interacting with the Relying Party. |
|
31
41
|
|
32
42
|
|
33
43
|
## Examples
|
@@ -3,8 +3,16 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.CredentialsNotFoundError = exports.AuthRequestDecodeError = void 0;
|
7
|
+
Object.defineProperty(exports, "DcqlError", {
|
8
|
+
enumerable: true,
|
9
|
+
get: function () {
|
10
|
+
return _dcql.DcqlError;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
exports.NoSuitableKeysFoundInEntityConfiguration = exports.MissingDataError = exports.InvalidRequestObjectError = exports.InvalidQRCodeError = void 0;
|
7
14
|
var _errors = require("../../utils/errors");
|
15
|
+
var _dcql = require("dcql");
|
8
16
|
/**
|
9
17
|
* An error subclass thrown when auth request decode fail
|
10
18
|
*
|
@@ -63,19 +71,18 @@ class InvalidQRCodeError extends _errors.IoWalletError {
|
|
63
71
|
}
|
64
72
|
|
65
73
|
/**
|
66
|
-
* When the
|
67
|
-
*
|
74
|
+
* When the Request Object sent by the Relying Party is not valid
|
68
75
|
*/
|
69
76
|
exports.InvalidQRCodeError = InvalidQRCodeError;
|
70
|
-
class
|
71
|
-
code = "
|
77
|
+
class InvalidRequestObjectError extends _errors.IoWalletError {
|
78
|
+
code = "ERR_INVALID_REQUEST_OBJECT";
|
72
79
|
|
73
|
-
/**
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
const message = `Unverified entity: ${reason}.`;
|
80
|
+
/** Detailed reason for the Request Object validation failure. */
|
81
|
+
|
82
|
+
constructor(message) {
|
83
|
+
let reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
78
84
|
super(message);
|
85
|
+
this.reason = reason;
|
79
86
|
}
|
80
87
|
}
|
81
88
|
|
@@ -83,7 +90,7 @@ class UnverifiedEntityError extends _errors.IoWalletError {
|
|
83
90
|
* When some required data is missing to continue because certain attributes are not contained inside the wallet.
|
84
91
|
*
|
85
92
|
*/
|
86
|
-
exports.
|
93
|
+
exports.InvalidRequestObjectError = InvalidRequestObjectError;
|
87
94
|
class MissingDataError extends _errors.IoWalletError {
|
88
95
|
code = "ERR_MISSING_DATA";
|
89
96
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_errors","require","AuthRequestDecodeError","IoWalletError","code","constructor","message","claim","arguments","length","undefined","reason","serializeAttrs","exports","NoSuitableKeysFoundInEntityConfiguration","scenario","InvalidQRCodeError","
|
1
|
+
{"version":3,"names":["_errors","require","_dcql","AuthRequestDecodeError","IoWalletError","code","constructor","message","claim","arguments","length","undefined","reason","serializeAttrs","exports","NoSuitableKeysFoundInEntityConfiguration","scenario","InvalidQRCodeError","InvalidRequestObjectError","MissingDataError","missingAttributes","CredentialsNotFoundError","details"],"sourceRoot":"../../../../src","sources":["credential/presentation/errors.ts"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACO,MAA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A,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IACjD,KAAK,CAACF,OAAO,CAAC;IACd,IAAI,CAACK,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AACA;AAHAE,OAAA,CAAAI,yBAAA,GAAAA,yBAAA;AAIO,MAAMC,gBAAgB,SAASf,qBAAa,CAAC;EAClDC,IAAI,GAAG,kBAAkB;;EAEzB;AACF;AACA;EACEC,WAAWA,CAACc,iBAAyB,EAAE;IACrC,MAAMb,OAAO,GAAI,kCAAiCa,iBAAkB,GAAE;IACtE,KAAK,CAACb,OAAO,CAAC;EAChB;AACF;AAACO,OAAA,CAAAK,gBAAA,GAAAA,gBAAA;AAQD;AACA;AACA;AACA;AACO,MAAME,wBAAwB,SAASjB,qBAAa,CAAC;EAC1DC,IAAI,GAAG,2BAA2B;EAGlC;AACF;AACA;EACEC,WAAWA,CAACgB,OAAyB,EAAE;IACrC,KAAK,CAAC,uDAAuD,CAAC;IAC9D,IAAI,CAACA,OAAO,GAAGA,OAAO;EACxB;AACF;AAACR,OAAA,CAAAO,wBAAA,GAAAA,wBAAA"}
|
@@ -52,6 +52,12 @@ Object.defineProperty(exports, "prepareRemotePresentations", {
|
|
52
52
|
return _evaluateDcqlQuery.prepareRemotePresentations;
|
53
53
|
}
|
54
54
|
});
|
55
|
+
Object.defineProperty(exports, "sendAuthorizationErrorResponse", {
|
56
|
+
enumerable: true,
|
57
|
+
get: function () {
|
58
|
+
return _sendAuthorizationResponse.sendAuthorizationErrorResponse;
|
59
|
+
}
|
60
|
+
});
|
55
61
|
Object.defineProperty(exports, "sendAuthorizationResponse", {
|
56
62
|
enumerable: true,
|
57
63
|
get: function () {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_startFlow","require","_evaluateRpTrust","_getRequestObject","_retrieveRpJwks","_verifyRequestObject","_fetchPresentationDefinition","_evaluateInputDescriptor","_evaluateDcqlQuery","_sendAuthorizationResponse","Errors","_interopRequireWildcard","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":"
|
1
|
+
{"version":3,"names":["_startFlow","require","_evaluateRpTrust","_getRequestObject","_retrieveRpJwks","_verifyRequestObject","_fetchPresentationDefinition","_evaluateInputDescriptor","_evaluateDcqlQuery","_sendAuthorizationResponse","Errors","_interopRequireWildcard","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAIA,IAAAE,iBAAA,GAAAF,OAAA;AAIA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AAIA,IAAAK,4BAAA,GAAAL,OAAA;AAIA,IAAAM,wBAAA,GAAAN,OAAA;AAMA,IAAAO,kBAAA,GAAAP,OAAA;AAMA,IAAAQ,0BAAA,GAAAR,OAAA;AAQA,IAAAS,MAAA,GAAAC,uBAAA,CAAAV,OAAA;AAAmCW,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAA,SAAAG,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,SAAAH,wBAAAO,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,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.WalletMetadata = exports.RequestObjectWalletCapabilities = exports.RequestObject = exports.PresentationDefinition = exports.
|
6
|
+
exports.WalletMetadata = exports.RequestObjectWalletCapabilities = exports.RequestObject = exports.PresentationDefinition = exports.InputDescriptor = exports.ErrorResponse = exports.DirectAuthorizationBodyPayload = void 0;
|
7
7
|
var _types = require("../../sd-jwt/types");
|
8
8
|
var z = _interopRequireWildcard(require("zod"));
|
9
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); }
|
@@ -127,24 +127,31 @@ const RequestObjectWalletCapabilities = z.object({
|
|
127
127
|
});
|
128
128
|
|
129
129
|
/**
|
130
|
-
*
|
131
|
-
*
|
130
|
+
* This type models the possible error responses the OpenID4VP protocol allows for a presentation of a credential.
|
131
|
+
* When the Wallet encounters one of these errors, it will notify the Relying Party through the `response_uri` endpoint.
|
132
|
+
* See https://italia.github.io/eid-wallet-it-docs/versione-corrente/en/pid-eaa-presentation.html#authorization-response-errors for more information.
|
132
133
|
*/
|
133
134
|
exports.RequestObjectWalletCapabilities = RequestObjectWalletCapabilities;
|
135
|
+
const ErrorResponse = z.enum(["invalid_request_object", "invalid_request_uri", "vp_formats_not_supported", "invalid_request", "access_denied", "invalid_client"]);
|
136
|
+
|
134
137
|
/**
|
135
138
|
* @deprecated Use `DirectAuthorizationBodyPayload`
|
136
139
|
*/
|
140
|
+
exports.ErrorResponse = ErrorResponse;
|
137
141
|
const LegacyDirectAuthorizationBodyPayload = z.object({
|
138
142
|
vp_token: z.union([z.string(), z.array(z.string())]).optional(),
|
139
143
|
presentation_submission: z.record(z.string(), z.unknown())
|
140
144
|
});
|
141
145
|
|
142
146
|
/**
|
143
|
-
* Authorization Response payload
|
147
|
+
* Authorization Response payload sent to the Relying Party.
|
144
148
|
*/
|
145
|
-
|
146
|
-
const DirectAuthorizationBodyPayload = z.object({
|
149
|
+
|
150
|
+
const DirectAuthorizationBodyPayload = z.union([z.object({
|
147
151
|
vp_token: z.record(z.string(), z.string())
|
148
|
-
})
|
152
|
+
}), z.object({
|
153
|
+
error: ErrorResponse,
|
154
|
+
error_description: z.string()
|
155
|
+
}), LegacyDirectAuthorizationBodyPayload]);
|
149
156
|
exports.DirectAuthorizationBodyPayload = DirectAuthorizationBodyPayload;
|
150
157
|
//# sourceMappingURL=types.js.map
|