@pagopa/io-react-native-wallet 3.2.0 → 3.3.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/issuance/common/02-start-user-authorization.js +4 -3
- package/lib/commonjs/credential/issuance/common/02-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +37 -8
- package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
- package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js +46 -38
- package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -1
- package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js +58 -51
- package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -1
- package/lib/commonjs/credential/issuance/mrtd-pop/index.js +21 -5
- package/lib/commonjs/credential/issuance/mrtd-pop/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js +3 -3
- package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.0.0/index.js +1 -1
- package/lib/commonjs/credential/issuance/v1.0.0/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.0.0/mappers.js +1 -1
- package/lib/commonjs/credential/issuance/v1.0.0/mappers.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +0 -2
- package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js +20 -16
- package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/04-authorize-access.js +20 -19
- package/lib/commonjs/credential/issuance/v1.3.3/04-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js +4 -6
- package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/06-verify-and-parse-credential.js +4 -1
- package/lib/commonjs/credential/issuance/v1.3.3/06-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/index.js +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/mappers.js +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/mappers.js.map +1 -1
- package/lib/commonjs/credential/presentation/{v1.3.3/utils.mdoc.js → common/utils/mdoc.js} +2 -2
- package/lib/commonjs/credential/presentation/common/utils/mdoc.js.map +1 -0
- package/lib/commonjs/credential/presentation/v1.3.3/06-evaluate-dcql-query.js +2 -2
- package/lib/commonjs/credential/presentation/v1.3.3/06-evaluate-dcql-query.js.map +1 -1
- package/lib/commonjs/credential/status/README.md +3 -2
- package/lib/commonjs/credential/status/v1.3.3/01-status-list.js +27 -5
- package/lib/commonjs/credential/status/v1.3.3/01-status-list.js.map +1 -1
- package/lib/commonjs/credential/status/v1.3.3/02-verify-and-parse-status-list.js +17 -6
- package/lib/commonjs/credential/status/v1.3.3/02-verify-and-parse-status-list.js.map +1 -1
- package/lib/commonjs/mdoc/index.js +3 -24
- package/lib/commonjs/mdoc/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/types.test.js +2 -14
- package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/utils.test.js +0 -12
- package/lib/commonjs/sd-jwt/__test__/utils.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +1 -14
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/utils/callbacks.js +20 -1
- package/lib/commonjs/utils/callbacks.js.map +1 -1
- package/lib/commonjs/utils/x509.js +34 -0
- package/lib/commonjs/utils/x509.js.map +1 -0
- package/lib/commonjs/wallet-instance-attestation/api/types.js +0 -2
- package/lib/commonjs/wallet-instance-attestation/api/types.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/mappers.js +1 -14
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/mappers.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js +2 -7
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
- package/lib/commonjs/wallet-unit-attestation/api/types.js +0 -11
- package/lib/commonjs/wallet-unit-attestation/api/types.js.map +1 -1
- package/lib/module/credential/issuance/common/02-start-user-authorization.js +4 -3
- package/lib/module/credential/issuance/common/02-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +39 -10
- package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
- package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js +47 -34
- package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -1
- package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js +58 -47
- package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -1
- package/lib/module/credential/issuance/mrtd-pop/index.js +20 -5
- package/lib/module/credential/issuance/mrtd-pop/index.js.map +1 -1
- package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js +1 -1
- package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/v1.0.0/index.js +2 -2
- package/lib/module/credential/issuance/v1.0.0/index.js.map +1 -1
- package/lib/module/credential/issuance/v1.0.0/mappers.js +1 -1
- package/lib/module/credential/issuance/v1.0.0/mappers.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +0 -2
- package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js +20 -16
- package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/04-authorize-access.js +22 -19
- package/lib/module/credential/issuance/v1.3.3/04-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js +5 -7
- package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/06-verify-and-parse-credential.js +4 -1
- package/lib/module/credential/issuance/v1.3.3/06-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/index.js +2 -2
- package/lib/module/credential/issuance/v1.3.3/index.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/mappers.js +1 -1
- package/lib/module/credential/issuance/v1.3.3/mappers.js.map +1 -1
- package/lib/module/credential/presentation/{v1.3.3/utils.mdoc.js → common/utils/mdoc.js} +2 -2
- package/lib/module/credential/presentation/common/utils/mdoc.js.map +1 -0
- package/lib/module/credential/presentation/v1.3.3/06-evaluate-dcql-query.js +2 -3
- package/lib/module/credential/presentation/v1.3.3/06-evaluate-dcql-query.js.map +1 -1
- package/lib/module/credential/status/README.md +3 -2
- package/lib/module/credential/status/v1.3.3/01-status-list.js +27 -5
- package/lib/module/credential/status/v1.3.3/01-status-list.js.map +1 -1
- package/lib/module/credential/status/v1.3.3/02-verify-and-parse-status-list.js +17 -6
- package/lib/module/credential/status/v1.3.3/02-verify-and-parse-status-list.js.map +1 -1
- package/lib/module/mdoc/index.js +3 -24
- package/lib/module/mdoc/index.js.map +1 -1
- package/lib/module/sd-jwt/__test__/types.test.js +2 -14
- package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/utils.test.js +0 -12
- package/lib/module/sd-jwt/__test__/utils.test.js.map +1 -1
- package/lib/module/sd-jwt/types.js +1 -14
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/utils/callbacks.js +19 -1
- package/lib/module/utils/callbacks.js.map +1 -1
- package/lib/module/utils/x509.js +28 -0
- package/lib/module/utils/x509.js.map +1 -0
- package/lib/module/wallet-instance-attestation/api/types.js +0 -2
- package/lib/module/wallet-instance-attestation/api/types.js.map +1 -1
- package/lib/module/wallet-instance-attestation/v1.3.3/mappers.js +1 -14
- package/lib/module/wallet-instance-attestation/v1.3.3/mappers.js.map +1 -1
- package/lib/module/wallet-instance-attestation/v1.3.3/types.js +2 -7
- package/lib/module/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
- package/lib/module/wallet-unit-attestation/api/types.js +0 -11
- package/lib/module/wallet-unit-attestation/api/types.js.map +1 -1
- package/lib/typescript/credential/issuance/api/06-verify-and-parse-credential.d.ts +4 -0
- package/lib/typescript/credential/issuance/api/06-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/common/02-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/common/06-verify-and-parse-credential.sdjwt.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts +12 -1
- package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts +12 -1
- package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts +2 -1
- package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/01-evaluate-issuer-trust.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/02-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/04-authorize-access.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/05-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/06-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/{v1.3.3/utils.mdoc.d.ts → common/utils/mdoc.d.ts} +2 -2
- package/lib/typescript/credential/presentation/common/utils/mdoc.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/v1.3.3/06-evaluate-dcql-query.d.ts.map +1 -1
- package/lib/typescript/credential/status/api/status-list.d.ts +8 -4
- package/lib/typescript/credential/status/api/status-list.d.ts.map +1 -1
- package/lib/typescript/credential/status/v1.3.3/01-status-list.d.ts.map +1 -1
- package/lib/typescript/credential/status/v1.3.3/02-verify-and-parse-status-list.d.ts.map +1 -1
- package/lib/typescript/mdoc/index.d.ts +1 -1
- package/lib/typescript/mdoc/index.d.ts.map +1 -1
- package/lib/typescript/mdoc/utils.d.ts +0 -24
- package/lib/typescript/mdoc/utils.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +0 -12
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/utils/callbacks.d.ts +7 -0
- package/lib/typescript/utils/callbacks.d.ts.map +1 -1
- package/lib/typescript/utils/x509.d.ts +10 -0
- package/lib/typescript/utils/x509.d.ts.map +1 -0
- package/lib/typescript/wallet-instance-attestation/api/types.d.ts +0 -2
- package/lib/typescript/wallet-instance-attestation/api/types.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.0.0/mappers.d.ts +0 -2
- package/lib/typescript/wallet-instance-attestation/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts +2 -9
- package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts +2 -7
- package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts.map +1 -1
- package/lib/typescript/wallet-unit-attestation/api/types.d.ts +0 -11
- package/lib/typescript/wallet-unit-attestation/api/types.d.ts.map +1 -1
- package/lib/typescript/wallet-unit-attestation/v1.3.3/mappers.d.ts +0 -22
- package/lib/typescript/wallet-unit-attestation/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/wallet-unit-attestation/v1.3.3/types.d.ts +0 -11
- package/lib/typescript/wallet-unit-attestation/v1.3.3/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/credential/issuance/api/06-verify-and-parse-credential.ts +4 -0
- package/src/credential/issuance/common/02-start-user-authorization.ts +6 -3
- package/src/credential/issuance/common/06-verify-and-parse-credential.sdjwt.ts +42 -9
- package/src/credential/issuance/mrtd-pop/02-init-challenge.ts +69 -45
- package/src/credential/issuance/mrtd-pop/03-validate-challenge.ts +84 -62
- package/src/credential/issuance/mrtd-pop/index.ts +13 -5
- package/src/credential/issuance/v1.0.0/02-start-user-authorization.ts +1 -1
- package/src/credential/issuance/v1.0.0/index.ts +2 -2
- package/src/credential/issuance/v1.0.0/mappers.ts +4 -1
- package/src/credential/issuance/v1.3.3/01-evaluate-issuer-trust.ts +0 -2
- package/src/credential/issuance/v1.3.3/02-start-user-authorization.ts +24 -20
- package/src/credential/issuance/v1.3.3/04-authorize-access.ts +28 -23
- package/src/credential/issuance/v1.3.3/05-obtain-credential.ts +8 -8
- package/src/credential/issuance/v1.3.3/06-verify-and-parse-credential.ts +2 -1
- package/src/credential/issuance/v1.3.3/index.ts +2 -2
- package/src/credential/issuance/v1.3.3/mappers.ts +4 -1
- package/src/credential/presentation/{v1.3.3/utils.mdoc.ts → common/utils/mdoc.ts} +2 -2
- package/src/credential/presentation/v1.3.3/06-evaluate-dcql-query.ts +3 -3
- package/src/credential/status/README.md +3 -2
- package/src/credential/status/api/status-list.ts +10 -7
- package/src/credential/status/v1.3.3/01-status-list.ts +21 -7
- package/src/credential/status/v1.3.3/02-verify-and-parse-status-list.ts +19 -5
- package/src/mdoc/index.ts +5 -41
- package/src/sd-jwt/__test__/types.test.ts +1 -13
- package/src/sd-jwt/__test__/utils.test.ts +0 -12
- package/src/sd-jwt/types.ts +0 -13
- package/src/utils/callbacks.ts +28 -1
- package/src/utils/x509.ts +43 -0
- package/src/wallet-instance-attestation/api/types.ts +0 -2
- package/src/wallet-instance-attestation/v1.3.3/mappers.ts +3 -11
- package/src/wallet-instance-attestation/v1.3.3/types.ts +2 -7
- package/src/wallet-unit-attestation/api/types.ts +0 -11
- package/lib/commonjs/credential/issuance/common/authorization.js +0 -56
- package/lib/commonjs/credential/issuance/common/authorization.js.map +0 -1
- package/lib/commonjs/credential/presentation/v1.3.3/utils.mdoc.js.map +0 -1
- package/lib/module/credential/issuance/common/authorization.js +0 -48
- package/lib/module/credential/issuance/common/authorization.js.map +0 -1
- package/lib/module/credential/presentation/v1.3.3/utils.mdoc.js.map +0 -1
- package/lib/typescript/credential/issuance/common/authorization.d.ts +0 -21
- package/lib/typescript/credential/issuance/common/authorization.d.ts.map +0 -1
- package/lib/typescript/credential/presentation/v1.3.3/utils.mdoc.d.ts.map +0 -1
- package/src/credential/issuance/common/authorization.ts +0 -89
|
@@ -15,13 +15,8 @@ export const WalletInstanceAttestationJwt = z.object({
|
|
|
15
15
|
Jwt.shape.payload,
|
|
16
16
|
z.object({
|
|
17
17
|
sub: z.string(),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
wallet_provider_name: z.string(),
|
|
21
|
-
wallet_solution_id: z.string(),
|
|
22
|
-
wallet_solution_version: z.string(),
|
|
23
|
-
}),
|
|
24
|
-
}),
|
|
18
|
+
wallet_link: z.string().optional(),
|
|
19
|
+
wallet_name: z.string().optional(),
|
|
25
20
|
})
|
|
26
21
|
),
|
|
27
22
|
});
|
|
@@ -21,17 +21,6 @@ export const DecodedWalletUnitAttestation = z.object({
|
|
|
21
21
|
user_authentication: z.array(z.string()),
|
|
22
22
|
key_storage: z.array(z.string()),
|
|
23
23
|
status: Status,
|
|
24
|
-
eudi_wallet_info: z.object({
|
|
25
|
-
general_info: z.object({
|
|
26
|
-
wallet_provider_name: z.string(),
|
|
27
|
-
wallet_solution_id: z.string(),
|
|
28
|
-
wallet_solution_version: z.string(),
|
|
29
|
-
}),
|
|
30
|
-
key_storage_info: z.object({
|
|
31
|
-
keys_exportable: z.boolean(),
|
|
32
|
-
storage_type: z.string(),
|
|
33
|
-
}),
|
|
34
|
-
}),
|
|
35
24
|
iss: z.string(),
|
|
36
25
|
iat: UnixTime,
|
|
37
26
|
exp: UnixTime,
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.selectResponseMode = exports.selectCredentialDefinition = void 0;
|
|
7
|
-
var _errors = require("../../../utils/errors");
|
|
8
|
-
var _logging = require("../../../utils/logging");
|
|
9
|
-
/**
|
|
10
|
-
* Ensures that the credential type requested is supported by the issuer and contained in the
|
|
11
|
-
* issuer configuration.
|
|
12
|
-
* @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
|
|
13
|
-
* @param credentialId The credential configuration ID to be requested;
|
|
14
|
-
* @returns The credential definition to be used in the request which includes the format and the type and its type
|
|
15
|
-
*/
|
|
16
|
-
const selectCredentialDefinition = (issuerConf, credentialId) => {
|
|
17
|
-
const credential_configurations_supported = issuerConf.credential_configurations_supported;
|
|
18
|
-
const [result] = Object.keys(credential_configurations_supported).filter(e => e.includes(credentialId)).map(() => ({
|
|
19
|
-
credential_configuration_id: credentialId,
|
|
20
|
-
type: "openid_credential"
|
|
21
|
-
}));
|
|
22
|
-
if (!result) {
|
|
23
|
-
_logging.Logger.log(_logging.LogLevel.ERROR, `Requested credential ${credentialId} is not supported by the issuer according to its configuration ${JSON.stringify(credential_configurations_supported)}`);
|
|
24
|
-
throw new _errors.IoWalletError(`No credential support the type '${credentialId}'`);
|
|
25
|
-
}
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Ensures that the response mode requested is supported by the issuer and contained in the issuer configuration.
|
|
31
|
-
* When multiple credentials are provided, all of them must support the same response_mode.
|
|
32
|
-
* @param issuerConf The issuer configuration
|
|
33
|
-
* @param credentialIds The credential configuration IDs to be requested
|
|
34
|
-
* @returns The response mode to be used in the request, "query" for PersonIdentificationData and "form_post.jwt" for all other types.
|
|
35
|
-
*/
|
|
36
|
-
exports.selectCredentialDefinition = selectCredentialDefinition;
|
|
37
|
-
const selectResponseMode = (issuerConf, credentialIds) => {
|
|
38
|
-
const responseModeSet = new Set();
|
|
39
|
-
for (const credentialId of credentialIds) {
|
|
40
|
-
responseModeSet.add(credentialId.match(/PersonIdentificationData/i) ? "query" : "form_post.jwt");
|
|
41
|
-
}
|
|
42
|
-
if (responseModeSet.size !== 1) {
|
|
43
|
-
_logging.Logger.log(_logging.LogLevel.ERROR, `${credentialIds} have incompatible response_mode: ${[...responseModeSet.values()]}`);
|
|
44
|
-
throw new _errors.IoWalletError("Requested credentials have incompatible response_mode and cannot be requested with the same PAR request");
|
|
45
|
-
}
|
|
46
|
-
const [responseMode] = responseModeSet.values();
|
|
47
|
-
_logging.Logger.log(_logging.LogLevel.DEBUG, `Selected response mode ${responseMode} for credential IDs ${credentialIds}`);
|
|
48
|
-
const responseModeSupported = issuerConf.response_modes_supported;
|
|
49
|
-
if (responseModeSupported && !responseModeSupported.includes(responseMode)) {
|
|
50
|
-
_logging.Logger.log(_logging.LogLevel.ERROR, `Requested response mode ${responseMode} is not supported by the issuer according to its configuration ${JSON.stringify(responseModeSupported)}`);
|
|
51
|
-
throw new _errors.IoWalletError(`No response mode support for IDs '${credentialIds}'`);
|
|
52
|
-
}
|
|
53
|
-
return responseMode;
|
|
54
|
-
};
|
|
55
|
-
exports.selectResponseMode = selectResponseMode;
|
|
56
|
-
//# sourceMappingURL=authorization.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_errors","require","_logging","selectCredentialDefinition","issuerConf","credentialId","credential_configurations_supported","result","Object","keys","filter","e","includes","map","credential_configuration_id","type","Logger","log","LogLevel","ERROR","JSON","stringify","IoWalletError","exports","selectResponseMode","credentialIds","responseModeSet","Set","add","match","size","values","responseMode","DEBUG","responseModeSupported","response_modes_supported"],"sourceRoot":"../../../../../src","sources":["credential/issuance/common/authorization.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,0BAA0B,GAAGA,CACxCC,UAAwB,EACxBC,YAAoB,KACI;EACxB,MAAMC,mCAAmC,GACvCF,UAAU,CAACE,mCAAmC;EAEhD,MAAM,CAACC,MAAM,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACH,mCAAmC,CAAC,CAC9DI,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAACP,YAAY,CAAC,CAAC,CACvCQ,GAAG,CAAC,OAAO;IACVC,2BAA2B,EAAET,YAAY;IACzCU,IAAI,EAAE;EACR,CAAC,CAAC,CAAC;EAEL,IAAI,CAACR,MAAM,EAAE;IACXS,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAACC,KAAK,EACb,wBAAuBd,YAAa,kEAAiEe,IAAI,CAACC,SAAS,CAACf,mCAAmC,CAAE,EAC5J,CAAC;IACD,MAAM,IAAIgB,qBAAa,CAAE,mCAAkCjB,YAAa,GAAE,CAAC;EAC7E;EACA,OAAOE,MAAM;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AANAgB,OAAA,CAAApB,0BAAA,GAAAA,0BAAA;AAOO,MAAMqB,kBAAkB,GAAGA,CAChCpB,UAAwB,EACxBqB,aAAuB,KACN;EACjB,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAe,CAAC;EAE/C,KAAK,MAAMtB,YAAY,IAAIoB,aAAa,EAAE;IACxCC,eAAe,CAACE,GAAG,CACjBvB,YAAY,CAACwB,KAAK,CAAC,2BAA2B,CAAC,GAC3C,OAAO,GACP,eACN,CAAC;EACH;EAEA,IAAIH,eAAe,CAACI,IAAI,KAAK,CAAC,EAAE;IAC9Bd,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAACC,KAAK,EACb,GAAEM,aAAc,qCAAoC,CAAC,GAAGC,eAAe,CAACK,MAAM,CAAC,CAAC,CAAE,EACrF,CAAC;IACD,MAAM,IAAIT,qBAAa,CACrB,yGACF,CAAC;EACH;EAEA,MAAM,CAACU,YAAY,CAAC,GAAGN,eAAe,CAACK,MAAM,CAAC,CAAC;EAE/Cf,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAACe,KAAK,EACb,0BAAyBD,YAAa,uBAAsBP,aAAc,EAC7E,CAAC;EAED,MAAMS,qBAAqB,GAAG9B,UAAU,CAAC+B,wBAAwB;EACjE,IAAID,qBAAqB,IAAI,CAACA,qBAAqB,CAACtB,QAAQ,CAACoB,YAAa,CAAC,EAAE;IAC3EhB,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAACC,KAAK,EACb,2BAA0Ba,YAAa,kEAAiEZ,IAAI,CAACC,SAAS,CAACa,qBAAqB,CAAE,EACjJ,CAAC;IACD,MAAM,IAAIZ,qBAAa,CACpB,qCAAoCG,aAAc,GACrD,CAAC;EACH;EAEA,OAAOO,YAAY;AACrB,CAAC;AAACT,OAAA,CAAAC,kBAAA,GAAAA,kBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_ioReactNativeIso","require","_jsrsasign","_dcql","mapCredentialsToObj","credentialsMdoc","Promise","all","map","credential","issuerSigned","CBOR","decodeIssuerSigned","b64utob64","namespaces","Object","entries","nameSpaces","reduce","acc","_ref","ns","nsClaims","flattenNsClaims","ac","_ref2","el","elementIdentifier","elementValue","credential_format","doctype","issuerAuth","payload","docType","cryptographic_holder_binding","original_credential","exports","getClaimsFromDcqlMatch","match","getValidDcqlClaims","flatMap","_ref3","output","_ref4","keys","claimName","namespace","name","value","getPresentationFrameFromClaims","requestedClaims","_ref5","existingNamespace"],"sourceRoot":"../../../../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AA"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { IoWalletError } from "../../../utils/errors";
|
|
2
|
-
import { LogLevel, Logger } from "../../../utils/logging";
|
|
3
|
-
/**
|
|
4
|
-
* Ensures that the credential type requested is supported by the issuer and contained in the
|
|
5
|
-
* issuer configuration.
|
|
6
|
-
* @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
|
|
7
|
-
* @param credentialId The credential configuration ID to be requested;
|
|
8
|
-
* @returns The credential definition to be used in the request which includes the format and the type and its type
|
|
9
|
-
*/
|
|
10
|
-
export const selectCredentialDefinition = (issuerConf, credentialId) => {
|
|
11
|
-
const credential_configurations_supported = issuerConf.credential_configurations_supported;
|
|
12
|
-
const [result] = Object.keys(credential_configurations_supported).filter(e => e.includes(credentialId)).map(() => ({
|
|
13
|
-
credential_configuration_id: credentialId,
|
|
14
|
-
type: "openid_credential"
|
|
15
|
-
}));
|
|
16
|
-
if (!result) {
|
|
17
|
-
Logger.log(LogLevel.ERROR, `Requested credential ${credentialId} is not supported by the issuer according to its configuration ${JSON.stringify(credential_configurations_supported)}`);
|
|
18
|
-
throw new IoWalletError(`No credential support the type '${credentialId}'`);
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Ensures that the response mode requested is supported by the issuer and contained in the issuer configuration.
|
|
25
|
-
* When multiple credentials are provided, all of them must support the same response_mode.
|
|
26
|
-
* @param issuerConf The issuer configuration
|
|
27
|
-
* @param credentialIds The credential configuration IDs to be requested
|
|
28
|
-
* @returns The response mode to be used in the request, "query" for PersonIdentificationData and "form_post.jwt" for all other types.
|
|
29
|
-
*/
|
|
30
|
-
export const selectResponseMode = (issuerConf, credentialIds) => {
|
|
31
|
-
const responseModeSet = new Set();
|
|
32
|
-
for (const credentialId of credentialIds) {
|
|
33
|
-
responseModeSet.add(credentialId.match(/PersonIdentificationData/i) ? "query" : "form_post.jwt");
|
|
34
|
-
}
|
|
35
|
-
if (responseModeSet.size !== 1) {
|
|
36
|
-
Logger.log(LogLevel.ERROR, `${credentialIds} have incompatible response_mode: ${[...responseModeSet.values()]}`);
|
|
37
|
-
throw new IoWalletError("Requested credentials have incompatible response_mode and cannot be requested with the same PAR request");
|
|
38
|
-
}
|
|
39
|
-
const [responseMode] = responseModeSet.values();
|
|
40
|
-
Logger.log(LogLevel.DEBUG, `Selected response mode ${responseMode} for credential IDs ${credentialIds}`);
|
|
41
|
-
const responseModeSupported = issuerConf.response_modes_supported;
|
|
42
|
-
if (responseModeSupported && !responseModeSupported.includes(responseMode)) {
|
|
43
|
-
Logger.log(LogLevel.ERROR, `Requested response mode ${responseMode} is not supported by the issuer according to its configuration ${JSON.stringify(responseModeSupported)}`);
|
|
44
|
-
throw new IoWalletError(`No response mode support for IDs '${credentialIds}'`);
|
|
45
|
-
}
|
|
46
|
-
return responseMode;
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=authorization.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["IoWalletError","LogLevel","Logger","selectCredentialDefinition","issuerConf","credentialId","credential_configurations_supported","result","Object","keys","filter","e","includes","map","credential_configuration_id","type","log","ERROR","JSON","stringify","selectResponseMode","credentialIds","responseModeSet","Set","add","match","size","values","responseMode","DEBUG","responseModeSupported","response_modes_supported"],"sourceRoot":"../../../../../src","sources":["credential/issuance/common/authorization.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,QAAQ,EAAEC,MAAM,QAAQ,wBAAwB;AAMzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAGA,CACxCC,UAAwB,EACxBC,YAAoB,KACI;EACxB,MAAMC,mCAAmC,GACvCF,UAAU,CAACE,mCAAmC;EAEhD,MAAM,CAACC,MAAM,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACH,mCAAmC,CAAC,CAC9DI,MAAM,CAAEC,CAAC,IAA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ACgB,YAAa,CAAC,EAAE;IAC3E1B,MAAM,CAACc,GAAG,CACRf,QAAQ,CAACgB,KAAK,EACb,2BAA0BW,YAAa,kEAAiEV,IAAI,CAACC,SAAS,CAACW,qBAAqB,CAAE,EACjJ,CAAC;IACD,MAAM,IAAI9B,aAAa,CACpB,qCAAoCqB,aAAc,GACrD,CAAC;EACH;EAEA,OAAOO,YAAY;AACrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["CBOR","b64utob64","getValidDcqlClaims","mapCredentialsToObj","credentialsMdoc","Promise","all","map","credential","issuerSigned","decodeIssuerSigned","namespaces","Object","entries","nameSpaces","reduce","acc","_ref","ns","nsClaims","flattenNsClaims","ac","_ref2","el","elementIdentifier","elementValue","credential_format","doctype","issuerAuth","payload","docType","cryptographic_holder_binding","original_credential","getClaimsFromDcqlMatch","match","flatMap","_ref3","output","_ref4","keys","claimName","namespace","name","value","getPresentationFrameFromClaims","requestedClaims","_ref5","existingNamespace"],"sourceRoot":"../../../../../src","sources":["credential/presentation/v1.3.3/utils.mdoc.ts"],"mappings":"AAAA,SAASA,IAAI,QAAQ,kCAAkC;AACvD,SAASC,SAAS,QAAQ,WAAW;AAOrC,SAASC,kBAAkB,QAAQ,sBAAsB;AAMzD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,MACjCC,eAAkC,IACM;EACxC,OAAO,MAAMC,OAAO,CAACC,GAAG,CACtBF,eAAe,CAACG,GAAG,CAAC,MAAOC,UAAU,IAAK;IACxC,MAAMC,YAAY,GAAG,MAAMT,IAAI,CAACU,kBAAkB,CAChDT,SAAS,CAACO,UAAU,CAAC,CAAC,CAAC,CACzB,CAAC;IAED,MAAMG,UAAU,GAAGC,MAAM,CAACC,OAAO,CAACJ,YAAY,CAACK,UAAU,CAAC,CAACC,MAAM,CAC/D,CAACC,GAAG,EAAAC,IAAA,KAAqB;MAAA,IAAnB,CAACC,EAAE,EAAEC,QAAQ,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A8B,GAAGA,CAC5CC,eAAsC,EACtCf,OAAe,MACQ;EACvB,CAACA,OAAO,GAAGe,eAAe,CAAC9B,MAAM,CAAC,CAACC,GAAG,EAAA8B,KAAA,KAA0B;IAAA,IAAxB;MAAEJ,IAAI;MAAED;IAAU,CAAC,GAAAK,KAAA;IACzD,IAAIL,SAAS,EAAE;MACbzB,GAAG,CAACyB,SAAS,CAAC,KAAK,CAAC,CAAC;MACrB,MAAMM,iBAAiB,GAAG/B,GAAG,CAACyB,SAAS,CAA4B;MACnEM,iBAAiB,CAACL,IAAI,CAAC,GAAG,IAAI;IAChC,CAAC,MAAM;MACL1B,GAAG,CAAC0B,IAAI,CAAC,GAAG,IAAI;IAClB;IACA,OAAO1B,GAAG;EACZ,CAAC,EAAE,CAAC,CAAsB;AAC5B,CAAC,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AuthorizationDetail } from "../../../utils/par";
|
|
2
|
-
import type { IssuerConfig } from "../api";
|
|
3
|
-
type ResponseMode = "query" | "form_post.jwt";
|
|
4
|
-
/**
|
|
5
|
-
* Ensures that the credential type requested is supported by the issuer and contained in the
|
|
6
|
-
* issuer configuration.
|
|
7
|
-
* @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
|
|
8
|
-
* @param credentialId The credential configuration ID to be requested;
|
|
9
|
-
* @returns The credential definition to be used in the request which includes the format and the type and its type
|
|
10
|
-
*/
|
|
11
|
-
export declare const selectCredentialDefinition: (issuerConf: IssuerConfig, credentialId: string) => AuthorizationDetail;
|
|
12
|
-
/**
|
|
13
|
-
* Ensures that the response mode requested is supported by the issuer and contained in the issuer configuration.
|
|
14
|
-
* When multiple credentials are provided, all of them must support the same response_mode.
|
|
15
|
-
* @param issuerConf The issuer configuration
|
|
16
|
-
* @param credentialIds The credential configuration IDs to be requested
|
|
17
|
-
* @returns The response mode to be used in the request, "query" for PersonIdentificationData and "form_post.jwt" for all other types.
|
|
18
|
-
*/
|
|
19
|
-
export declare const selectResponseMode: (issuerConf: IssuerConfig, credentialIds: string[]) => ResponseMode;
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=authorization.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../../../../src/credential/issuance/common/authorization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,KAAK,YAAY,GAAG,OAAO,GAAG,eAAe,CAAC;AAE9C;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACrC,YAAY,YAAY,EACxB,cAAc,MAAM,KACnB,mBAmBF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,YAAY,YAAY,EACxB,eAAe,MAAM,EAAE,KACtB,YAwCF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mdoc.d.ts","sourceRoot":"","sources":["../../../../../src/credential/presentation/v1.3.3/utils.mdoc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAChE,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,QAAQ,CAAC;AAGhB,KAAK,wBAAwB,GAAG,kBAAkB,GAAG;IACnD,mBAAmB,EAAE,eAAe,CAAC;CACtC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,iBAAiB,eAAe,EAAE,KACjC,OAAO,CAAC,wBAAwB,EAAE,CAkCpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,eAAe,CAAC,eAAe,KACrC,mBAAmB,EASnB,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,GACzC,iBAAiB,mBAAmB,EAAE,EACtC,SAAS,MAAM,KACd,iBAWD,CAAC"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { IoWalletError } from "../../../utils/errors";
|
|
2
|
-
import { LogLevel, Logger } from "../../../utils/logging";
|
|
3
|
-
import { AuthorizationDetail } from "../../../utils/par";
|
|
4
|
-
import type { IssuerConfig } from "../api";
|
|
5
|
-
|
|
6
|
-
type ResponseMode = "query" | "form_post.jwt";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Ensures that the credential type requested is supported by the issuer and contained in the
|
|
10
|
-
* issuer configuration.
|
|
11
|
-
* @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
|
|
12
|
-
* @param credentialId The credential configuration ID to be requested;
|
|
13
|
-
* @returns The credential definition to be used in the request which includes the format and the type and its type
|
|
14
|
-
*/
|
|
15
|
-
export const selectCredentialDefinition = (
|
|
16
|
-
issuerConf: IssuerConfig,
|
|
17
|
-
credentialId: string
|
|
18
|
-
): AuthorizationDetail => {
|
|
19
|
-
const credential_configurations_supported =
|
|
20
|
-
issuerConf.credential_configurations_supported;
|
|
21
|
-
|
|
22
|
-
const [result] = Object.keys(credential_configurations_supported)
|
|
23
|
-
.filter((e) => e.includes(credentialId))
|
|
24
|
-
.map(() => ({
|
|
25
|
-
credential_configuration_id: credentialId,
|
|
26
|
-
type: "openid_credential" as const,
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
if (!result) {
|
|
30
|
-
Logger.log(
|
|
31
|
-
LogLevel.ERROR,
|
|
32
|
-
`Requested credential ${credentialId} is not supported by the issuer according to its configuration ${JSON.stringify(credential_configurations_supported)}`
|
|
33
|
-
);
|
|
34
|
-
throw new IoWalletError(`No credential support the type '${credentialId}'`);
|
|
35
|
-
}
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Ensures that the response mode requested is supported by the issuer and contained in the issuer configuration.
|
|
41
|
-
* When multiple credentials are provided, all of them must support the same response_mode.
|
|
42
|
-
* @param issuerConf The issuer configuration
|
|
43
|
-
* @param credentialIds The credential configuration IDs to be requested
|
|
44
|
-
* @returns The response mode to be used in the request, "query" for PersonIdentificationData and "form_post.jwt" for all other types.
|
|
45
|
-
*/
|
|
46
|
-
export const selectResponseMode = (
|
|
47
|
-
issuerConf: IssuerConfig,
|
|
48
|
-
credentialIds: string[]
|
|
49
|
-
): ResponseMode => {
|
|
50
|
-
const responseModeSet = new Set<ResponseMode>();
|
|
51
|
-
|
|
52
|
-
for (const credentialId of credentialIds) {
|
|
53
|
-
responseModeSet.add(
|
|
54
|
-
credentialId.match(/PersonIdentificationData/i)
|
|
55
|
-
? "query"
|
|
56
|
-
: "form_post.jwt"
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (responseModeSet.size !== 1) {
|
|
61
|
-
Logger.log(
|
|
62
|
-
LogLevel.ERROR,
|
|
63
|
-
`${credentialIds} have incompatible response_mode: ${[...responseModeSet.values()]}`
|
|
64
|
-
);
|
|
65
|
-
throw new IoWalletError(
|
|
66
|
-
"Requested credentials have incompatible response_mode and cannot be requested with the same PAR request"
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const [responseMode] = responseModeSet.values();
|
|
71
|
-
|
|
72
|
-
Logger.log(
|
|
73
|
-
LogLevel.DEBUG,
|
|
74
|
-
`Selected response mode ${responseMode} for credential IDs ${credentialIds}`
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
const responseModeSupported = issuerConf.response_modes_supported;
|
|
78
|
-
if (responseModeSupported && !responseModeSupported.includes(responseMode!)) {
|
|
79
|
-
Logger.log(
|
|
80
|
-
LogLevel.ERROR,
|
|
81
|
-
`Requested response mode ${responseMode} is not supported by the issuer according to its configuration ${JSON.stringify(responseModeSupported)}`
|
|
82
|
-
);
|
|
83
|
-
throw new IoWalletError(
|
|
84
|
-
`No response mode support for IDs '${credentialIds}'`
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return responseMode!;
|
|
89
|
-
};
|