@pagopa/io-react-native-wallet 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/credential/index.js +1 -5
- package/lib/commonjs/credential/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/02-get-issuer-config.js +48 -0
- package/lib/commonjs/credential/issuance/02-get-issuer-config.js.map +1 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +16 -20
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +8 -8
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +8 -9
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +18 -21
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +3 -3
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/README.md +18 -21
- package/lib/commonjs/credential/issuance/index.js +3 -3
- package/lib/commonjs/credential/issuance/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/types.js +1 -1
- package/lib/commonjs/credential/issuance/types.js.map +1 -1
- package/lib/commonjs/credential/presentation/01-start-flow.js +7 -2
- package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +2 -2
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/commonjs/credential/presentation/03-retrieve-jwks.js +68 -0
- package/lib/commonjs/credential/presentation/03-retrieve-jwks.js.map +1 -0
- package/lib/commonjs/credential/presentation/{03-get-request-object.js → 04-get-request-object.js} +27 -13
- package/lib/commonjs/credential/presentation/04-get-request-object.js.map +1 -0
- package/lib/commonjs/credential/presentation/{04-send-authorization-response.js → 05-send-authorization-response.js} +1 -1
- package/lib/commonjs/credential/presentation/{04-send-authorization-response.js.map → 05-send-authorization-response.js.map} +1 -1
- package/lib/commonjs/credential/presentation/README.md +74 -2
- package/lib/commonjs/credential/presentation/index.js +15 -2
- package/lib/commonjs/credential/presentation/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js +5 -3
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/entity/openid-connect/issuer/index.js +25 -0
- package/lib/commonjs/entity/openid-connect/issuer/index.js.map +1 -0
- package/lib/commonjs/entity/openid-connect/issuer/types.js +61 -0
- package/lib/commonjs/entity/openid-connect/issuer/types.js.map +1 -0
- package/lib/commonjs/{trust → entity/trust}/chain.js +1 -1
- package/lib/commonjs/entity/trust/chain.js.map +1 -0
- package/lib/commonjs/{trust → entity/trust}/index.js +1 -1
- package/lib/commonjs/entity/trust/index.js.map +1 -0
- package/lib/commonjs/{trust → entity/trust}/types.js +2 -2
- package/lib/commonjs/entity/trust/types.js.map +1 -0
- package/lib/commonjs/index.js +1 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/pid/sd-jwt/types.js +2 -18
- package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/index.test.js +32 -23
- package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/types.test.js +20 -11
- package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +18 -5
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/utils/error-codes.js +1 -13
- package/lib/commonjs/utils/error-codes.js.map +1 -1
- package/lib/commonjs/utils/errors.js +2 -53
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/commonjs/utils/jwk.js +5 -1
- package/lib/commonjs/utils/jwk.js.map +1 -1
- package/lib/commonjs/utils/par.js +6 -12
- package/lib/commonjs/utils/par.js.map +1 -1
- package/lib/module/credential/index.js +1 -3
- package/lib/module/credential/index.js.map +1 -1
- package/lib/module/credential/issuance/02-get-issuer-config.js +42 -0
- package/lib/module/credential/issuance/02-get-issuer-config.js.map +1 -0
- package/lib/module/credential/issuance/03-start-user-authorization.js +16 -20
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +8 -8
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +8 -9
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +18 -21
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +3 -3
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/issuance/README.md +18 -21
- 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 +1 -1
- package/lib/module/credential/issuance/types.js.map +1 -1
- package/lib/module/credential/presentation/01-start-flow.js +7 -2
- package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js +1 -1
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/module/credential/presentation/03-retrieve-jwks.js +61 -0
- package/lib/module/credential/presentation/03-retrieve-jwks.js.map +1 -0
- package/lib/module/credential/presentation/{03-get-request-object.js → 04-get-request-object.js} +26 -12
- package/lib/module/credential/presentation/04-get-request-object.js.map +1 -0
- package/lib/module/credential/presentation/{04-send-authorization-response.js → 05-send-authorization-response.js} +1 -1
- package/lib/module/credential/presentation/{04-send-authorization-response.js.map → 05-send-authorization-response.js.map} +1 -1
- package/lib/module/credential/presentation/README.md +74 -2
- package/lib/module/credential/presentation/index.js +4 -3
- package/lib/module/credential/presentation/index.js.map +1 -1
- package/lib/module/credential/presentation/types.js +5 -3
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/entity/openid-connect/issuer/index.js +20 -0
- package/lib/module/entity/openid-connect/issuer/index.js.map +1 -0
- package/lib/module/entity/openid-connect/issuer/types.js +47 -0
- package/lib/module/entity/openid-connect/issuer/types.js.map +1 -0
- package/lib/module/{trust → entity/trust}/chain.js +1 -1
- package/lib/module/entity/trust/chain.js.map +1 -0
- package/lib/module/{trust → entity/trust}/index.js +1 -1
- package/lib/module/entity/trust/index.js.map +1 -0
- package/lib/module/{trust → entity/trust}/types.js +2 -2
- package/lib/module/entity/trust/types.js.map +1 -0
- package/lib/module/index.js +1 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/pid/sd-jwt/types.js +1 -16
- package/lib/module/pid/sd-jwt/types.js.map +1 -1
- package/lib/module/sd-jwt/__test__/index.test.js +32 -23
- package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/types.test.js +20 -11
- package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/module/sd-jwt/types.js +16 -4
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/utils/error-codes.js +1 -13
- package/lib/module/utils/error-codes.js.map +1 -1
- package/lib/module/utils/errors.js +0 -48
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/module/utils/jwk.js +3 -0
- package/lib/module/utils/jwk.js.map +1 -1
- package/lib/module/utils/par.js +6 -12
- package/lib/module/utils/par.js.map +1 -1
- package/lib/typescript/credential/index.d.ts +1 -3
- package/lib/typescript/credential/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -1
- package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts +32 -0
- package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +3 -3
- 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 +8 -8
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts +3 -3
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +3 -3
- 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 -3
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/index.d.ts +3 -3
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/types.d.ts +4 -9
- package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +1 -1
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/03-retrieve-jwks.d.ts +41 -0
- package/lib/typescript/credential/presentation/03-retrieve-jwks.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/{03-get-request-object.d.ts → 04-get-request-object.d.ts} +4 -4
- package/lib/typescript/credential/presentation/04-get-request-object.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/{04-send-authorization-response.d.ts → 05-send-authorization-response.d.ts} +2 -2
- package/lib/typescript/credential/presentation/{04-send-authorization-response.d.ts.map → 05-send-authorization-response.d.ts.map} +1 -1
- package/lib/typescript/credential/presentation/index.d.ts +5 -4
- package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +15 -15
- package/lib/typescript/entity/openid-connect/issuer/index.d.ts +12 -0
- package/lib/typescript/entity/openid-connect/issuer/index.d.ts.map +1 -0
- package/lib/typescript/entity/openid-connect/issuer/types.d.ts +641 -0
- package/lib/typescript/entity/openid-connect/issuer/types.d.ts.map +1 -0
- package/lib/typescript/entity/trust/chain.d.ts.map +1 -0
- package/lib/typescript/{trust → entity/trust}/index.d.ts +97 -97
- package/lib/typescript/entity/trust/index.d.ts.map +1 -0
- package/lib/typescript/{trust → entity/trust}/types.d.ts +597 -597
- package/lib/typescript/{trust → entity/trust}/types.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/pid/sd-jwt/types.d.ts +25 -103
- package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/index.d.ts +60 -20
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +114 -24
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/utils/error-codes.d.ts +0 -12
- package/lib/typescript/utils/error-codes.d.ts.map +1 -1
- package/lib/typescript/utils/errors.d.ts +6 -37
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/jwk.d.ts +135 -0
- package/lib/typescript/utils/jwk.d.ts.map +1 -1
- package/lib/typescript/utils/par.d.ts +1 -8
- package/lib/typescript/utils/par.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +12 -12
- package/package.json +1 -1
- package/src/credential/index.ts +1 -4
- package/src/credential/issuance/01-start-flow.ts +1 -1
- package/src/credential/issuance/02-get-issuer-config.ts +67 -0
- package/src/credential/issuance/03-start-user-authorization.ts +22 -30
- package/src/credential/issuance/04-complete-user-authorization.ts +11 -13
- package/src/credential/issuance/05-authorize-access.ts +8 -10
- package/src/credential/issuance/06-obtain-credential.ts +30 -31
- package/src/credential/issuance/07-verify-and-parse-credential.ts +6 -6
- package/src/credential/issuance/README.md +18 -21
- package/src/credential/issuance/index.ts +3 -6
- package/src/credential/issuance/types.ts +1 -1
- package/src/credential/presentation/01-start-flow.ts +8 -2
- package/src/credential/presentation/02-evaluate-rp-trust.ts +2 -2
- package/src/credential/presentation/03-retrieve-jwks.ts +73 -0
- package/src/credential/presentation/{03-get-request-object.ts → 04-get-request-object.ts} +33 -15
- package/src/credential/presentation/{04-send-authorization-response.ts → 05-send-authorization-response.ts} +1 -1
- package/src/credential/presentation/README.md +74 -2
- package/src/credential/presentation/index.ts +10 -2
- package/src/credential/presentation/types.ts +3 -3
- package/src/entity/openid-connect/issuer/index.ts +27 -0
- package/src/entity/openid-connect/issuer/types.ts +68 -0
- package/src/{trust → entity/trust}/chain.ts +2 -2
- package/src/{trust → entity/trust}/index.ts +1 -1
- package/src/{trust → entity/trust}/types.ts +2 -2
- package/src/index.ts +0 -2
- package/src/pid/sd-jwt/types.ts +1 -18
- package/src/sd-jwt/__test__/index.test.ts +47 -37
- package/src/sd-jwt/__test__/types.test.ts +26 -16
- package/src/sd-jwt/types.ts +16 -2
- package/src/utils/error-codes.ts +0 -12
- package/src/utils/errors.ts +12 -86
- package/src/utils/jwk.ts +5 -0
- package/src/utils/par.ts +3 -10
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +0 -27
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +0 -1
- package/lib/commonjs/credential/presentation/03-get-request-object.js.map +0 -1
- package/lib/commonjs/credential/status/01-start-flow.js +0 -2
- package/lib/commonjs/credential/status/01-start-flow.js.map +0 -1
- package/lib/commonjs/credential/status/02-status-attestation.js +0 -72
- package/lib/commonjs/credential/status/02-status-attestation.js.map +0 -1
- package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +0 -52
- package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +0 -1
- package/lib/commonjs/credential/status/README.md +0 -67
- package/lib/commonjs/credential/status/index.js +0 -27
- package/lib/commonjs/credential/status/index.js.map +0 -1
- package/lib/commonjs/credential/status/types.js +0 -48
- package/lib/commonjs/credential/status/types.js.map +0 -1
- package/lib/commonjs/credential/trustmark/README.md +0 -62
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +0 -81
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +0 -1
- package/lib/commonjs/credential/trustmark/index.js +0 -13
- package/lib/commonjs/credential/trustmark/index.js.map +0 -1
- package/lib/commonjs/trust/chain.js.map +0 -1
- package/lib/commonjs/trust/index.js.map +0 -1
- package/lib/commonjs/trust/types.js.map +0 -1
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +0 -20
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +0 -1
- package/lib/module/credential/presentation/03-get-request-object.js.map +0 -1
- package/lib/module/credential/status/01-start-flow.js +0 -2
- package/lib/module/credential/status/01-start-flow.js.map +0 -1
- package/lib/module/credential/status/02-status-attestation.js +0 -64
- package/lib/module/credential/status/02-status-attestation.js.map +0 -1
- package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +0 -46
- package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +0 -1
- package/lib/module/credential/status/README.md +0 -67
- package/lib/module/credential/status/index.js +0 -5
- package/lib/module/credential/status/index.js.map +0 -1
- package/lib/module/credential/status/types.js +0 -40
- package/lib/module/credential/status/types.js.map +0 -1
- package/lib/module/credential/trustmark/README.md +0 -62
- package/lib/module/credential/trustmark/get-credential-trustmark.js +0 -72
- package/lib/module/credential/trustmark/get-credential-trustmark.js.map +0 -1
- package/lib/module/credential/trustmark/index.js +0 -3
- package/lib/module/credential/trustmark/index.js.map +0 -1
- package/lib/module/trust/chain.js.map +0 -1
- package/lib/module/trust/index.js.map +0 -1
- package/lib/module/trust/types.js.map +0 -1
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +0 -19
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +0 -1
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +0 -1
- package/lib/typescript/credential/status/01-start-flow.d.ts +0 -10
- package/lib/typescript/credential/status/01-start-flow.d.ts.map +0 -1
- package/lib/typescript/credential/status/02-status-attestation.d.ts +0 -19
- package/lib/typescript/credential/status/02-status-attestation.d.ts.map +0 -1
- package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts +0 -24
- package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +0 -1
- package/lib/typescript/credential/status/index.d.ts +0 -7
- package/lib/typescript/credential/status/index.d.ts.map +0 -1
- package/lib/typescript/credential/status/types.d.ts +0 -305
- package/lib/typescript/credential/status/types.d.ts.map +0 -1
- package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts +0 -52
- package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +0 -1
- package/lib/typescript/credential/trustmark/index.d.ts +0 -4
- package/lib/typescript/credential/trustmark/index.d.ts.map +0 -1
- package/lib/typescript/trust/chain.d.ts.map +0 -1
- package/lib/typescript/trust/index.d.ts.map +0 -1
- package/src/credential/issuance/02-evaluate-issuer-trust.ts +0 -32
- package/src/credential/status/01-start-flow.ts +0 -9
- package/src/credential/status/02-status-attestation.ts +0 -102
- package/src/credential/status/03-verify-and-parse-status-attestation.ts +0 -60
- package/src/credential/status/README.md +0 -67
- package/src/credential/status/index.ts +0 -22
- package/src/credential/status/types.ts +0 -43
- package/src/credential/trustmark/README.md +0 -62
- package/src/credential/trustmark/get-credential-trustmark.ts +0 -120
- package/src/credential/trustmark/index.ts +0 -8
- /package/lib/typescript/{trust → entity/trust}/chain.d.ts +0 -0
|
@@ -17,8 +17,7 @@ Object.defineProperty(exports, "WalletProviderResponseErrorCodes", {
|
|
|
17
17
|
return _errorCodes.WalletProviderResponseErrorCodes;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
exports.
|
|
21
|
-
exports.serializeAttrs = exports.isWalletProviderResponseError = exports.isIssuerResponseError = void 0;
|
|
20
|
+
exports.serializeAttrs = void 0;
|
|
22
21
|
var _errorCodes = require("./error-codes");
|
|
23
22
|
// An error reason that supports both a string and a generic JSON object
|
|
24
23
|
|
|
@@ -139,58 +138,7 @@ class WalletProviderResponseError extends UnexpectedStatusCodeError {
|
|
|
139
138
|
this.code = params.code ?? _errorCodes.WalletProviderResponseErrorCodes.WalletProviderGenericError;
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
|
-
exports.WalletProviderResponseError = WalletProviderResponseError;
|
|
143
|
-
/**
|
|
144
|
-
* Function to extract the error message from the Entity Configuration's supported error codes.
|
|
145
|
-
* @param errorCode The error code to map to a meaningful message
|
|
146
|
-
* @param issuerConf The entity configuration for credentials
|
|
147
|
-
* @param credentialType The type of credential the error belongs to
|
|
148
|
-
* @returns A localized error {@link LocalizedIssuanceError} or undefined
|
|
149
|
-
* @throws {IoWalletError} When no credential config is found
|
|
150
|
-
*/
|
|
151
|
-
function extractErrorMessageFromIssuerConf(errorCode, _ref5) {
|
|
152
|
-
let {
|
|
153
|
-
issuerConf,
|
|
154
|
-
credentialType
|
|
155
|
-
} = _ref5;
|
|
156
|
-
const credentialConfiguration = issuerConf.openid_credential_issuer.credential_configurations_supported[credentialType];
|
|
157
|
-
if (!credentialConfiguration) {
|
|
158
|
-
throw new IoWalletError(`No configuration found for ${credentialType} in the provided EC`);
|
|
159
|
-
}
|
|
160
|
-
const {
|
|
161
|
-
issuance_errors_supported
|
|
162
|
-
} = credentialConfiguration;
|
|
163
|
-
if (!(issuance_errors_supported !== null && issuance_errors_supported !== void 0 && issuance_errors_supported[errorCode])) {
|
|
164
|
-
return undefined;
|
|
165
|
-
}
|
|
166
|
-
const localesList = issuance_errors_supported[errorCode].display;
|
|
167
|
-
return localesList.reduce((acc, _ref6) => {
|
|
168
|
-
let {
|
|
169
|
-
locale,
|
|
170
|
-
...rest
|
|
171
|
-
} = _ref6;
|
|
172
|
-
return {
|
|
173
|
-
...acc,
|
|
174
|
-
[locale]: rest
|
|
175
|
-
};
|
|
176
|
-
}, {});
|
|
177
|
-
}
|
|
178
141
|
|
|
179
|
-
/**
|
|
180
|
-
* Type guard for issuer errors.
|
|
181
|
-
* @param error The error to check
|
|
182
|
-
* @param code Optional code to narrow down the issuer error
|
|
183
|
-
*/
|
|
184
|
-
const isIssuerResponseError = (error, code) => error instanceof IssuerResponseError && error.code === (code ?? error.code);
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Type guard for wallet provider errors.
|
|
188
|
-
* @param error The error to check
|
|
189
|
-
* @param code Optional code to narrow down the wallet provider error
|
|
190
|
-
*/
|
|
191
|
-
exports.isIssuerResponseError = isIssuerResponseError;
|
|
192
|
-
const isWalletProviderResponseError = (error, code) => error instanceof WalletProviderResponseError && error.code === (code ?? error.code);
|
|
193
|
-
exports.isWalletProviderResponseError = isWalletProviderResponseError;
|
|
194
142
|
/**
|
|
195
143
|
* Builder class used to create specialized errors from type {@link UnexpectedStatusCodeError} that handles multiple status codes.
|
|
196
144
|
*
|
|
@@ -205,6 +153,7 @@ exports.isWalletProviderResponseError = isWalletProviderResponseError;
|
|
|
205
153
|
* .buildFrom(baseError)
|
|
206
154
|
* ```
|
|
207
155
|
*/
|
|
156
|
+
exports.WalletProviderResponseError = WalletProviderResponseError;
|
|
208
157
|
class ResponseErrorBuilder {
|
|
209
158
|
errorCases = {};
|
|
210
159
|
constructor(ErrorClass) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_errorCodes","require","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","exports","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerResponseErrorCodes","IssuerGenericError","WalletProviderResponseError","WalletProviderResponseErrorCodes","WalletProviderGenericError","
|
|
1
|
+
{"version":3,"names":["_errorCodes","require","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","exports","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerResponseErrorCodes","IssuerGenericError","WalletProviderResponseError","WalletProviderResponseErrorCodes","WalletProviderGenericError","ResponseErrorBuilder","errorCases","ErrorClass","handle","status","buildFrom","originalError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AASA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,cAAc,GACzBC,KAA8E,IAE9EC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,MAAM,CAACC,IAAA;EAAA,IAAC,GAAGC,CAAC,CAAC,GAAAD,IAAA;EAAA,OAAKC,CAAC,KAAKC,SAAS;AAAA,EAAC,CAClCC,GAAG,CAACC,KAAA,IAAY;EAAA,IAAX,CAACC,CAAC,EAAEJ,CAAC,CAAC,GAAAG,KAAA;EACV,IAAIE,KAAK,CAACC,OAAO,CAACN,CAAC,CAAC,EAAE,OAAO,CAACI,CAAC,EAAG,IAAGJ,CAAC,CAACO,IAAI,CAAC,IAAI,CAAE,GAAE,CAAC;EACrD,IAAI,OAAOP,CAAC,KAAK,QAAQ,EAAE,OAAO,CAACI,CAAC,EAAEI,IAAI,CAACC,SAAS,CAACT,CAAC,CAAC,CAAC;EACxD,OAAO,CAACI,CAAC,EAAEJ,CAAC,CAAC;AACf,CAAC,CAAC,CACDE,GAAG,CAAEQ,CAAC,IAAKA,CAAC,CAACH,IAAI,CAAC,GAAG,CAAC,CAAC,CACvBA,IAAI,CAAC,GAAG,CAAC;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVAI,OAAA,CAAAjB,cAAA,GAAAA,cAAA;AAWO,MAAMkB,aAAa,SAASC,KAAK,CAAC;EACvC;EACAC,IAAI,GAAW,uBAAuB;EAEtCC,WAAWA,CAACC,OAAgB,EAAE;IAC5B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,IAAI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,2BAA2B,SAASP,yBAAyB,CAAC;EAIzEP,WAAWA,CAACW,MAKX,EAAE;IACD,KAAK,CAACA,MAAM,CAAC;IACb,IAAI,CAACL,MAAM,GAAGK,MAAM,CAACL,MAAM;IAC3B,IAAI,CAACP,IAAI,GACPY,MAAM,CAACZ,IAAI,IACXgB,4CAAgC,CAACC,0BAA0B;EAC/D;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAbApB,OAAA,CAAAkB,2BAAA,GAAAA,2BAAA;AAcO,MAAMG,oBAAoB,CAA6C;EACpEC,UAAU,GAEd,CAAC,CAAC;EAENlB,WAAWA,CAASmB,UAAa,EAAE;IAAA,KAAfA,UAAa,GAAbA,UAAa;EAAG;EAEpCC,MAAMA,CAACC,MAAoB,EAAEV,MAAoB,EAAE;IACjD,IAAI,CAACO,UAAU,CAACG,MAAM,CAAC,GAAGV,MAAM;IAChC,OAAO,IAAI;EACb;EAEAW,SAASA,CAACC,aAAwC,EAAE;IAClD,MAAMZ,MAAM,GACV,IAAI,CAACO,UAAU,CAACK,aAAa,CAACd,UAAU,CAAC,IAAI,IAAI,CAACS,UAAU,CAAC,GAAG,CAAC;IAEnE,IAAIP,MAAM,EAAE;MACV,OAAO,IAAI,IAAI,CAACQ,UAAU,CAAC;QAAE,GAAGI,aAAa;QAAE,GAAGZ;MAAO,CAAC,CAAC;IAC7D;IAEA,OAAOY,aAAa;EACtB;AACF;AAAC3B,OAAA,CAAAqB,oBAAA,GAAAA,oBAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.JWK = void 0;
|
|
6
|
+
exports.JWKS = exports.JWK = void 0;
|
|
7
7
|
exports.fixBase64EncodingOnKey = fixBase64EncodingOnKey;
|
|
8
8
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
|
9
9
|
var _zod = require("zod");
|
|
@@ -77,4 +77,8 @@ function fixBase64EncodingOnKey(key) {
|
|
|
77
77
|
} : {})
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
+
const JWKS = _zod.z.object({
|
|
81
|
+
keys: _zod.z.array(JWK)
|
|
82
|
+
});
|
|
83
|
+
exports.JWKS = JWKS;
|
|
80
84
|
//# sourceMappingURL=jwk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_zod","JWK","z","object","alg","string","optional","crv","d","dp","dq","e","ext","boolean","k","key_ops","array","kid","kty","union","literal","n","p","q","qi","use","x","y","x5c","x5t","x5u","exports","fixBase64EncodingOnKey","key","pk","removePadding"],"sourceRoot":"../../../src","sources":["utils/jwk.ts"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAGO,MAAME,GAAG,GAAGC,MAAC,CAACC,MAAM,CAAC;EAC1B;EACAC,GAAG,EAAEF,MAAC,CAACG,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC1BC,GAAG,EAAEL,MAAC,CAACG,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC1BE,CAAC,EAAEN,MAAC,CAACG,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACxBG,EAAE,EAAEP,MAAC,CAACG,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACzBI,EAAE,EAAER,MAAC,CAACG,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACzBK,CAAC,EAAET,MAAC,CAACG,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACxB;EACAM,GAAG,EAAEV,MAAC,CAACW,OAAO,CAAC,CAAC,CAACP,QAAQ,CAAC,CAAC;EAC3BQ,CAAC,EAAEZ,MAAC,CAACG,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;E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,CAAC,CAACC,QAAQ,CAAC;AAC3B,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAyB,OAAA,CAAA9B,GAAA,GAAAA,GAAA;AAQO,SAAS+B,sBAAsBA,CAACC,GAAQ,EAAO;EACpD,MAAM;IAAEP,CAAC;IAAEC,CAAC;IAAEhB,CAAC;IAAEU,CAAC;IAAE,GAAGa;EAAG,CAAC,GAAGD,GAAG;EAEjC,OAAO;IACL,GAAGC,EAAE;IACL,IAAIR,CAAC,GAAG;MAAEA,CAAC,EAAE,IAAAS,+BAAa,EAACT,CAAC;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,IAAIC,CAAC,GAAG;MAAEA,CAAC,EAAE,IAAAQ,+BAAa,EAACR,CAAC;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,IAAIhB,CAAC,GAAG;MAAEA,CAAC,EAAE,IAAAwB,+BAAa,EAACxB,CAAC;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,IAAIU,CAAC,GAAG;MAAEA,CAAC,EAAE,IAAAc,+BAAa,EAACd,CAAC;IAAE,CAAC,GAAG,CAAC,CAAC;EACtC,CAAC;AACH"}
|
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_zod","JWK","z","object","alg","string","optional","crv","d","dp","dq","e","ext","boolean","k","key_ops","array","kid","kty","union","literal","n","p","q","qi","use","x","y","x5c","x5t","x5u","exports","fixBase64EncodingOnKey","key","pk","removePadding","JWKS","keys"],"sourceRoot":"../../../src","sources":["utils/jwk.ts"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAGO,MAAME,GAAG,GAAGC,MAAC,CAACC,MAAM,CAAC;EAC1B;EACAC,GAAG,EAAEF,MAAC,CAACG,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC1BC,GAAG,EAAEL,MAAC,CAACG,MAAM,CAAC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tC,CAAC;AACH;AAGO,MAAMe,IAAI,GAAGlC,MAAC,CAACC,MAAM,CAAC;EAC3BkC,IAAI,EAAEnC,MAAC,CAACc,KAAK,CAACf,GAAG;AACnB,CAAC,CAAC;AAAC8B,OAAA,CAAAK,IAAA,GAAAA,IAAA"}
|
|
@@ -16,7 +16,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
const AuthorizationDetail = z.object({
|
|
18
18
|
credential_configuration_id: z.string(),
|
|
19
|
-
format: z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]),
|
|
20
19
|
type: z.literal("openid_credential")
|
|
21
20
|
});
|
|
22
21
|
exports.AuthorizationDetail = AuthorizationDetail;
|
|
@@ -31,7 +30,7 @@ const makeParRequest = _ref => {
|
|
|
31
30
|
wiaCryptoContext,
|
|
32
31
|
appFetch
|
|
33
32
|
} = _ref;
|
|
34
|
-
return async (clientId, codeVerifier, redirectUri, responseMode, parEndpoint, walletInstanceAttestation, authorizationDetails
|
|
33
|
+
return async (clientId, codeVerifier, redirectUri, responseMode, parEndpoint, walletInstanceAttestation, authorizationDetails) => {
|
|
35
34
|
const wiaPublicKey = await wiaCryptoContext.getPublicKey();
|
|
36
35
|
const parUrl = new URL(parEndpoint);
|
|
37
36
|
const aud = `${parUrl.protocol}//${parUrl.hostname}`;
|
|
@@ -66,26 +65,21 @@ const makeParRequest = _ref => {
|
|
|
66
65
|
code_challenge: codeChallenge,
|
|
67
66
|
code_challenge_method: codeChallengeMethod,
|
|
68
67
|
authorization_details: authorizationDetails,
|
|
69
|
-
redirect_uri: redirectUri
|
|
70
|
-
client_assertion_type: assertionType,
|
|
71
|
-
client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
|
|
68
|
+
redirect_uri: redirectUri
|
|
72
69
|
}).setIssuedAt() //iat is set to now
|
|
73
70
|
.setExpirationTime("5min").sign();
|
|
74
71
|
|
|
75
72
|
/** The request body for the Pushed Authorization Request */
|
|
76
73
|
var formBody = new URLSearchParams({
|
|
77
|
-
response_type: "code",
|
|
78
74
|
client_id: clientId,
|
|
79
|
-
|
|
80
|
-
code_challenge_method: "S256",
|
|
81
|
-
request: signedJwtForPar,
|
|
82
|
-
client_assertion_type: assertionType,
|
|
83
|
-
client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
|
|
75
|
+
request: signedJwtForPar
|
|
84
76
|
});
|
|
85
77
|
return await appFetch(parEndpoint, {
|
|
86
78
|
method: "POST",
|
|
87
79
|
headers: {
|
|
88
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
80
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
81
|
+
"OAuth-Client-Attestation": walletInstanceAttestation,
|
|
82
|
+
"OAuth-Client-Attestation-PoP": signedWiaPoP
|
|
89
83
|
},
|
|
90
84
|
body: formBody.toString()
|
|
91
85
|
}).then((0, _misc.hasStatusOrThrow)(201, _errors.IssuerResponseError)).then(res => res.json()).then(result => result.request_uri);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","z","_interopRequireWildcard","WalletInstanceAttestation","_misc","_pop","_errors","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationDetail","object","credential_configuration_id","string","
|
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","z","_interopRequireWildcard","WalletInstanceAttestation","_misc","_pop","_errors","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationDetail","object","credential_configuration_id","string","type","literal","exports","AuthorizationDetails","array","makeParRequest","_ref","wiaCryptoContext","appFetch","clientId","codeVerifier","redirectUri","responseMode","parEndpoint","walletInstanceAttestation","authorizationDetails","wiaPublicKey","getPublicKey","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","signedWiaPoP","createPopToken","jti","uuid","v4","codeChallengeMethod","codeChallenge","sha256ToBase64","signedJwtForPar","SignJWT","setProtectedHeader","typ","setPayload","response_type","response_mode","client_id","state","generateRandomAlphaNumericString","code_challenge","code_challenge_method","authorization_details","redirect_uri","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","request","method","headers","body","toString","then","hasStatusOrThrow","IssuerResponseError","res","json","result","request_uri"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAKA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,CAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAA+C,SAAAS,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAN,wBAAAU,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,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oB;MAC3CmC,YAAY,EAAEvC;IAChB,CAAC,CAAC,CACDwC,WAAW,CAAC,CAAC,CAAC;IAAA,CACdC,iBAAiB,CAAC,MAAM,CAAC,CACzBC,IAAI,CAAC,CAAC;;IAET;IACA,IAAIC,QAAQ,GAAG,IAAIC,eAAe,CAAC;MACjCX,SAAS,EAAEnC,QAAQ;MACnB+C,OAAO,EAAEnB;IACX,CAAC,CAAC;IAEF,OAAO,MAAM7B,QAAQ,CAACK,WAAW,EAAE;MACjC4C,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE,mCAAmC;QACnD,0BAA0B,EAAE5C,yBAAyB;QACrD,8BAA8B,EAAEe;MAClC,CAAC;MACD8B,IAAI,EAAEL,QAAQ,CAACM,QAAQ,CAAC;IAC1B,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,CAAEK,MAAM,IAAKA,MAAM,CAACC,WAAW,CAAC;EACzC,CAAC;AAAA;AAACjE,OAAA,CAAAG,cAAA,GAAAA,cAAA"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import * as Issuance from "./issuance";
|
|
2
2
|
import * as Presentation from "./presentation";
|
|
3
|
-
|
|
4
|
-
import * as Trustmark from "./trustmark";
|
|
5
|
-
export { Issuance, Presentation, Status, Trustmark };
|
|
3
|
+
export { Issuance, Presentation };
|
|
6
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Issuance","Presentation"
|
|
1
|
+
{"version":3,"names":["Issuance","Presentation"],"sourceRoot":"../../../src","sources":["credential/index.ts"],"mappings":"AAAA,OAAO,KAAKA,QAAQ,MAAM,YAAY;AACtC,OAAO,KAAKC,YAAY,MAAM,gBAAgB;AAC9C,SAASD,QAAQ,EAAEC,YAAY"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { getCredentialIssuerMetadata } from "../../entity/openid-connect/issuer";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Common configuration for the issuer.
|
|
5
|
+
* This is needed to have a common configuration for the issuer to be used in our flows.
|
|
6
|
+
* It allows to support multiple issuers with different configurations, defining a common interface to interact with them.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* WARNING: This function must be called after {@link startFlow}. The next function to be called is {@link startUserAuthorization}.
|
|
11
|
+
* Get the Issuer's configuration from the Issuer's metadata.
|
|
12
|
+
* Currently it only supports a mixed configuration based on OpenID Connect partial implementation.
|
|
13
|
+
* @param issuerUrl The base url of the Issuer returned by {@link startFlow}
|
|
14
|
+
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
|
15
|
+
* @returns The Issuer's configuration
|
|
16
|
+
*/
|
|
17
|
+
export const getIssuerConfig = async function (issuerUrl) {
|
|
18
|
+
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19
|
+
const res = await getCredentialIssuerMetadata(issuerUrl, {
|
|
20
|
+
appFetch: context.appFetch
|
|
21
|
+
});
|
|
22
|
+
return credentialIssuerRationalization(res);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Rationalize the issuer's metadata to the issuer's configuration which is then used in our flows to interact with the issuer.
|
|
27
|
+
* @param issuerMetadata - The issuer's metadata
|
|
28
|
+
* @returns the isssuer configuration to be used later in our flows
|
|
29
|
+
*/
|
|
30
|
+
const credentialIssuerRationalization = issuerMetadata => {
|
|
31
|
+
return {
|
|
32
|
+
issuerConf: {
|
|
33
|
+
credential_configurations_supported: issuerMetadata.credential_configurations_supported,
|
|
34
|
+
pushed_authorization_request_endpoint: issuerMetadata.pushed_authorization_request_endpoint,
|
|
35
|
+
authorization_endpoint: issuerMetadata.authorization_endpoint,
|
|
36
|
+
token_endpoint: issuerMetadata.token_endpoint,
|
|
37
|
+
credential_endpoint: issuerMetadata.credential_endpoint,
|
|
38
|
+
keys: issuerMetadata.jwks.keys
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=02-get-issuer-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getCredentialIssuerMetadata","getIssuerConfig","issuerUrl","context","arguments","length","undefined","res","appFetch","credentialIssuerRationalization","issuerMetadata","issuerConf","credential_configurations_supported","pushed_authorization_request_endpoint","authorization_endpoint","token_endpoint","credential_endpoint","keys","jwks"],"sourceRoot":"../../../../src","sources":["credential/issuance/02-get-issuer-config.ts"],"mappings":"AAGA,SAASA,2BAA2B,QAAQ,oCAAoC;;AAUhF;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,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,MAAMP,2BAA2B,CAACE,SAAS,EAAE;IACvDM,QAAQ,EAAEL,OAAO,CAACK;EACpB,CAAC,CAAC;EAEF,OAAOC,+BAA+B,CAACF,GAAG,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAME,+BAA+B,GACnCC,cAAuE,IAC9B;EACzC,OAAO;IACLC,UAAU,EAAE;MACVC,mCAAmC,EACjCF,cAAc,CAACE,mCAAmC;MACpDC,qCAAqC,EACnCH,cAAc,CAACG,qCAAqC;MACtDC,sBAAsB,EAAEJ,cAAc,CAACI,sBAAsB;MAC7DC,cAAc,EAAEL,cAAc,CAACK,cAAc;MAC7CC,mBAAmB,EAAEN,cAAc,CAACM,mBAAmB;MACvDC,IAAI,EAAEP,cAAc,CAACQ,IAAI,CAACD;IAC5B;EACF,CAAC;AACH,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { generateRandomAlphaNumericString } from "../../utils/misc";
|
|
2
2
|
import { makeParRequest } from "../../utils/par";
|
|
3
|
-
import { ASSERTION_TYPE } from "./const";
|
|
4
3
|
/**
|
|
5
4
|
* Ensures that the credential type requested is supported by the issuer and contained in the
|
|
6
5
|
* issuer configuration.
|
|
7
|
-
* @param issuerConf The issuer configuration returned by {@link
|
|
6
|
+
* @param issuerConf The issuer configuration returned by {@link getIssuerConfig}
|
|
8
7
|
* @param credentialType The type of the credential to be requested returned by {@link startFlow}
|
|
9
8
|
* @param context.wiaCryptoContext The Wallet Instance's crypto context
|
|
10
9
|
* @param context.walletInstanceAttestation The Wallet Instance's attestation
|
|
@@ -13,15 +12,16 @@ import { ASSERTION_TYPE } from "./const";
|
|
|
13
12
|
* @returns The credential definition to be used in the request which includes the format and the type and its type
|
|
14
13
|
*/
|
|
15
14
|
const selectCredentialDefinition = (issuerConf, credentialType) => {
|
|
16
|
-
const credential_configurations_supported = issuerConf.
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
format: credential_configurations_supported[e].format,
|
|
20
|
-
type: "openid_credential"
|
|
21
|
-
}));
|
|
22
|
-
if (!result) {
|
|
15
|
+
const credential_configurations_supported = issuerConf.credential_configurations_supported;
|
|
16
|
+
const credential = credential_configurations_supported[credentialType];
|
|
17
|
+
if (!credential) {
|
|
23
18
|
throw new Error(`No credential support the type '${credentialType}'`);
|
|
24
19
|
}
|
|
20
|
+
const result = {
|
|
21
|
+
credential_configuration_id: credentialType,
|
|
22
|
+
format: credential.format,
|
|
23
|
+
type: "openid_credential"
|
|
24
|
+
};
|
|
25
25
|
return result;
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -29,19 +29,15 @@ const selectCredentialDefinition = (issuerConf, credentialType) => {
|
|
|
29
29
|
* Ensures that the response mode requested is supported by the issuer and contained in the issuer configuration.
|
|
30
30
|
* @param issuerConf The issuer configuration
|
|
31
31
|
* @param credentialType The type of the credential to be requested
|
|
32
|
-
* @returns The response mode to be used in the request, "query" for
|
|
32
|
+
* @returns The response mode to be used in the request, "query" for urn:eu.europa.ec.eudi:pid:1 and "form_post.jwt" for all other types.
|
|
33
33
|
*/
|
|
34
|
-
const selectResponseMode =
|
|
35
|
-
const
|
|
36
|
-
const responseMode = credentialType === "PersonIdentificationData" ? "query" : "form_post.jwt";
|
|
37
|
-
if (!responseModeSupported.includes(responseMode)) {
|
|
38
|
-
throw new Error(`No response mode support the type '${credentialType}'`);
|
|
39
|
-
}
|
|
34
|
+
const selectResponseMode = credentialType => {
|
|
35
|
+
const responseMode = credentialType === "urn:eu.europa.ec.eudi:pid:1" ? "query" : "form_post.jwt";
|
|
40
36
|
return responseMode;
|
|
41
37
|
};
|
|
42
38
|
|
|
43
39
|
/**
|
|
44
|
-
* WARNING: This function must be called after {@link
|
|
40
|
+
* WARNING: This function must be called after {@link getIssuerConfig} and {@link startFlow}. The next steam is {@link compeUserAuthorizationWithQueryMode} or {@link compeUserAuthorizationWithFormPostJwtMode}
|
|
45
41
|
* Creates and sends a PAR request to the /as/par endpoint of the authorization server.
|
|
46
42
|
* This starts the authentication flow to obtain an access token.
|
|
47
43
|
* This token enables the Wallet Instance to request a digital credential from the Credential Endpoint of the Credential Issuer.
|
|
@@ -67,14 +63,14 @@ export const startUserAuthorization = async (issuerConf, credentialType, ctx) =>
|
|
|
67
63
|
} = ctx;
|
|
68
64
|
const clientId = await wiaCryptoContext.getPublicKey().then(_ => _.kid);
|
|
69
65
|
const codeVerifier = generateRandomAlphaNumericString(64);
|
|
70
|
-
const parEndpoint = issuerConf.
|
|
66
|
+
const parEndpoint = issuerConf.pushed_authorization_request_endpoint;
|
|
71
67
|
const credentialDefinition = selectCredentialDefinition(issuerConf, credentialType);
|
|
72
|
-
const responseMode = selectResponseMode(
|
|
68
|
+
const responseMode = selectResponseMode(credentialType);
|
|
73
69
|
const getPar = makeParRequest({
|
|
74
70
|
wiaCryptoContext,
|
|
75
71
|
appFetch
|
|
76
72
|
});
|
|
77
|
-
const issuerRequestUri = await getPar(clientId, codeVerifier, redirectUri, responseMode, parEndpoint, walletInstanceAttestation, [credentialDefinition]
|
|
73
|
+
const issuerRequestUri = await getPar(clientId, codeVerifier, redirectUri, responseMode, parEndpoint, walletInstanceAttestation, [credentialDefinition]);
|
|
78
74
|
return {
|
|
79
75
|
issuerRequestUri,
|
|
80
76
|
clientId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["generateRandomAlphaNumericString","makeParRequest","
|
|
1
|
+
{"version":3,"names":["generateRandomAlphaNumericString","makeParRequest","selectCredentialDefinition","issuerConf","credentialType","credential_configurations_supported","credential","Error","result","credential_configuration_id","format","type","selectResponseMode","responseMode","startUserAuthorization","ctx","wiaCryptoContext","walletInstanceAttestation","redirectUri","appFetch","fetch","clientId","getPublicKey","then","_","kid","codeVerifier","parEndpoint","pushed_authorization_request_endpoint","credentialDefinition","getPar","issuerRequestUri"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-user-authorization.ts"],"mappings":"AAEA,SAASA,gCAAgC,QAAkB,kBAAkB;AAE7E,SAA8BC,cAAc,QAAQ,iBAAiB;AAmBrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAGA,CACjCC,UAA8C,EAC9CC,cAAgD,KACxB;EACxB,MAAMC,mCAAmC,GACvCF,UAAU,CAACE,mCAAmC;EAEhD,MAAMC,UAAU,GAAGD,mCAAmC,CAACD,cAAc,CAAC;EAEtE,IAAI,CAACE,UAAU,EAAE;IACf,MAAM,IAAIC,KAAK,CAAE,mCAAkCH,cAAe,GAAE,CAAC;EACvE;EAEA,MAAMI,MAAM,GAAG;IACbC,2BAA2B,EAAEL,cAAc;IAC3CM,MAAM,EAAEJ,UAAU,CAACI,MAAM;IACzBC,IAAI,EAAE;EACR,CAAC;EAED,OAAOH,MAAM;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,kBAAkB,GACtBR,cAAgD,IAC/B;EACjB,MAAMS,YAAY,GAChBT,cAAc,KAAK,6BAA6B,GAC5C,OAAO,GACP,eAAe;EAErB,OAAOS,YAAY;AACrB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAA8C,GAAG,MAAAA,CAC5DX,UAAU,EACVC,cAAc,EACdW,GAAG,KACA;EACH,MAAM;IACJC,gBAAgB;IAChBC,yBAAyB;IACzBC,WAAW;IACXC,QAAQ,GAAGC;EACb,CAAC,GAAGL,GAAG;EAEP,MAAMM,QAAQ,GAAG,MAAML,gBAAgB,CAACM,YAAY,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,GAAG,CAAC;EACzE,MAAMC,YAAY,GAAG1B,gCAAgC,CAAC,EAAE,CAAC;EACzD,MAAM2B,WAAW,GAAGxB,UAAU,CAACyB,qCAAqC;EACpE,MAAMC,oBAAoB,GAAG3B,0BAA0B,CACrDC,UAAU,EACVC,cACF,CAAC;EACD,MAAMS,YAAY,GAAGD,kBAAkB,CAACR,cAAc,CAAC;EAEvD,MAAM0B,MAAM,GAAG7B,cAAc,CAAC;IAAEe,gBAAgB;IAAEG;EAAS,CAAC,CAAC;EAC7D,MAAMY,gBAAgB,GAAG,MAAMD,MAAM,CACnCT,QAAQ,EACRK,YAAY,EACZR,WAAW,EACXL,YAAY,EACZc,WAAW,EACXV,yBAAyB,EACzB,CAACY,oBAAoB,CACvB,CAAC;EAED,OAAO;IAAEE,gBAAgB;IAAEV,QAAQ;IAAEK,YAAY;IAAEG;EAAqB,CAAC;AAC3E,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { getJwtFromFormPost } from "../../utils/decoder";
|
|
|
10
10
|
import { AuthorizationError, AuthorizationIdpError } from "./errors";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* The interface of the phase to complete User authorization via strong identification when the response mode is "query" and the request credential is a
|
|
13
|
+
* The interface of the phase to complete User authorization via strong identification when the response mode is "query" and the request credential is a urn:eu.europa.ec.eudi:pid:1.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -18,12 +18,12 @@ import { AuthorizationError, AuthorizationIdpError } from "./errors";
|
|
|
18
18
|
* Builds the authorization URL to which the end user should be redirected to continue the authentication flow.
|
|
19
19
|
* @param issuerRequestUri the URI of the issuer where the request is sent
|
|
20
20
|
* @param clientId Identifies the current client across all the requests of the issuing flow returned by {@link startUserAuthorization}
|
|
21
|
-
* @param issuerConf The issuer configuration returned by {@link
|
|
21
|
+
* @param issuerConf The issuer configuration returned by {@link getIssuerConfig}
|
|
22
22
|
* @param idpHint Unique identifier of the IDP selected by the user
|
|
23
23
|
* @returns An object containing the authorization URL
|
|
24
24
|
*/
|
|
25
25
|
export const buildAuthorizationUrl = async (issuerRequestUri, clientId, issuerConf, idpHint) => {
|
|
26
|
-
const authzRequestEndpoint = issuerConf.
|
|
26
|
+
const authzRequestEndpoint = issuerConf.authorization_endpoint;
|
|
27
27
|
const params = new URLSearchParams({
|
|
28
28
|
client_id: clientId,
|
|
29
29
|
request_uri: issuerRequestUri,
|
|
@@ -37,7 +37,7 @@ export const buildAuthorizationUrl = async (issuerRequestUri, clientId, issuerCo
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* WARNING: This function must be called after obtaining the authorization redirect URL from the webviews (SPID and CIE L3) or browser for CIEID.
|
|
40
|
-
* Complete User authorization via strong identification when the response mode is "query" and the request credential is a
|
|
40
|
+
* Complete User authorization via strong identification when the response mode is "query" and the request credential is a urn:eu.europa.ec.eudi:pid:1.
|
|
41
41
|
* This function parses the authorization redirect URL to extract the authorization response.
|
|
42
42
|
* @param authRedirectUrl The URL to which the end user should be redirected to start the authentication flow
|
|
43
43
|
* @returns the authorization response which contains code, state and iss
|
|
@@ -54,14 +54,14 @@ export const completeUserAuthorizationWithQueryMode = async authRedirectUrl => {
|
|
|
54
54
|
* The information is obtained by performing a GET request to the authorization endpoint with request_uri and client_id parameters.
|
|
55
55
|
* @param issuerRequestUri the URI of the issuer where the request is sent
|
|
56
56
|
* @param clientId Identifies the current client across all the requests of the issuing flow returned by {@link startUserAuthorization}
|
|
57
|
-
* @param issuerConf The issuer configuration returned by {@link
|
|
57
|
+
* @param issuerConf The issuer configuration returned by {@link getIssuerConfig}
|
|
58
58
|
* @param appFetch (optional) fetch api implementation. Default: built-in fetch
|
|
59
59
|
* @throws {ValidationFailed} if an error while validating the response
|
|
60
60
|
* @returns the request object which contains the credential to be presented in order to obtain the requested credential
|
|
61
61
|
*/
|
|
62
62
|
export const getRequestedCredentialToBePresented = async function (issuerRequestUri, clientId, issuerConf) {
|
|
63
63
|
let appFetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : fetch;
|
|
64
|
-
const authzRequestEndpoint = issuerConf.
|
|
64
|
+
const authzRequestEndpoint = issuerConf.authorization_endpoint;
|
|
65
65
|
const params = new URLSearchParams({
|
|
66
66
|
client_id: clientId,
|
|
67
67
|
request_uri: issuerRequestUri
|
|
@@ -85,7 +85,7 @@ export const getRequestedCredentialToBePresented = async function (issuerRequest
|
|
|
85
85
|
* The information is obtained by performing a GET request to the authorization endpoint with request_uri and client_id parameters.
|
|
86
86
|
* @param issuerRequestUri the URI of the issuer where the request is sent
|
|
87
87
|
* @param clientId Identifies the current client across all the requests of the issuing flow returned by {@link startUserAuthorization}
|
|
88
|
-
* @param issuerConf The issuer configuration returned by {@link
|
|
88
|
+
* @param issuerConf The issuer configuration returned by {@link getIssuerConfig}
|
|
89
89
|
* @param context.walletInstanceAccestation the Wallet Instance's attestation to be presented
|
|
90
90
|
* @param context.pid the PID to be presented
|
|
91
91
|
* @param context.wiaCryptoContext The Wallet Instance's crypto context associated with the walletInstanceAttestation parameter
|
|
@@ -126,7 +126,7 @@ export const completeUserAuthorizationWithFormPostJwtMode = async (requestObject
|
|
|
126
126
|
definition_id: `${uuid.v4()}`,
|
|
127
127
|
id: `${uuid.v4()}`,
|
|
128
128
|
descriptor_map: [{
|
|
129
|
-
id: "
|
|
129
|
+
id: "urn:eu.europa.ec.eudi:pid:1",
|
|
130
130
|
path: "$.vp_token[0].vp",
|
|
131
131
|
format: "vc+sd-jwt"
|
|
132
132
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AuthorizationErrorShape","AuthorizationResultShape","hasStatusOrThrow","parseUrl","IssuerResponseError","ValidationFailed","decode","encodeBase64","SignJWT","RequestObject","uuid","ResponseUriResultShape","getJwtFromFormPost","AuthorizationError","AuthorizationIdpError","buildAuthorizationUrl","issuerRequestUri","clientId","issuerConf","idpHint","authzRequestEndpoint","
|
|
1
|
+
{"version":3,"names":["AuthorizationErrorShape","AuthorizationResultShape","hasStatusOrThrow","parseUrl","IssuerResponseError","ValidationFailed","decode","encodeBase64","SignJWT","RequestObject","uuid","ResponseUriResultShape","getJwtFromFormPost","AuthorizationError","AuthorizationIdpError","buildAuthorizationUrl","issuerRequestUri","clientId","issuerConf","idpHint","authzRequestEndpoint","authorization_endpoint","params","URLSearchParams","client_id","request_uri","idphint","authUrl","completeUserAuthorizationWithQueryMode","authRedirectUrl","query","parseAuthorizationResponse","getRequestedCredentialToBePresented","appFetch","arguments","length","undefined","fetch","requestObject","toString","method","then","res","text","jws","reqObj","safeParse","payload","success","message","reason","error","data","completeUserAuthorizationWithFormPostJwtMode","ctx","wiaCryptoContext","pidCryptoContext","pid","walletInstanceAttestation","wiaWpToken","setProtectedHeader","alg","typ","setPayload","vp","jti","v4","nonce","setIssuedAt","setExpirationTime","setAudience","response_uri","sign","pidWpToken","presentationSubmission","definition_id","id","descriptor_map","path","format","authzResponsePayload","JSON","stringify","state","presentation_submission","vp_token","body","response","resUriRes","headers","reqUri","json","responseUri","redirect_uri","cbRes","decodedJwt","authRes","authResParsed","authErr","error_description"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,wBAAwB,QAEnB,kBAAkB;AACzB,SAASC,gBAAgB,QAAkB,kBAAkB;AAE7D,OAAOC,QAAQ,MAAM,WAAW;AAChC,SAASC,mBAAmB,EAAEC,gBAAgB,QAAQ,oBAAoB;AAE1E,SACEC,MAAM,EACNC,YAAY,EACZC,OAAO,QAEF,6BAA6B;AACpC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,sBAAsB,QAAQ,SAAS;AAChD,SAASC,kBAAkB,QAAQ,qBAAqB;AACxD,SAASC,kBAAkB,EAAEC,qBAAqB,QAAQ,UAAU;;AAEpE;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAA4C,GAAG,MAAAA,CAC1DC,gBAAgB,EAChBC,QAAQ,EACRC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,oBAAoB,GAAGF,UAAU,CAACG,sBAAsB;EAE9D,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC;IACjCC,SAAS,EAAEP,QAAQ;IACnBQ,WAAW,EAAET,gBAAgB;IAC7BU,OAAO,EAAEP;EACX,CAAC,CAAC;EAEF,MAAMQ,OAAO,GAAI,GAAEP,oBAAqB,IAAGE,MAAO,EAAC;EAEnD,OAAO;IAAEK;EAAQ,CAAC;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sCAA8E,GACzF,MAAOC,eAAe,IAAK;EACzB,MAAMC,KAAK,GAAG3B,QAAQ,CAAC0B,eAAe,CAAC,CAACC,KAAK;EAE7C,OAAOC,0BAA0B,CAACD,KAAK,CAAC;AAC1C,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,mCAAwE,GACn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,CAAC,CAAC,CACzBF,IAAI,CAAC7B,kBAAkB,CAAC,CACxB6B,IAAI,CAAEqD,KAAK,IAAK/D,0BAA0B,CAAC+D,KAAK,CAACC,UAAU,CAAChD,OAAO,CAAC,CAAC;AAC1E,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMhB,0BAA0B,GACrCiE,OAAgB,IACQ;EACxB,MAAMC,aAAa,GAAGhG,wBAAwB,CAAC6C,SAAS,CAACkD,OAAO,CAAC;EACjE,IAAI,CAACC,aAAa,CAACjD,OAAO,EAAE;IAC1B,MAAMkD,OAAO,GAAGlG,uBAAuB,CAAC8C,SAAS,CAACkD,OAAO,CAAC;IAC1D,IAAI,CAACE,OAAO,CAAClD,OAAO,EAAE;MACpB,MAAM,IAAInC,kBAAkB,CAACoF,aAAa,CAAC9C,KAAK,CAACF,OAAO,CAAC,CAAC,CAAC;IAC7D;;IACA,MAAM,IAAInC,qBAAqB,CAC7BoF,OAAO,CAAC9C,IAAI,CAACD,KAAK,EAClB+C,OAAO,CAAC9C,IAAI,CAAC+C,iBACf,CAAC;EACH;EACA,OAAOF,aAAa,CAAC7C,IAAI;AAC3B,CAAC"}
|
|
@@ -3,7 +3,6 @@ import { createDPopToken } from "../../utils/dpop";
|
|
|
3
3
|
import uuid from "react-native-uuid";
|
|
4
4
|
import { createPopToken } from "../../utils/pop";
|
|
5
5
|
import * as WalletInstanceAttestation from "../../wallet-instance-attestation";
|
|
6
|
-
import { ASSERTION_TYPE } from "./const";
|
|
7
6
|
import { TokenResponse } from "./types";
|
|
8
7
|
import { IssuerResponseError, ValidationFailed } from "../../utils/errors";
|
|
9
8
|
/**
|
|
@@ -11,7 +10,7 @@ import { IssuerResponseError, ValidationFailed } from "../../utils/errors";
|
|
|
11
10
|
* for requesting the issuance of an access token bound to the public key of the Wallet Instance contained within the DPoP.
|
|
12
11
|
* This enables the Wallet Instance to request a digital credential.
|
|
13
12
|
* The DPoP Proof JWT is generated according to the section 4.3 of the DPoP RFC 9449 specification.
|
|
14
|
-
* @param issuerConf The issuer configuration returned by {@link
|
|
13
|
+
* @param issuerConf The issuer configuration returned by {@link getIssuerConfig}
|
|
15
14
|
* @param code The authorization code returned by {@link completeUserAuthorizationWithQueryMode} or {@link completeUserAuthorizationWithFormPost}
|
|
16
15
|
* @param redirectUri The redirect URI which is the custom URL scheme that the Wallet Instance is registered to handle
|
|
17
16
|
* @param clientId The client id returned by {@link startUserAuthorization}
|
|
@@ -31,11 +30,11 @@ export const authorizeAccess = async (issuerConf, code, clientId, redirectUri, c
|
|
|
31
30
|
wiaCryptoContext,
|
|
32
31
|
dPopCryptoContext
|
|
33
32
|
} = context;
|
|
34
|
-
const parEndpoint = issuerConf.
|
|
33
|
+
const parEndpoint = issuerConf.pushed_authorization_request_endpoint;
|
|
35
34
|
const parUrl = new URL(parEndpoint);
|
|
36
35
|
const aud = `${parUrl.protocol}//${parUrl.hostname}`;
|
|
37
36
|
const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
|
|
38
|
-
const tokenUrl = issuerConf.
|
|
37
|
+
const tokenUrl = issuerConf.token_endpoint;
|
|
39
38
|
const tokenRequestSignedDPop = await createDPopToken({
|
|
40
39
|
htm: "POST",
|
|
41
40
|
htu: tokenUrl,
|
|
@@ -47,20 +46,20 @@ export const authorizeAccess = async (issuerConf, code, clientId, redirectUri, c
|
|
|
47
46
|
iss
|
|
48
47
|
}, wiaCryptoContext);
|
|
49
48
|
const requestBody = {
|
|
50
|
-
grant_type: "authorization_code",
|
|
51
49
|
client_id: clientId,
|
|
50
|
+
grant_type: "authorization_code",
|
|
52
51
|
code,
|
|
53
52
|
redirect_uri: redirectUri,
|
|
54
|
-
code_verifier: codeVerifier
|
|
55
|
-
client_assertion_type: ASSERTION_TYPE,
|
|
56
|
-
client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
|
|
53
|
+
code_verifier: codeVerifier
|
|
57
54
|
};
|
|
58
55
|
const authorizationRequestFormBody = new URLSearchParams(requestBody);
|
|
59
56
|
const tokenRes = await appFetch(tokenUrl, {
|
|
60
57
|
method: "POST",
|
|
61
58
|
headers: {
|
|
62
59
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
63
|
-
DPoP: tokenRequestSignedDPop
|
|
60
|
+
DPoP: tokenRequestSignedDPop,
|
|
61
|
+
"OAuth-Client-Attestation": walletInstanceAttestation,
|
|
62
|
+
"OAuth-Client-Attestation-PoP": signedWiaPoP
|
|
64
63
|
},
|
|
65
64
|
body: authorizationRequestFormBody.toString()
|
|
66
65
|
}).then(hasStatusOrThrow(200, IssuerResponseError)).then(res => res.json()).then(body => TokenResponse.safeParse(body));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["hasStatusOrThrow","createDPopToken","uuid","createPopToken","WalletInstanceAttestation","
|
|
1
|
+
{"version":3,"names":["hasStatusOrThrow","createDPopToken","uuid","createPopToken","WalletInstanceAttestation","TokenResponse","IssuerResponseError","ValidationFailed","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","dPopCryptoContext","parEndpoint","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","tokenRequestSignedDPop","htm","htu","jti","v4","signedWiaPoP","requestBody","client_id","grant_type","redirect_uri","code_verifier","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","res","json","safeParse","success","message","reason","error","accessToken","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":"AAAA,SAASA,gBAAgB,QAAkB,kBAAkB;AAG7D,SAASC,eAAe,QAAQ,kBAAkB;AAClD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,cAAc,QAAQ,iBAAiB;AAChD,OAAO,KAAKC,yBAAyB,MAAM,mCAAmC;AAE9E,SAASC,aAAa,QAAQ,SAAS;AACvC,SAAS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