@pagopa/io-react-native-wallet 0.28.2 → 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/README.md +43 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +5 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +12 -0
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +5 -0
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +13 -2
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +10 -0
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/presentation/01-start-flow.js +9 -8
- package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
- 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 +43 -16
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +16 -4
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.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 +27 -9
- package/lib/commonjs/credential/presentation/errors.js +28 -23
- 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/credential/status/02-status-attestation.js +2 -0
- package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -1
- package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +3 -0
- package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +1 -1
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +5 -0
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -1
- package/lib/commonjs/index.js +3 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/decoder.js +2 -0
- package/lib/commonjs/utils/decoder.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/commonjs/utils/logging.js +68 -0
- package/lib/commonjs/utils/logging.js.map +1 -0
- package/lib/commonjs/utils/misc.js +2 -0
- package/lib/commonjs/utils/misc.js.map +1 -1
- package/lib/commonjs/utils/par.js +2 -0
- package/lib/commonjs/utils/par.js.map +1 -1
- package/lib/commonjs/wallet-instance/index.js +4 -0
- package/lib/commonjs/wallet-instance/index.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/issuing.js +5 -0
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/credential/issuance/03-start-user-authorization.js +5 -0
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +12 -0
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +5 -0
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +13 -2
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +10 -0
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/presentation/01-start-flow.js +9 -8
- package/lib/module/credential/presentation/01-start-flow.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 +44 -17
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +17 -5
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.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 +27 -9
- package/lib/module/credential/presentation/errors.js +17 -19
- 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/credential/status/02-status-attestation.js +2 -0
- package/lib/module/credential/status/02-status-attestation.js.map +1 -1
- package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +3 -0
- package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -1
- package/lib/module/credential/trustmark/get-credential-trustmark.js +5 -0
- package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/decoder.js +2 -0
- package/lib/module/utils/decoder.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/module/utils/logging.js +62 -0
- package/lib/module/utils/logging.js.map +1 -0
- package/lib/module/utils/misc.js +2 -0
- package/lib/module/utils/misc.js.map +1 -1
- package/lib/module/utils/par.js +2 -0
- package/lib/module/utils/par.js.map +1 -1
- package/lib/module/wallet-instance/index.js +4 -0
- package/lib/module/wallet-instance/index.js.map +1 -1
- package/lib/module/wallet-instance-attestation/issuing.js +5 -0
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/01-start-flow.d.ts +17 -14
- package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts +1 -3
- 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/07-evaluate-input-descriptor.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 +17 -12
- 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/credential/status/02-status-attestation.d.ts.map +1 -1
- package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -1
- package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/decoder.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/lib/typescript/utils/logging.d.ts +35 -0
- package/lib/typescript/utils/logging.d.ts.map +1 -0
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/utils/par.d.ts.map +1 -1
- package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/credential/issuance/03-start-user-authorization.ts +18 -0
- package/src/credential/issuance/04-complete-user-authorization.ts +51 -0
- package/src/credential/issuance/05-authorize-access.ts +16 -0
- package/src/credential/issuance/06-obtain-credential.ts +31 -2
- package/src/credential/issuance/07-verify-and-parse-credential.ts +27 -1
- package/src/credential/presentation/01-start-flow.ts +12 -11
- package/src/credential/presentation/03-get-request-object.ts +5 -5
- package/src/credential/presentation/05-verify-request-object.ts +73 -15
- package/src/credential/presentation/07-evaluate-dcql-query.ts +43 -18
- package/src/credential/presentation/07-evaluate-input-descriptor.ts +25 -13
- package/src/credential/presentation/08-send-authorization-response.ts +110 -3
- package/src/credential/presentation/README.md +27 -9
- package/src/credential/presentation/errors.ts +24 -17
- package/src/credential/presentation/index.ts +4 -0
- package/src/credential/presentation/types.ts +22 -10
- package/src/credential/status/02-status-attestation.ts +3 -0
- package/src/credential/status/03-verify-and-parse-status-attestation.ts +10 -0
- package/src/credential/trustmark/get-credential-trustmark.ts +19 -0
- package/src/index.ts +2 -0
- package/src/utils/decoder.ts +5 -0
- package/src/utils/error-codes.ts +11 -0
- package/src/utils/errors.ts +59 -29
- package/src/utils/logging.ts +68 -0
- package/src/utils/misc.ts +5 -0
- package/src/utils/par.ts +6 -0
- package/src/wallet-instance/index.ts +17 -1
- package/src/wallet-instance-attestation/issuing.ts +19 -0
@@ -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;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AS,CAACN,CAAC,CAAC;AACjB,CAAC"}
|
@@ -15,12 +15,30 @@ sequenceDiagram
|
|
15
15
|
O->>+I: QR-CODE: Authorization Request (`request_uri`)
|
16
16
|
I->>+O: GET: Verifier's Entity Configuration
|
17
17
|
O->>+I: Respond with metadata (including public keys)
|
18
|
-
I->>+O: GET: Request Object, resolved from
|
18
|
+
I->>+O: GET: Request Object, resolved from `request_uri`
|
19
19
|
O->>+I: Respond with the Request Object
|
20
|
-
I->>+
|
21
|
-
O
|
20
|
+
I->>+I: Validate Request Object and give consent
|
21
|
+
I->>+O: POST: Authorization Response with encrypted VP token
|
22
|
+
O->>+I: Respond with optional `redirect_uri`
|
22
23
|
```
|
23
24
|
|
25
|
+
## Mapped results
|
26
|
+
|
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. |
|
41
|
+
|
24
42
|
|
25
43
|
## Examples
|
26
44
|
|
@@ -35,23 +53,23 @@ const qrCodeParams = decodeQrCode(qrCode)
|
|
35
53
|
|
36
54
|
// Start the issuance flow
|
37
55
|
const {
|
38
|
-
|
39
|
-
|
40
|
-
|
56
|
+
request_uri,
|
57
|
+
client_id,
|
58
|
+
request_uri_method,
|
41
59
|
state
|
42
60
|
} = Credential.Presentation.startFlowFromQR(qrCodeParams);
|
43
61
|
|
44
62
|
// Get the Relying Party's Entity Configuration and evaluate trust
|
45
|
-
const { rpConf } = await Credential.Presentation.evaluateRelyingPartyTrust(
|
63
|
+
const { rpConf } = await Credential.Presentation.evaluateRelyingPartyTrust(client_id);
|
46
64
|
|
47
65
|
// Get the Request Object from the RP
|
48
66
|
const { requestObjectEncodedJwt } =
|
49
|
-
await Credential.Presentation.getRequestObject(
|
67
|
+
await Credential.Presentation.getRequestObject(request_uri);
|
50
68
|
|
51
69
|
// Validate the Request Object
|
52
70
|
const { requestObject } = await Credential.Presentation.verifyRequestObject(
|
53
71
|
requestObjectEncodedJwt,
|
54
|
-
{ clientId, rpConf }
|
72
|
+
{ clientId: client_id, rpConf }
|
55
73
|
);
|
56
74
|
|
57
75
|
// All the credentials that might be requested by the Relying Party
|
@@ -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
|
|
@@ -86,20 +86,18 @@ export class MissingDataError extends IoWalletError {
|
|
86
86
|
super(message);
|
87
87
|
}
|
88
88
|
}
|
89
|
-
|
90
89
|
/**
|
91
|
-
*
|
92
|
-
*
|
90
|
+
* Error thrown when one or more credentials cannot be found in the wallet
|
91
|
+
* and the presentation request cannot be satisfied.
|
93
92
|
*/
|
94
|
-
export class
|
95
|
-
code = "
|
96
|
-
|
93
|
+
export class CredentialsNotFoundError extends IoWalletError {
|
94
|
+
code = "ERR_CREDENTIALS_NOT_FOUND";
|
97
95
|
/**
|
98
|
-
* @param
|
96
|
+
* @param details The details of the credentials that could not be found.
|
99
97
|
*/
|
100
|
-
constructor(
|
101
|
-
|
102
|
-
|
98
|
+
constructor(details) {
|
99
|
+
super("One or more credentials cannot be found in the wallet");
|
100
|
+
this.details = details;
|
103
101
|
}
|
104
102
|
}
|
105
103
|
//# sourceMappingURL=errors.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["IoWalletError","serializeAttrs","AuthRequestDecodeError","code","constructor","message","claim","arguments","length","undefined","reason","NoSuitableKeysFoundInEntityConfiguration","scenario","InvalidQRCodeError","
|
1
|
+
{"version":3,"names":["IoWalletError","serializeAttrs","DcqlError","AuthRequestDecodeError","code","constructor","message","claim","arguments","length","undefined","reason","NoSuitableKeysFoundInEntityConfiguration","scenario","InvalidQRCodeError","InvalidRequestObjectError","MissingDataError","missingAttributes","CredentialsNotFoundError","details"],"sourceRoot":"../../../../src","sources":["credential/presentation/errors.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,cAAc,QAAQ,oBAAoB;AAClE,SAASC,SAAS,QAAQ,MAAM;;AAEhC;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASH,aAAa,CA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A;AACA;AACA,OAAO,MAAMK,gBAAgB,SAAShB,aAAa,CAAC;EAClDI,IAAI,GAAG,kBAAkB;;EAEzB;AACF;AACA;EACEC,WAAWA,CAACY,iBAAyB,EAAE;IACrC,MAAMX,OAAO,GAAI,kCAAiCW,iBAAkB,GAAE;IACtE,KAAK,CAACX,OAAO,CAAC;EAChB;AACF;AAQA;AACA;AACA;AACA;AACA,OAAO,MAAMY,wBAAwB,SAASlB,aAAa,CAAC;EAC1DI,IAAI,GAAG,2BAA2B;EAGlC;AACF;AACA;EACEC,WAAWA,CAACc,OAAyB,EAAE;IACrC,KAAK,CAAC,uDAAuD,CAAC;IAC9D,IAAI,CAACA,OAAO,GAAGA,OAAO;EACxB;AACF"}
|
@@ -6,7 +6,7 @@ import { verifyRequestObject } from "./05-verify-request-object";
|
|
6
6
|
import { fetchPresentDefinition } from "./06-fetch-presentation-definition";
|
7
7
|
import { evaluateInputDescriptors, prepareLegacyRemotePresentations } from "./07-evaluate-input-descriptor";
|
8
8
|
import { evaluateDcqlQuery, prepareRemotePresentations } from "./07-evaluate-dcql-query";
|
9
|
-
import { sendAuthorizationResponse, sendLegacyAuthorizationResponse } from "./08-send-authorization-response";
|
9
|
+
import { sendAuthorizationResponse, sendLegacyAuthorizationResponse, sendAuthorizationErrorResponse } from "./08-send-authorization-response";
|
10
10
|
import * as Errors from "./errors";
|
11
|
-
export { startFlowFromQR, evaluateRelyingPartyTrust, getRequestObject, getJwksFromConfig, verifyRequestObject, fetchPresentDefinition, evaluateInputDescriptors, evaluateDcqlQuery, prepareLegacyRemotePresentations, prepareRemotePresentations, sendAuthorizationResponse, sendLegacyAuthorizationResponse, Errors };
|
11
|
+
export { startFlowFromQR, evaluateRelyingPartyTrust, getRequestObject, getJwksFromConfig, verifyRequestObject, fetchPresentDefinition, evaluateInputDescriptors, evaluateDcqlQuery, prepareLegacyRemotePresentations, prepareRemotePresentations, sendAuthorizationResponse, sendLegacyAuthorizationResponse, sendAuthorizationErrorResponse, Errors };
|
12
12
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["startFlowFromQR","evaluateRelyingPartyTrust","getRequestObject","getJwksFromConfig","verifyRequestObject","fetchPresentDefinition","evaluateInputDescriptors","prepareLegacyRemotePresentations","evaluateDcqlQuery","prepareRemotePresentations","sendAuthorizationResponse","sendLegacyAuthorizationResponse","Errors"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAwB,iBAAiB;AACjE,SACEC,yBAAyB,QAEpB,wBAAwB;AAC/B,SACEC,gBAAgB,QAEX,yBAAyB;AAChC,SAASC,iBAAiB,QAAwB,uBAAuB;AACzE,SACEC,mBAAmB,QAEd,4BAA4B;AACnC,SACEC,sBAAsB,QAEjB,oCAAoC;AAC3C,SACEC,wBAAwB,EACxBC,gCAAgC,QAG3B,gCAAgC;AACvC,SACEC,iBAAiB,EACjBC,0BAA0B,QAGrB,0BAA0B;AACjC,SACEC,yBAAyB,EAEzBC,+BAA+B,
|
1
|
+
{"version":3,"names":["startFlowFromQR","evaluateRelyingPartyTrust","getRequestObject","getJwksFromConfig","verifyRequestObject","fetchPresentDefinition","evaluateInputDescriptors","prepareLegacyRemotePresentations","evaluateDcqlQuery","prepareRemotePresentations","sendAuthorizationResponse","sendLegacyAuthorizationResponse","sendAuthorizationErrorResponse","Errors"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAwB,iBAAiB;AACjE,SACEC,yBAAyB,QAEpB,wBAAwB;AAC/B,SACEC,gBAAgB,QAEX,yBAAyB;AAChC,SAASC,iBAAiB,QAAwB,uBAAuB;AACzE,SACEC,mBAAmB,QAEd,4BAA4B;AACnC,SACEC,sBAAsB,QAEjB,oCAAoC;AAC3C,SACEC,wBAAwB,EACxBC,gCAAgC,QAG3B,gCAAgC;AACvC,SACEC,iBAAiB,EACjBC,0BAA0B,QAGrB,0BAA0B;AACjC,SACEC,yBAAyB,EAEzBC,+BAA+B,EAE/BC,8BAA8B,QAEzB,kCAAkC;AACzC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAElC,SACEb,eAAe,EACfC,yBAAyB,EACzBC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,sBAAsB,EACtBC,wBAAwB,EACxBE,iBAAiB,EACjBD,gCAAgC,EAChCE,0BAA0B,EAC1BC,yBAAyB,EACzBC,+BAA+B,EAC/BC,8BAA8B,EAC9BC,MAAM"}
|
@@ -118,23 +118,29 @@ export const RequestObjectWalletCapabilities = z.object({
|
|
118
118
|
});
|
119
119
|
|
120
120
|
/**
|
121
|
-
*
|
122
|
-
*
|
121
|
+
* This type models the possible error responses the OpenID4VP protocol allows for a presentation of a credential.
|
122
|
+
* When the Wallet encounters one of these errors, it will notify the Relying Party through the `response_uri` endpoint.
|
123
|
+
* See https://italia.github.io/eid-wallet-it-docs/versione-corrente/en/pid-eaa-presentation.html#authorization-response-errors for more information.
|
123
124
|
*/
|
124
125
|
|
126
|
+
export const ErrorResponse = z.enum(["invalid_request_object", "invalid_request_uri", "vp_formats_not_supported", "invalid_request", "access_denied", "invalid_client"]);
|
127
|
+
|
125
128
|
/**
|
126
129
|
* @deprecated Use `DirectAuthorizationBodyPayload`
|
127
130
|
*/
|
128
|
-
|
131
|
+
const LegacyDirectAuthorizationBodyPayload = z.object({
|
129
132
|
vp_token: z.union([z.string(), z.array(z.string())]).optional(),
|
130
133
|
presentation_submission: z.record(z.string(), z.unknown())
|
131
134
|
});
|
132
135
|
|
133
136
|
/**
|
134
|
-
* Authorization Response payload
|
137
|
+
* Authorization Response payload sent to the Relying Party.
|
135
138
|
*/
|
136
139
|
|
137
|
-
export const DirectAuthorizationBodyPayload = z.object({
|
140
|
+
export const DirectAuthorizationBodyPayload = z.union([z.object({
|
138
141
|
vp_token: z.record(z.string(), z.string())
|
139
|
-
})
|
142
|
+
}), z.object({
|
143
|
+
error: ErrorResponse,
|
144
|
+
error_description: z.string()
|
145
|
+
}), LegacyDirectAuthorizationBodyPayload]);
|
140
146
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnixTime","z","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","SubmissionRequirement","rule","from","from_nested","count","number","PresentationDefinition","input_descriptors","submission_requirements","RequestObject","iss","iat","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,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAO,KAAKC,CAAC,MAAM,KAAK;;AAExB;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;;AAQA,MAAMC,MAAM,GAAGD,CAAC,CAACE,MAAM,CAAC;EACtBC,IAAI,EAAEH,CAAC,CAACI,KAAK,CAACJ,CAAC,CAACK,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAAC;EAAE;EAClCC,EAAE,EAAEP,CAAC,CAACK,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAAE;EAC3BC,OAAO,EAAET,CAAC,CAACK,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAAE;EAChCE,IAAI,EAAEV,CAAC,CAACK,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAAE;EAC7BG,MAAM,EAAEX,CAAC,CAACY,GAAG,CAAC,CAAC,CAACJ,QAAQ,CAAC,CAAC;EAAE;EAC5BA,QAAQ,EAA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,CAACE,MAAM,CAAC;IACP,mBAAmB,EAAEF,CAAC,CAACI,KAAK,CAACJ,CAAC,CAACK,MAAM,CAAC,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC,CAAE;EACvD,CAAC,CACH;EACA;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;;AAIA,OAAO,MAAM6C,+BAA+B,GAAGrD,CAAC,CAACE,MAAM,CAAC;EACtDoD,eAAe,EAAEN,cAAc;EAC/BO,YAAY,EAAEvD,CAAC,CAACK,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC;AACpC,CAAC,CAAC;;AAEF;AACA;AACA;AACA;;
|
1
|
+
{"version":3,"names":["UnixTime","z","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","SubmissionRequirement","rule","from","from_nested","count","number","PresentationDefinition","input_descriptors","submission_requirements","RequestObject","iss","iat","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/types.ts"],"mappings":"AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAO,KAAKC,CAAC,MAAM,KAAK;;AAExB;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;;AAQA,MAAMC,MAAM,GAAGD,CAAC,CAACE,MAAM,CAAC;EACtBC,IAAI,EAAEH,CAAC,CAACI,KAAK,CAACJ,CAAC,CAACK,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAAC;EAAE;EAClCC,EAAE,EAAEP,CAAC,CAACK,M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C,CAAC6D,OAAO,CAAC,CAAC;AAC3D,CAAC,CAAC;;AAEF;AACA;AACA;;AAIA,OAAO,MAAMC,8BAA8B,GAAG9D,CAAC,CAAC2D,KAAK,CAAC,CACpD3D,CAAC,CAACE,MAAM,CAAC;EACPwD,QAAQ,EAAE1D,CAAC,CAACqB,MAAM,CAACrB,CAAC,CAACK,MAAM,CAAC,CAAC,EAAEL,CAAC,CAACK,MAAM,CAAC,CAAC;AAC3C,CAAC,CAAC,EACFL,CAAC,CAACE,MAAM,CAAC;EAAE6D,KAAK,EAAEP,aAAa;EAAEQ,iBAAiB,EAAEhE,CAAC,CAACK,MAAM,CAAC;AAAE,CAAC,CAAC,EACjEoD,oCAAoC,CACrC,CAAC"}
|
@@ -3,6 +3,7 @@ import { SignJWT } from "@pagopa/io-react-native-jwt";
|
|
3
3
|
import { v4 as uuidv4 } from "uuid";
|
4
4
|
import { StatusAttestationResponse } from "./types";
|
5
5
|
import { IssuerResponseError, IssuerResponseErrorCodes, ResponseErrorBuilder, UnexpectedStatusCodeError } from "../../utils/errors";
|
6
|
+
import { LogLevel, Logger } from "../../utils/logging";
|
6
7
|
/**
|
7
8
|
* WARNING: This function must be called after {@link startFlow}.
|
8
9
|
* Verify the status of the credential attestation.
|
@@ -31,6 +32,7 @@ export const statusAttestation = async function (issuerConf, credential, credent
|
|
31
32
|
const body = {
|
32
33
|
credential_pop: credentialPop
|
33
34
|
};
|
35
|
+
Logger.log(LogLevel.DEBUG, `Credential pop: ${credentialPop}`);
|
34
36
|
const result = await appFetch(statusAttUrl, {
|
35
37
|
method: "POST",
|
36
38
|
headers: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getCredentialHashWithouDiscloures","hasStatusOrThrow","SignJWT","v4","uuidv4","StatusAttestationResponse","IssuerResponseError","IssuerResponseErrorCodes","ResponseErrorBuilder","UnexpectedStatusCodeError","statusAttestation","issuerConf","credential","credentialCryptoContext","appFetch","arguments","length","undefined","fetch","jwk","getPublicKey","credentialHash","statusAttUrl","openid_credential_issuer","status_attestation_endpoint","credentialPop","setPayload","aud","jti","toString","credential_hash","credential_hash_alg","setProtectedHeader","alg","typ","kid","setIssuedAt","setExpirationTime","sign","body","credential_pop","result","method","headers","JSON","stringify","then","raw","json","parse","catch","handleStatusAttestationError","status_attestation","e","handle","code","CredentialInvalidStatus","message","StatusAttestationRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/status/02-status-attestation.ts"],"mappings":"AAAA,SACEA,iCAAiC,EACjCC,gBAAgB,QAEX,kBAAkB;AAEzB,SAA6BC,OAAO,QAAQ,6BAA6B;AACzE,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,SAASC,yBAAyB,QAAQ,SAAS;AACnD,SACEC,mBAAmB,EACnBC,wBAAwB,EACxBC,oBAAoB,EACpBC,yBAAyB,QACpB,oBAAoB;
|
1
|
+
{"version":3,"names":["getCredentialHashWithouDiscloures","hasStatusOrThrow","SignJWT","v4","uuidv4","StatusAttestationResponse","IssuerResponseError","IssuerResponseErrorCodes","ResponseErrorBuilder","UnexpectedStatusCodeError","LogLevel","Logger","statusAttestation","issuerConf","credential","credentialCryptoContext","appFetch","arguments","length","undefined","fetch","jwk","getPublicKey","credentialHash","statusAttUrl","openid_credential_issuer","status_attestation_endpoint","credentialPop","setPayload","aud","jti","toString","credential_hash","credential_hash_alg","setProtectedHeader","alg","typ","kid","setIssuedAt","setExpirationTime","sign","body","credential_pop","log","DEBUG","result","method","headers","JSON","stringify","then","raw","json","parse","catch","handleStatusAttestationError","status_attestation","e","handle","code","CredentialInvalidStatus","message","StatusAttestationRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/status/02-status-attestation.ts"],"mappings":"AAAA,SACEA,iCAAiC,EACjCC,gBAAgB,QAEX,kBAAkB;AAEzB,SAA6BC,OAAO,QAAQ,6BAA6B;AACzE,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,SAASC,yBAAyB,QAAQ,SAAS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EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE;IAClB,CAAC;IACDN,IAAI,EAAEO,IAAI,CAACC,SAAS,CAACR,IAAI;EAC3B,CAAC,CAAC,CACCS,IAAI,CAACjD,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAC3BiD,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEE,IAAI,IAAK/C,yBAAyB,CAACgD,KAAK,CAACD,IAAI,CAAC,CAAC,CACrDE,KAAK,CAACC,4BAA4B,CAAC;EAEtC,OAAO;IAAE3C,iBAAiB,EAAEiC,MAAM,CAACW;EAAmB,CAAC;AACzD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMD,4BAA4B,GAAIE,CAAU,IAAK;EACnD,IAAI,EAAEA,CAAC,YAAYhD,yBAAyB,CAAC,EAAE;IAC7C,MAAMgD,CAAC;EACT;EAEA,MAAM,IAAIjD,oBAAoB,CAACF,mBAAmB,CAAC,CAChDoD,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEpD,wBAAwB,CAACqD,uBAAuB;IACtDC,OAAO,EAAE;EACX,CAAC,CAAC,CACDH,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEpD,wBAAwB,CAACuD,8BAA8B;IAC7DD,OAAO,EAAG;EACZ,CAAC,CAAC,CACDE,SAAS,CAACN,CAAC,CAAC;AACjB,CAAC"}
|
@@ -2,6 +2,7 @@ import { IoWalletError } from "../../utils/errors";
|
|
2
2
|
import { verify } from "@pagopa/io-react-native-jwt";
|
3
3
|
import { ParsedStatusAttestation } from "./types";
|
4
4
|
import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
|
5
|
+
import { LogLevel, Logger } from "../../utils/logging";
|
5
6
|
/**
|
6
7
|
* Given a status attestation, verifies that:
|
7
8
|
* - It's in the supported format;
|
@@ -29,11 +30,13 @@ export const verifyAndParseStatusAttestation = async (issuerConf, rawStatusAttes
|
|
29
30
|
header: decodedJwt.protectedHeader,
|
30
31
|
payload: decodedJwt.payload
|
31
32
|
});
|
33
|
+
Logger.log(LogLevel.DEBUG, `Parsed status attestation: ${JSON.stringify(parsedStatusAttestation)}`);
|
32
34
|
const holderBindingKey = await credentialCryptoContext.getPublicKey();
|
33
35
|
const {
|
34
36
|
cnf
|
35
37
|
} = parsedStatusAttestation.payload;
|
36
38
|
if (!cnf.jwk.kid || cnf.jwk.kid !== holderBindingKey.kid) {
|
39
|
+
Logger.log(LogLevel.ERROR, `Failed to verify holder binding for status attestation, expected kid: ${holderBindingKey.kid}, got: ${parsedStatusAttestation.payload.cnf.jwk.kid}`);
|
37
40
|
throw new IoWalletError(`Failed to verify holder binding for status attestation, expected kid: ${holderBindingKey.kid}, got: ${parsedStatusAttestation.payload.cnf.jwk.kid}`);
|
38
41
|
}
|
39
42
|
return {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["IoWalletError","verify","ParsedStatusAttestation","decode","decodeJwt","verifyAndParseStatusAttestation","issuerConf","rawStatusAttestation","context","statusAttestation","credentialCryptoContext","openid_credential_issuer","jwks","keys","decodedJwt","parsedStatusAttestation","parse","header","protectedHeader","payload","holderBindingKey","getPublicKey","cnf","jwk","kid","
|
1
|
+
{"version":3,"names":["IoWalletError","verify","ParsedStatusAttestation","decode","decodeJwt","LogLevel","Logger","verifyAndParseStatusAttestation","issuerConf","rawStatusAttestation","context","statusAttestation","credentialCryptoContext","openid_credential_issuer","jwks","keys","decodedJwt","parsedStatusAttestation","parse","header","protectedHeader","payload","log","DEBUG","JSON","stringify","holderBindingKey","getPublicKey","cnf","jwk","kid","ERROR","e"],"sourceRoot":"../../../../src","sources":["credential/status/03-verify-and-parse-status-attestation.ts"],"mappings":"AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,MAAM,QAA4B,6BAA6B;AAExE,SAASC,uBAAuB,QAAQ,SAAS;AACjD,SAASC,MAAM,IAAIC,SAAS,QAA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AO,CAACO,GAAG,CAACC,GAAG,CAACC,GAAI,EACrJ,CAAC;IACH;IAEA,OAAO;MAAEb;IAAwB,CAAC;EACpC,CAAC,CAAC,OAAOe,CAAC,EAAE;IACV,MAAM,IAAIhC,aAAa,CACpB,wCAAuCwB,IAAI,CAACC,SAAS,CAACO,CAAC,CAAE,EAC5D,CAAC;EACH;AACF,CAAC"}
|
@@ -2,6 +2,7 @@ import { SignJWT, thumbprint, decode as decodeJwt } from "@pagopa/io-react-nativ
|
|
2
2
|
import * as WalletInstanceAttestation from "../../wallet-instance-attestation";
|
3
3
|
import { IoWalletError } from "../../utils/errors";
|
4
4
|
import { obfuscateString } from "../../utils/string";
|
5
|
+
import { LogLevel, Logger } from "../../utils/logging";
|
5
6
|
/**
|
6
7
|
* Generates a trustmark signed JWT, which is used to verify the authenticity of a credential.
|
7
8
|
* The public key used to sign the trustmark must the same used for the Wallet Instance Attestation.
|
@@ -31,11 +32,13 @@ export const getCredentialTrustmark = async _ref => {
|
|
31
32
|
*/
|
32
33
|
const holderBindingKey = await wiaCryptoContext.getPublicKey();
|
33
34
|
const decodedWia = WalletInstanceAttestation.decode(walletInstanceAttestation);
|
35
|
+
Logger.log(LogLevel.DEBUG, `Decoded wia ${JSON.stringify(decodedWia.payload)} with holder binding key ${JSON.stringify(holderBindingKey)}`);
|
34
36
|
|
35
37
|
/**
|
36
38
|
* Check that the WIA is not expired
|
37
39
|
*/
|
38
40
|
if (decodedWia.payload.exp * 1000 < Date.now()) {
|
41
|
+
Logger.log(LogLevel.ERROR, `Wallet Instance Attestation expired with exp: ${decodedWia.payload.exp}`);
|
39
42
|
throw new IoWalletError("Wallet Instance Attestation expired");
|
40
43
|
}
|
41
44
|
|
@@ -45,8 +48,10 @@ export const getCredentialTrustmark = async _ref => {
|
|
45
48
|
const wiaThumbprint = await thumbprint(decodedWia.payload.cnf.jwk);
|
46
49
|
const cryptoContextThumbprint = await thumbprint(holderBindingKey);
|
47
50
|
if (wiaThumbprint !== cryptoContextThumbprint) {
|
51
|
+
Logger.log(LogLevel.ERROR, `Failed to verify holder binding for status attestation, expected thumbprint: ${cryptoContextThumbprint}, got: ${wiaThumbprint}`);
|
48
52
|
throw new IoWalletError(`Failed to verify holder binding for status attestation, expected thumbprint: ${cryptoContextThumbprint}, got: ${wiaThumbprint}`);
|
49
53
|
}
|
54
|
+
Logger.log(LogLevel.DEBUG, `Wia thumbprint: ${wiaThumbprint} CryptoContext thumbprint: ${cryptoContextThumbprint}`);
|
50
55
|
|
51
56
|
/**
|
52
57
|
* Generate Trustmark signed JWT
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["SignJWT","thumbprint","decode","decodeJwt","WalletInstanceAttestation","IoWalletError","obfuscateString","getCredentialTrustmark","_ref","walletInstanceAttestation","wiaCryptoContext","credentialType","docNumber","expirationTime","holderBindingKey","getPublicKey","decodedWia","payload","exp","Date","now","wiaThumbprint","cnf","jwk","cryptoContextThumbprint","signedTrustmarkJwt","setProtectedHeader","alg","setPayload","iss","sub","subtyp","setIssuedAt","setExpirationTime","sign","decodedTrustmark","jwt"],"sourceRoot":"../../../../src","sources":["credential/trustmark/get-credential-trustmark.ts"],"mappings":"AAAA,SACEA,OAAO,EACPC,UAAU,EAEVC,MAAM,IAAIC,SAAS,QACd,6BAA6B;AACpC,OAAO,KAAKC,yBAAyB,MAAM,mCAAmC;AAC9E,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,eAAe,QAAQ,oBAAoB;
|
1
|
+
{"version":3,"names":["SignJWT","thumbprint","decode","decodeJwt","WalletInstanceAttestation","IoWalletError","obfuscateString","LogLevel","Logger","getCredentialTrustmark","_ref","walletInstanceAttestation","wiaCryptoContext","credentialType","docNumber","expirationTime","holderBindingKey","getPublicKey","decodedWia","log","DEBUG","JSON","stringify","payload","exp","Date","now","ERROR","wiaThumbprint","cnf","jwk","cryptoContextThumbprint","signedTrustmarkJwt","setProtectedHeader","alg","setPayload","iss","sub","subtyp","setIssuedAt","setExpirationTime","sign","decodedTrustmark","jwt"],"sourceRoot":"../../../../src","sources":["credential/trustmark/get-credential-trustmark.ts"],"mappings":"AAAA,SACEA,OAAO,EACPC,UAAU,EAEVC,MAAM,IAAIC,SAAS,QACd,6BAA6B;AACpC,OAAO,KAAKC,yBAAyB,MAAM,mCAAmC;AAC9E,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,QAAQ,EAAEC,MAAM,QAAQ,qBAAqB;AAoCtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAiD,GAAG,MAAAC,IAAA,IAM3D;EAAA,IANkE;IACtEC,yBAAyB;IACzBC,gBAAgB;IAChBC,cAAc;IACdC,SAAS;IACTC,cAAc,GAAG;EACnB,CAAC,GAAAL,IAAA;EACC;AACF;AACA;EACE,MAAMM,gBAAgB,GAAG,MAAMJ,gBAAgB,CAACK,YAAY,CAAC,CAAC;EAC9D,MAAMC,UAAU,GAAGd,yBAAyB,CAACF,MAAM,CACjDS,yBACF,CAAC;EAEDH,MAAM,CAACW,GAAG,CACRZ,QAAQ,CAACa,KAAK,EACb,eAAcC,IAAI,CAACC,SAAS,CAACJ,UAAU,CAACK,OAAO,CAAE,4BAA2BF,IAAI,CAACC,SAAS,CAACN,gBAAgB,CAAE,EAChH,CAAC;;EAED;AACF;AACA;EACE,IAAIE,UAAU,CAACK,OAAO,CAACC,GAAG,GAAG,IAAI,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE;IAC9ClB,MAAM,CAACW,GAAG,CACRZ,QAAQ,CAACoB,KAAK,EACb,iDAAgDT,UAAU,CAACK,OAAO,CAACC,GAAI,EAC1E,CAAC;IACD,MAAM,IAAInB,aAAa,CAAC,qCAAqC,CAAC;EAChE;;EAEA;AACF;AACA;EACE,MAAMuB,aAAa,GAAG,MAAM3B,UAAU,CAACiB,UAAU,CAACK,OAAO,CAACM,GAAG,CAACC,GAAG,CAAC;EAClE,MAAMC,uBAAuB,GAAG,MAAM9B,UAAU,CAACe,gBAAgB,CAAC;EAElE,IAAIY,aAAa,KAAKG,uBAAuB,EAAE;IAC7CvB,MAAM,CAACW,GAAG,CACRZ,QAAQ,CAACoB,KAAK,EACb,gFAA+EI,uBAAwB,UAASH,aAAc,EACjI,CAAC;IACD,MAAM,IAAIvB,aAAa,CACpB,gFAA+E0B,uBAAwB,UAASH,aAAc,EACjI,CAAC;EACH;EAEApB,MAAM,CAACW,GAAG,CACRZ,QAAQ,CAACa,KAAK,EACb,mBAAkBQ,aAAc,8BAA6BG,uBAAwB,EACxF,CAAC;;EAED;AACF;AACA;EACE,MAAMC,kBAAkB,GAAG,MAAM,IAAIhC,OAAO,CAACY,gBAAgB,CAAC,CAC3DqB,kBAAkB,CAAC;IAClBC,GAAG,EAAE;EACP,CAAC,CAAC,CACDC,UAAU,CAAC;IACVC,GAAG,EAAEzB,yBAAyB;IAC9B;AACN;AACA;IACM,IAAIG,SAAS,GAAG;MAAEuB,GAAG,EAAE/B,eAAe,CAACQ,SAAS;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzDwB,MAAM,EAAEzB;EACV,CAAC,CAAC,CACD0B,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAACzB,cAAc,CAAC,CACjC0B,IAAI,CAAC,CAAC;EAET,MAAMC,gBAAgB,GAAGvC,SAAS,CAAC6B,kBAAkB,CAAC;EAEtD,OAAO;IACLW,GAAG,EAAEX,kBAAkB;IACvBjB,cAAc,EAAE2B,gBAAgB,CAACnB,OAAO,CAACC,GAAG,IAAI;EAClD,CAAC;AACH,CAAC"}
|
package/lib/module/index.js
CHANGED
@@ -9,7 +9,8 @@ import * as Errors from "./utils/errors";
|
|
9
9
|
import * as WalletInstanceAttestation from "./wallet-instance-attestation";
|
10
10
|
import * as Trust from "./trust";
|
11
11
|
import * as WalletInstance from "./wallet-instance";
|
12
|
+
import * as Logging from "./utils/logging";
|
12
13
|
import { AuthorizationDetail, AuthorizationDetails } from "./utils/par";
|
13
14
|
import { createCryptoContextFor } from "./utils/crypto";
|
14
|
-
export { SdJwt, PID, Credential, WalletInstanceAttestation, WalletInstance, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails, fixBase64EncodingOnKey };
|
15
|
+
export { SdJwt, PID, Credential, WalletInstanceAttestation, WalletInstance, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails, fixBase64EncodingOnKey, Logging };
|
15
16
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["fixBase64EncodingOnKey","Credential","PID","SdJwt","Errors","WalletInstanceAttestation","Trust","WalletInstance","AuthorizationDetail","AuthorizationDetails","createCryptoContextFor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,aAAa;AACpD;AACA;AACA,OAAO,gCAAgC;AAEvC,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,GAAG,MAAM,OAAO;AAC5B,OAAO,KAAKC,KAAK,MAAM,UAAU;AACjC,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,KAAK,MAAM,SAAS;AAChC,OAAO,KAAKC,cAAc,MAAM,mBAAmB;AACnD,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,aAAa;AACvE,SAASC,sBAAsB,QAAQ,gBAAgB;AAGvD,
|
1
|
+
{"version":3,"names":["fixBase64EncodingOnKey","Credential","PID","SdJwt","Errors","WalletInstanceAttestation","Trust","WalletInstance","Logging","AuthorizationDetail","AuthorizationDetails","createCryptoContextFor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,aAAa;AACpD;AACA;AACA,OAAO,gCAAgC;AAEvC,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,GAAG,MAAM,OAAO;AAC5B,OAAO,KAAKC,KAAK,MAAM,UAAU;AACjC,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,KAAK,MAAM,SAAS;AAChC,OAAO,KAAKC,cAAc,MAAM,mBAAmB;AACnD,OAAO,KAAKC,OAAO,MAAM,iBAAiB;AAC1C,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,aAAa;AACvE,SAASC,sBAAsB,QAAQ,gBAAgB;AAGvD,SACER,KAAK,EACLD,GAAG,EACHD,UAAU,EACVI,yBAAyB,EACzBE,cAAc,EACdH,MAAM,EACNE,KAAK,EACLK,sBAAsB,EACtBF,mBAAmB,EACnBC,oBAAoB,EACpBV,sBAAsB,EACtBQ,OAAO"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
|
2
2
|
import { ValidationFailed } from "./errors";
|
3
|
+
import { LogLevel, Logger } from "./logging";
|
3
4
|
|
4
5
|
/*
|
5
6
|
* Decode a form_post.jwt and return the final JWT.
|
@@ -44,6 +45,7 @@ export const getJwtFromFormPost = async formData => {
|
|
44
45
|
};
|
45
46
|
}
|
46
47
|
}
|
48
|
+
Logger.log(LogLevel.ERROR, `Unable to obtain JWT from form_post.jwt. Form data: ${formData}`);
|
47
49
|
throw new ValidationFailed({
|
48
50
|
message: `Unable to obtain JWT from form_post.jwt. Form data: ${formData}`
|
49
51
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["decode","decodeJwt","ValidationFailed","getJwtFromFormPost","formData","formPostRegex","lineExpressionRegex","match","exec","responseJwt","jwt","replace","decodedJwt","message"],"sourceRoot":"../../../src","sources":["utils/decoder.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AAEjE,SAASC,gBAAgB,QAAQ,UAAU;;
|
1
|
+
{"version":3,"names":["decode","decodeJwt","ValidationFailed","LogLevel","Logger","getJwtFromFormPost","formData","formPostRegex","lineExpressionRegex","match","exec","responseJwt","jwt","replace","decodedJwt","log","ERROR","message"],"sourceRoot":"../../../src","sources":["utils/decoder.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AAEjE,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,WAAW;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAG,MAChCC,QAAgB,IAC0C;EAC1D,MAAMC,aAAa,GAAG,iDAAiD;EACvE,MAAMC,mBAAmB,GAAG,sBAAsB;EAElD,MAAMC,KAAK,GAAGF,aAAa,CAACG,IAAI,CAACJ,QAAQ,CAAC;EAC1C,IAAIG,KAAK,IAAIA,KAAK,CAAC,CAAC,CAAC,EAAE;IACrB,MAAME,WAAW,GAAGF,KAAK,CAAC,CAAC,CAAC;IAE5B,IAAIE,WAAW,EAAE;MACf,MAAMC,GAAG,GAAGD,WAAW,CAACE,OAAO,CAACL,mBAAmB,EAAE,EAAE,CAAC;MACxD,MAAMM,UAAU,GAAGb,SAAS,CAACW,GAAG,CAAC;MACjC,OAAO;QAAEA,GAAG;QAAEE;MAAW,CAAC;IAC5B;EACF;EAEAV,MAAM,CAACW,GAAG,CACRZ,QAAQ,CAACa,KAAK,EACb,uDAAsDV,QAAS,EAClE,CAAC;EACD,MAAM,IAAIJ,gBAAgB,CAAC;IACzBe,OAAO,EAAG,uDAAsDX,QAAS;EAC3E,CAAC,CAAC;AACJ,CAAC"}
|
@@ -40,4 +40,11 @@ export const WalletProviderResponseErrorCodes = {
|
|
40
40
|
*/
|
41
41
|
WalletInstanceNotFound: "ERR_IO_WALLET_INSTANCE_NOT_FOUND"
|
42
42
|
};
|
43
|
+
export const RelyingPartyResponseErrorCodes = {
|
44
|
+
RelyingPartyGenericError: "ERR_RP_GENERIC_ERROR",
|
45
|
+
/**
|
46
|
+
* An error code thrown then the Relying Party rejects the Wallet's Authorization Response.
|
47
|
+
*/
|
48
|
+
InvalidAuthorizationResponse: "ERR_RP_INVALID_AUTHORIZATION_RESPONSE"
|
49
|
+
};
|
43
50
|
//# sourceMappingURL=error-codes.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["IssuerResponseErrorCodes","IssuerGenericError","CredentialIssuingNotSynchronous","CredentialRequestFailed","CredentialInvalidStatus","StatusAttestationRequestFailed","WalletProviderResponseErrorCodes","WalletProviderGenericError","WalletInstanceCreationFailed","WalletInstanceAttestationIssuingFailed","WalletInstanceIntegrityFailed","WalletInstanceRevoked","WalletInstanceNotFound"],"sourceRoot":"../../../src","sources":["utils/error-codes.ts"],"mappings":"AAAA,OAAO,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;AAEV,OAAO,MAAMC,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"}
|
1
|
+
{"version":3,"names":["IssuerResponseErrorCodes","IssuerGenericError","CredentialIssuingNotSynchronous","CredentialRequestFailed","CredentialInvalidStatus","StatusAttestationRequestFailed","WalletProviderResponseErrorCodes","WalletProviderGenericError","WalletInstanceCreationFailed","WalletInstanceAttestationIssuingFailed","WalletInstanceIntegrityFailed","WalletInstanceRevoked","WalletInstanceNotFound","RelyingPartyResponseErrorCodes","RelyingPartyGenericError","InvalidAuthorizationResponse"],"sourceRoot":"../../../src","sources":["utils/error-codes.ts"],"mappings":"AAAA,OAAO,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;AAEV,OAAO,MAAMC,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;AAEV,OAAO,MAAMC,8BAA8B,GAAG;EAC5CC,wBAAwB,EAAE,sBAAsB;EAChD;AACF;AACA;EACEC,4BAA4B,EAAE;AAChC,CAAU"}
|