@pagopa/io-react-native-wallet 2.0.0-next.2 → 2.0.0-next.4
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/03-start-user-authorization.js +38 -24
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +75 -57
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +6 -10
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +43 -11
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +51 -48
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/README.md +77 -45
- package/lib/commonjs/credential/issuance/const.js +1 -1
- package/lib/commonjs/credential/issuance/types.js +17 -10
- package/lib/commonjs/credential/issuance/types.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +6 -13
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +10 -11
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js +1 -1
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/credential/status/README.md +0 -1
- package/lib/commonjs/sd-jwt/__test__/index.test.js +11 -15
- package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/types.test.js +5 -2
- package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/utils.test.js +37 -0
- package/lib/commonjs/sd-jwt/__test__/utils.test.js.map +1 -0
- package/lib/commonjs/sd-jwt/index.js +26 -1
- package/lib/commonjs/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +71 -8
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/sd-jwt/utils.js +64 -0
- package/lib/commonjs/sd-jwt/utils.js.map +1 -0
- package/lib/commonjs/trust/types.js +18 -13
- package/lib/commonjs/trust/types.js.map +1 -1
- package/lib/commonjs/utils/par.js +32 -22
- package/lib/commonjs/utils/par.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/types.js +4 -1
- package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
- package/lib/module/credential/issuance/03-start-user-authorization.js +38 -24
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +76 -58
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +6 -10
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +44 -12
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +51 -48
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/issuance/README.md +77 -45
- package/lib/module/credential/issuance/const.js +1 -1
- package/lib/module/credential/issuance/types.js +13 -8
- package/lib/module/credential/issuance/types.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js +6 -13
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +10 -11
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/module/credential/presentation/types.js +1 -1
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/credential/status/README.md +0 -1
- package/lib/module/sd-jwt/__test__/index.test.js +11 -16
- package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/types.test.js +5 -2
- package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/utils.test.js +35 -0
- package/lib/module/sd-jwt/__test__/utils.test.js.map +1 -0
- package/lib/module/sd-jwt/index.js +7 -1
- package/lib/module/sd-jwt/index.js.map +1 -1
- package/lib/module/sd-jwt/types.js +70 -7
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/sd-jwt/utils.js +57 -0
- package/lib/module/sd-jwt/utils.js.map +1 -0
- package/lib/module/trust/types.js +18 -13
- package/lib/module/trust/types.js.map +1 -1
- package/lib/module/utils/par.js +29 -20
- package/lib/module/utils/par.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/types.js +4 -1
- package/lib/module/wallet-instance-attestation/types.js.map +1 -1
- package/lib/typescript/client/generated/wallet-provider.d.ts +12 -12
- package/lib/typescript/credential/issuance/01-start-flow.d.ts +2 -2
- package/lib/typescript/credential/issuance/01-start-flow.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +7 -6
- 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 +7 -14
- 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 +10 -5
- 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 +3 -2
- 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/types.d.ts +49 -26
- package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/01-start-flow.d.ts +2 -2
- package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +4 -3
- 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 +9 -5
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +3 -4
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
- package/lib/typescript/credential/status/types.d.ts +4 -4
- package/lib/typescript/pid/sd-jwt/types.d.ts +7 -7
- package/lib/typescript/sd-jwt/__test__/utils.test.d.ts +2 -0
- package/lib/typescript/sd-jwt/__test__/utils.test.d.ts.map +1 -0
- package/lib/typescript/sd-jwt/index.d.ts +69 -28
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +264 -31
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/utils.d.ts +18 -0
- package/lib/typescript/sd-jwt/utils.d.ts.map +1 -0
- package/lib/typescript/trust/build-chain.d.ts +30 -14
- package/lib/typescript/trust/build-chain.d.ts.map +1 -1
- package/lib/typescript/trust/types.d.ts +322 -158
- package/lib/typescript/trust/types.d.ts.map +1 -1
- package/lib/typescript/utils/par.d.ts +29 -13
- package/lib/typescript/utils/par.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +9 -9
- package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/credential/issuance/01-start-flow.ts +2 -2
- package/src/credential/issuance/03-start-user-authorization.ts +57 -38
- package/src/credential/issuance/04-complete-user-authorization.ts +79 -85
- package/src/credential/issuance/05-authorize-access.ts +5 -11
- package/src/credential/issuance/06-obtain-credential.ts +56 -23
- package/src/credential/issuance/07-verify-and-parse-credential.ts +54 -62
- package/src/credential/issuance/README.md +77 -45
- package/src/credential/issuance/const.ts +1 -1
- package/src/credential/issuance/types.ts +19 -8
- package/src/credential/presentation/07-evaluate-dcql-query.ts +16 -17
- package/src/credential/presentation/07-evaluate-input-descriptor.ts +19 -16
- package/src/credential/presentation/types.ts +1 -2
- package/src/credential/status/README.md +0 -1
- package/src/sd-jwt/__test__/index.test.ts +8 -29
- package/src/sd-jwt/__test__/types.test.ts +6 -2
- package/src/sd-jwt/__test__/utils.test.ts +37 -0
- package/src/sd-jwt/index.ts +7 -1
- package/src/sd-jwt/types.ts +68 -7
- package/src/sd-jwt/utils.ts +73 -0
- package/src/trust/types.ts +23 -17
- package/src/utils/par.ts +37 -21
- package/src/utils/pop.ts +1 -1
- package/src/wallet-instance-attestation/types.ts +3 -1
@@ -6,55 +6,60 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.startUserAuthorization = void 0;
|
7
7
|
var _misc = require("../../utils/misc");
|
8
8
|
var _par = require("../../utils/par");
|
9
|
-
var _const = require("./const");
|
10
9
|
var _logging = require("../../utils/logging");
|
11
10
|
/**
|
12
11
|
* Ensures that the credential type requested is supported by the issuer and contained in the
|
13
12
|
* issuer configuration.
|
14
13
|
* @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
|
15
|
-
* @param
|
16
|
-
* @param context.wiaCryptoContext The Wallet Instance's crypto context
|
17
|
-
* @param context.walletInstanceAttestation The Wallet Instance's attestation
|
18
|
-
* @param context.redirectUri The redirect URI which is the custom URL scheme that the Wallet Instance is registered to handle
|
19
|
-
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
14
|
+
* @param credentialId The credential configuration ID to be requested;
|
20
15
|
* @returns The credential definition to be used in the request which includes the format and the type and its type
|
21
16
|
*/
|
22
|
-
const selectCredentialDefinition = (issuerConf,
|
17
|
+
const selectCredentialDefinition = (issuerConf, credentialId) => {
|
23
18
|
const credential_configurations_supported = issuerConf.openid_credential_issuer.credential_configurations_supported;
|
24
|
-
const [result] = Object.keys(credential_configurations_supported).filter(e => e.includes(
|
25
|
-
credential_configuration_id:
|
26
|
-
format: credential_configurations_supported[e].format,
|
19
|
+
const [result] = Object.keys(credential_configurations_supported).filter(e => e.includes(credentialId)).map(() => ({
|
20
|
+
credential_configuration_id: credentialId,
|
27
21
|
type: "openid_credential"
|
28
22
|
}));
|
29
23
|
if (!result) {
|
30
|
-
_logging.Logger.log(_logging.LogLevel.ERROR, `Requested credential
|
31
|
-
throw new Error(`No credential support the type '${
|
24
|
+
_logging.Logger.log(_logging.LogLevel.ERROR, `Requested credential ${credentialId} is not supported by the issuer according to its configuration ${JSON.stringify(credential_configurations_supported)}`);
|
25
|
+
throw new Error(`No credential support the type '${credentialId}'`);
|
32
26
|
}
|
33
27
|
return result;
|
34
28
|
};
|
35
29
|
|
36
30
|
/**
|
37
31
|
* Ensures that the response mode requested is supported by the issuer and contained in the issuer configuration.
|
32
|
+
* When multiple credentials are provided, all of them must support the same response_mode.
|
38
33
|
* @param issuerConf The issuer configuration
|
39
|
-
* @param
|
34
|
+
* @param credentialIds The credential configuration IDs to be requested
|
40
35
|
* @returns The response mode to be used in the request, "query" for PersonIdentificationData and "form_post.jwt" for all other types.
|
41
36
|
*/
|
42
|
-
const selectResponseMode = (issuerConf,
|
37
|
+
const selectResponseMode = (issuerConf, credentialIds) => {
|
43
38
|
const responseModeSupported = issuerConf.oauth_authorization_server.response_modes_supported;
|
44
|
-
const
|
45
|
-
|
39
|
+
const responseModeSet = new Set();
|
40
|
+
for (const credentialId of credentialIds) {
|
41
|
+
responseModeSet.add(credentialId.match(/PersonIdentificationData/i) ? "query" : "form_post.jwt");
|
42
|
+
}
|
43
|
+
if (responseModeSet.size !== 1) {
|
44
|
+
_logging.Logger.log(_logging.LogLevel.ERROR, `${credentialIds} have incompatible response_mode: ${[...responseModeSet.values()]}`);
|
45
|
+
throw new Error("Requested credentials have incompatible response_mode and cannot be requested with the same PAR request");
|
46
|
+
}
|
47
|
+
const [responseMode] = responseModeSet.values();
|
48
|
+
_logging.Logger.log(_logging.LogLevel.DEBUG, `Selected response mode ${responseMode} for credential IDs ${credentialIds}`);
|
46
49
|
if (!responseModeSupported.includes(responseMode)) {
|
47
50
|
_logging.Logger.log(_logging.LogLevel.ERROR, `Requested response mode ${responseMode} is not supported by the issuer according to its configuration ${JSON.stringify(responseModeSupported)}`);
|
48
|
-
throw new Error(`No response mode support
|
51
|
+
throw new Error(`No response mode support for IDs '${credentialIds}'`);
|
49
52
|
}
|
50
53
|
return responseMode;
|
51
54
|
};
|
52
55
|
|
53
56
|
/**
|
54
57
|
* WARNING: This function must be called after {@link evaluateIssuerTrust} and {@link startFlow}. The next steam is {@link compeUserAuthorizationWithQueryMode} or {@link compeUserAuthorizationWithFormPostJwtMode}
|
58
|
+
*
|
55
59
|
* Creates and sends a PAR request to the /as/par endpoint of the authorization server.
|
56
60
|
* This starts the authentication flow to obtain an access token.
|
57
|
-
* This token enables the Wallet Instance to request a digital credential from the Credential Endpoint of the Credential Issuer
|
61
|
+
* This token enables the Wallet Instance to request a digital credential from the Credential Endpoint of the Credential Issuer; when multiple credential types are passed,
|
62
|
+
* it is possible to use the same access token for the issuance of all requested credentials.
|
58
63
|
* This is an HTTP POST request containing the Wallet Instance identifier (client id), the code challenge and challenge method as specified by PKCE according to RFC 9126
|
59
64
|
* along with the WTE and its proof of possession (WTE-PoP).
|
60
65
|
* Additionally, it includes a request object, which is a signed JWT encapsulating the type of digital credential requested (authorization_details),
|
@@ -64,11 +69,12 @@ const selectResponseMode = (issuerConf, credentialType) => {
|
|
64
69
|
* to the Wallet Instance's Token Endpoint to obtain the Access Token, and the redirectUri of the Wallet Instance where the Authorization Response
|
65
70
|
* should be delivered. The redirect is achived by using a custom URL scheme that the Wallet Instance is registered to handle.
|
66
71
|
* @param issuerConf The issuer configuration
|
67
|
-
* @param
|
72
|
+
* @param credentialIds The credential configuration IDs to be requested
|
68
73
|
* @param ctx The context object containing the Wallet Instance's cryptographic context, the Wallet Instance's attestation, the redirect URI and the fetch implementation
|
69
|
-
* @returns The URI to which the end user should be redirected to start the authentication flow, along with the client id, the code verifier and the credential definition
|
74
|
+
* @returns The URI to which the end user should be redirected to start the authentication flow, along with the client id, the code verifier and the credential definition(s)
|
70
75
|
*/
|
71
|
-
|
76
|
+
|
77
|
+
const startUserAuthorization = async (issuerConf, credentialIds, ctx) => {
|
72
78
|
const {
|
73
79
|
wiaCryptoContext,
|
74
80
|
walletInstanceAttestation,
|
@@ -82,13 +88,21 @@ const startUserAuthorization = async (issuerConf, credentialType, ctx) => {
|
|
82
88
|
}
|
83
89
|
const codeVerifier = (0, _misc.generateRandomAlphaNumericString)(64);
|
84
90
|
const parEndpoint = issuerConf.oauth_authorization_server.pushed_authorization_request_endpoint;
|
85
|
-
const
|
86
|
-
const
|
91
|
+
const aud = issuerConf.openid_credential_issuer.credential_issuer;
|
92
|
+
const credentialDefinition = credentialIds.map(c => selectCredentialDefinition(issuerConf, c));
|
93
|
+
const responseMode = selectResponseMode(issuerConf, credentialIds);
|
87
94
|
const getPar = (0, _par.makeParRequest)({
|
88
95
|
wiaCryptoContext,
|
89
96
|
appFetch
|
90
97
|
});
|
91
|
-
const issuerRequestUri = await getPar(
|
98
|
+
const issuerRequestUri = await getPar(parEndpoint, walletInstanceAttestation, {
|
99
|
+
aud,
|
100
|
+
clientId,
|
101
|
+
codeVerifier,
|
102
|
+
redirectUri,
|
103
|
+
responseMode,
|
104
|
+
authorizationDetails: credentialDefinition
|
105
|
+
});
|
92
106
|
return {
|
93
107
|
issuerRequestUri,
|
94
108
|
clientId,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_misc","require","_par","
|
1
|
+
{"version":3,"names":["_misc","require","_par","_logging","selectCredentialDefinition","issuerConf","credentialId","credential_configurations_supported","openid_credential_issuer","result","Object","keys","filter","e","includes","map","credential_configuration_id","type","Logger","log","LogLevel","ERROR","JSON","stringify","Error","selectResponseMode","credentialIds","responseModeSupported","oauth_authorization_server","response_modes_supported","responseModeSet","Set","add","match","size","values","responseMode","DEBUG","startUserAuthorization","ctx","wiaCryptoContext","walletInstanceAttestation","redirectUri","appFetch","fetch","clientId","getPublicKey","then","_","kid","codeVerifier","generateRandomAlphaNumericString","parEndpoint","pushed_authorization_request_endpoint","aud","credential_issuer","credentialDefinition","c","getPar","makeParRequest","issuerRequestUri","authorizationDetails","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-user-authorization.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,0BAA0B,GAAGA,CACjCC,UAAkD,EAClDC,YAA4C,KACpB;EACxB,MAAMC,mCAAmC,GACvCF,UAAU,CAACG,wBAAwB,CAACD,mCAAmC;EAEzE,MAAM,CAACE,MAAM,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACJ,mCAAmC,CAAC,CAC9DK,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAACR,YAAY,CAAC,CAAC,CACvCS,GAAG,CAAC,OAAO;IACVC,2BAA2B,EAAEV,YAAY;IACzCW,IAAI,EAAE;EACR,CAAC,CAAC,CAAC;EAEL,IAAI,CAACR,MAAM,EAAE;IACXS,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAACC,KAAK,EACb,wBAAuBf,YAAa,kEAAiEgB,IAAI,CAACC,SAAS,CAAChB,mCAAmC,CAAE,EAC5J,CAAC;IACD,MAAM,IAAIiB,KAAK,CAAE,mCAAkClB,YAAa,GAAE,CAAC;EACrE;EACA,OAAOG,MAAM;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMgB,kBAAkB,GAAGA,CACzBpB,UAAkD,EAClDqB,aAAuB,KACN;EACjB,MAAMC,qBAAqB,GACzBtB,UAAU,CAACuB,0BAA0B,CA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BAAgB,CAACM,YAAY,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,GAAG,CAAC;EAEzE,IAAI,CAACJ,QAAQ,EAAE;IACb3B,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAACC,KAAK,EACb,kCAAiCwB,QAAS,0BAC7C,CAAC;IACD,MAAM,IAAIrB,KAAK,CAAC,qBAAqB,CAAC;EACxC;EACA,MAAM0B,YAAY,GAAG,IAAAC,sCAAgC,EAAC,EAAE,CAAC;EACzD,MAAMC,WAAW,GACf/C,UAAU,CAACuB,0BAA0B,CAACyB,qCAAqC;EAC7E,MAAMC,GAAG,GAAGjD,UAAU,CAACG,wBAAwB,CAAC+C,iBAAiB;EACjE,MAAMC,oBAAoB,GAAG9B,aAAa,CAACX,GAAG,CAAE0C,CAAC,IAC/CrD,0BAA0B,CAACC,UAAU,EAAEoD,CAAC,CAC1C,CAAC;EACD,MAAMrB,YAAY,GAAGX,kBAAkB,CAACpB,UAAU,EAAEqB,aAAa,CAAC;EAClE,MAAMgC,MAAM,GAAG,IAAAC,mBAAc,EAAC;IAAEnB,gBAAgB;IAAEG;EAAS,CAAC,CAAC;EAC7D,MAAMiB,gBAAgB,GAAG,MAAMF,MAAM,CACnCN,WAAW,EACXX,yBAAyB,EACzB;IACEa,GAAG;IACHT,QAAQ;IACRK,YAAY;IACZR,WAAW;IACXN,YAAY;IACZyB,oBAAoB,EAAEL;EACxB,CACF,CAAC;EAED,OAAO;IAAEI,gBAAgB;IAAEf,QAAQ;IAAEK,YAAY;IAAEM;EAAqB,CAAC;AAC3E,CAAC;AAACM,OAAA,CAAAxB,sBAAA,GAAAA,sBAAA"}
|
@@ -10,11 +10,11 @@ var _parseUrl = _interopRequireDefault(require("parse-url"));
|
|
10
10
|
var _errors = require("../../utils/errors");
|
11
11
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
12
12
|
var _types = require("../presentation/types");
|
13
|
-
var _uuid = require("uuid");
|
14
13
|
var _types2 = require("./types");
|
15
14
|
var _decoder = require("../../utils/decoder");
|
16
15
|
var _errors2 = require("./errors");
|
17
16
|
var _logging = require("../../utils/logging");
|
17
|
+
var _ = require("..");
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
19
|
/**
|
20
20
|
* The interface of the phase to complete User authorization via strong identification when the response mode is "query" and the request credential is a PersonIdentificationData.
|
@@ -94,71 +94,47 @@ const getRequestedCredentialToBePresented = async function (issuerRequestUri, cl
|
|
94
94
|
};
|
95
95
|
|
96
96
|
/**
|
97
|
-
* WARNING: This function must be called after {@link
|
97
|
+
* WARNING: This function must be called after {@link getRequestedCredentialToBePresented}. The next function to be called is {@link authorizeAccess}.
|
98
98
|
* The interface of the phase to complete User authorization via presentation of existing credentials when the response mode is "form_post.jwt".
|
99
|
-
*
|
100
|
-
*
|
101
|
-
* @param
|
102
|
-
* @param
|
103
|
-
* @param
|
104
|
-
* @param context.walletInstanceAccestation the Wallet Instance's attestation to be presented
|
105
|
-
* @param context.pid the PID to be presented
|
106
|
-
* @param context.wiaCryptoContext The Wallet Instance's crypto context associated with the walletInstanceAttestation parameter
|
107
|
-
* @param context.pidCryptoContext The PID crypto context associated with the pid parameter
|
108
|
-
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
99
|
+
* The information is obtained by performing a POST request to the endpoint received in the response_uri field of the requestObject, where the Authorization Response payload is posted.
|
100
|
+
* Following this,the redirect_uri from the response is used to obtain the final authorization response.
|
101
|
+
* @param requestObject - The request object containing the necessary parameters for authorization.
|
102
|
+
* @param pid The `PID` that must be presented for the issuance of credentials.
|
103
|
+
* @param appFetch (optional) fetch api implementation. Default: built-in fetch
|
109
104
|
* @throws {ValidationFailed} if an error while validating the response
|
110
105
|
* @returns the authorization response which contains code, state and iss
|
111
106
|
*/
|
112
107
|
exports.getRequestedCredentialToBePresented = getRequestedCredentialToBePresented;
|
113
|
-
const completeUserAuthorizationWithFormPostJwtMode = async (requestObject,
|
114
|
-
|
115
|
-
const {
|
108
|
+
const completeUserAuthorizationWithFormPostJwtMode = async (requestObject, pid, _ref) => {
|
109
|
+
let {
|
116
110
|
wiaCryptoContext,
|
117
111
|
pidCryptoContext,
|
118
|
-
pid,
|
119
|
-
walletInstanceAttestation,
|
120
112
|
appFetch = fetch
|
121
|
-
} =
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
}
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
*/
|
143
|
-
const presentationSubmission = {
|
144
|
-
definition_id: `${(0, _uuid.v4)()}`,
|
145
|
-
id: `${(0, _uuid.v4)()}`,
|
146
|
-
descriptor_map: [{
|
147
|
-
id: "PersonIdentificationData",
|
148
|
-
path: "$.vp_token[0].vp",
|
149
|
-
format: "vc+sd-jwt"
|
150
|
-
}, {
|
151
|
-
id: "WalletAttestation",
|
152
|
-
path: "$.vp_token[1].vp",
|
153
|
-
format: "jwt"
|
154
|
-
}]
|
155
|
-
};
|
156
|
-
_logging.Logger.log(_logging.LogLevel.DEBUG, `Presentation submission: ${JSON.stringify(presentationSubmission)}`);
|
157
|
-
const authzResponsePayload = (0, _ioReactNativeJwt.encodeBase64)(JSON.stringify({
|
113
|
+
} = _ref;
|
114
|
+
_logging.Logger.log(_logging.LogLevel.DEBUG, `The requeste credential is not a PersonIdentificationData, completing the user authorization with form_post.jwt mode`);
|
115
|
+
if (!requestObject.dcql_query) {
|
116
|
+
throw new Error("Invalid request object");
|
117
|
+
}
|
118
|
+
const dcqlQueryResult = _.Presentation.evaluateDcqlQuery([[pidCryptoContext, pid]], requestObject.dcql_query);
|
119
|
+
const credentialsToPresent = dcqlQueryResult.map(_ref2 => {
|
120
|
+
let {
|
121
|
+
requiredDisclosures,
|
122
|
+
...rest
|
123
|
+
} = _ref2;
|
124
|
+
return {
|
125
|
+
...rest,
|
126
|
+
requestedClaims: requiredDisclosures.map(_ref3 => {
|
127
|
+
let [, claimName] = _ref3;
|
128
|
+
return claimName;
|
129
|
+
})
|
130
|
+
};
|
131
|
+
});
|
132
|
+
const remotePresentations = await _.Presentation.prepareRemotePresentations(credentialsToPresent, requestObject.nonce, requestObject.client_id);
|
133
|
+
const authzResponsePayload = await createAuthzResponsePayload({
|
158
134
|
state: requestObject.state,
|
159
|
-
|
160
|
-
|
161
|
-
})
|
135
|
+
remotePresentations,
|
136
|
+
wiaCryptoContext
|
137
|
+
});
|
162
138
|
_logging.Logger.log(_logging.LogLevel.DEBUG, `Authz response payload: ${authzResponsePayload}`);
|
163
139
|
|
164
140
|
// Note: according to the spec, the response should be encrypted with the public key of the RP however this is not implemented yet
|
@@ -213,5 +189,47 @@ const parseAuthorizationResponse = authRes => {
|
|
213
189
|
}
|
214
190
|
return authResParsed.data;
|
215
191
|
};
|
192
|
+
|
193
|
+
/**
|
194
|
+
* Creates the authorization response payload to be sent.
|
195
|
+
* This payload includes the state and the VP tokens for the presented credentials.
|
196
|
+
* The payload is encoded in Base64.
|
197
|
+
* @param state - The state parameter from the request object (optional).
|
198
|
+
* @param remotePresentations - An array of remote presentations containing credential IDs and their corresponding VP tokens.
|
199
|
+
* @returns The Base64 encoded authorization response payload.
|
200
|
+
*/
|
216
201
|
exports.parseAuthorizationResponse = parseAuthorizationResponse;
|
202
|
+
const createAuthzResponsePayload = async _ref4 => {
|
203
|
+
let {
|
204
|
+
state,
|
205
|
+
remotePresentations,
|
206
|
+
wiaCryptoContext
|
207
|
+
} = _ref4;
|
208
|
+
const {
|
209
|
+
kid
|
210
|
+
} = await wiaCryptoContext.getPublicKey();
|
211
|
+
return new _ioReactNativeJwt.SignJWT(wiaCryptoContext).setProtectedHeader({
|
212
|
+
typ: "jwt",
|
213
|
+
kid
|
214
|
+
}).setPayload({
|
215
|
+
/**
|
216
|
+
* TODO [SIW-2264]: `state` coming from `requestObject` is marked as `optional`
|
217
|
+
* At the moment, it is not entirely clear whether this value can indeed be omitted
|
218
|
+
* and, if so, what the consequences of its absence might be.
|
219
|
+
*/
|
220
|
+
...(state ? {
|
221
|
+
state
|
222
|
+
} : {}),
|
223
|
+
vp_token: remotePresentations.reduce((vp_token, _ref5) => {
|
224
|
+
let {
|
225
|
+
credentialId,
|
226
|
+
vpToken
|
227
|
+
} = _ref5;
|
228
|
+
return {
|
229
|
+
...vp_token,
|
230
|
+
[credentialId]: vpToken
|
231
|
+
};
|
232
|
+
}, {})
|
233
|
+
}).setIssuedAt().setExpirationTime("1h").sign();
|
234
|
+
};
|
217
235
|
//# sourceMappingURL=04-complete-user-authorization.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","_ioReactNativeJwt","_types","
|
1
|
+
{"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","_ioReactNativeJwt","_types","_types2","_decoder","_errors2","_logging","_","obj","__esModule","default","buildAuthorizationUrl","issuerRequestUri","clientId","issuerConf","idpHint","authzRequestEndpoint","oauth_authorization_server","authorization_endpoint","params","URLSearchParams","client_id","request_uri","append","authUrl","exports","completeUserAuthorizationWithQueryMode","authRedirectUrl","Logger","log","LogLevel","DEBUG","query","parseUrl","parseAuthorizationResponse","getRequestedCredentialToBePresented","appFetch","arguments","length","undefined","fetch","toString","requestObject","method","then","hasStatusOrThrow","IssuerResponseError","res","text","jws","decode","reqObj","RequestObject","safeParse","payload","success","ERROR","error","message","ValidationFailed","reason","data","completeUserAuthorizationWithFormPostJwtMode","pid","_ref","wiaCryptoContext","pidCryptoContext","dcql_query","Error","dcqlQueryResult","Presentation","evaluateDcqlQuery","credentialsToPresent","map","_ref2","requiredDisclosures","rest","requestedClaims","_ref3","claimName","remotePresentations","prepareRemotePresentations","nonce","authzResponsePayload","createAuthzResponsePayload","state","body","response","resUriRes","response_uri","headers","reqUri","json","responseUri","ResponseUriResultShape","redirect_uri","getJwtFromFormPost","cbRes","decodedJwt","authRes","authResParsed","AuthorizationResultShape","authErr","AuthorizationErrorShape","AuthorizationError","JSON","stringify","AuthorizationIdpError","error_description","_ref4","kid","getPublicKey","SignJWT","setProtectedHeader","typ","setPayload","vp_token","reduce","_ref5","credentialId","vpToken","setIssuedAt","setExpirationTime","sign"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,iBAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,CAAA,GAAAX,OAAA;AAAkC,SAAAG,uBAAAS,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGlC;AACA;AACA;;AA+BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,qBAA4C,GAAG,MAAAA,CAC1DC,gBAAgB,EAChBC,QAAQ,EACRC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,oBAAoB,GACxBF,UAAU,CAACG,0BAA0B,CAACC,sBAAsB;EAE9D,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC;IACjCC,SAAS,EAAER,QAAQ;IACnBS,WAAW,EAAEV;EACf,CAAC,CAAC;EAEF,IAAIG,OAAO,EAAE;IACXI,MAAM,CAACI,MAAM,CAAC,SAAS,EAAER,OAAO,CAAC;EACnC;EAEA,MAAMS,OAAO,GAAI,GAAER,oBAAqB,IAAGG,MAAO,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EACrE,CAAC;IACD,MAAM,IAAIK,8BAAqB,CAC7BL,OAAO,CAACzC,IAAI,CAACJ,KAAK,EAClB6C,OAAO,CAACzC,IAAI,CAAC+C,iBACf,CAAC;EACH;EACA,OAAOR,aAAa,CAACvC,IAAI;AAC3B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPApC,OAAA,CAAAS,0BAAA,GAAAA,0BAAA;AAQA,MAAMkD,0BAA0B,GAAG,MAAAyB,KAAA,IAQZ;EAAA,IARmB;IACxCxB,KAAK;IACLL,mBAAmB;IACnBf;EAKF,CAAC,GAAA4C,KAAA;EACC,MAAM;IAAEC;EAAI,CAAC,GAAG,MAAM7C,gBAAgB,CAAC8C,YAAY,CAAC,CAAC;EAErD,OAAO,IAAIC,yBAAO,CAAC/C,gBAAgB,CAAC,CACjCgD,kBAAkB,CAAC;IAClBC,GAAG,EAAE,KAAK;IACVJ;EACF,CAAC,CAAC,CACDK,UAAU,CAAC;IACV;AACN;AACA;AACA;AACA;IACM,IAAI9B,KAAK,GAAG;MAAEA;IAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B+B,QAAQ,EAAEpC,mBAAmB,CAACqC,MAAM,CAClC,CAACD,QAAQ,EAAAE,KAAA;MAAA,IAAE;QAAEC,YAAY;QAAEC;MAAQ,CAAC,GAAAF,KAAA;MAAA,OAAM;QACxC,GAAGF,QAAQ;QACX,CAACG,YAAY,GAAGC;MAClB,CAAC;IAAA,CAAC,EACF,CAAC,CACH;EACF,CAAC,CAAC,CACDC,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,IAAI,CAAC,CACvBC,IAAI,CAAC,CAAC;AACX,CAAC"}
|
@@ -9,7 +9,6 @@ var _dpop = require("../../utils/dpop");
|
|
9
9
|
var _uuid = require("uuid");
|
10
10
|
var _pop = require("../../utils/pop");
|
11
11
|
var WalletInstanceAttestation = _interopRequireWildcard(require("../../wallet-instance-attestation"));
|
12
|
-
var _const = require("./const");
|
13
12
|
var _types = require("./types");
|
14
13
|
var _errors = require("../../utils/errors");
|
15
14
|
var _logging = require("../../utils/logging");
|
@@ -33,16 +32,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
33
32
|
* @throws {IssuerResponseError} with a specific code for more context
|
34
33
|
* @return The token response containing the access token along with the token request signed with DPoP which has to be used in the {@link obtainCredential} step.
|
35
34
|
*/
|
36
|
-
const authorizeAccess = async (issuerConf, code,
|
35
|
+
const authorizeAccess = async (issuerConf, code, _, redirectUri, codeVerifier, context) => {
|
37
36
|
const {
|
38
37
|
appFetch = fetch,
|
39
38
|
walletInstanceAttestation,
|
40
39
|
wiaCryptoContext,
|
41
40
|
dPopCryptoContext
|
42
41
|
} = context;
|
43
|
-
const
|
44
|
-
const parUrl = new URL(parEndpoint);
|
45
|
-
const aud = `${parUrl.protocol}//${parUrl.hostname}`;
|
42
|
+
const aud = issuerConf.openid_credential_issuer.credential_issuer;
|
46
43
|
const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
|
47
44
|
const tokenUrl = issuerConf.oauth_authorization_server.token_endpoint;
|
48
45
|
const tokenRequestSignedDPop = await (0, _dpop.createDPopToken)({
|
@@ -59,12 +56,9 @@ const authorizeAccess = async (issuerConf, code, clientId, redirectUri, codeVeri
|
|
59
56
|
_logging.Logger.log(_logging.LogLevel.DEBUG, `WIA DPoP token: ${signedWiaPoP}`);
|
60
57
|
const requestBody = {
|
61
58
|
grant_type: "authorization_code",
|
62
|
-
client_id: clientId,
|
63
59
|
code,
|
64
|
-
redirect_uri: redirectUri,
|
65
60
|
code_verifier: codeVerifier,
|
66
|
-
|
67
|
-
client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
|
61
|
+
redirect_uri: redirectUri
|
68
62
|
};
|
69
63
|
const authorizationRequestFormBody = new URLSearchParams(requestBody);
|
70
64
|
_logging.Logger.log(_logging.LogLevel.DEBUG, `Auth form request body: ${authorizationRequestFormBody}`);
|
@@ -72,7 +66,9 @@ const authorizeAccess = async (issuerConf, code, clientId, redirectUri, codeVeri
|
|
72
66
|
method: "POST",
|
73
67
|
headers: {
|
74
68
|
"Content-Type": "application/x-www-form-urlencoded",
|
75
|
-
DPoP: tokenRequestSignedDPop
|
69
|
+
DPoP: tokenRequestSignedDPop,
|
70
|
+
"OAuth-Client-Attestation": walletInstanceAttestation,
|
71
|
+
"OAuth-Client-Attestation-PoP": signedWiaPoP
|
76
72
|
},
|
77
73
|
body: authorizationRequestFormBody.toString()
|
78
74
|
}).then((0, _misc.hasStatusOrThrow)(200, _errors.IssuerResponseError)).then(res => res.json()).then(body => _types.TokenResponse.safeParse(body));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_misc","require","_dpop","_uuid","_pop","WalletInstanceAttestation","_interopRequireWildcard","
|
1
|
+
{"version":3,"names":["_misc","require","_dpop","_uuid","_pop","WalletInstanceAttestation","_interopRequireWildcard","_types","_errors","_logging","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","authorizeAccess","issuerConf","code","_","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","dPopCryptoContext","aud","openid_credential_issuer","credential_issuer","iss","decode","payload","cnf","jwk","kid","tokenUrl","oauth_authorization_server","token_endpoint","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuidv4","Logger","log","LogLevel","DEBUG","signedWiaPoP","createPopToken","requestBody","grant_type","code_verifier","redirect_uri","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","hasStatusOrThrow","IssuerResponseError","res","json","TokenResponse","safeParse","success","ERROR","error","message","ValidationFailed","reason","accessToken","data","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GA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AChCnC,IAAI;IACJoC,aAAa,EAAEjC,YAAY;IAC3BkC,YAAY,EAAEnC;EAChB,CAAC;EAED,MAAMoC,4BAA4B,GAAG,IAAIC,eAAe,CAACL,WAAW,CAAC;EAErEN,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAACC,KAAK,EACb,2BAA0BO,4BAA6B,EAC1D,CAAC;EAED,MAAME,QAAQ,GAAG,MAAMnC,QAAQ,CAACc,QAAQ,EAAE;IACxCsB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,mCAAmC;MACnDC,IAAI,EAAErB,sBAAsB;MAC5B,0BAA0B,EAAEf,yBAAyB;MACrD,8BAA8B,EAAEyB;IAClC,CAAC;IACDY,IAAI,EAAEN,4BAA4B,CAACO,QAAQ,CAAC;EAC9C,CAAC,CAAC,CACCC,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,EAAEC,2BAAmB,CAAC,CAAC,CAChDF,IAAI,CAAEG,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBJ,IAAI,CAAEF,IAAI,IAAKO,oBAAa,CAACC,SAAS,CAACR,IAAI,CAAC,CAAC;EAEhD,IAAI,CAACJ,QAAQ,CAACa,OAAO,EAAE;IACrBzB,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAACwB,KAAK,EACb,qCAAoCd,QAAQ,CAACe,KAAK,CAACC,OAAQ,EAC9D,CAAC;IAED,MAAM,IAAIC,wBAAgB,CAAC;MACzBD,OAAO,EAAE,kCAAkC;MAC3CE,MAAM,EAAElB,QAAQ,CAACe,KAAK,CAACC;IACzB,CAAC,CAAC;EACJ;EAEA,OAAO;IAAEG,WAAW,EAAEnB,QAAQ,CAACoB;EAAK,CAAC;AACvC,CAAC;AAACC,OAAA,CAAA/D,eAAA,GAAAA,eAAA"}
|
@@ -30,11 +30,11 @@ const createNonceProof = async (nonce, issuer, audience, ctx) => {
|
|
30
30
|
* @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
|
31
31
|
* @param accessToken The access token response returned by {@link authorizeAccess}
|
32
32
|
* @param clientId The client id returned by {@link startUserAuthorization}
|
33
|
-
* @param credentialDefinition The credential definition of the credential to be obtained returned by {@link
|
34
|
-
* @param tokenRequestSignedDPop The DPoP signed token request returned by {@link authorizeAccess}
|
33
|
+
* @param credentialDefinition The credential definition of the credential to be obtained returned by {@link authorizeAccess}
|
35
34
|
* @param context.credentialCryptoContext The crypto context used to obtain the credential
|
36
35
|
* @param context.dPopCryptoContext The DPoP crypto context
|
37
36
|
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
37
|
+
* @param operationType Specify the type of credential issuance (used for reissuing)
|
38
38
|
* @returns The credential response containing the credential
|
39
39
|
*/
|
40
40
|
exports.createNonceProof = createNonceProof;
|
@@ -44,18 +44,34 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
|
|
44
44
|
appFetch = fetch,
|
45
45
|
dPopCryptoContext
|
46
46
|
} = context;
|
47
|
+
const {
|
48
|
+
credential_configuration_id,
|
49
|
+
credential_identifier
|
50
|
+
} = credentialDefinition;
|
47
51
|
const credentialUrl = issuerConf.openid_credential_issuer.credential_endpoint;
|
52
|
+
const issuerUrl = issuerConf.oauth_authorization_server.issuer;
|
53
|
+
const nonceUrl = issuerConf.openid_credential_issuer.nonce_endpoint;
|
54
|
+
|
55
|
+
// Fetch the nonce from the Credential Issuer
|
56
|
+
const {
|
57
|
+
c_nonce
|
58
|
+
} = await appFetch(nonceUrl, {
|
59
|
+
method: "POST",
|
60
|
+
headers: {
|
61
|
+
"Content-Type": "application/json"
|
62
|
+
}
|
63
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(body => _types.NonceResponse.parse(body));
|
48
64
|
|
49
65
|
/**
|
50
66
|
* JWT proof token to bind the request nonce to the key that will bind the holder User with the Credential
|
51
67
|
* 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
68
|
* @see https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#name-proof-types
|
53
69
|
*/
|
54
|
-
const signedNonceProof = await createNonceProof(
|
70
|
+
const signedNonceProof = await createNonceProof(c_nonce, clientId, issuerUrl, credentialCryptoContext);
|
55
71
|
_logging.Logger.log(_logging.LogLevel.DEBUG, `Signed nonce proof: ${signedNonceProof}`);
|
56
72
|
|
57
73
|
// Validation of accessTokenResponse.authorization_details if contain credentialDefinition
|
58
|
-
const containsCredentialDefinition = accessToken.authorization_details.some(c => c.credential_configuration_id ===
|
74
|
+
const containsCredentialDefinition = accessToken.authorization_details.some(c => c.credential_configuration_id === credential_configuration_id && (credential_identifier ? c.credential_identifiers.includes(credential_identifier) : true));
|
59
75
|
if (!containsCredentialDefinition) {
|
60
76
|
_logging.Logger.log(_logging.LogLevel.ERROR, `Credential definition not found in the access token response ${accessToken.authorization_details}`);
|
61
77
|
throw new _errors.ValidationFailed({
|
@@ -63,12 +79,20 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
|
|
63
79
|
});
|
64
80
|
}
|
65
81
|
|
66
|
-
/**
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
82
|
+
/**
|
83
|
+
* The credential request body.
|
84
|
+
* We accept both `credential_identifier` (recommended) and `credential_configuration_id`
|
85
|
+
* when the Authorization Server does not support `credential_identifier`.
|
86
|
+
* @see https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0-15.html#section-3.3.4
|
87
|
+
*/
|
88
|
+
const credentialRequestFormBody = credential_identifier ? {
|
89
|
+
credential_identifier: credential_identifier,
|
90
|
+
proof: {
|
91
|
+
jwt: signedNonceProof,
|
92
|
+
proof_type: "jwt"
|
93
|
+
}
|
94
|
+
} : {
|
95
|
+
credential_configuration_id: credential_configuration_id,
|
72
96
|
proof: {
|
73
97
|
jwt: signedNonceProof,
|
74
98
|
proof_type: "jwt"
|
@@ -102,7 +126,15 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
|
|
102
126
|
});
|
103
127
|
}
|
104
128
|
_logging.Logger.log(_logging.LogLevel.DEBUG, `Credential Response: ${JSON.stringify(credentialRes.data)}`);
|
105
|
-
|
129
|
+
|
130
|
+
// Extract the format corresponding to the credential_configuration_id used
|
131
|
+
const issuerCredentialConfig = issuerConf.openid_credential_issuer.credential_configurations_supported[credential_configuration_id];
|
132
|
+
|
133
|
+
// TODO: [SIW-2264] Handle multiple credentials
|
134
|
+
return {
|
135
|
+
credential: credentialRes.data.credentials.at(0).credential,
|
136
|
+
format: issuerCredentialConfig.format
|
137
|
+
};
|
106
138
|
};
|
107
139
|
|
108
140
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_misc","_errors","_types","_dpop","_uuid","_logging","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","exports","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","context","operationType","credentialCryptoContext","appFetch","fetch","dPopCryptoContext","credentialUrl","openid_credential_issuer","credential_endpoint","
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_misc","_errors","_types","_dpop","_uuid","_logging","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","exports","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","context","operationType","credentialCryptoContext","appFetch","fetch","dPopCryptoContext","credential_configuration_id","credential_identifier","credentialUrl","openid_credential_issuer","credential_endpoint","issuerUrl","oauth_authorization_server","nonceUrl","nonce_endpoint","c_nonce","method","headers","then","hasStatusOrThrow","res","json","body","NonceResponse","parse","signedNonceProof","Logger","log","LogLevel","DEBUG","containsCredentialDefinition","authorization_details","some","c","credential_identifiers","includes","ERROR","ValidationFailed","message","credentialRequestFormBody","proof","jwt","proof_type","JSON","stringify","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuidv4","ath","sha256ToBase64","access_token","credentialRes","DPoP","Authorization","token_type","CredentialResponse","safeParse","catch","handleObtainCredentialError","success","error","reason","data","issuerCredentialConfig","credential_configurations_supported","credential","credentials","at","format","e","UnexpectedStatusCodeError","ResponseErrorBuilder","IssuerResponseError","handle","code","IssuerResponseErrorCodes","CredentialIssuingNotSynchronous","CredentialInvalidStatus","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,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAqBO,MAAMO,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,CAAC,CAAC;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfAC,OAAA,CAAAhB,gBAAA,GAAAA,gBAAA;AAgBO,MAAMiB,gBAAkC,GAAG,MAAAA,CAChDC,UAAU,EACVC,WAAW,EACXC,QAAQ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