@pagopa/io-react-native-wallet 3.1.2 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/credential/issuance/README.md +44 -17
- package/lib/commonjs/credential/issuance/common/02-start-user-authorization.js +4 -3
- package/lib/commonjs/credential/issuance/common/02-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +37 -8
- package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
- package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js +46 -38
- package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -1
- package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js +58 -51
- package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -1
- package/lib/commonjs/credential/issuance/mrtd-pop/index.js +21 -5
- package/lib/commonjs/credential/issuance/mrtd-pop/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js +3 -3
- package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.0.0/03-complete-user-authorization.js +5 -2
- package/lib/commonjs/credential/issuance/v1.0.0/03-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.0.0/05-obtain-credential.js +5 -1
- package/lib/commonjs/credential/issuance/v1.0.0/05-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.0.0/index.js +2 -1
- package/lib/commonjs/credential/issuance/v1.0.0/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.0.0/mappers.js +1 -1
- package/lib/commonjs/credential/issuance/v1.0.0/mappers.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +0 -2
- package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js +20 -16
- package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/04-authorize-access.js +20 -19
- package/lib/commonjs/credential/issuance/v1.3.3/04-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js +150 -57
- package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/06-verify-and-parse-credential.js +4 -1
- package/lib/commonjs/credential/issuance/v1.3.3/06-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/index.js +2 -1
- package/lib/commonjs/credential/issuance/v1.3.3/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/mappers.js +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/mappers.js.map +1 -1
- package/lib/commonjs/credential/presentation/api/types.js.map +1 -1
- package/lib/commonjs/credential/presentation/{v1.3.3/utils.mdoc.js → common/utils/mdoc.js} +2 -2
- package/lib/commonjs/credential/presentation/common/utils/mdoc.js.map +1 -0
- package/lib/commonjs/credential/presentation/v1.0.0/05-verify-request-object.js +18 -12
- package/lib/commonjs/credential/presentation/v1.0.0/05-verify-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/07-send-authorization-response.js +3 -0
- package/lib/commonjs/credential/presentation/v1.0.0/07-send-authorization-response.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/index.js +0 -2
- package/lib/commonjs/credential/presentation/v1.0.0/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/mappers.js +23 -13
- package/lib/commonjs/credential/presentation/v1.0.0/mappers.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/types.js +25 -17
- package/lib/commonjs/credential/presentation/v1.0.0/types.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/05-verify-request-object.js +29 -6
- package/lib/commonjs/credential/presentation/v1.3.3/05-verify-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/06-evaluate-dcql-query.js +2 -2
- package/lib/commonjs/credential/presentation/v1.3.3/06-evaluate-dcql-query.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/07-send-authorization-response.js +9 -6
- package/lib/commonjs/credential/presentation/v1.3.3/07-send-authorization-response.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/mappers.js +25 -13
- package/lib/commonjs/credential/presentation/v1.3.3/mappers.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/types.js +6 -3
- package/lib/commonjs/credential/presentation/v1.3.3/types.js.map +1 -1
- package/lib/commonjs/credential/status/README.md +3 -2
- package/lib/commonjs/credential/status/v1.3.3/01-status-list.js +27 -5
- package/lib/commonjs/credential/status/v1.3.3/01-status-list.js.map +1 -1
- package/lib/commonjs/credential/status/v1.3.3/02-verify-and-parse-status-list.js +17 -6
- package/lib/commonjs/credential/status/v1.3.3/02-verify-and-parse-status-list.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js +26 -1
- package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.js +4 -0
- package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-translations.js +5 -3
- package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-translations.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js +9 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/types.js +49 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/types.js.map +1 -1
- package/lib/commonjs/mdoc/index.js +3 -24
- package/lib/commonjs/mdoc/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/types.test.js +2 -14
- package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/utils.test.js +0 -12
- package/lib/commonjs/sd-jwt/__test__/utils.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +1 -14
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/utils/callbacks.js +45 -7
- package/lib/commonjs/utils/callbacks.js.map +1 -1
- package/lib/commonjs/utils/crypto.js +58 -5
- package/lib/commonjs/utils/crypto.js.map +1 -1
- package/lib/commonjs/utils/x509.js +34 -0
- package/lib/commonjs/utils/x509.js.map +1 -0
- package/lib/commonjs/wallet-instance-attestation/api/types.js +0 -2
- package/lib/commonjs/wallet-instance-attestation/api/types.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/mappers.js +1 -14
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/mappers.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js +2 -7
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
- package/lib/commonjs/wallet-unit-attestation/api/types.js +0 -11
- package/lib/commonjs/wallet-unit-attestation/api/types.js.map +1 -1
- package/lib/module/credential/issuance/README.md +44 -17
- package/lib/module/credential/issuance/common/02-start-user-authorization.js +4 -3
- package/lib/module/credential/issuance/common/02-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +39 -10
- package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
- package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js +47 -34
- package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -1
- package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js +58 -47
- package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -1
- package/lib/module/credential/issuance/mrtd-pop/index.js +20 -5
- package/lib/module/credential/issuance/mrtd-pop/index.js.map +1 -1
- package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js +1 -1
- package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/v1.0.0/03-complete-user-authorization.js +6 -3
- package/lib/module/credential/issuance/v1.0.0/03-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/v1.0.0/05-obtain-credential.js +4 -1
- package/lib/module/credential/issuance/v1.0.0/05-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/v1.0.0/index.js +4 -3
- package/lib/module/credential/issuance/v1.0.0/index.js.map +1 -1
- package/lib/module/credential/issuance/v1.0.0/mappers.js +1 -1
- package/lib/module/credential/issuance/v1.0.0/mappers.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +0 -2
- package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js +20 -16
- package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js +1 -1
- package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/04-authorize-access.js +22 -19
- package/lib/module/credential/issuance/v1.3.3/04-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js +147 -55
- package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/06-verify-and-parse-credential.js +4 -1
- package/lib/module/credential/issuance/v1.3.3/06-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/index.js +4 -3
- package/lib/module/credential/issuance/v1.3.3/index.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/mappers.js +1 -1
- package/lib/module/credential/issuance/v1.3.3/mappers.js.map +1 -1
- package/lib/module/credential/presentation/api/types.js.map +1 -1
- package/lib/module/credential/presentation/{v1.3.3/utils.mdoc.js → common/utils/mdoc.js} +2 -2
- package/lib/module/credential/presentation/common/utils/mdoc.js.map +1 -0
- package/lib/module/credential/presentation/v1.0.0/05-verify-request-object.js +13 -7
- package/lib/module/credential/presentation/v1.0.0/05-verify-request-object.js.map +1 -1
- package/lib/module/credential/presentation/v1.0.0/07-send-authorization-response.js +4 -1
- package/lib/module/credential/presentation/v1.0.0/07-send-authorization-response.js.map +1 -1
- package/lib/module/credential/presentation/v1.0.0/index.js +0 -2
- package/lib/module/credential/presentation/v1.0.0/index.js.map +1 -1
- package/lib/module/credential/presentation/v1.0.0/mappers.js +23 -13
- package/lib/module/credential/presentation/v1.0.0/mappers.js.map +1 -1
- package/lib/module/credential/presentation/v1.0.0/types.js +23 -15
- package/lib/module/credential/presentation/v1.0.0/types.js.map +1 -1
- package/lib/module/credential/presentation/v1.3.3/05-verify-request-object.js +28 -6
- package/lib/module/credential/presentation/v1.3.3/05-verify-request-object.js.map +1 -1
- package/lib/module/credential/presentation/v1.3.3/06-evaluate-dcql-query.js +2 -3
- package/lib/module/credential/presentation/v1.3.3/06-evaluate-dcql-query.js.map +1 -1
- package/lib/module/credential/presentation/v1.3.3/07-send-authorization-response.js +9 -6
- package/lib/module/credential/presentation/v1.3.3/07-send-authorization-response.js.map +1 -1
- package/lib/module/credential/presentation/v1.3.3/mappers.js +25 -13
- package/lib/module/credential/presentation/v1.3.3/mappers.js.map +1 -1
- package/lib/module/credential/presentation/v1.3.3/types.js +5 -2
- package/lib/module/credential/presentation/v1.3.3/types.js.map +1 -1
- package/lib/module/credential/status/README.md +3 -2
- package/lib/module/credential/status/v1.3.3/01-status-list.js +27 -5
- package/lib/module/credential/status/v1.3.3/01-status-list.js.map +1 -1
- package/lib/module/credential/status/v1.3.3/02-verify-and-parse-status-list.js +17 -6
- package/lib/module/credential/status/v1.3.3/02-verify-and-parse-status-list.js.map +1 -1
- package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js +24 -0
- package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.js +5 -1
- package/lib/module/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/fetch-translations.js +5 -3
- package/lib/module/credentials-catalogue/v1.3.3/fetch-translations.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/mappers.js +9 -1
- package/lib/module/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/types.js +47 -0
- package/lib/module/credentials-catalogue/v1.3.3/types.js.map +1 -1
- package/lib/module/mdoc/index.js +3 -24
- package/lib/module/mdoc/index.js.map +1 -1
- package/lib/module/sd-jwt/__test__/types.test.js +2 -14
- package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/utils.test.js +0 -12
- package/lib/module/sd-jwt/__test__/utils.test.js.map +1 -1
- package/lib/module/sd-jwt/types.js +1 -14
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/utils/callbacks.js +45 -8
- package/lib/module/utils/callbacks.js.map +1 -1
- package/lib/module/utils/crypto.js +57 -6
- package/lib/module/utils/crypto.js.map +1 -1
- package/lib/module/utils/x509.js +28 -0
- package/lib/module/utils/x509.js.map +1 -0
- package/lib/module/wallet-instance-attestation/api/types.js +0 -2
- package/lib/module/wallet-instance-attestation/api/types.js.map +1 -1
- package/lib/module/wallet-instance-attestation/v1.3.3/mappers.js +1 -14
- package/lib/module/wallet-instance-attestation/v1.3.3/mappers.js.map +1 -1
- package/lib/module/wallet-instance-attestation/v1.3.3/types.js +2 -7
- package/lib/module/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
- package/lib/module/wallet-unit-attestation/api/types.js +0 -11
- package/lib/module/wallet-unit-attestation/api/types.js.map +1 -1
- package/lib/typescript/credential/issuance/api/05-obtain-credential.d.ts +20 -0
- package/lib/typescript/credential/issuance/api/05-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/api/06-verify-and-parse-credential.d.ts +4 -0
- package/lib/typescript/credential/issuance/api/06-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/common/02-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/common/06-verify-and-parse-credential.sdjwt.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts +12 -1
- package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts +12 -1
- package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts +2 -1
- package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.0.0/03-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.0.0/05-obtain-credential.d.ts +1 -0
- package/lib/typescript/credential/issuance/v1.0.0/05-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.0.0/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/01-evaluate-issuer-trust.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/02-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/04-authorize-access.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/05-obtain-credential.d.ts +23 -2
- package/lib/typescript/credential/issuance/v1.3.3/05-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/06-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/api/04-verify-certificate-chain.d.ts +9 -2
- package/lib/typescript/credential/presentation/api/04-verify-certificate-chain.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/api/05-verify-request-object.d.ts +2 -2
- package/lib/typescript/credential/presentation/api/05-verify-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/api/07-send-authorization-response.d.ts +2 -2
- package/lib/typescript/credential/presentation/api/07-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/api/types.d.ts +18 -0
- package/lib/typescript/credential/presentation/api/types.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/{v1.3.3/utils.mdoc.d.ts → common/utils/mdoc.d.ts} +2 -2
- package/lib/typescript/credential/presentation/common/utils/mdoc.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/v1.0.0/05-verify-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/07-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/index.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/mappers.d.ts +21 -13
- package/lib/typescript/credential/presentation/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/types.d.ts +23 -15
- package/lib/typescript/credential/presentation/v1.0.0/types.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/05-verify-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/06-evaluate-dcql-query.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/07-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/mappers.d.ts +89 -79
- package/lib/typescript/credential/presentation/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/types.d.ts +87 -79
- package/lib/typescript/credential/presentation/v1.3.3/types.d.ts.map +1 -1
- package/lib/typescript/credential/status/api/status-list.d.ts +8 -4
- package/lib/typescript/credential/status/api/status-list.d.ts.map +1 -1
- package/lib/typescript/credential/status/v1.3.3/01-status-list.d.ts.map +1 -1
- package/lib/typescript/credential/status/v1.3.3/02-verify-and-parse-status-list.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts +73 -0
- package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/api/index.d.ts +6 -5
- package/lib/typescript/credentials-catalogue/api/index.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts +25 -0
- package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/fetch-translations.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts +51 -0
- package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/types.d.ts +33 -0
- package/lib/typescript/credentials-catalogue/v1.3.3/types.d.ts.map +1 -1
- package/lib/typescript/mdoc/index.d.ts +1 -1
- package/lib/typescript/mdoc/index.d.ts.map +1 -1
- package/lib/typescript/mdoc/utils.d.ts +0 -24
- package/lib/typescript/mdoc/utils.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +0 -12
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/utils/callbacks.d.ts +7 -0
- package/lib/typescript/utils/callbacks.d.ts.map +1 -1
- package/lib/typescript/utils/crypto.d.ts +32 -15
- package/lib/typescript/utils/crypto.d.ts.map +1 -1
- package/lib/typescript/utils/x509.d.ts +10 -0
- package/lib/typescript/utils/x509.d.ts.map +1 -0
- package/lib/typescript/wallet-instance-attestation/api/types.d.ts +0 -2
- package/lib/typescript/wallet-instance-attestation/api/types.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.0.0/mappers.d.ts +0 -2
- package/lib/typescript/wallet-instance-attestation/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts +2 -9
- package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts +2 -7
- package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts.map +1 -1
- package/lib/typescript/wallet-unit-attestation/api/types.d.ts +0 -11
- package/lib/typescript/wallet-unit-attestation/api/types.d.ts.map +1 -1
- package/lib/typescript/wallet-unit-attestation/v1.3.3/mappers.d.ts +0 -22
- package/lib/typescript/wallet-unit-attestation/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/wallet-unit-attestation/v1.3.3/types.d.ts +0 -11
- package/lib/typescript/wallet-unit-attestation/v1.3.3/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/credential/issuance/README.md +44 -17
- package/src/credential/issuance/api/05-obtain-credential.ts +24 -0
- package/src/credential/issuance/api/06-verify-and-parse-credential.ts +4 -0
- package/src/credential/issuance/common/02-start-user-authorization.ts +6 -3
- package/src/credential/issuance/common/06-verify-and-parse-credential.sdjwt.ts +42 -9
- package/src/credential/issuance/mrtd-pop/02-init-challenge.ts +69 -45
- package/src/credential/issuance/mrtd-pop/03-validate-challenge.ts +84 -62
- package/src/credential/issuance/mrtd-pop/index.ts +13 -5
- package/src/credential/issuance/v1.0.0/02-start-user-authorization.ts +1 -1
- package/src/credential/issuance/v1.0.0/03-complete-user-authorization.ts +8 -3
- package/src/credential/issuance/v1.0.0/05-obtain-credential.ts +6 -0
- package/src/credential/issuance/v1.0.0/index.ts +7 -3
- package/src/credential/issuance/v1.0.0/mappers.ts +4 -1
- package/src/credential/issuance/v1.3.3/01-evaluate-issuer-trust.ts +0 -2
- package/src/credential/issuance/v1.3.3/02-start-user-authorization.ts +24 -20
- package/src/credential/issuance/v1.3.3/03-complete-user-authorization.ts +1 -1
- package/src/credential/issuance/v1.3.3/04-authorize-access.ts +28 -23
- package/src/credential/issuance/v1.3.3/05-obtain-credential.ts +182 -87
- package/src/credential/issuance/v1.3.3/06-verify-and-parse-credential.ts +2 -1
- package/src/credential/issuance/v1.3.3/index.ts +7 -3
- package/src/credential/issuance/v1.3.3/mappers.ts +4 -1
- package/src/credential/presentation/api/04-verify-certificate-chain.ts +9 -2
- package/src/credential/presentation/api/05-verify-request-object.ts +2 -2
- package/src/credential/presentation/api/07-send-authorization-response.ts +2 -2
- package/src/credential/presentation/api/types.ts +16 -0
- package/src/credential/presentation/{v1.3.3/utils.mdoc.ts → common/utils/mdoc.ts} +2 -2
- package/src/credential/presentation/v1.0.0/05-verify-request-object.ts +21 -10
- package/src/credential/presentation/v1.0.0/07-send-authorization-response.ts +7 -0
- package/src/credential/presentation/v1.0.0/index.ts +0 -2
- package/src/credential/presentation/v1.0.0/mappers.ts +17 -17
- package/src/credential/presentation/v1.0.0/types.ts +23 -15
- package/src/credential/presentation/v1.3.3/05-verify-request-object.ts +63 -10
- package/src/credential/presentation/v1.3.3/06-evaluate-dcql-query.ts +3 -3
- package/src/credential/presentation/v1.3.3/07-send-authorization-response.ts +13 -4
- package/src/credential/presentation/v1.3.3/mappers.ts +19 -17
- package/src/credential/presentation/v1.3.3/types.ts +9 -3
- package/src/credential/status/README.md +3 -2
- package/src/credential/status/api/status-list.ts +10 -7
- package/src/credential/status/v1.3.3/01-status-list.ts +21 -7
- package/src/credential/status/v1.3.3/02-verify-and-parse-status-list.ts +19 -5
- package/src/credentials-catalogue/api/DigitalCredentialsCatalogue.ts +32 -0
- package/src/credentials-catalogue/api/index.ts +6 -3
- package/src/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.ts +6 -0
- package/src/credentials-catalogue/v1.3.3/fetch-translations.ts +6 -3
- package/src/credentials-catalogue/v1.3.3/mappers.ts +17 -1
- package/src/credentials-catalogue/v1.3.3/types.ts +51 -0
- package/src/mdoc/index.ts +5 -41
- package/src/sd-jwt/__test__/types.test.ts +1 -13
- package/src/sd-jwt/__test__/utils.test.ts +0 -12
- package/src/sd-jwt/types.ts +0 -13
- package/src/utils/callbacks.ts +57 -9
- package/src/utils/crypto.ts +86 -15
- package/src/utils/x509.ts +43 -0
- package/src/wallet-instance-attestation/api/types.ts +0 -2
- package/src/wallet-instance-attestation/v1.3.3/mappers.ts +3 -11
- package/src/wallet-instance-attestation/v1.3.3/types.ts +2 -7
- package/src/wallet-unit-attestation/api/types.ts +0 -11
- package/lib/commonjs/credential/issuance/common/authorization.js +0 -56
- package/lib/commonjs/credential/issuance/common/authorization.js.map +0 -1
- package/lib/commonjs/credential/presentation/v1.0.0/04-verify-certificate-chain.js +0 -12
- package/lib/commonjs/credential/presentation/v1.0.0/04-verify-certificate-chain.js.map +0 -1
- package/lib/commonjs/credential/presentation/v1.3.3/utils.mdoc.js.map +0 -1
- package/lib/module/credential/issuance/common/authorization.js +0 -48
- package/lib/module/credential/issuance/common/authorization.js.map +0 -1
- package/lib/module/credential/presentation/v1.0.0/04-verify-certificate-chain.js +0 -5
- package/lib/module/credential/presentation/v1.0.0/04-verify-certificate-chain.js.map +0 -1
- package/lib/module/credential/presentation/v1.3.3/utils.mdoc.js.map +0 -1
- package/lib/typescript/credential/issuance/common/authorization.d.ts +0 -21
- package/lib/typescript/credential/issuance/common/authorization.d.ts.map +0 -1
- package/lib/typescript/credential/presentation/v1.0.0/04-verify-certificate-chain.d.ts +0 -3
- package/lib/typescript/credential/presentation/v1.0.0/04-verify-certificate-chain.d.ts.map +0 -1
- package/lib/typescript/credential/presentation/v1.3.3/utils.mdoc.d.ts.map +0 -1
- package/src/credential/issuance/common/authorization.ts +0 -89
- package/src/credential/presentation/v1.0.0/04-verify-certificate-chain.ts +0 -10
|
@@ -1,14 +1,22 @@
|
|
|
1
|
+
import { sdkConfigV1_0, sdkConfigV1_3 } from "../../../utils/config";
|
|
1
2
|
import type { MRTDPoPApi } from "../api/mrtd-pop";
|
|
2
3
|
import { verifyAndParseChallengeInfo } from "./01-verify-and-parse-challenge-info";
|
|
3
|
-
import {
|
|
4
|
+
import { createInitChallenge } from "./02-init-challenge";
|
|
4
5
|
import {
|
|
5
|
-
|
|
6
|
+
createValidateChallenge,
|
|
6
7
|
buildChallengeCallbackUrl,
|
|
7
8
|
} from "./03-validate-challenge";
|
|
8
9
|
|
|
9
|
-
export const
|
|
10
|
+
export const MRTDPoPv1_0: MRTDPoPApi = {
|
|
10
11
|
verifyAndParseChallengeInfo,
|
|
11
|
-
initChallenge,
|
|
12
|
-
validateChallenge,
|
|
12
|
+
initChallenge: createInitChallenge({ sdkConfig: sdkConfigV1_0 }),
|
|
13
|
+
validateChallenge: createValidateChallenge({ sdkConfig: sdkConfigV1_0 }),
|
|
14
|
+
buildChallengeCallbackUrl,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const MRTDPoPv1_3: MRTDPoPApi = {
|
|
18
|
+
verifyAndParseChallengeInfo,
|
|
19
|
+
initChallenge: createInitChallenge({ sdkConfig: sdkConfigV1_3 }),
|
|
20
|
+
validateChallenge: createValidateChallenge({ sdkConfig: sdkConfigV1_3 }),
|
|
13
21
|
buildChallengeCallbackUrl,
|
|
14
22
|
};
|
|
@@ -6,7 +6,7 @@ import type { IssuanceApi } from "../api";
|
|
|
6
6
|
import {
|
|
7
7
|
selectCredentialDefinition,
|
|
8
8
|
selectResponseMode,
|
|
9
|
-
} from "../common/authorization";
|
|
9
|
+
} from "../common/02-start-user-authorization";
|
|
10
10
|
|
|
11
11
|
export const startUserAuthorization: IssuanceApi["startUserAuthorization"] =
|
|
12
12
|
async (issuerConf, credentialIds, proof, ctx) => {
|
|
@@ -17,7 +17,7 @@ import { ResponseUriResultShape } from "./types";
|
|
|
17
17
|
import { getJwtFromFormPost } from "../../../utils/decoder";
|
|
18
18
|
import { AuthorizationError, AuthorizationIdpError } from "../common/errors";
|
|
19
19
|
import { LogLevel, Logger } from "../../../utils/logging";
|
|
20
|
-
import {
|
|
20
|
+
import { RawRequestObject } from "../../presentation/v1.0.0/types";
|
|
21
21
|
import { RemotePresentation as RemotePresentationFlow } from "../../presentation/v1.0.0";
|
|
22
22
|
import type { IssuanceApi } from "../api";
|
|
23
23
|
import type { RemotePresentation } from "../../presentation";
|
|
@@ -105,7 +105,12 @@ export const getRequestedCredentialToBePresented: IssuanceApi["getRequestedCrede
|
|
|
105
105
|
.then(hasStatusOrThrow(200, IssuerResponseError))
|
|
106
106
|
.then((res) => res.text())
|
|
107
107
|
.then((jws) => decode(jws))
|
|
108
|
-
.then((reqObj) =>
|
|
108
|
+
.then((reqObj) =>
|
|
109
|
+
RawRequestObject.safeParse({
|
|
110
|
+
header: reqObj.protectedHeader,
|
|
111
|
+
payload: reqObj.payload,
|
|
112
|
+
})
|
|
113
|
+
);
|
|
109
114
|
|
|
110
115
|
if (!requestObject.success) {
|
|
111
116
|
Logger.log(
|
|
@@ -117,7 +122,7 @@ export const getRequestedCredentialToBePresented: IssuanceApi["getRequestedCrede
|
|
|
117
122
|
reason: requestObject.error.message,
|
|
118
123
|
});
|
|
119
124
|
}
|
|
120
|
-
return requestObject.data;
|
|
125
|
+
return requestObject.data.payload;
|
|
121
126
|
};
|
|
122
127
|
|
|
123
128
|
export const completeUserAuthorizationWithFormPostJwtMode: IssuanceApi["completeUserAuthorizationWithFormPostJwtMode"] =
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
IssuerResponseErrorCodes,
|
|
11
11
|
ResponseErrorBuilder,
|
|
12
12
|
UnexpectedStatusCodeError,
|
|
13
|
+
UnimplementedFeatureError,
|
|
13
14
|
ValidationFailed,
|
|
14
15
|
} from "../../../utils/errors";
|
|
15
16
|
import { createDPopToken } from "../../../utils/dpop";
|
|
@@ -210,3 +211,8 @@ const handleObtainCredentialError = (e: unknown) => {
|
|
|
210
211
|
})
|
|
211
212
|
.buildFrom(e);
|
|
212
213
|
};
|
|
214
|
+
|
|
215
|
+
export const obtainCredentialsBatch: IssuanceApi["obtainCredentialsBatch"] =
|
|
216
|
+
() => {
|
|
217
|
+
throw new UnimplementedFeatureError("obtainCredentialsBatch", "1.0.0");
|
|
218
|
+
};
|
|
@@ -9,9 +9,12 @@ import {
|
|
|
9
9
|
getRequestedCredentialToBePresented,
|
|
10
10
|
} from "./03-complete-user-authorization";
|
|
11
11
|
import { authorizeAccess } from "./04-authorize-access";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
obtainCredential,
|
|
14
|
+
obtainCredentialsBatch,
|
|
15
|
+
} from "./05-obtain-credential";
|
|
13
16
|
import { verifyAndParseCredential } from "./06-verify-and-parse-credential";
|
|
14
|
-
import {
|
|
17
|
+
import { MRTDPoPv1_0 } from "../mrtd-pop";
|
|
15
18
|
|
|
16
19
|
export const Issuance: IssuanceApi = {
|
|
17
20
|
evaluateIssuerTrust,
|
|
@@ -23,6 +26,7 @@ export const Issuance: IssuanceApi = {
|
|
|
23
26
|
completeUserAuthorizationWithFormPostJwtMode,
|
|
24
27
|
authorizeAccess,
|
|
25
28
|
obtainCredential,
|
|
29
|
+
obtainCredentialsBatch,
|
|
26
30
|
verifyAndParseCredential,
|
|
27
|
-
MRTDPoP,
|
|
31
|
+
MRTDPoP: MRTDPoPv1_0,
|
|
28
32
|
};
|
|
@@ -17,7 +17,10 @@ export const mapToIssuerConfig = createMapper<
|
|
|
17
17
|
credential_issuer: openid_credential_issuer.credential_issuer,
|
|
18
18
|
credential_configurations_supported:
|
|
19
19
|
openid_credential_issuer.credential_configurations_supported,
|
|
20
|
-
keys:
|
|
20
|
+
keys: [
|
|
21
|
+
...openid_credential_issuer.jwks.keys,
|
|
22
|
+
...oauth_authorization_server.jwks.keys,
|
|
23
|
+
],
|
|
21
24
|
pushed_authorization_request_endpoint:
|
|
22
25
|
oauth_authorization_server.pushed_authorization_request_endpoint,
|
|
23
26
|
token_endpoint: oauth_authorization_server.token_endpoint,
|
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
fetchMetadata,
|
|
3
3
|
type MetadataResponseV1_3,
|
|
4
4
|
} from "@pagopa/io-wallet-oid4vci";
|
|
5
|
-
import { partialCallbacks } from "../../../utils/callbacks";
|
|
6
5
|
import { sdkConfigV1_3 } from "../../../utils/config";
|
|
7
6
|
import type { IssuanceApi } from "../api";
|
|
8
7
|
import { mapToIssuerConfig } from "./mappers";
|
|
@@ -15,7 +14,6 @@ export const evaluateIssuerTrust: IssuanceApi["evaluateIssuerTrust"] = async (
|
|
|
15
14
|
config: sdkConfigV1_3,
|
|
16
15
|
credentialIssuerUrl: issuerUrl,
|
|
17
16
|
callbacks: {
|
|
18
|
-
...partialCallbacks,
|
|
19
17
|
fetch: context.appFetch,
|
|
20
18
|
},
|
|
21
19
|
})) as MetadataResponseV1_3;
|
|
@@ -3,16 +3,17 @@ import {
|
|
|
3
3
|
fetchPushedAuthorizationResponse,
|
|
4
4
|
createClientAttestationPopJwt,
|
|
5
5
|
} from "@pagopa/io-wallet-oauth2";
|
|
6
|
-
import type {
|
|
6
|
+
import type { JwtSignerJwk } from "@pagopa/io-wallet-oauth2";
|
|
7
|
+
import { v4 as uuidv4 } from "uuid";
|
|
7
8
|
import { LogLevel, Logger } from "../../../utils/logging";
|
|
8
9
|
import type { IssuanceApi } from "../api";
|
|
9
|
-
import { SignJWT } from "@pagopa/io-react-native-jwt";
|
|
10
|
-
import { partialCallbacks } from "../../../utils/callbacks";
|
|
11
|
-
import { IoWalletError } from "../../../utils/errors";
|
|
12
10
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "
|
|
11
|
+
createSignJwtFromCryptoContext,
|
|
12
|
+
partialCallbacks,
|
|
13
|
+
} from "../../../utils/callbacks";
|
|
14
|
+
import { IoWalletError } from "../../../utils/errors";
|
|
15
|
+
import { sdkConfigV1_3 } from "../../../utils/config";
|
|
16
|
+
import { selectCredentialDefinition } from "../common/02-start-user-authorization";
|
|
16
17
|
|
|
17
18
|
export const startUserAuthorization: IssuanceApi["startUserAuthorization"] =
|
|
18
19
|
async (issuerConf, credentialIds, proof, ctx) => {
|
|
@@ -33,8 +34,6 @@ export const startUserAuthorization: IssuanceApi["startUserAuthorization"] =
|
|
|
33
34
|
throw new IoWalletError("No public key found");
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
const responseMode = selectResponseMode(issuerConf, credentialIds);
|
|
37
|
-
|
|
38
37
|
const credentialDefinition = credentialIds.map((c) =>
|
|
39
38
|
selectCredentialDefinition(issuerConf, c)
|
|
40
39
|
);
|
|
@@ -54,13 +53,16 @@ export const startUserAuthorization: IssuanceApi["startUserAuthorization"] =
|
|
|
54
53
|
});
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
56
|
+
const wiaSigner: JwtSignerJwk = {
|
|
57
|
+
method: "jwk",
|
|
58
|
+
alg: "ES256",
|
|
59
|
+
publicJwk: await wiaCryptoContext.getPublicKey(),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const signJwt = createSignJwtFromCryptoContext(wiaCryptoContext);
|
|
62
63
|
|
|
63
64
|
const parRequest = await createPushedAuthorizationRequest({
|
|
65
|
+
config: sdkConfigV1_3,
|
|
64
66
|
callbacks: {
|
|
65
67
|
...partialCallbacks,
|
|
66
68
|
signJwt,
|
|
@@ -68,25 +70,27 @@ export const startUserAuthorization: IssuanceApi["startUserAuthorization"] =
|
|
|
68
70
|
authorizationServerMetadata: {
|
|
69
71
|
require_signed_request_object: true,
|
|
70
72
|
},
|
|
73
|
+
jti: uuidv4(),
|
|
71
74
|
clientId,
|
|
72
75
|
audience: issuerConf.credential_issuer,
|
|
73
76
|
authorization_details: credentialDefinition,
|
|
74
77
|
codeChallengeMethodsSupported: ["S256"],
|
|
75
|
-
responseMode,
|
|
76
78
|
redirectUri,
|
|
79
|
+
dpop: {
|
|
80
|
+
signer: wiaSigner,
|
|
81
|
+
},
|
|
77
82
|
});
|
|
78
83
|
|
|
79
84
|
const clientAttestationPoP = await createClientAttestationPopJwt({
|
|
85
|
+
config: sdkConfigV1_3,
|
|
80
86
|
callbacks: {
|
|
87
|
+
generateRandom: partialCallbacks.generateRandom,
|
|
81
88
|
signJwt,
|
|
82
89
|
},
|
|
83
90
|
clientAttestation: walletInstanceAttestation,
|
|
84
91
|
authorizationServer: issuerConf.authorization_endpoint,
|
|
85
|
-
signer:
|
|
86
|
-
|
|
87
|
-
alg: "ES256",
|
|
88
|
-
publicJwk: signerJwk,
|
|
89
|
-
},
|
|
92
|
+
signer: wiaSigner,
|
|
93
|
+
jti: uuidv4(),
|
|
90
94
|
});
|
|
91
95
|
|
|
92
96
|
const { request_uri } = await fetchPushedAuthorizationResponse({
|
|
@@ -16,11 +16,11 @@ import { AuthorizationError, AuthorizationIdpError } from "../common/errors";
|
|
|
16
16
|
import { LogLevel, Logger } from "../../../utils/logging";
|
|
17
17
|
import { RemotePresentation as RemotePresentationFlow } from "../../presentation/v1.3.3";
|
|
18
18
|
import { partialCallbacks } from "../../../utils/callbacks";
|
|
19
|
+
import { sdkConfigV1_3 } from "../../../utils/config";
|
|
19
20
|
import {
|
|
20
21
|
IoWalletError,
|
|
21
22
|
sdkUnexpectedStatusCodeToIssuerError,
|
|
22
23
|
} from "../../../utils/errors";
|
|
23
|
-
import { sdkConfigV1_3 } from "../../../utils/config";
|
|
24
24
|
import type { IssuanceApi } from "../api";
|
|
25
25
|
import { mapToRequestObject } from "./mappers";
|
|
26
26
|
import type { RemotePresentation } from "../../presentation";
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createClientAttestationPopJwt,
|
|
3
|
+
createTokenDPoP,
|
|
4
|
+
fetchTokenResponse,
|
|
5
|
+
} from "@pagopa/io-wallet-oauth2";
|
|
3
6
|
import { v4 as uuidv4 } from "uuid";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
import {
|
|
8
|
+
createSignJwtFromCryptoContext,
|
|
9
|
+
partialCallbacks,
|
|
10
|
+
} from "../../../utils/callbacks";
|
|
7
11
|
import { IoWalletError } from "../../../utils/errors";
|
|
12
|
+
import { sdkConfigV1_3 } from "../../../utils/config";
|
|
8
13
|
import type { IssuanceApi, TokenResponse } from "../api";
|
|
9
14
|
|
|
10
15
|
export const authorizeAccess: IssuanceApi["authorizeAccess"] = async (
|
|
@@ -21,37 +26,37 @@ export const authorizeAccess: IssuanceApi["authorizeAccess"] = async (
|
|
|
21
26
|
dPopCryptoContext,
|
|
22
27
|
} = context;
|
|
23
28
|
|
|
24
|
-
const dPopSignerJwk = await dPopCryptoContext.getPublicKey();
|
|
25
29
|
const tokenDPoP = await createTokenDPoP({
|
|
26
30
|
callbacks: {
|
|
27
31
|
...partialCallbacks,
|
|
28
|
-
signJwt:
|
|
29
|
-
jwt: await new SignJWT(wiaCryptoContext).setPayload(payload).sign(),
|
|
30
|
-
signerJwk: dPopSignerJwk,
|
|
31
|
-
}),
|
|
32
|
+
signJwt: createSignJwtFromCryptoContext(dPopCryptoContext),
|
|
32
33
|
},
|
|
33
34
|
signer: {
|
|
34
|
-
alg: "ES256",
|
|
35
35
|
method: "jwk",
|
|
36
|
-
|
|
36
|
+
alg: "ES256",
|
|
37
|
+
publicJwk: await dPopCryptoContext.getPublicKey(),
|
|
37
38
|
},
|
|
39
|
+
jti: uuidv4(),
|
|
38
40
|
tokenRequest: {
|
|
39
41
|
method: "POST",
|
|
40
42
|
url: issuerConf.token_endpoint,
|
|
41
43
|
},
|
|
42
44
|
});
|
|
43
45
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
jti: uuidv4(),
|
|
50
|
-
aud: issuerConf.credential_issuer,
|
|
51
|
-
iss,
|
|
46
|
+
const clientAttestationDPoP = await createClientAttestationPopJwt({
|
|
47
|
+
config: sdkConfigV1_3,
|
|
48
|
+
callbacks: {
|
|
49
|
+
generateRandom: partialCallbacks.generateRandom,
|
|
50
|
+
signJwt: createSignJwtFromCryptoContext(wiaCryptoContext),
|
|
52
51
|
},
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
clientAttestation: walletInstanceAttestation,
|
|
53
|
+
authorizationServer: issuerConf.credential_issuer,
|
|
54
|
+
signer: {
|
|
55
|
+
method: "jwk",
|
|
56
|
+
alg: "ES256",
|
|
57
|
+
publicJwk: await wiaCryptoContext.getPublicKey(),
|
|
58
|
+
},
|
|
59
|
+
});
|
|
55
60
|
|
|
56
61
|
const tokenResponse = await fetchTokenResponse({
|
|
57
62
|
accessTokenEndpoint: issuerConf.token_endpoint,
|
|
@@ -61,7 +66,7 @@ export const authorizeAccess: IssuanceApi["authorizeAccess"] = async (
|
|
|
61
66
|
},
|
|
62
67
|
walletAttestation: walletInstanceAttestation,
|
|
63
68
|
dPoP: tokenDPoP.jwt,
|
|
64
|
-
clientAttestationDPoP
|
|
69
|
+
clientAttestationDPoP,
|
|
65
70
|
accessTokenRequest: {
|
|
66
71
|
code,
|
|
67
72
|
grant_type: "authorization_code",
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { type CryptoContext, SignJWT } from "@pagopa/io-react-native-jwt";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createTokenDPoP,
|
|
4
|
+
type CallbackContext,
|
|
5
|
+
type JwtSignerJwk,
|
|
6
|
+
} from "@pagopa/io-wallet-oauth2";
|
|
3
7
|
import {
|
|
4
8
|
fetchCredentialResponse,
|
|
5
9
|
createCredentialRequest,
|
|
6
10
|
} from "@pagopa/io-wallet-oid4vci";
|
|
7
11
|
import { UnexpectedStatusCodeError as SdkUnexpectedStatusCodeError } from "@pagopa/io-wallet-utils";
|
|
8
|
-
import {
|
|
12
|
+
import { v4 as uuidv4 } from "uuid";
|
|
13
|
+
import { hasStatusOrThrow, type Out } from "../../../utils/misc";
|
|
9
14
|
import {
|
|
10
15
|
IoWalletError,
|
|
11
16
|
IssuerResponseError,
|
|
@@ -15,126 +20,116 @@ import {
|
|
|
15
20
|
} from "../../../utils/errors";
|
|
16
21
|
import { LogLevel, Logger } from "../../../utils/logging";
|
|
17
22
|
import { sdkConfigV1_3 } from "../../../utils/config";
|
|
18
|
-
import {
|
|
19
|
-
|
|
23
|
+
import {
|
|
24
|
+
createSignJwtFromCryptoContext,
|
|
25
|
+
partialCallbacks,
|
|
26
|
+
} from "../../../utils/callbacks";
|
|
27
|
+
import type { IssuanceApi, IssuerConfig } from "../api";
|
|
20
28
|
import { NonceResponse } from "./types";
|
|
29
|
+
import type { AuthorizeAccessApi } from "../api/04-authorize-access";
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
nonce,
|
|
32
|
-
})
|
|
33
|
-
.setProtectedHeader({
|
|
34
|
-
typ: "openid4vci-proof+jwt",
|
|
35
|
-
jwk,
|
|
36
|
-
})
|
|
37
|
-
.setAudience(audience)
|
|
38
|
-
.setIssuer(issuer)
|
|
39
|
-
.setIssuedAt()
|
|
40
|
-
.setExpirationTime("5min")
|
|
41
|
-
.sign();
|
|
31
|
+
type CreateRequestParams = {
|
|
32
|
+
clientId: string;
|
|
33
|
+
credentialIdentifier: string;
|
|
34
|
+
accessToken: Out<AuthorizeAccessApi["authorizeAccess"]>["accessToken"];
|
|
35
|
+
issuerConf: IssuerConfig;
|
|
36
|
+
dPopCryptoContext: CryptoContext;
|
|
37
|
+
credentialCryptoContexts: CryptoContext[];
|
|
38
|
+
keyAttestationJwt: string;
|
|
39
|
+
appFetch?: GlobalFetch["fetch"];
|
|
42
40
|
};
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Helper to create a credential request and fetch it from the issuer.
|
|
44
|
+
*
|
|
45
|
+
* When multiple keys are provided as {@link CryptoContext}, a batch is requested.
|
|
46
|
+
*
|
|
47
|
+
* @returns The raw credential response
|
|
48
|
+
*/
|
|
49
|
+
export const requestCredentials = async ({
|
|
45
50
|
issuerConf,
|
|
46
51
|
accessToken,
|
|
52
|
+
credentialIdentifier,
|
|
47
53
|
clientId,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
dPopCryptoContext,
|
|
54
|
-
walletUnitAttestation,
|
|
55
|
-
appFetch = fetch,
|
|
56
|
-
} = context;
|
|
57
|
-
if (!walletUnitAttestation) {
|
|
58
|
-
throw new ValidationFailed({
|
|
59
|
-
message:
|
|
60
|
-
"The Wallet Unit Attestation is required to obtain the credential",
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const { credential_configuration_id, credential_identifier } =
|
|
65
|
-
credentialDefinition;
|
|
66
|
-
|
|
67
|
-
// Fetch the nonce from the Credential Issuer
|
|
54
|
+
keyAttestationJwt,
|
|
55
|
+
credentialCryptoContexts,
|
|
56
|
+
dPopCryptoContext,
|
|
57
|
+
appFetch = fetch,
|
|
58
|
+
}: CreateRequestParams) => {
|
|
68
59
|
const { c_nonce } = await appFetch(issuerConf.nonce_endpoint, {
|
|
69
60
|
method: "POST",
|
|
70
61
|
headers: { "Content-Type": "application/json" },
|
|
71
62
|
})
|
|
72
63
|
.then(hasStatusOrThrow(200))
|
|
73
64
|
.then((res) => res.json())
|
|
74
|
-
.then(
|
|
65
|
+
.then(NonceResponse.parse);
|
|
75
66
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
? c.credential_identifiers.includes(credential_identifier)
|
|
82
|
-
: true)
|
|
67
|
+
const keys = await Promise.all(
|
|
68
|
+
credentialCryptoContexts.map(async (ctx) => {
|
|
69
|
+
const publicJwk = await ctx.getPublicKey();
|
|
70
|
+
return { publicJwk, cryptoContext: ctx };
|
|
71
|
+
})
|
|
83
72
|
);
|
|
84
73
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"The access token response does not contain the requested credential",
|
|
93
|
-
});
|
|
94
|
-
}
|
|
74
|
+
const signJwt: CallbackContext["signJwt"] = async (
|
|
75
|
+
jwtSigner,
|
|
76
|
+
{ header, payload }
|
|
77
|
+
) => {
|
|
78
|
+
if (jwtSigner.method !== "jwk") {
|
|
79
|
+
throw new IoWalletError(`Unsupported signer method: ${jwtSigner.method}`);
|
|
80
|
+
}
|
|
95
81
|
|
|
96
|
-
|
|
82
|
+
const { cryptoContext } =
|
|
83
|
+
keys.find(({ publicJwk }) => publicJwk.kid === jwtSigner.publicJwk.kid) ??
|
|
84
|
+
{};
|
|
85
|
+
|
|
86
|
+
if (!cryptoContext) {
|
|
87
|
+
throw new IoWalletError(
|
|
88
|
+
`Could not find CryptoContext for key ${jwtSigner.publicJwk.kid}`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
jwt: await new SignJWT(cryptoContext)
|
|
94
|
+
.setProtectedHeader(header)
|
|
95
|
+
.setPayload(payload)
|
|
96
|
+
.sign(),
|
|
97
|
+
signerJwk: jwtSigner.publicJwk,
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const signers = keys.map<JwtSignerJwk>(({ publicJwk }) => ({
|
|
102
|
+
alg: "ES256",
|
|
103
|
+
method: "jwk",
|
|
104
|
+
publicJwk,
|
|
105
|
+
}));
|
|
97
106
|
|
|
98
107
|
const credentialRequest = await createCredentialRequest({
|
|
99
108
|
config: sdkConfigV1_3,
|
|
100
109
|
callbacks: {
|
|
101
110
|
hash: partialCallbacks.hash,
|
|
102
|
-
signJwt
|
|
103
|
-
jwt: await new SignJWT(credentialCryptoContext)
|
|
104
|
-
.setPayload(payload)
|
|
105
|
-
.sign(),
|
|
106
|
-
signerJwk,
|
|
107
|
-
}),
|
|
111
|
+
signJwt,
|
|
108
112
|
},
|
|
109
113
|
clientId,
|
|
110
|
-
credential_identifier:
|
|
114
|
+
credential_identifier: credentialIdentifier,
|
|
111
115
|
issuerIdentifier: issuerConf.credential_issuer,
|
|
116
|
+
maxBatchSize: issuerConf.credential_issuance_batch_size,
|
|
112
117
|
nonce: c_nonce,
|
|
113
|
-
keyAttestation:
|
|
114
|
-
signers
|
|
115
|
-
{
|
|
116
|
-
alg: "ES256",
|
|
117
|
-
method: "jwk",
|
|
118
|
-
publicJwk: signerJwk,
|
|
119
|
-
},
|
|
120
|
-
],
|
|
118
|
+
keyAttestation: keyAttestationJwt,
|
|
119
|
+
signers,
|
|
121
120
|
});
|
|
122
121
|
|
|
123
|
-
const dPopSignerJwk = await dPopCryptoContext.getPublicKey();
|
|
124
|
-
|
|
125
122
|
const credentialDPoP = await createTokenDPoP({
|
|
126
123
|
callbacks: {
|
|
127
124
|
...partialCallbacks,
|
|
128
|
-
signJwt:
|
|
129
|
-
jwt: await new SignJWT(dPopCryptoContext).setPayload(payload).sign(),
|
|
130
|
-
signerJwk,
|
|
131
|
-
}),
|
|
125
|
+
signJwt: createSignJwtFromCryptoContext(dPopCryptoContext),
|
|
132
126
|
},
|
|
133
127
|
signer: {
|
|
134
128
|
method: "jwk",
|
|
135
129
|
alg: "ES256",
|
|
136
|
-
publicJwk:
|
|
130
|
+
publicJwk: await dPopCryptoContext.getPublicKey(),
|
|
137
131
|
},
|
|
132
|
+
jti: uuidv4(),
|
|
138
133
|
tokenRequest: {
|
|
139
134
|
method: "POST",
|
|
140
135
|
url: issuerConf.credential_endpoint,
|
|
@@ -142,7 +137,7 @@ export const obtainCredential: IssuanceApi["obtainCredential"] = async (
|
|
|
142
137
|
accessToken: accessToken.access_token,
|
|
143
138
|
});
|
|
144
139
|
|
|
145
|
-
|
|
140
|
+
return await fetchCredentialResponse({
|
|
146
141
|
callbacks: {
|
|
147
142
|
fetch: appFetch,
|
|
148
143
|
},
|
|
@@ -151,6 +146,61 @@ export const obtainCredential: IssuanceApi["obtainCredential"] = async (
|
|
|
151
146
|
accessToken: accessToken.access_token,
|
|
152
147
|
dPoP: credentialDPoP.jwt,
|
|
153
148
|
}).catch(handleObtainCredentialError);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const obtainCredential: IssuanceApi["obtainCredential"] = async (
|
|
152
|
+
issuerConf,
|
|
153
|
+
accessToken,
|
|
154
|
+
clientId,
|
|
155
|
+
credentialDefinition,
|
|
156
|
+
context
|
|
157
|
+
) => {
|
|
158
|
+
const {
|
|
159
|
+
credentialCryptoContext,
|
|
160
|
+
dPopCryptoContext,
|
|
161
|
+
walletUnitAttestation,
|
|
162
|
+
appFetch = fetch,
|
|
163
|
+
} = context;
|
|
164
|
+
if (!walletUnitAttestation) {
|
|
165
|
+
throw new ValidationFailed({
|
|
166
|
+
message:
|
|
167
|
+
"The Wallet Unit Attestation is required to obtain the credential",
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const { credential_configuration_id, credential_identifier } =
|
|
172
|
+
credentialDefinition;
|
|
173
|
+
|
|
174
|
+
// Validation of accessTokenResponse.authorization_details if contain credentialDefinition
|
|
175
|
+
const containsCredentialDefinition = accessToken.authorization_details.some(
|
|
176
|
+
(c) =>
|
|
177
|
+
c.credential_configuration_id === credential_configuration_id &&
|
|
178
|
+
(credential_identifier
|
|
179
|
+
? c.credential_identifiers.includes(credential_identifier)
|
|
180
|
+
: true)
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
if (!containsCredentialDefinition) {
|
|
184
|
+
Logger.log(
|
|
185
|
+
LogLevel.ERROR,
|
|
186
|
+
`Credential definition not found in the access token response ${accessToken.authorization_details}`
|
|
187
|
+
);
|
|
188
|
+
throw new ValidationFailed({
|
|
189
|
+
message:
|
|
190
|
+
"The access token response does not contain the requested credential",
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const credentialRes = await requestCredentials({
|
|
195
|
+
issuerConf,
|
|
196
|
+
accessToken,
|
|
197
|
+
clientId,
|
|
198
|
+
credentialCryptoContexts: [credentialCryptoContext],
|
|
199
|
+
credentialIdentifier: credential_identifier!,
|
|
200
|
+
dPopCryptoContext,
|
|
201
|
+
keyAttestationJwt: walletUnitAttestation,
|
|
202
|
+
appFetch,
|
|
203
|
+
});
|
|
154
204
|
|
|
155
205
|
Logger.log(
|
|
156
206
|
LogLevel.DEBUG,
|
|
@@ -172,6 +222,51 @@ export const obtainCredential: IssuanceApi["obtainCredential"] = async (
|
|
|
172
222
|
};
|
|
173
223
|
};
|
|
174
224
|
|
|
225
|
+
export const obtainCredentialsBatch: IssuanceApi["obtainCredentialsBatch"] =
|
|
226
|
+
async (issuerConf, accessToken, clientId, credentialDefinition, context) => {
|
|
227
|
+
const {
|
|
228
|
+
credentialCryptoContexts,
|
|
229
|
+
dPopCryptoContext,
|
|
230
|
+
walletUnitAttestation,
|
|
231
|
+
appFetch = fetch,
|
|
232
|
+
} = context;
|
|
233
|
+
if (!walletUnitAttestation) {
|
|
234
|
+
throw new ValidationFailed({
|
|
235
|
+
message:
|
|
236
|
+
"The Wallet Unit Attestation is required to obtain the credential",
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const { credential_configuration_id, credential_identifier } =
|
|
241
|
+
credentialDefinition;
|
|
242
|
+
|
|
243
|
+
const credentialRes = await requestCredentials({
|
|
244
|
+
issuerConf,
|
|
245
|
+
accessToken,
|
|
246
|
+
clientId,
|
|
247
|
+
credentialCryptoContexts,
|
|
248
|
+
credentialIdentifier: credential_identifier,
|
|
249
|
+
dPopCryptoContext,
|
|
250
|
+
keyAttestationJwt: walletUnitAttestation,
|
|
251
|
+
appFetch,
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// Extract the format corresponding to the credential_configuration_id used
|
|
255
|
+
const issuerCredentialConfig =
|
|
256
|
+
issuerConf.credential_configurations_supported[
|
|
257
|
+
credential_configuration_id
|
|
258
|
+
];
|
|
259
|
+
|
|
260
|
+
if ("transaction_id" in credentialRes) {
|
|
261
|
+
throw new IoWalletError("Deferred issuance is not currently supported");
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return credentialRes.credentials.map(({ credential }) => ({
|
|
265
|
+
credential,
|
|
266
|
+
format: issuerCredentialConfig!.format,
|
|
267
|
+
}));
|
|
268
|
+
};
|
|
269
|
+
|
|
175
270
|
/**
|
|
176
271
|
* Handle the credential error by mapping it to a custom exception.
|
|
177
272
|
* If the error is not an instance of {@link SdkUnexpectedStatusCodeError}, it is thrown as is.
|