@pagopa/io-react-native-wallet 1.7.1 → 1.8.1
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/client/generated/wallet-provider.js +37 -11
- package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
- package/lib/commonjs/credential/issuance/02-get-issuer-config.js +69 -3
- package/lib/commonjs/credential/issuance/02-get-issuer-config.js.map +1 -1
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +5 -7
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +27 -10
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +50 -46
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/README.md +1 -1
- package/lib/commonjs/credential/issuance/const.js +1 -1
- package/lib/commonjs/credential/issuance/const.js.map +1 -1
- package/lib/commonjs/credential/issuance/index.js +6 -0
- package/lib/commonjs/credential/issuance/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/types.js +19 -10
- package/lib/commonjs/credential/issuance/types.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +10 -3
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +11 -4
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js +3 -3
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/entity/openid-connect/issuer/types.js +2 -2
- package/lib/commonjs/entity/openid-connect/issuer/types.js.map +1 -1
- package/lib/commonjs/entity/trust/types.js +19 -30
- package/lib/commonjs/entity/trust/types.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mdoc/index.js +3 -3
- package/lib/commonjs/mdoc/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/index.js +2 -2
- package/lib/commonjs/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +1 -1
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +3 -2
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +1 -1
- package/lib/commonjs/utils/misc.js +23 -1
- package/lib/commonjs/utils/misc.js.map +1 -1
- package/lib/commonjs/utils/pop.js +1 -1
- package/lib/commonjs/utils/pop.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/issuing.js +11 -7
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/types.js +14 -19
- package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
- package/lib/module/client/generated/wallet-provider.js +29 -7
- package/lib/module/client/generated/wallet-provider.js.map +1 -1
- package/lib/module/credential/issuance/02-get-issuer-config.js +66 -1
- package/lib/module/credential/issuance/02-get-issuer-config.js.map +1 -1
- package/lib/module/credential/issuance/03-start-user-authorization.js +5 -7
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +28 -11
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +50 -46
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/issuance/README.md +1 -1
- package/lib/module/credential/issuance/const.js +1 -1
- package/lib/module/credential/issuance/const.js.map +1 -1
- package/lib/module/credential/issuance/index.js +2 -2
- package/lib/module/credential/issuance/index.js.map +1 -1
- package/lib/module/credential/issuance/types.js +15 -8
- package/lib/module/credential/issuance/types.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js +10 -3
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +11 -4
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js +3 -3
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/entity/openid-connect/issuer/types.js +2 -2
- package/lib/module/entity/openid-connect/issuer/types.js.map +1 -1
- package/lib/module/entity/trust/types.js +19 -30
- package/lib/module/entity/trust/types.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mdoc/index.js +3 -3
- package/lib/module/mdoc/index.js.map +1 -1
- package/lib/module/sd-jwt/index.js +2 -2
- package/lib/module/sd-jwt/index.js.map +1 -1
- package/lib/module/sd-jwt/types.js +1 -1
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +3 -2
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +1 -1
- package/lib/module/utils/misc.js +20 -0
- package/lib/module/utils/misc.js.map +1 -1
- package/lib/module/utils/pop.js +1 -1
- package/lib/module/utils/pop.js.map +1 -1
- package/lib/module/wallet-instance-attestation/issuing.js +13 -9
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/wallet-instance-attestation/types.js +12 -17
- package/lib/module/wallet-instance-attestation/types.js.map +1 -1
- package/lib/typescript/client/generated/wallet-provider.d.ts +146 -17
- package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts +16 -1
- package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +7 -2
- 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/issuance/const.d.ts +1 -1
- package/lib/typescript/credential/issuance/const.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/index.d.ts +2 -2
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/types.d.ts +52 -21
- package/lib/typescript/credential/issuance/types.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 +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +4 -2
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
- package/lib/typescript/entity/openid-connect/issuer/types.d.ts +17 -17
- package/lib/typescript/entity/openid-connect/issuer/types.d.ts.map +1 -1
- package/lib/typescript/entity/trust/index.d.ts +150 -140
- package/lib/typescript/entity/trust/index.d.ts.map +1 -1
- package/lib/typescript/entity/trust/types.d.ts +540 -344
- package/lib/typescript/entity/trust/types.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/pid/sd-jwt/types.d.ts +2 -2
- package/lib/typescript/sd-jwt/index.d.ts +12 -12
- package/lib/typescript/sd-jwt/types.d.ts +14 -14
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts.map +1 -1
- package/lib/typescript/utils/misc.d.ts +8 -0
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +50 -102
- package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client/generated/wallet-provider.ts +39 -7
- package/src/credential/issuance/02-get-issuer-config.ts +98 -1
- package/src/credential/issuance/03-start-user-authorization.ts +7 -8
- package/src/credential/issuance/06-obtain-credential.ts +41 -14
- package/src/credential/issuance/07-verify-and-parse-credential.ts +7 -3
- package/src/credential/issuance/README.md +1 -1
- package/src/credential/issuance/const.ts +1 -0
- package/src/credential/issuance/index.ts +6 -1
- package/src/credential/issuance/types.ts +21 -8
- package/src/credential/presentation/07-evaluate-dcql-query.ts +15 -5
- package/src/credential/presentation/07-evaluate-input-descriptor.ts +21 -4
- package/src/credential/presentation/08-send-authorization-response.ts +3 -3
- package/src/credential/presentation/types.ts +3 -0
- package/src/entity/openid-connect/issuer/types.ts +2 -1
- package/src/entity/trust/types.ts +22 -20
- package/src/index.ts +2 -0
- package/src/mdoc/index.ts +3 -3
- package/src/sd-jwt/index.ts +2 -2
- package/src/sd-jwt/types.ts +1 -1
- package/src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts +3 -2
- package/src/utils/misc.ts +24 -0
- package/src/utils/pop.ts +1 -1
- package/src/wallet-instance-attestation/issuing.ts +14 -8
- package/src/wallet-instance-attestation/types.ts +16 -22
@@ -3,11 +3,16 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.WalletInstanceData = exports.WalletAttestationView = exports.SetWalletInstanceStatusBody = exports.RevocationReason = exports.ProblemDetail = exports.NonceDetailView = exports.EndpointByMethod = exports.CreateWalletInstanceBody = exports.CreateWalletAttestationBody = exports.ApiClient = void 0;
|
6
|
+
exports.WalletInstanceData = exports.WalletAttestationsView = exports.WalletAttestationView = exports.SetWalletInstanceStatusBody = exports.RevocationReason = exports.ProblemDetail = exports.NonceDetailView = exports.EndpointByMethod = exports.CreateWalletInstanceBody = exports.CreateWalletAttestationV2Body = exports.CreateWalletAttestationBody = exports.ApplicationInfo = exports.ApiClient = void 0;
|
7
7
|
exports.createApiClient = createApiClient;
|
8
|
-
exports.put_SetWalletInstanceStatus = exports.post_CreateWalletInstance = exports.post_CreateWalletAttestation = exports.get_GetWalletInstanceStatus = exports.get_GetNonce = void 0;
|
8
|
+
exports.put_SetWalletInstanceStatus = exports.post_CreateWalletInstance = exports.post_CreateWalletAttestationV2 = exports.post_CreateWalletAttestation = exports.get_GetWalletInstanceStatus = exports.get_GetNonce = void 0;
|
9
9
|
var _zod = _interopRequireDefault(require("zod"));
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
const ApplicationInfo = _zod.default.object({
|
12
|
+
name: _zod.default.string(),
|
13
|
+
version: _zod.default.string()
|
14
|
+
});
|
15
|
+
exports.ApplicationInfo = ApplicationInfo;
|
11
16
|
const NonceDetailView = _zod.default.object({
|
12
17
|
nonce: _zod.default.string()
|
13
18
|
});
|
@@ -16,6 +21,13 @@ const WalletAttestationView = _zod.default.object({
|
|
16
21
|
wallet_attestation: _zod.default.string()
|
17
22
|
});
|
18
23
|
exports.WalletAttestationView = WalletAttestationView;
|
24
|
+
const WalletAttestationsView = _zod.default.object({
|
25
|
+
wallet_attestations: _zod.default.array(_zod.default.object({
|
26
|
+
format: _zod.default.union([_zod.default.literal("jwt"), _zod.default.literal("dc+sd-jwt")]),
|
27
|
+
wallet_attestation: _zod.default.string()
|
28
|
+
}))
|
29
|
+
});
|
30
|
+
exports.WalletAttestationsView = WalletAttestationsView;
|
19
31
|
const CreateWalletInstanceBody = _zod.default.object({
|
20
32
|
challenge: _zod.default.string(),
|
21
33
|
key_attestation: _zod.default.string(),
|
@@ -27,14 +39,10 @@ const CreateWalletAttestationBody = _zod.default.object({
|
|
27
39
|
assertion: _zod.default.string()
|
28
40
|
});
|
29
41
|
exports.CreateWalletAttestationBody = CreateWalletAttestationBody;
|
30
|
-
const
|
31
|
-
|
32
|
-
title: _zod.default.string().optional(),
|
33
|
-
status: _zod.default.number().optional(),
|
34
|
-
detail: _zod.default.string().optional(),
|
35
|
-
instance: _zod.default.string().optional()
|
42
|
+
const CreateWalletAttestationV2Body = _zod.default.object({
|
43
|
+
assertion: _zod.default.string()
|
36
44
|
});
|
37
|
-
exports.
|
45
|
+
exports.CreateWalletAttestationV2Body = CreateWalletAttestationV2Body;
|
38
46
|
const SetWalletInstanceStatusBody = _zod.default.object({
|
39
47
|
status: _zod.default.literal("REVOKED")
|
40
48
|
});
|
@@ -47,6 +55,14 @@ const WalletInstanceData = _zod.default.object({
|
|
47
55
|
revocation_reason: _zod.default.union([RevocationReason, _zod.default.undefined()]).optional()
|
48
56
|
});
|
49
57
|
exports.WalletInstanceData = WalletInstanceData;
|
58
|
+
const ProblemDetail = _zod.default.object({
|
59
|
+
type: _zod.default.string().optional(),
|
60
|
+
title: _zod.default.string().optional(),
|
61
|
+
status: _zod.default.number().optional(),
|
62
|
+
detail: _zod.default.string().optional(),
|
63
|
+
instance: _zod.default.string().optional()
|
64
|
+
});
|
65
|
+
exports.ProblemDetail = ProblemDetail;
|
50
66
|
const get_GetNonce = {
|
51
67
|
method: _zod.default.literal("GET"),
|
52
68
|
path: _zod.default.literal("/nonce"),
|
@@ -94,9 +110,18 @@ const post_CreateWalletAttestation = {
|
|
94
110
|
}),
|
95
111
|
response: WalletAttestationView
|
96
112
|
};
|
113
|
+
exports.post_CreateWalletAttestation = post_CreateWalletAttestation;
|
114
|
+
const post_CreateWalletAttestationV2 = {
|
115
|
+
method: _zod.default.literal("POST"),
|
116
|
+
path: _zod.default.literal("/wallet-attestations"),
|
117
|
+
parameters: _zod.default.object({
|
118
|
+
body: CreateWalletAttestationV2Body
|
119
|
+
}),
|
120
|
+
response: WalletAttestationsView
|
121
|
+
};
|
97
122
|
|
98
123
|
// <EndpointByMethod>
|
99
|
-
exports.
|
124
|
+
exports.post_CreateWalletAttestationV2 = post_CreateWalletAttestationV2;
|
100
125
|
const EndpointByMethod = {
|
101
126
|
get: {
|
102
127
|
"/nonce": get_GetNonce,
|
@@ -104,7 +129,8 @@ const EndpointByMethod = {
|
|
104
129
|
},
|
105
130
|
post: {
|
106
131
|
"/wallet-instances": post_CreateWalletInstance,
|
107
|
-
"/token": post_CreateWalletAttestation
|
132
|
+
"/token": post_CreateWalletAttestation,
|
133
|
+
"/wallet-attestations": post_CreateWalletAttestationV2
|
108
134
|
},
|
109
135
|
put: {
|
110
136
|
"/wallet-instances/{id}/status": put_SetWalletInstanceStatus
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_zod","_interopRequireDefault","require","obj","__esModule","default","
|
1
|
+
{"version":3,"names":["_zod","_interopRequireDefault","require","obj","__esModule","default","ApplicationInfo","z","object","name","string","version","exports","NonceDetailView","nonce","WalletAttestationView","wallet_attestation","WalletAttestationsView","wallet_attestations","array","format","union","literal","CreateWalletInstanceBody","challenge","key_attestation","hardware_key_tag","CreateWalletAttestationBody","grant_type","assertion","CreateWalletAttestationV2Body","SetWalletInstanceStatusBody","status","RevocationReason","WalletInstanceData","id","is_revoked","boolean","revocation_reason","undefined","optional","ProblemDetail","type","title","number","detail","instance","get_GetNonce","method","path","parameters","never","response","post_CreateWalletInstance","body","unknown","get_GetWalletInstanceStatus","put_SetWalletInstanceStatus","post_CreateWalletAttestation","post_CreateWalletAttestationV2","EndpointByMethod","get","post","put","ApiClient","baseUrl","constructor","fetcher","setBaseUrl","arguments","length","createApiClient"],"sourceRoot":"../../../../src","sources":["client/generated/wallet-provider.ts"],"mappings":";;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoB,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGb,MAAMG,eAAe,GAAGC,YAAC,CAACC,MAAM,CAAC;EACtCC,IAAI,EAAEF,YAAC,CAACG,MAAM,CAAC,CAAC;EAChBC,OAAO,EAAEJ,YAAC,CAACG,MAAM,CAAC;AACpB,CAAC,CAAC;AAACE,OAAA,CAAAN,eAAA,GAAAA,eAAA;AA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10 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.getIssuerConfig = void 0;
|
6
|
+
exports.getIssuerConfigOIDFED = exports.getIssuerConfig = void 0;
|
7
|
+
var _misc = require("../../utils/misc");
|
7
8
|
var _issuer = require("../../entity/openid-connect/issuer");
|
9
|
+
var _ioReactNativeWallet = require("@pagopa/io-react-native-wallet");
|
8
10
|
/**
|
9
11
|
* Common configuration for the issuer.
|
10
12
|
* This is needed to have a common configuration for the issuer to be used in our flows.
|
@@ -13,6 +15,8 @@ var _issuer = require("../../entity/openid-connect/issuer");
|
|
13
15
|
|
14
16
|
/**
|
15
17
|
* WARNING: This function must be called after {@link startFlow}. The next function to be called is {@link startUserAuthorization}.
|
18
|
+
* WARNING: This function extracts the {@link IssuerConfig} from the OpenID Connect endpoint. For the OpenID Federation variant, use {@link getIssuerConfigOIDFED}.
|
19
|
+
* WARNING: The variants should not be used in conjunction.
|
16
20
|
* Get the Issuer's configuration from the Issuer's metadata.
|
17
21
|
* Currently it only supports a mixed configuration based on OpenID Connect partial implementation.
|
18
22
|
* @param issuerUrl The base url of the Issuer returned by {@link startFlow}
|
@@ -27,12 +31,31 @@ const getIssuerConfig = async function (issuerUrl) {
|
|
27
31
|
return credentialIssuerRationalization(res);
|
28
32
|
};
|
29
33
|
|
34
|
+
/**
|
35
|
+
* WARNING: This function must be called after {@link startFlow}. The next function to be called is {@link startUserAuthorization}.
|
36
|
+
* WARNING: This function extracts the {@link IssuerConfig} from the OpenID Federation EC. For the OpenID Connect variant, use {@link getIssuerConfig}.
|
37
|
+
* WARNING: The variants should not be used in conjunction.
|
38
|
+
* Get the Issuer's configuration from the Issuer's metadata fetched from the OpenID Federation system.
|
39
|
+
* Currently it only supports a mixed configuration based on OpenID Federation partial implementation.
|
40
|
+
* @param issuerUrl The base url of the Issuer returned by {@link startFlow}
|
41
|
+
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
42
|
+
* @returns The Issuer's configuration
|
43
|
+
*/
|
44
|
+
exports.getIssuerConfig = getIssuerConfig;
|
45
|
+
const getIssuerConfigOIDFED = async function (issuerUrl) {
|
46
|
+
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
47
|
+
const res = await (0, _ioReactNativeWallet.getCredentialIssuerEntityConfiguration)(issuerUrl, {
|
48
|
+
appFetch: context.appFetch
|
49
|
+
});
|
50
|
+
return credentialIssuerRationalizationOIDFED(res);
|
51
|
+
};
|
52
|
+
|
30
53
|
/**
|
31
54
|
* Rationalize the issuer's metadata to the issuer's configuration which is then used in our flows to interact with the issuer.
|
32
55
|
* @param issuerMetadata - The issuer's metadata
|
33
56
|
* @returns the isssuer configuration to be used later in our flows
|
34
57
|
*/
|
35
|
-
exports.
|
58
|
+
exports.getIssuerConfigOIDFED = getIssuerConfigOIDFED;
|
36
59
|
const credentialIssuerRationalization = issuerMetadata => {
|
37
60
|
return {
|
38
61
|
issuerConf: {
|
@@ -41,7 +64,50 @@ const credentialIssuerRationalization = issuerMetadata => {
|
|
41
64
|
authorization_endpoint: issuerMetadata.authorization_endpoint,
|
42
65
|
token_endpoint: issuerMetadata.token_endpoint,
|
43
66
|
credential_endpoint: issuerMetadata.credential_endpoint,
|
44
|
-
keys: issuerMetadata.jwks.keys
|
67
|
+
keys: issuerMetadata.jwks.keys,
|
68
|
+
issuer: issuerMetadata.authorization_endpoint
|
69
|
+
}
|
70
|
+
};
|
71
|
+
};
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Rationalize the issuer's metadata taken from OpenID Federation to the issuer's configuration which is then used in our flows to interact with the issuer.
|
75
|
+
* @param issuerMetadata - The issuer's metadata
|
76
|
+
* @returns the isssuer configuration to be used later in our flows
|
77
|
+
*/
|
78
|
+
const credentialIssuerRationalizationOIDFED = issuerMetadata => {
|
79
|
+
const adapted_credential_configurations_supported = Object.fromEntries(Object.entries(issuerMetadata.payload.metadata.openid_credential_issuer.credential_configurations_supported).map(_ref => {
|
80
|
+
let [key, config] = _ref;
|
81
|
+
const claimsRaw = config.claims;
|
82
|
+
const claims = Object.entries(claimsRaw).map(_ref2 => {
|
83
|
+
let [, v] = _ref2;
|
84
|
+
return {
|
85
|
+
path: v.path,
|
86
|
+
details: {
|
87
|
+
mandatory: v.mandatory,
|
88
|
+
display: v.display
|
89
|
+
}
|
90
|
+
};
|
91
|
+
}).reduce((cumulated, entry) => (0, _misc.pathInsert)(cumulated, entry.path, entry.details), {});
|
92
|
+
const newConfig = {
|
93
|
+
...config,
|
94
|
+
claims,
|
95
|
+
// cryptographic_suites_supported have been renamed credential_signing_alg_values_supported.
|
96
|
+
// We mantain it for Potential compatibility
|
97
|
+
cryptographic_suites_supported: config.credential_signing_alg_values_supported
|
98
|
+
};
|
99
|
+
return [key, newConfig];
|
100
|
+
}));
|
101
|
+
return {
|
102
|
+
issuerConf: {
|
103
|
+
credential_configurations_supported: adapted_credential_configurations_supported,
|
104
|
+
pushed_authorization_request_endpoint: issuerMetadata.payload.metadata.oauth_authorization_server.pushed_authorization_request_endpoint,
|
105
|
+
authorization_endpoint: issuerMetadata.payload.metadata.oauth_authorization_server.authorization_endpoint,
|
106
|
+
token_endpoint: issuerMetadata.payload.metadata.oauth_authorization_server.token_endpoint,
|
107
|
+
credential_endpoint: issuerMetadata.payload.metadata.openid_credential_issuer.credential_endpoint,
|
108
|
+
keys: issuerMetadata.payload.metadata.openid_credential_issuer.jwks.keys,
|
109
|
+
issuer: issuerMetadata.payload.metadata.oauth_authorization_server.issuer,
|
110
|
+
nonce_endpoint: issuerMetadata.payload.metadata.openid_credential_issuer.nonce_endpoint
|
45
111
|
}
|
46
112
|
};
|
47
113
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_misc","require","_issuer","_ioReactNativeWallet","getIssuerConfig","issuerUrl","context","arguments","length","undefined","res","getCredentialIssuerMetadata","appFetch","credentialIssuerRationalization","exports","getIssuerConfigOIDFED","getCredentialIssuerEntityConfiguration","credentialIssuerRationalizationOIDFED","issuerMetadata","issuerConf","credential_configurations_supported","pushed_authorization_request_endpoint","authorization_endpoint","token_endpoint","credential_endpoint","keys","jwks","issuer","adapted_credential_configurations_supported","Object","fromEntries","entries","payload","metadata","openid_credential_issuer","map","_ref","key","config","claimsRaw","claims","_ref2","v","path","details","mandatory","display","reduce","cumulated","entry","pathInsert","newConfig","cryptographic_suites_supported","credential_signing_alg_values_supported","oauth_authorization_server","nonce_endpoint"],"sourceRoot":"../../../../src","sources":["credential/issuance/02-get-issuer-config.ts"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,oBAAA,GAAAF,OAAA;AASA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,eAAgC,GAAG,eAAAA,CAC9CC,SAAS,EAEuB;EAAA,IADhCC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEZ,MAAMG,GAAG,GAAG,MAAM,IAAAC,mCAA2B,EAACN,SAAS,EAAE;IACvDO,QAAQ,EAAEN,OAAO,CAACM;EACpB,CAAC,CAAC;EAEF,OAAOC,+BAA+B,CAACH,GAAG,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATAI,OAAA,CAAAV,eAAA,GAAAA,eAAA;AAUO,MAAMW,qBAAsC,GAAG,eAAAA,CACpDV,SAAS,EAEuB;EAAA,IADhCC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEZ,MAAMG,GAAG,GAAG,MAAM,IAAAM,2DAAsC,EAACX,SAAS,EAAE;IAClEO,QAAQ,EAAEN,OAAO,CAACM;EACpB,CAAC,CAAC;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ACF,SAAS,EAAEC,KAAK,CAACN,IAAI,EAAEM,KAAK,CAACL,OAAO,CAAC,EAClD,CAAC,CACH,CAAC;IAEL,MAAMO,SAAmD,GAAG;MAC1D,GAAGb,MAAM;MACTE,MAAM;MACN;MACA;MACAY,8BAA8B,EAC5Bd,MAAM,CAACe;IACX,CAAC;IAED,OAAO,CAAChB,GAAG,EAAEc,SAAS,CAAC;EACzB,CAAC,CACH,CAAC;EAEH,OAAO;IACLhC,UAAU,EAAE;MACVC,mCAAmC,EACjCQ,2CAA2C;MAC7CP,qCAAqC,EACnCH,cAAc,CAACc,OAAO,CAACC,QAAQ,CAACqB,0BAA0B,CACvDjC,qCAAqC;MAC1CC,sBAAsB,EACpBJ,cAAc,CAACc,OAAO,CAACC,QAAQ,CAACqB,0BAA0B,CACvDhC,sBAAsB;MAC3BC,cAAc,EACZL,cAAc,CAACc,OAAO,CAACC,QAAQ,CAACqB,0BAA0B,CACvD/B,cAAc;MACnBC,mBAAmB,EACjBN,cAAc,CAACc,OAAO,CAACC,QAAQ,CAACC,wBAAwB,CACrDV,mBAAmB;MACxBC,IAAI,EAAEP,cAAc,CAACc,OAAO,CAACC,QAAQ,CAACC,wBAAwB,CAACR,IAAI,CAACD,IAAI;MACxEE,MAAM,EAAET,cAAc,CAACc,OAAO,CAACC,QAAQ,CAACqB,0BAA0B,CAAC3B,MAAM;MACzE4B,cAAc,EACZrC,cAAc,CAACc,OAAO,CAACC,QAAQ,CAACC,wBAAwB,CAACqB;IAC7D;EACF,CAAC;AACH,CAAC"}
|
@@ -19,15 +19,13 @@ var _par = require("../../utils/par");
|
|
19
19
|
*/
|
20
20
|
const selectCredentialDefinition = (issuerConf, credentialType) => {
|
21
21
|
const credential_configurations_supported = issuerConf.credential_configurations_supported;
|
22
|
-
const
|
23
|
-
if (!credential) {
|
24
|
-
throw new Error(`No credential support the type '${credentialType}'`);
|
25
|
-
}
|
26
|
-
const result = {
|
22
|
+
const [result] = Object.keys(credential_configurations_supported).filter(e => e.includes(credentialType)).map(() => ({
|
27
23
|
credential_configuration_id: credentialType,
|
28
|
-
format: credential.format,
|
29
24
|
type: "openid_credential"
|
30
|
-
};
|
25
|
+
}));
|
26
|
+
if (!result) {
|
27
|
+
throw new Error(`No credential support the type '${credentialType}'`);
|
28
|
+
}
|
31
29
|
return result;
|
32
30
|
};
|
33
31
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_misc","require","_par","selectCredentialDefinition","issuerConf","credentialType","credential_configurations_supported","
|
1
|
+
{"version":3,"names":["_misc","require","_par","selectCredentialDefinition","issuerConf","credentialType","credential_configurations_supported","result","Object","keys","filter","e","includes","map","credential_configuration_id","type","Error","selectResponseMode","responseMode","startUserAuthorization","ctx","wiaCryptoContext","walletInstanceAttestation","redirectUri","appFetch","fetch","clientId","getPublicKey","then","_","kid","codeVerifier","generateRandomAlphaNumericString","parEndpoint","pushed_authorization_request_endpoint","credentialDefinition","getPar","makeParRequest","issuerRequestUri","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-user-authorization.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,0BAA0B,GAAGA,CACjCC,UAA8C,EAC9CC,cAAgD,KACxB;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,cAAc,CAAC,CAAC,CACzCQ,GAAG,CAAC,OAAO;IACVC,2BAA2B,EAAET,cAAc;IAC3CU,IAAI,EAAE;EACR,CAAC,CAAC,CAAC;EAEL,IAAI,CAACR,MAAM,EAAE;IACX,MAAM,IAAIS,KAAK,CAAE,mCAAkCX,cAAe,GAAE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;AAC3E,CAAC;AAACI,OAAA,CAAApB,sBAAA,GAAAA,sBAAA"}
|
@@ -45,14 +45,33 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
|
|
45
45
|
dPopCryptoContext
|
46
46
|
} = context;
|
47
47
|
const credentialUrl = issuerConf.credential_endpoint;
|
48
|
+
const issuerUrl = issuerConf.issuer;
|
49
|
+
const nonceUrl = issuerConf.nonce_endpoint;
|
50
|
+
|
51
|
+
// Fetch the nonce from the Credential Issuer
|
52
|
+
const {
|
53
|
+
c_nonce
|
54
|
+
} = nonceUrl ? await appFetch(nonceUrl, {
|
55
|
+
method: "POST",
|
56
|
+
headers: {
|
57
|
+
"Content-Type": "application/json"
|
58
|
+
}
|
59
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(body => _types.NonceResponse.parse(body)) : accessToken;
|
60
|
+
if (!c_nonce) {
|
61
|
+
throw new _errors.ValidationFailed({
|
62
|
+
message: "Nonce Endpoint not found or access token does not contain the c_nonce"
|
63
|
+
});
|
64
|
+
}
|
48
65
|
|
49
66
|
/**
|
50
67
|
* JWT proof token to bind the request nonce to the key that will bind the holder User with the Credential
|
51
68
|
* This is presented along with the access token to the Credential Endpoint as proof of possession of the private key used to sign the Access Token.
|
52
69
|
* @see https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#name-proof-types
|
53
70
|
*/
|
54
|
-
const signedNonceProof = await createNonceProof(
|
55
|
-
|
71
|
+
const signedNonceProof = await createNonceProof(c_nonce, clientId, issuerUrl, credentialCryptoContext);
|
72
|
+
|
73
|
+
// Validation of accessTokenResponse.authorization_details if contain credentialDefinition
|
74
|
+
const containsCredentialDefinition = accessToken.authorization_details.some(c => c.credential_configuration_id === credentialDefinition.credential_configuration_id && (credentialDefinition.credential_identifier ? c.credential_identifiers.includes(credentialDefinition.credential_identifier) : true));
|
56
75
|
if (!containsCredentialDefinition) {
|
57
76
|
throw new _errors.ValidationFailed({
|
58
77
|
message: "The access token response does not contain the requested credential"
|
@@ -73,12 +92,7 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
|
|
73
92
|
|
74
93
|
/** The credential request body */
|
75
94
|
const credentialRequestFormBody = {
|
76
|
-
|
77
|
-
doctype: credentialDefinition.credential_configuration_id
|
78
|
-
} : {
|
79
|
-
vct: credentialDefinition.credential_configuration_id
|
80
|
-
}),
|
81
|
-
format,
|
95
|
+
credential_identifier: credentialDefinition.credential_configuration_id,
|
82
96
|
proof: {
|
83
97
|
jwt: signedNonceProof,
|
84
98
|
proof_type: "jwt"
|
@@ -106,8 +120,11 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
|
|
106
120
|
});
|
107
121
|
}
|
108
122
|
|
109
|
-
|
110
|
-
return
|
123
|
+
// We support only one credential for now
|
124
|
+
return {
|
125
|
+
format,
|
126
|
+
...credentialRes.data.credentials.at(0)
|
127
|
+
};
|
111
128
|
};
|
112
129
|
|
113
130
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_misc","_errors","_types","_dpop","_reactNativeUuid","_interopRequireDefault","obj","__esModule","default","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","exports","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","context","credentialCryptoContext","appFetch","fetch","dPopCryptoContext","credentialUrl","credential_endpoint","
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_misc","_errors","_types","_dpop","_reactNativeUuid","_interopRequireDefault","obj","__esModule","default","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","exports","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","context","credentialCryptoContext","appFetch","fetch","dPopCryptoContext","credentialUrl","credential_endpoint","issuerUrl","nonceUrl","nonce_endpoint","c_nonce","method","headers","then","hasStatusOrThrow","res","json","body","NonceResponse","parse","ValidationFailed","message","signedNonceProof","containsCredentialDefinition","authorization_details","some","c","credential_configuration_id","credential_identifier","credential_identifiers","includes","credential","credential_configurations_supported","format","credentialRequestFormBody","proof","jwt","proof_type","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuid","v4","ath","sha256ToBase64","access_token","credentialRes","DPoP","Authorization","token_type","JSON","stringify","CredentialResponse","safeParse","catch","handleObtainCredentialError","success","reason","error","data","credentials","at","e","UnexpectedStatusCodeError","ResponseErrorBuilder","IssuerResponseError","handle","code","IssuerResponseErrorCodes","CredentialRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAC,sBAAA,CAAAN,OAAA;AAAqC,SAAAM,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAiB9B,MAAMG,gBAAgB,GAAG,MAAAA,CAC9BC,KAAa,EACbC,MAAc,EACdC,QAAgB,EAChBC,GAAkB,KACE;EACpB,MAAMC,GAAG,GAAG,MAAMD,GAAG,CAACE,YAAY,CAAC,CAAC;EACpC,OAAO,IAAIC,yBAAO,CAACH,GAAG,CAAC,CACpBI,UAAU,CAAC;IACVP;EACF,CAAC,CAAC,CACDQ,kBAAkB,CAAC;IAClBC,GAAG,EAAE,sBAAsB;IAC3BL;EACF,CAAC,CAAC,CACDM,WAAW,CAACR,QAAQ,CAAC,CACrBS,SAAS,CAACV,MAAM,CAAC,CACjBW,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,MAAM,CAAC,CACzBC,IAAI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AErD,WAAW,CAACsD,UAAW,IAAGtD,WAAW,CAACkD,YAAa;IACvE,CAAC;IACD9B,IAAI,EAAEmC,IAAI,CAACC,SAAS,CAACnB,yBAAyB;EAChD,CAAC,CAAC,CACCrB,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,CAAC,CAAC,CAC3BD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAAEI,IAAI,IAAKqC,yBAAkB,CAACC,SAAS,CAACtC,IAAI,CAAC,CAAC,CAClDuC,KAAK,CAACC,2BAA2B,CAAC;EAErC,IAAI,CAACT,aAAa,CAACU,OAAO,EAAE;IAC1B,MAAM,IAAItC,wBAAgB,CAAC;MACzBC,OAAO,EAAE,uCAAuC;MAChDsC,MAAM,EAAEX,aAAa,CAACY,KAAK,CAACvC;IAC9B,CAAC,CAAC;EACJ;;EAEA;EACA,OAAO;IACLY,MAAM;IACN,GAAGe,aAAa,CAACa,IAAI,CAACC,WAAW,CAACC,EAAE,CAAC,CAAC;EACxC,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALArE,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AAMA,MAAM8D,2BAA2B,GAAIO,CAAU,IAAK;EAClD,IAAI,EAAEA,CAAC,YAAYC,iCAAyB,CAAC,EAAE;IAC7C,MAAMD,CAAC;EACT;EAEA,MAAM,IAAIE,4BAAoB,CAACC,2BAAmB,CAAC,CAChDC,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,gCAAwB,CAACC,uBAAuB;IACtDlD,OAAO,EAAE;EACX,CAAC,CAAC,CACDmD,SAAS,CAACR,CAAC,CAAC;AACjB,CAAC"}
|
@@ -16,13 +16,17 @@ var _converters2 = require("../../mdoc/converters");
|
|
16
16
|
|
17
17
|
//Exported for testing purposes
|
18
18
|
const parseCredentialSdJwt = function (credentials_supported, _ref) {
|
19
|
+
var _Object$entries$find;
|
19
20
|
let {
|
20
21
|
sdJwt,
|
21
22
|
disclosures
|
22
23
|
} = _ref;
|
23
24
|
let ignoreMissingAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
24
25
|
let includeUndefinedAttributes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
25
|
-
const credentialSubject = credentials_supported
|
26
|
+
const credentialSubject = (_Object$entries$find = Object.entries(credentials_supported).find(_ref2 => {
|
27
|
+
let [, vl] = _ref2;
|
28
|
+
return vl.vct === sdJwt.payload.vct;
|
29
|
+
})) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[1];
|
26
30
|
if (!credentialSubject) {
|
27
31
|
throw new _errors.IoWalletError("Credential type not supported by the issuer");
|
28
32
|
}
|
@@ -39,10 +43,10 @@ const parseCredentialSdJwt = function (credentials_supported, _ref) {
|
|
39
43
|
const attrDefinitions = Object.entries(claims);
|
40
44
|
|
41
45
|
// the key of the attribute defintion must match the disclosure's name
|
42
|
-
const attrsNotInDisclosures = attrDefinitions.filter(
|
43
|
-
let [attrKey, definition] =
|
44
|
-
return !disclosures.some(
|
45
|
-
let [, name] =
|
46
|
+
const attrsNotInDisclosures = attrDefinitions.filter(_ref3 => {
|
47
|
+
let [attrKey, definition] = _ref3;
|
48
|
+
return !disclosures.some(_ref4 => {
|
49
|
+
let [, name] = _ref4;
|
46
50
|
return name === attrKey;
|
47
51
|
}) && definition.mandatory;
|
48
52
|
});
|
@@ -58,33 +62,33 @@ const parseCredentialSdJwt = function (credentials_supported, _ref) {
|
|
58
62
|
// and are present in the disclosure set
|
59
63
|
const definedValues = Object.fromEntries(attrDefinitions
|
60
64
|
// retrieve the value from the disclosure set
|
61
|
-
.map(
|
65
|
+
.map(_ref5 => {
|
62
66
|
var _disclosures$find;
|
63
|
-
let [attrKey, definition] =
|
67
|
+
let [attrKey, definition] = _ref5;
|
64
68
|
return [attrKey, {
|
65
69
|
...definition,
|
66
70
|
value: (_disclosures$find = disclosures.find(_ => _[1 /* name */] === attrKey)) === null || _disclosures$find === void 0 ? void 0 : _disclosures$find[2 /* value */]
|
67
71
|
}];
|
68
72
|
})
|
69
73
|
//filter the not found elements
|
70
|
-
.filter(
|
71
|
-
let [_, definition] =
|
74
|
+
.filter(_ref6 => {
|
75
|
+
let [_, definition] = _ref6;
|
72
76
|
return definition.value !== undefined;
|
73
77
|
})
|
74
78
|
// add a human readable attribute name, with i18n, in the form { locale: name }
|
75
79
|
// example: { "it-IT": "Nome", "en-EN": "Name", "es-ES": "Nombre" }
|
76
|
-
.map(
|
80
|
+
.map(_ref7 => {
|
77
81
|
let [attrKey, {
|
78
82
|
display,
|
79
83
|
...definition
|
80
|
-
}] =
|
84
|
+
}] = _ref7;
|
81
85
|
return [attrKey, {
|
82
86
|
...definition,
|
83
|
-
name: display.reduce((names,
|
87
|
+
name: display.reduce((names, _ref8) => {
|
84
88
|
let {
|
85
89
|
locale,
|
86
90
|
name
|
87
|
-
} =
|
91
|
+
} = _ref8;
|
88
92
|
return {
|
89
93
|
...names,
|
90
94
|
[locale]: name
|
@@ -95,8 +99,8 @@ const parseCredentialSdJwt = function (credentials_supported, _ref) {
|
|
95
99
|
if (includeUndefinedAttributes) {
|
96
100
|
// attributes that are in the disclosure set
|
97
101
|
// but are not defined in the issuer configuration
|
98
|
-
const undefinedValues = Object.fromEntries(disclosures.filter(_ => !Object.keys(definedValues).includes(_[1])).map(
|
99
|
-
let [, key, value] =
|
102
|
+
const undefinedValues = Object.fromEntries(disclosures.filter(_ => !Object.keys(definedValues).includes(_[1])).map(_ref9 => {
|
103
|
+
let [, key, value] = _ref9;
|
100
104
|
return [key, {
|
101
105
|
value,
|
102
106
|
name: key
|
@@ -112,10 +116,10 @@ const parseCredentialSdJwt = function (credentials_supported, _ref) {
|
|
112
116
|
|
113
117
|
//Exported for testing purposes
|
114
118
|
exports.parseCredentialSdJwt = parseCredentialSdJwt;
|
115
|
-
const parseCredentialMDoc = function (credentials_supported, credential_type,
|
119
|
+
const parseCredentialMDoc = function (credentials_supported, credential_type, _ref10) {
|
116
120
|
let {
|
117
121
|
issuerSigned
|
118
|
-
} =
|
122
|
+
} = _ref10;
|
119
123
|
let ignoreMissingAttributes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
120
124
|
let includeUndefinedAttributes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
121
125
|
const credentialSubject = credentials_supported[credential_type];
|
@@ -129,27 +133,27 @@ const parseCredentialMDoc = function (credentials_supported, credential_type, _r
|
|
129
133
|
}
|
130
134
|
|
131
135
|
const claims = credentialSubject.claims;
|
132
|
-
const attrDefinitions = Object.entries(claims).flatMap(
|
133
|
-
let [namespace, claimName] =
|
134
|
-
return Object.entries(claimName).map(
|
135
|
-
let [claimNameKey, definition] =
|
136
|
+
const attrDefinitions = Object.entries(claims).flatMap(_ref11 => {
|
137
|
+
let [namespace, claimName] = _ref11;
|
138
|
+
return Object.entries(claimName).map(_ref12 => {
|
139
|
+
let [claimNameKey, definition] = _ref12;
|
136
140
|
return [namespace, claimNameKey, definition];
|
137
141
|
});
|
138
142
|
});
|
139
143
|
if (!issuerSigned.nameSpaces) {
|
140
144
|
throw new _errors.IoWalletError("Missing claims in the credential");
|
141
145
|
}
|
142
|
-
const flatNamespaces = Object.entries(issuerSigned.nameSpaces).flatMap(
|
143
|
-
let [namespace, values] =
|
146
|
+
const flatNamespaces = Object.entries(issuerSigned.nameSpaces).flatMap(_ref13 => {
|
147
|
+
let [namespace, values] = _ref13;
|
144
148
|
return values.map(v => [namespace, v.elementIdentifier, v.elementValue]);
|
145
149
|
});
|
146
150
|
|
147
151
|
// Check that all mandatory attributes defined in the issuer configuration are present in the disclosure set
|
148
152
|
// and filter the non present ones
|
149
|
-
const attrsNotInDisclosures = attrDefinitions.filter(
|
150
|
-
let [attrDefNamespace, attrKey, definition] =
|
151
|
-
const isClaimPresent = flatNamespaces.find(
|
152
|
-
let [namespace, name] =
|
153
|
+
const attrsNotInDisclosures = attrDefinitions.filter(_ref14 => {
|
154
|
+
let [attrDefNamespace, attrKey, definition] = _ref14;
|
155
|
+
const isClaimPresent = flatNamespaces.find(_ref15 => {
|
156
|
+
let [namespace, name] = _ref15;
|
153
157
|
return attrDefNamespace === namespace && name === attrKey;
|
154
158
|
});
|
155
159
|
return isClaimPresent === undefined && definition.mandatory;
|
@@ -165,36 +169,36 @@ const parseCredentialMDoc = function (credentials_supported, credential_type, _r
|
|
165
169
|
// Attributes defined in the issuer configuration and present in the disclosure set
|
166
170
|
const definedValues = Object.fromEntries(attrDefinitions
|
167
171
|
// Retrieve the value from the corresponding disclosure
|
168
|
-
.map(
|
172
|
+
.map(_ref16 => {
|
169
173
|
var _flatNamespaces$find;
|
170
|
-
let [attrDefNamespace, attrKey, definition] =
|
174
|
+
let [attrDefNamespace, attrKey, definition] = _ref16;
|
171
175
|
return [attrKey, {
|
172
176
|
...definition,
|
173
|
-
value: (_flatNamespaces$find = flatNamespaces.find(
|
174
|
-
let [namespace, name] =
|
177
|
+
value: (_flatNamespaces$find = flatNamespaces.find(_ref17 => {
|
178
|
+
let [namespace, name] = _ref17;
|
175
179
|
return attrDefNamespace === namespace && name === attrKey;
|
176
180
|
})) === null || _flatNamespaces$find === void 0 ? void 0 : _flatNamespaces$find[2]
|
177
181
|
}];
|
178
182
|
})
|
179
183
|
//filter the not found elements
|
180
|
-
.filter(
|
181
|
-
let [_, definition] =
|
184
|
+
.filter(_ref18 => {
|
185
|
+
let [_, definition] = _ref18;
|
182
186
|
return definition.value !== undefined;
|
183
187
|
})
|
184
188
|
// Add a human-readable attribute name, with i18n, in the form { locale: name }
|
185
189
|
// Example: { "it-IT": "Nome", "en-EN": "Name", "es-ES": "Nombre" }
|
186
|
-
.map(
|
190
|
+
.map(_ref19 => {
|
187
191
|
let [attrKey, {
|
188
192
|
display,
|
189
193
|
...definition
|
190
|
-
}] =
|
194
|
+
}] = _ref19;
|
191
195
|
return [attrKey, {
|
192
196
|
...definition,
|
193
|
-
name: display.reduce((names,
|
197
|
+
name: display.reduce((names, _ref20) => {
|
194
198
|
let {
|
195
199
|
locale,
|
196
200
|
name
|
197
|
-
} =
|
201
|
+
} = _ref20;
|
198
202
|
return {
|
199
203
|
...names,
|
200
204
|
[locale]: name
|
@@ -204,11 +208,11 @@ const parseCredentialMDoc = function (credentials_supported, credential_type, _r
|
|
204
208
|
}));
|
205
209
|
if (includeUndefinedAttributes) {
|
206
210
|
// Attributes that are present in the disclosure set but not defined in the issuer configuration
|
207
|
-
const undefinedValues = Object.fromEntries(flatNamespaces.filter(
|
208
|
-
let [, key] =
|
211
|
+
const undefinedValues = Object.fromEntries(flatNamespaces.filter(_ref21 => {
|
212
|
+
let [, key] = _ref21;
|
209
213
|
return !Object.keys(definedValues).includes(key);
|
210
|
-
}).map(
|
211
|
-
let [, key, value] =
|
214
|
+
}).map(_ref22 => {
|
215
|
+
let [, key, value] = _ref22;
|
212
216
|
return [key, {
|
213
217
|
value,
|
214
218
|
name: key
|
@@ -297,12 +301,12 @@ async function verifyCredentialMDoc(rawCredential, issuerKeys, holderBindingCont
|
|
297
301
|
|
298
302
|
// utility type that specialize VerifyAndParseCredential for given format
|
299
303
|
|
300
|
-
const verifyAndParseCredentialSdJwt = async (issuerConf, credential, _, __,
|
304
|
+
const verifyAndParseCredentialSdJwt = async (issuerConf, credential, _, __, _ref23) => {
|
301
305
|
let {
|
302
306
|
credentialCryptoContext,
|
303
307
|
ignoreMissingAttributes,
|
304
308
|
includeUndefinedAttributes
|
305
|
-
} =
|
309
|
+
} = _ref23;
|
306
310
|
const decoded = await verifyCredentialSdJwt(credential, issuerConf.keys, credentialCryptoContext);
|
307
311
|
const parsedCredential = parseCredentialSdJwt(issuerConf.credential_configurations_supported, decoded, ignoreMissingAttributes, includeUndefinedAttributes);
|
308
312
|
const maybeIssuedAt = (0, _converters.getValueFromDisclosures)(decoded.disclosures, "iat");
|
@@ -312,12 +316,12 @@ const verifyAndParseCredentialSdJwt = async (issuerConf, credential, _, __, _ref
|
|
312
316
|
issuedAt: typeof maybeIssuedAt === "number" ? new Date(maybeIssuedAt * 1000) : undefined
|
313
317
|
};
|
314
318
|
};
|
315
|
-
const verifyAndParseCredentialMDoc = async (issuerConf, credential, _, credentialType,
|
319
|
+
const verifyAndParseCredentialMDoc = async (issuerConf, credential, _, credentialType, _ref24) => {
|
316
320
|
var _parsedCredential$exp, _parsedCredential$iss;
|
317
321
|
let {
|
318
322
|
credentialCryptoContext,
|
319
323
|
ignoreMissingAttributes
|
320
|
-
} =
|
324
|
+
} = _ref24;
|
321
325
|
const decoded = await verifyCredentialMDoc(credential, issuerConf.keys, credentialCryptoContext);
|
322
326
|
const parsedCredential = parseCredentialMDoc(issuerConf.credential_configurations_supported, credentialType, decoded, undefined, ignoreMissingAttributes);
|
323
327
|
const expirationDate = (0, _converters2.extractElementValueAsDate)(parsedCredential === null || parsedCredential === void 0 || (_parsedCredential$exp = parsedCredential.expiry_date) === null || _parsedCredential$exp === void 0 ? void 0 : _parsedCredential$exp.value);
|
@@ -348,7 +352,7 @@ const verifyAndParseCredentialMDoc = async (issuerConf, credential, _, credentia
|
|
348
352
|
* @throws {IoWalletError} If the credential data fail to parse
|
349
353
|
*/
|
350
354
|
const verifyAndParseCredential = async (issuerConf, credential, format, credentialType, context) => {
|
351
|
-
if (format === "vc+sd-jwt") {
|
355
|
+
if (format === "vc+sd-jwt" || format === "dc+sd-jwt") {
|
352
356
|
return verifyAndParseCredentialSdJwt(issuerConf, credential, format, credentialType, context);
|
353
357
|
}
|
354
358
|
if (format === "mso_mdoc") {
|