@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
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Fields","object","path","array","string","min","id","optional","purpose","name","filter","any","boolean","intent_to_retain","Constraints","fields","limit_disclosure","enum","InputDescriptor","format","record","constraints","group","exports","SubmissionRequirement","rule","from","from_nested","count","number","PresentationDefinition","input_descriptors","submission_requirements","RequestObject","iss","iat","UnixTime","exp","state","nonce","response_uri","response_uri_method","response_type","literal","response_mode","client_id","dcql_query","scope","presentation_definition","WalletMetadata","presentation_definition_uri_supported","client_id_schemes_supported","request_object_signing_alg_values_supported","vp_formats_supported","RequestObjectWalletCapabilities","wallet_metadata","wallet_nonce","LegacyDirectAuthorizationBodyPayload","vp_token","union","presentation_submission","unknown","DirectAuthorizationBodyPayload"],"sourceRoot":"../../../../src","sources":["credential/presentation/types.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAyB,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,SAAAF,wBAAAM,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,M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CAAC,CAACG,QAAQ,CAAC,CAAC;EAC3E8C,oBAAoB,EAAE7E,CAAC,CAAC4C,MAAM,CAC5B5C,CAAC,CAAC4B,MAAM,CAAC,CAAC;EAAE;EACZ5B,CAAC,CAACyB,MAAM,CAAC;IACP,mBAAmB,EAAEzB,CAAC,CAAC2B,KAAK,CAAC3B,CAAC,CAAC4B,MAAM,CAAC,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC,CAAE;EACvD,CAAC,CACH;EACA;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AAHAgB,OAAA,CAAA0B,cAAA,GAAAA,cAAA;AAOO,MAAMK,+BAA+B,GAAG9E,CAAC,CAACyB,MAAM,CAAC;EACtDsD,eAAe,EAAEN,cAAc;EAC/BO,YAAY,EAAEhF,CAAC,CAAC4B,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC;AACpC,CAAC,CAAC;;AAEF;AACA;AACA;AACA;
|
1
|
+
{"version":3,"names":["_types","require","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Fields","object","path","array","string","min","id","optional","purpose","name","filter","any","boolean","intent_to_retain","Constraints","fields","limit_disclosure","enum","InputDescriptor","format","record","constraints","group","exports","SubmissionRequirement","rule","from","from_nested","count","number","PresentationDefinition","input_descriptors","submission_requirements","RequestObject","iss","iat","UnixTime","exp","state","nonce","response_uri","response_uri_method","response_type","literal","response_mode","client_id","dcql_query","scope","presentation_definition","WalletMetadata","presentation_definition_uri_supported","client_id_schemes_supported","request_object_signing_alg_values_supported","vp_formats_supported","RequestObjectWalletCapabilities","wallet_metadata","wallet_nonce","ErrorResponse","LegacyDirectAuthorizationBodyPayload","vp_token","union","presentation_submission","unknown","DirectAuthorizationBodyPayload","error","error_description"],"sourceRoot":"../../../../src","sources":["credential/presentation/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odes = void 0;
|
6
|
+
exports.WalletProviderResponseErrorCodes = exports.RelyingPartyResponseErrorCodes = exports.IssuerResponseErrorCodes = void 0;
|
7
7
|
const IssuerResponseErrorCodes = {
|
8
8
|
IssuerGenericError: "ERR_ISSUER_GENERIC_ERROR",
|
9
9
|
/**
|
@@ -48,4 +48,12 @@ const WalletProviderResponseErrorCodes = {
|
|
48
48
|
WalletInstanceNotFound: "ERR_IO_WALLET_INSTANCE_NOT_FOUND"
|
49
49
|
};
|
50
50
|
exports.WalletProviderResponseErrorCodes = WalletProviderResponseErrorCodes;
|
51
|
+
const RelyingPartyResponseErrorCodes = {
|
52
|
+
RelyingPartyGenericError: "ERR_RP_GENERIC_ERROR",
|
53
|
+
/**
|
54
|
+
* An error code thrown then the Relying Party rejects the Wallet's Authorization Response.
|
55
|
+
*/
|
56
|
+
InvalidAuthorizationResponse: "ERR_RP_INVALID_AUTHORIZATION_RESPONSE"
|
57
|
+
};
|
58
|
+
exports.RelyingPartyResponseErrorCodes = RelyingPartyResponseErrorCodes;
|
51
59
|
//# sourceMappingURL=error-codes.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["IssuerResponseErrorCodes","IssuerGenericError","CredentialIssuingNotSynchronous","CredentialRequestFailed","CredentialInvalidStatus","StatusAttestationRequestFailed","exports","WalletProviderResponseErrorCodes","WalletProviderGenericError","WalletInstanceCreationFailed","WalletInstanceAttestationIssuingFailed","WalletInstanceIntegrityFailed","WalletInstanceRevoked","WalletInstanceNotFound"],"sourceRoot":"../../../src","sources":["utils/error-codes.ts"],"mappings":";;;;;;AAAO,MAAMA,wBAAwB,GAAG;EACtCC,kBAAkB,EAAE,0BAA0B;EAC9C;AACF;AACA;EACEC,+BAA+B,EAAE,wCAAwC;EACzE;AACF;AACA;EACEC,uBAAuB,EAAE,+BAA+B;EACxD;AACF;AACA;EACEC,uBAAuB,EAAE,+BAA+B;EACxD;AACF;AACA;EACEC,8BAA8B,EAAE;AAClC,CAAU;AAACC,OAAA,CAAAN,wBAAA,GAAAA,wBAAA;AAEJ,MAAMO,gCAAgC,GAAG;EAC9CC,0BAA0B,EAAE,sCAAsC;EAClE;AACF;AACA;EACEC,4BAA4B,EAAE,wCAAwC;EACtE;AACF;AACA;EACEC,sCAAsC,EACpC,mDAAmD;EACrD;AACF;AACA;EACEC,6BAA6B,EAAE,yCAAyC;EACxE;AACF;AACA;EACEC,qBAAqB,EAAE,gCAAgC;EACvD;AACF;AACA;EACEC,sBAAsB,EAAE;AAC1B,CAAU;AAACP,OAAA,CAAAC,gCAAA,GAAAA,gCAAA"}
|
1
|
+
{"version":3,"names":["IssuerResponseErrorCodes","IssuerGenericError","CredentialIssuingNotSynchronous","CredentialRequestFailed","CredentialInvalidStatus","StatusAttestationRequestFailed","exports","WalletProviderResponseErrorCodes","WalletProviderGenericError","WalletInstanceCreationFailed","WalletInstanceAttestationIssuingFailed","WalletInstanceIntegrityFailed","WalletInstanceRevoked","WalletInstanceNotFound","RelyingPartyResponseErrorCodes","RelyingPartyGenericError","InvalidAuthorizationResponse"],"sourceRoot":"../../../src","sources":["utils/error-codes.ts"],"mappings":";;;;;;AAAO,MAAMA,wBAAwB,GAAG;EACtCC,kBAAkB,EAAE,0BAA0B;EAC9C;AACF;AACA;EACEC,+BAA+B,EAAE,wCAAwC;EACzE;AACF;AACA;EACEC,uBAAuB,EAAE,+BAA+B;EACxD;AACF;AACA;EACEC,uBAAuB,EAAE,+BAA+B;EACxD;AACF;AACA;EACEC,8BAA8B,EAAE;AAClC,CAAU;AAACC,OAAA,CAAAN,wBAAA,GAAAA,wBAAA;AAEJ,MAAMO,gCAAgC,GAAG;EAC9CC,0BAA0B,EAAE,sCAAsC;EAClE;AACF;AACA;EACEC,4BAA4B,EAAE,wCAAwC;EACtE;AACF;AACA;EACEC,sCAAsC,EACpC,mDAAmD;EACrD;AACF;AACA;EACEC,6BAA6B,EAAE,yCAAyC;EACxE;AACF;AACA;EACEC,qBAAqB,EAAE,gCAAgC;EACvD;AACF;AACA;EACEC,sBAAsB,EAAE;AAC1B,CAAU;AAACP,OAAA,CAAAC,gCAAA,GAAAA,gCAAA;AAEJ,MAAMO,8BAA8B,GAAG;EAC5CC,wBAAwB,EAAE,sBAAsB;EAChD;AACF;AACA;EACEC,4BAA4B,EAAE;AAChC,CAAU;AAACV,OAAA,CAAAQ,8BAAA,GAAAA,8BAAA"}
|
@@ -10,6 +10,13 @@ Object.defineProperty(exports, "IssuerResponseErrorCodes", {
|
|
10
10
|
return _errorCodes.IssuerResponseErrorCodes;
|
11
11
|
}
|
12
12
|
});
|
13
|
+
exports.RelyingPartyResponseError = void 0;
|
14
|
+
Object.defineProperty(exports, "RelyingPartyResponseErrorCodes", {
|
15
|
+
enumerable: true,
|
16
|
+
get: function () {
|
17
|
+
return _errorCodes.RelyingPartyResponseErrorCodes;
|
18
|
+
}
|
19
|
+
});
|
13
20
|
exports.WalletProviderResponseError = exports.ValidationFailed = exports.UnexpectedStatusCodeError = exports.ResponseErrorBuilder = void 0;
|
14
21
|
Object.defineProperty(exports, "WalletProviderResponseErrorCodes", {
|
15
22
|
enumerable: true,
|
@@ -18,7 +25,7 @@ Object.defineProperty(exports, "WalletProviderResponseErrorCodes", {
|
|
18
25
|
}
|
19
26
|
});
|
20
27
|
exports.extractErrorMessageFromIssuerConf = extractErrorMessageFromIssuerConf;
|
21
|
-
exports.serializeAttrs = exports.isWalletProviderResponseError = exports.isIssuerResponseError = void 0;
|
28
|
+
exports.serializeAttrs = exports.isWalletProviderResponseError = exports.isRelyingPartyResponseError = exports.isIssuerResponseError = void 0;
|
22
29
|
var _errorCodes = require("./error-codes");
|
23
30
|
// An error reason that supports both a string and a generic JSON object
|
24
31
|
|
@@ -116,8 +123,6 @@ class UnexpectedStatusCodeError extends IoWalletError {
|
|
116
123
|
/**
|
117
124
|
* An error subclass thrown when an Issuer HTTP request fails.
|
118
125
|
* The specific error can be found in the `code` property.
|
119
|
-
*
|
120
|
-
* The class is generic over the error code to narrow down the reason.
|
121
126
|
*/
|
122
127
|
exports.UnexpectedStatusCodeError = UnexpectedStatusCodeError;
|
123
128
|
class IssuerResponseError extends UnexpectedStatusCodeError {
|
@@ -139,7 +144,19 @@ class WalletProviderResponseError extends UnexpectedStatusCodeError {
|
|
139
144
|
this.code = params.code ?? _errorCodes.WalletProviderResponseErrorCodes.WalletProviderGenericError;
|
140
145
|
}
|
141
146
|
}
|
147
|
+
|
148
|
+
/**
|
149
|
+
* An error subclass thrown when a Relying Party HTTP request fails.
|
150
|
+
* The specific error can be found in the `code` property.
|
151
|
+
*/
|
142
152
|
exports.WalletProviderResponseError = WalletProviderResponseError;
|
153
|
+
class RelyingPartyResponseError extends UnexpectedStatusCodeError {
|
154
|
+
constructor(params) {
|
155
|
+
super(params);
|
156
|
+
this.code = params.code ?? _errorCodes.RelyingPartyResponseErrorCodes.RelyingPartyGenericError;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
exports.RelyingPartyResponseError = RelyingPartyResponseError;
|
143
160
|
/**
|
144
161
|
* Function to extract the error message from the Entity Configuration's supported error codes.
|
145
162
|
* @param errorCode The error code to map to a meaningful message
|
@@ -177,20 +194,20 @@ function extractErrorMessageFromIssuerConf(errorCode, _ref5) {
|
|
177
194
|
}
|
178
195
|
|
179
196
|
/**
|
180
|
-
*
|
181
|
-
*
|
182
|
-
* @param
|
183
|
-
|
184
|
-
const isIssuerResponseError = (error, code) => error instanceof IssuerResponseError && error.code === (code ?? error.code);
|
185
|
-
|
186
|
-
/**
|
187
|
-
* Type guard for wallet provider errors.
|
188
|
-
* @param error The error to check
|
189
|
-
* @param code Optional code to narrow down the wallet provider error
|
197
|
+
* Factory function to create a type guard for specific error classes.
|
198
|
+
*
|
199
|
+
* @param errorClass The error class to create the type guard for
|
200
|
+
* @returns A type guard that checks if the error is an instance of the given class and has the expected code
|
190
201
|
*/
|
202
|
+
const makeErrorTypeGuard = ErrorClass => (error, code) => error instanceof ErrorClass && error.code === (code ?? error.code);
|
203
|
+
const isIssuerResponseError = makeErrorTypeGuard(IssuerResponseError);
|
191
204
|
exports.isIssuerResponseError = isIssuerResponseError;
|
192
|
-
const isWalletProviderResponseError = (
|
205
|
+
const isWalletProviderResponseError = makeErrorTypeGuard(WalletProviderResponseError);
|
193
206
|
exports.isWalletProviderResponseError = isWalletProviderResponseError;
|
207
|
+
const isRelyingPartyResponseError = makeErrorTypeGuard(RelyingPartyResponseError);
|
208
|
+
|
209
|
+
// Mapping type between error classes and their allowed codes
|
210
|
+
exports.isRelyingPartyResponseError = isRelyingPartyResponseError;
|
194
211
|
/**
|
195
212
|
* Builder class used to create specialized errors from type {@link UnexpectedStatusCodeError} that handles multiple status codes.
|
196
213
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_errorCodes","require","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","exports","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerResponseErrorCodes","IssuerGenericError","WalletProviderResponseError","WalletProviderResponseErrorCodes","WalletProviderGenericError","extractErrorMessageFromIssuerConf","errorCode","_ref5","issuerConf","credentialType","credentialConfiguration","openid_credential_issuer","credential_configurations_supported","issuance_errors_supported","localesList","display","reduce","acc","_ref6","locale","rest","
|
1
|
+
{"version":3,"names":["_errorCodes","require","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","exports","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerResponseErrorCodes","IssuerGenericError","WalletProviderResponseError","WalletProviderResponseErrorCodes","WalletProviderGenericError","RelyingPartyResponseError","RelyingPartyResponseErrorCodes","RelyingPartyGenericError","extractErrorMessageFromIssuerConf","errorCode","_ref5","issuerConf","credentialType","credentialConfiguration","openid_credential_issuer","credential_configurations_supported","issuance_errors_supported","localesList","display","reduce","acc","_ref6","locale","rest","makeErrorTypeGuard","ErrorClass","error","isIssuerResponseError","isWalletProviderResponseError","isRelyingPartyResponseError","ResponseErrorBuilder","errorCases","handle","status","buildFrom","originalError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAAA,WAAA,GAAAC,OAAA;AAeA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,cAAc,GACzBC,KAA8E,IAE9EC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,MAAM,CAACC,IAAA;EAAA,IAAC,GAAGC,CAAC,CAAC,GAAAD,IAAA;EAAA,OAAKC,CAAC,KAAKC,SAAS;AAAA,EAAC,CAClCC,GAAG,CAACC,KAAA,IAAY;EAAA,IAAX,CAACC,CAAC,EAAEJ,CAAC,CAAC,GAAAG,KAAA;EACV,IAAIE,KAAK,CAACC,OAAO,CAACN,CAAC,CAAC,EAAE,OAAO,CAACI,CAAC,EAAG,IAAGJ,CAAC,CAACO,IAAI,CAAC,IAAI,CAAE,GAAE,CAAC;EACrD,IAAI,OAAOP,CAAC,KAAK,QAAQ,EAAE,OAAO,CAACI,CAAC,EAAEI,IAAI,CAACC,SAAS,CAACT,CAAC,CAAC,CAAC;EACxD,OAAO,CAACI,CAAC,EAAEJ,CAAC,CAAC;AACf,CAAC,CAAC,CACDE,GAAG,CAAEQ,CAAC,IAAKA,CAAC,CAACH,IAAI,CAAC,GAAG,CAAC,CAAC,CACvBA,IAAI,CAAC,GAAG,CAAC;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVAI,OAAA,CAAAjB,cAAA,GAAAA,cAAA;AAWO,MAAMkB,aAAa,SAASC,KAAK,CAAC;EACvC;EACAC,IAAI,GAAW,uBAAuB;EAEtCC,WAAWA,CAACC,OAAgB,EAAE;IAC5B,KAAK,CAACA,OAAO,CAA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GAAGpC;MAAO,CAAC,CAAC;IAC7D;IAEA,OAAOoC,aAAa;EACtB;AACF;AAACnD,OAAA,CAAA8C,oBAAA,GAAAA,oBAAA"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { RelyingPartyResponseError } from "../../utils/errors";
|
1
2
|
import { hasStatusOrThrow } from "../../utils/misc";
|
2
3
|
import { RequestObjectWalletCapabilities } from "./types";
|
3
4
|
/**
|
@@ -33,14 +34,14 @@ export const getRequestObject = async function (requestUri) {
|
|
33
34
|
"Content-Type": "application/x-www-form-urlencoded"
|
34
35
|
},
|
35
36
|
body: formUrlEncodedBody.toString()
|
36
|
-
}).then(hasStatusOrThrow(200)).then(res => res.text());
|
37
|
+
}).then(hasStatusOrThrow(200, RelyingPartyResponseError)).then(res => res.text());
|
37
38
|
return {
|
38
39
|
requestObjectEncodedJwt
|
39
40
|
};
|
40
41
|
}
|
41
42
|
const requestObjectEncodedJwt = await appFetch(requestUri, {
|
42
43
|
method: "GET"
|
43
|
-
}).then(hasStatusOrThrow(200)).then(res => res.text());
|
44
|
+
}).then(hasStatusOrThrow(200, RelyingPartyResponseError)).then(res => res.text());
|
44
45
|
return {
|
45
46
|
requestObjectEncodedJwt
|
46
47
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["hasStatusOrThrow","RequestObjectWalletCapabilities","getRequestObject","requestUri","appFetch","fetch","walletCapabilities","arguments","length","undefined","wallet_metadata","wallet_nonce","parse","formUrlEncodedBody","URLSearchParams","JSON","stringify","requestObjectEncodedJwt","method","headers","body","toString","then","res","text"],"sourceRoot":"../../../../src","sources":["credential/presentation/03-get-request-object.ts"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,+BAA+B,QAAQ,SAAS;AAUzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,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,GACrCV,+BAA+B,CAACW,KAAK,CAACN,kBAAkB,CAAC;IAE3D,MAAMO,kBAAkB,GAAG,IAAIC,eAAe,CAAC;MAC7CJ,eAAe,EAAEK,IAAI,CAACC,SAAS,CAACN,eAAe,CAAC;MAChD,IAAIC,YAAY,IAAI;QAAEA;MAAa,CAAC;IACtC,CAAC,CAAC;IAEF,MAAMM,uBAAuB,GAAG,MAAMb,QAAQ,CAACD,UAAU,EAAE;MACzDe,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB,CAAC;MACDC,IAAI,EAAEP,kBAAkB,CAACQ,QAAQ,CAAC;IACpC,CAAC,CAAC,CACCC,IAAI,CAACtB,gBAAgB,CAAC,GAAG,CAAC,CAAC,
|
1
|
+
{"version":3,"names":["RelyingPartyResponseError","hasStatusOrThrow","RequestObjectWalletCapabilities","getRequestObject","requestUri","appFetch","fetch","walletCapabilities","arguments","length","undefined","wallet_metadata","wallet_nonce","parse","formUrlEncodedBody","URLSearchParams","JSON","stringify","requestObjectEncodedJwt","method","headers","body","toString","then","res","text"],"sourceRoot":"../../../../src","sources":["credential/presentation/03-get-request-object.ts"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,oBAAoB;AAC9D,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,+BAA+B,QAAQ,SAAS;AAUzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,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,GACrCV,+BAA+B,CAACW,KAAK,CAACN,kBAAkB,CAAC;IAE3D,MAAMO,kBAAkB,GAAG,IAAIC,eAAe,CAAC;MAC7CJ,eAAe,EAAEK,IAAI,CAACC,SAAS,CAACN,eAAe,CAAC;MAChD,IAAIC,YAAY,IAAI;QAAEA;MAAa,CAAC;IACtC,CAAC,CAAC;IAEF,MAAMM,uBAAuB,GAAG,MAAMb,QAAQ,CAACD,UAAU,EAAE;MACzDe,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB,CAAC;MACDC,IAAI,EAAEP,kBAAkB,CAACQ,QAAQ,CAAC;IACpC,CAAC,CAAC,CACCC,IAAI,CAACtB,gBAAgB,CAAC,GAAG,EAAED,yBAAyB,CAAC,CAAC,CACtDuB,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;IAE5B,OAAO;MACLP;IACF,CAAC;EACH;EAEA,MAAMA,uBAAuB,GAAG,MAAMb,QAAQ,CAACD,UAAU,EAAE;IACzDe,MAAM,EAAE;EACV,CAAC,CAAC,CACCI,IAAI,CAACtB,gBAAgB,CAAC,GAAG,EAAED,yBAAyB,CAAC,CAAC,CACtDuB,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;EAE5B,OAAO;IACLP;EACF,CAAC;AACH,CAAC"}
|
@@ -1,14 +1,15 @@
|
|
1
1
|
import { decode as decodeJwt, verify } from "@pagopa/io-react-native-jwt";
|
2
|
-
import {
|
2
|
+
import { InvalidRequestObjectError } from "./errors";
|
3
3
|
import { RequestObject } from "./types";
|
4
4
|
import { getJwksFromConfig } from "./04-retrieve-rp-jwks";
|
5
5
|
/**
|
6
|
-
* Function to verify the Request Object's signature
|
6
|
+
* Function to verify the Request Object's validity, from the signature to the required properties.
|
7
7
|
* @param requestObjectEncodedJwt The Request Object in JWT format
|
8
8
|
* @param context.clientId The client ID to verify
|
9
9
|
* @param context.rpConf The Entity Configuration of the Relying Party
|
10
10
|
* @param context.state Optional state
|
11
11
|
* @returns The verified Request Object
|
12
|
+
* @throws {InvalidRequestObjectError} if the Request Object cannot be validated
|
12
13
|
*/
|
13
14
|
export const verifyRequestObject = async (requestObjectEncodedJwt, _ref) => {
|
14
15
|
let {
|
@@ -18,36 +19,70 @@ export const verifyRequestObject = async (requestObjectEncodedJwt, _ref) => {
|
|
18
19
|
state
|
19
20
|
} = _ref;
|
20
21
|
const requestObjectJwt = decodeJwt(requestObjectEncodedJwt);
|
21
|
-
const
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
} = _ref2;
|
30
|
-
return kid === requestObjectJwt.protectedHeader.kid;
|
31
|
-
});
|
32
|
-
if (!pubKey) {
|
33
|
-
throw new UnverifiedEntityError("Request Object signature verification!");
|
22
|
+
const pubKey = getSigPublicKey(rpConf, requestObjectJwt.protectedHeader.kid);
|
23
|
+
try {
|
24
|
+
// Standard claims are verified within `verify`
|
25
|
+
await verify(requestObjectEncodedJwt, pubKey, {
|
26
|
+
issuer: clientId
|
27
|
+
});
|
28
|
+
} catch (_) {
|
29
|
+
throw new InvalidRequestObjectError("The Request Object signature verification failed");
|
34
30
|
}
|
35
|
-
|
36
|
-
// Standard claims are verified within `verify`
|
37
|
-
await verify(requestObjectEncodedJwt, pubKey, {
|
38
|
-
issuer: clientId
|
39
|
-
});
|
40
|
-
const requestObject = RequestObject.parse(requestObjectJwt.payload);
|
31
|
+
const requestObject = validateRequestObjectShape(requestObjectJwt.payload);
|
41
32
|
const isClientIdMatch = clientId === requestObject.client_id && clientId === rpSubject;
|
42
33
|
if (!isClientIdMatch) {
|
43
|
-
throw new
|
34
|
+
throw new InvalidRequestObjectError("Client ID does not match Request Object or Entity Configuration");
|
44
35
|
}
|
45
36
|
const isStateMatch = state && requestObject.state ? state === requestObject.state : true;
|
46
37
|
if (!isStateMatch) {
|
47
|
-
throw new
|
38
|
+
throw new InvalidRequestObjectError("The provided state does not match the Request Object's");
|
48
39
|
}
|
49
40
|
return {
|
50
41
|
requestObject
|
51
42
|
};
|
52
43
|
};
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Validate the shape of the Request Object to ensure all required properties are present and are of the expected type.
|
47
|
+
*
|
48
|
+
* @param payload The Request Object to validate
|
49
|
+
* @returns A valid Request Object
|
50
|
+
* @throws {InvalidRequestObjectError} when the Request Object cannot be parsed
|
51
|
+
*/
|
52
|
+
const validateRequestObjectShape = payload => {
|
53
|
+
const requestObjectParse = RequestObject.safeParse(payload);
|
54
|
+
if (requestObjectParse.success) {
|
55
|
+
return requestObjectParse.data;
|
56
|
+
}
|
57
|
+
throw new InvalidRequestObjectError("The Request Object cannot be parsed successfully", formatFlattenedZodErrors(requestObjectParse.error.flatten()));
|
58
|
+
};
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Get the public key to verify the Request Object's signature from the Relying Party's EC.
|
62
|
+
*
|
63
|
+
* @param rpConf The Relying Party's EC
|
64
|
+
* @param kid The identifier of the key to find
|
65
|
+
* @returns The corresponding public key to verify the signature
|
66
|
+
* @throws {InvalidRequestObjectError} when the key cannot be found
|
67
|
+
*/
|
68
|
+
const getSigPublicKey = (rpConf, kid) => {
|
69
|
+
try {
|
70
|
+
const {
|
71
|
+
keys
|
72
|
+
} = getJwksFromConfig(rpConf);
|
73
|
+
const pubKey = keys.find(k => k.kid === kid);
|
74
|
+
if (!pubKey) throw new Error();
|
75
|
+
return pubKey;
|
76
|
+
} catch (_) {
|
77
|
+
throw new InvalidRequestObjectError(`The public key for signature verification (${kid}) cannot be found in the Entity Configuration`);
|
78
|
+
}
|
79
|
+
};
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Utility to format flattened Zod errors into a simplified string `key1: key1_error, key2: key2_error`
|
83
|
+
*/
|
84
|
+
const formatFlattenedZodErrors = errors => Object.entries(errors.fieldErrors).map(_ref2 => {
|
85
|
+
let [key, error] = _ref2;
|
86
|
+
return `${key}: ${error[0]}`;
|
87
|
+
}).join(", ");
|
53
88
|
//# sourceMappingURL=05-verify-request-object.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["decode","decodeJwt","verify","
|
1
|
+
{"version":3,"names":["decode","decodeJwt","verify","InvalidRequestObjectError","RequestObject","getJwksFromConfig","verifyRequestObject","requestObjectEncodedJwt","_ref","clientId","rpConf","rpSubject","state","requestObjectJwt","pubKey","getSigPublicKey","protectedHeader","kid","issuer","_","requestObject","validateRequestObjectShape","payload","isClientIdMatch","client_id","isStateMatch","requestObjectParse","safeParse","success","data","formatFlattenedZodErrors","error","flatten","keys","find","k","Error","errors","Object","entries","fieldErrors","map","_ref2","key","join"],"sourceRoot":"../../../../src","sources":["credential/presentation/05-verify-request-object.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,EAAEC,MAAM,QAAQ,6BAA6B;AAEzE,SAASC,yBAAyB,QAAQ,UAAU;AACpD,SAASC,aAAa,QAAQ,SAAS;AACvC,SAASC,iBAAiB,QAAQ,uBAAuB;AAYzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAwC,GAAG,MAAAA,CACtDC,uBAAuB,EAAAC,IAAA,KAEpB;EAAA,IADH;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,SAAS;IAAEC;EAAM,CAAC,GAAAJ,IAAA;EAEtC,MAAMK,gBAAgB,GAAGZ,SAAS,CAACM,uBAAuB,CAAC;EAE3D,MAAMO,MAAM,GAAGC,eAAe,CAACL,MAAM,EAAEG,gBAAgB,CAACG,eAAe,CAACC,GAAG,CAAC;EAE5E,IAAI;IACF;IACA,MAAMf,MAAM,CAACK,uBAAuB,EAAEO,MAAM,EAAE;MAAEI,MAAM,EAAET;IAAS,CAAC,C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ACH,MAAM,EAAE,MAAM,IAAIsB,KAAK,CAAC,CAAC;IAE9B,OAAOtB,MAAM;EACf,CAAC,CAAC,OAAOK,CAAC,EAAE;IACV,MAAM,IAAIhB,yBAAyB,CAChC,8CAA6Cc,GAAI,+CACpD,CAAC;EACH;AACF,CAAC;;AAED;AACA;AACA;AACA,MAAMa,wBAAwB,GAC5BO,MAA+C,IAE/CC,MAAM,CAACC,OAAO,CAACF,MAAM,CAACG,WAAW,CAAC,CAC/BC,GAAG,CAACC,KAAA;EAAA,IAAC,CAACC,GAAG,EAAEZ,KAAK,CAAC,GAAAW,KAAA;EAAA,OAAM,GAAEC,GAAI,KAAIZ,KAAK,CAAC,CAAC,CAAE,EAAC;AAAA,EAAC,CAC5Ca,IAAI,CAAC,IAAI,CAAC"}
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import { DcqlQuery, DcqlError
|
1
|
+
import { DcqlQuery, DcqlError } from "dcql";
|
2
2
|
import { isValiError } from "valibot";
|
3
3
|
import { decode, prepareVpToken } from "../../sd-jwt";
|
4
|
-
import { ValidationFailed } from "../../utils/errors";
|
5
4
|
import { createCryptoContextFor } from "../../utils/crypto";
|
6
5
|
import { CredentialsNotFoundError } from "./errors";
|
7
6
|
|
@@ -126,19 +125,16 @@ export const evaluateDcqlQuery = (credentialsSdJwt, query) => {
|
|
126
125
|
};
|
127
126
|
});
|
128
127
|
} catch (error) {
|
129
|
-
// Invalid DCQL query structure
|
128
|
+
// Invalid DCQL query structure. Remap to `DcqlError` for consistency.
|
130
129
|
if (isValiError(error)) {
|
131
|
-
throw new
|
132
|
-
message: "
|
133
|
-
|
130
|
+
throw new DcqlError({
|
131
|
+
message: "Failed to parse the provided DCQL query",
|
132
|
+
code: "PARSE_ERROR",
|
133
|
+
cause: error.issues
|
134
134
|
});
|
135
135
|
}
|
136
|
-
|
137
|
-
|
138
|
-
}
|
139
|
-
if (error instanceof DcqlCredentialSetError) {
|
140
|
-
// TODO [SIW-2110]: handle missing credentials or let the error propagate
|
141
|
-
}
|
136
|
+
|
137
|
+
// Let other errors propagate so they can be caught with `err instanceof DcqlError`
|
142
138
|
throw error;
|
143
139
|
}
|
144
140
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["DcqlQuery","DcqlError","
|
1
|
+
{"version":3,"names":["DcqlQuery","DcqlError","isValiError","decode","prepareVpToken","createCryptoContextFor","CredentialsNotFoundError","mapCredentialToObject","jwt","sdJwt","disclosures","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","parse","validate","canBeSatisfied","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","message","code","cause","issues","prepareRemotePresentations","nonce","clientId","Promise","all","item","vp_token","requestedClaims","credentialId","vpToken"],"sourceRoot":"../../../../src","sources":["credential/presentation/07-evaluate-dcql-query.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,SAAS,QAAyB,MAAM;AAC5D,SAASC,WAAW,QAAQ,SAAS;AACrC,SAASC,MAAM,EAAEC,cAAc,QAAQ,cAAc;AAErD,SAASC,sBAAsB,QAAQ,oBAAoB;AAE3D,SAASC,wBAAwB,QAA6B,UAAU;;AAExE;AACA;AACA;;AAuCA;AACA;AACA;AACA;AACA,MAAMC,qBAAqB,GAAIC,GAAW,IAAK;EAC7C,MAAM;IAAEC,KAAK;IAAEC;EAAY,CAAC,GAAGP,MAAM,CAACK,GAAG,CAAC;EAC1C,MAAMG,gBAAgB,GAAGF,KAAK,CAACG,MAAM,CAACC,GAAG;;EAEzC;EACA,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IACd;IACA,IAAI7E,WAAW,CAAC6E,KAAK,CAAC,EAAE;MACtB,MAAM,IAAI9E,SAAS,CAAC;QAClB+E,OAAO,EAAE,yCAAyC;QAClDC,IAAI,EAAE,aAAa;QACnBC,KAAK,EAAEH,KAAK,CAACI;MACf,CAAC,CAAC;IACJ;;IAEA;IACA,MAAMJ,KAAK;EACb;AACF,CAAC;AAED,OAAO,MAAMK,0BAAsD,GAAG,MAAAA,CACpE1C,WAAW,EACX2C,KAAK,EACLC,QAAQ,KACL;EACH,OAAOC,OAAO,CAACC,GAAG,CAChB9C,WAAW,CAACL,GAAG,CAAC,MAAOoD,IAAI,IAAK;IAC9B,MAAM;MAAEC;IAAS,CAAC,GAAG,MAAMtF,cAAc,CAACiF,KAAK,EAAEC,QAAQ,EAAE,CACzDG,IAAI,CAAChD,UAAU,EACfgD,IAAI,CAACE,eAAe,EACpBtF,sBAAsB,CAACoF,IAAI,CAACb,MAAM,CAAC,CACpC,CAAC;IAEF,OAAO;MACLgB,YAAY,EAAEH,IAAI,CAACjD,EAAE;MACrBmD,eAAe,EAAEF,IAAI,CAACE,eAAe;MACrCE,OAAO,EAAEH,QAAQ;MACjB7C,MAAM,EAAE;IACV,CAAC;EACH,CAAC,CACH,CAAC;AACH,CAAC"}
|
@@ -4,6 +4,7 @@ import { getJwksFromConfig } from "./04-retrieve-rp-jwks";
|
|
4
4
|
import { NoSuitableKeysFoundInEntityConfiguration } from "./errors";
|
5
5
|
import { hasStatusOrThrow } from "../../utils/misc";
|
6
6
|
import * as z from "zod";
|
7
|
+
import { RelyingPartyResponseError, ResponseErrorBuilder, UnexpectedStatusCodeError, RelyingPartyResponseErrorCodes } from "../../utils/errors";
|
7
8
|
export const AuthorizationResponse = z.object({
|
8
9
|
status: z.string().optional(),
|
9
10
|
response_code: z.string() /**
|
@@ -74,6 +75,29 @@ export const buildDirectPostJwtBody = async (requestObject, rpConf, payload) =>
|
|
74
75
|
return formBody.toString();
|
75
76
|
};
|
76
77
|
|
78
|
+
/**
|
79
|
+
* Builds a URL-encoded form body for a direct POST response without encryption.
|
80
|
+
*
|
81
|
+
* @param requestObject - Contains state, nonce, and other relevant info.
|
82
|
+
* @param payload - Object that contains either the VP token to encrypt and the stringified mapping of the credential disclosures or the error code
|
83
|
+
* @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
|
84
|
+
*/
|
85
|
+
export const buildDirectPostBody = async (requestObject, payload) => {
|
86
|
+
const formUrlEncodedBody = new URLSearchParams({
|
87
|
+
...(requestObject.state && {
|
88
|
+
state: requestObject.state
|
89
|
+
}),
|
90
|
+
...Object.entries(payload).reduce((acc, _ref) => {
|
91
|
+
let [key, value] = _ref;
|
92
|
+
return {
|
93
|
+
...acc,
|
94
|
+
[key]: Array.isArray(value) || typeof value === "object" ? JSON.stringify(value) : value
|
95
|
+
};
|
96
|
+
}, {})
|
97
|
+
});
|
98
|
+
return formUrlEncodedBody.toString();
|
99
|
+
};
|
100
|
+
|
77
101
|
/**
|
78
102
|
* Type definition for the function that sends the authorization response
|
79
103
|
* to the Relying Party, completing the presentation flow.
|
@@ -153,6 +177,63 @@ export const sendAuthorizationResponse = async function (requestObject, remotePr
|
|
153
177
|
"Content-Type": "application/x-www-form-urlencoded"
|
154
178
|
},
|
155
179
|
body: requestBody
|
156
|
-
}).then(hasStatusOrThrow(200)).then(res => res.json()).then(AuthorizationResponse.parse);
|
180
|
+
}).then(hasStatusOrThrow(200)).then(res => res.json()).then(AuthorizationResponse.parse).catch(handleAuthorizationResponseError);
|
181
|
+
};
|
182
|
+
|
183
|
+
/**
|
184
|
+
* Type definition for the function that sends the authorization response
|
185
|
+
* to the Relying Party, completing the presentation flow.
|
186
|
+
*/
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Sends the authorization error response to the Relying Party (RP) using the specified `response_mode`.
|
190
|
+
* This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
|
191
|
+
*
|
192
|
+
* @param requestObject - The request details, including presentation requirements.
|
193
|
+
* @param error - The response error value, with description
|
194
|
+
* @param context - Contains optional custom fetch implementation.
|
195
|
+
* @returns Parsed and validated authorization response from the Relying Party.
|
196
|
+
*/
|
197
|
+
export const sendAuthorizationErrorResponse = async function (requestObject, _ref2) {
|
198
|
+
let {
|
199
|
+
error,
|
200
|
+
errorDescription
|
201
|
+
} = _ref2;
|
202
|
+
let {
|
203
|
+
appFetch = fetch
|
204
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
205
|
+
const requestBody = await buildDirectPostBody(requestObject, {
|
206
|
+
error,
|
207
|
+
error_description: errorDescription
|
208
|
+
});
|
209
|
+
return await appFetch(requestObject.response_uri, {
|
210
|
+
method: "POST",
|
211
|
+
headers: {
|
212
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
213
|
+
},
|
214
|
+
body: requestBody
|
215
|
+
}).then(hasStatusOrThrow(200, RelyingPartyResponseError)).then(res => res.json()).then(AuthorizationResponse.parse);
|
216
|
+
};
|
217
|
+
|
218
|
+
/**
|
219
|
+
* Handle the the presentation error by mapping it to a custom exception.
|
220
|
+
* If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
|
221
|
+
* @param e - The error to be handled
|
222
|
+
* @throws {RelyingPartyResponseError} with a specific code for more context
|
223
|
+
*/
|
224
|
+
const handleAuthorizationResponseError = e => {
|
225
|
+
if (!(e instanceof UnexpectedStatusCodeError)) {
|
226
|
+
throw e;
|
227
|
+
}
|
228
|
+
throw new ResponseErrorBuilder(RelyingPartyResponseError).handle(400, {
|
229
|
+
code: RelyingPartyResponseErrorCodes.InvalidAuthorizationResponse,
|
230
|
+
message: "The Authorization Response contains invalid parameters or it is malformed"
|
231
|
+
}).handle(403, {
|
232
|
+
code: RelyingPartyResponseErrorCodes.InvalidAuthorizationResponse,
|
233
|
+
message: "The Authorization Response was forbidden"
|
234
|
+
}).handle("*", {
|
235
|
+
code: RelyingPartyResponseErrorCodes.RelyingPartyGenericError,
|
236
|
+
message: "Unable to successfully send the Authorization Response"
|
237
|
+
}).buildFrom(e);
|
157
238
|
};
|
158
239
|
//# sourceMappingURL=08-send-authorization-response.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["EncryptJwe","uuid","getJwksFromConfig","NoSuitableKeysFoundInEntityConfiguration","hasStatusOrThrow","z","AuthorizationResponse","object","status","string","optional","response_code","redirect_uri","choosePublicKeyToEncrypt","rpJwkKeys","encKey","find","jwk","use","buildDirectPostJwtBody","requestObject","rpConf","payload","authzResponsePayload","JSON","stringify","state","keys","encPublicJwk","authorization_encrypted_response_alg","authorization_encrypted_response_enc","openid_credential_verifier","defaultAlg","kty","encryptedResponse","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","v4","definition_id","requestBody","response_uri","method","headers","body","then","res","json","parse","sendAuthorizationResponse","
|
1
|
+
{"version":3,"names":["EncryptJwe","uuid","getJwksFromConfig","NoSuitableKeysFoundInEntityConfiguration","hasStatusOrThrow","z","RelyingPartyResponseError","ResponseErrorBuilder","UnexpectedStatusCodeError","RelyingPartyResponseErrorCodes","AuthorizationResponse","object","status","string","optional","response_code","redirect_uri","choosePublicKeyToEncrypt","rpJwkKeys","encKey","find","jwk","use","buildDirectPostJwtBody","requestObject","rpConf","payload","authzResponsePayload","JSON","stringify","state","keys","encPublicJwk","authorization_encrypted_response_alg","authorization_encrypted_response_enc","openid_credential_verifier","defaultAlg","kty","encryptedResponse","alg","enc","kid","encrypt","formBody","URLSearchParams","response","toString","buildDirectPostBody","formUrlEncodedBody","Object","entries","reduce","acc","_ref","key","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","v4","definition_id","requestBody","response_uri","method","headers","body","then","res","json","parse","sendAuthorizationResponse","presentation","credentialId","catch","handleAuthorizationResponseError","sendAuthorizationErrorResponse","_ref2","error","errorDescription","error_description","e","handle","code","InvalidAuthorizationResponse","message","RelyingPartyGenericError","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/presentation/08-send-authorization-response.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,6BAA6B;AACxD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,iBAAiB,QAAwB,uBAAuB;AAEzE,SAASC,wCAAwC,QAAQ,UAAU;AACnE,SAASC,gBAAgB,QAAkB,kBAAkB;AAO7D,OAAO,KAAKC,CAAC,MAAM,KAAK;AAGxB,SACEC,yBAAyB,EACzBC,oBAAoB,EACpBC,yBAAyB,EACzBC,8BAA8B,QACzB,oBAAoB;AAG3B,OAAO,MAAMC,qBAAqB,GAAGL,CAAC,CAACM,MAAM,CAAC;EAC5CC,MAAM,EAAEP,CAAC,CAACQ,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC7BC,aAAa,EAAEV,CAAC,CACbQ,MAAM,CAAC,CAAC,CAAC;AACd;AACA;AACA;AACA,8BAJc,CAKTC,QAAQ,CAAC,CAAC;EACbE,YAAY,EAAEX,CAAC,CAACQ,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AACpC,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,wBAAwB,GACnCC,SAAiC,IACzB;EACR,MAAMC,MAAM,GAAGD,SAAS,CAACE,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,GAAG,KAAK,KAAK,CAAC;EAEzD,IAAIH,MAAM,EAAE;IACV,OAAOA,MAAM;EACf;;EAEA;EACA,MAAM,IAAIhB,wCAAwC,CAChD,8CACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMoB,sBAAsB,GA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B,CAAC8E,KAAK,CAAC;AACtC,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,gCAAgC,GAAIM,CAAU,IAAK;EACvD,IAAI,EAAEA,CAAC,YAAY3F,yBAAyB,CAAC,EAAE;IAC7C,MAAM2F,CAAC;EACT;EAEA,MAAM,IAAI5F,oBAAoB,CAACD,yBAAyB,CAAC,CACtD8F,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAE5F,8BAA8B,CAAC6F,4BAA4B;IACjEC,OAAO,EACL;EACJ,CAAC,CAAC,CACDH,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAE5F,8BAA8B,CAAC6F,4BAA4B;IACjEC,OAAO,EAAE;EACX,CAAC,CAAC,CACDH,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAE5F,8BAA8B,CAAC+F,wBAAwB;IAC7DD,OAAO,EAAE;EACX,CAAC,CAAC,CACDE,SAAS,CAACN,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
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { IoWalletError, serializeAttrs } from "../../utils/errors";
|
2
|
+
export { DcqlError } from "dcql";
|
2
3
|
|
3
4
|
/**
|
4
5
|
* An error subclass thrown when auth request decode fail
|
@@ -56,18 +57,17 @@ export class InvalidQRCodeError extends IoWalletError {
|
|
56
57
|
}
|
57
58
|
|
58
59
|
/**
|
59
|
-
* When the
|
60
|
-
*
|
60
|
+
* When the Request Object sent by the Relying Party is not valid
|
61
61
|
*/
|
62
|
-
export class
|
63
|
-
code = "
|
62
|
+
export class InvalidRequestObjectError extends IoWalletError {
|
63
|
+
code = "ERR_INVALID_REQUEST_OBJECT";
|
64
64
|
|
65
|
-
/**
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
const message = `Unverified entity: ${reason}.`;
|
65
|
+
/** Detailed reason for the Request Object validation failure. */
|
66
|
+
|
67
|
+
constructor(message) {
|
68
|
+
let reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
70
69
|
super(message);
|
70
|
+
this.reason = reason;
|
71
71
|
}
|
72
72
|
}
|
73
73
|
|