@pagopa/io-react-native-wallet 1.7.1 → 2.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -1
- package/lib/commonjs/client/generated/wallet-provider.js +49 -20
- package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
- package/lib/commonjs/credential/index.js +5 -1
- package/lib/commonjs/credential/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +27 -0
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +25 -16
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +30 -18
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +17 -12
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +36 -29
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +27 -207
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/README.md +23 -20
- package/lib/commonjs/credential/issuance/const.js +1 -1
- package/lib/commonjs/credential/issuance/const.js.map +1 -1
- package/lib/commonjs/credential/issuance/index.js +3 -3
- package/lib/commonjs/credential/issuance/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/01-start-flow.js +14 -15
- package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +6 -4
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/commonjs/credential/presentation/03-get-request-object.js +34 -7
- package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js +4 -126
- package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
- package/lib/commonjs/credential/presentation/05-verify-request-object.js +80 -25
- package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js +6 -30
- package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +97 -117
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +86 -191
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js +112 -176
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/commonjs/credential/presentation/README.md +74 -79
- package/lib/commonjs/credential/presentation/errors.js +42 -21
- package/lib/commonjs/credential/presentation/errors.js.map +1 -1
- package/lib/commonjs/credential/presentation/index.js +13 -13
- package/lib/commonjs/credential/presentation/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js +53 -29
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/credential/status/01-start-flow.js +2 -0
- package/lib/commonjs/credential/status/01-start-flow.js.map +1 -0
- package/lib/commonjs/credential/status/02-status-attestation.js +73 -0
- package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -0
- package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +55 -0
- package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
- package/lib/commonjs/credential/status/README.md +67 -0
- package/lib/commonjs/credential/status/index.js +27 -0
- package/lib/commonjs/credential/status/index.js.map +1 -0
- package/lib/commonjs/credential/status/types.js +48 -0
- package/lib/commonjs/credential/status/types.js.map +1 -0
- package/lib/commonjs/credential/trustmark/README.md +62 -0
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +86 -0
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -0
- package/lib/commonjs/credential/trustmark/index.js +13 -0
- package/lib/commonjs/credential/trustmark/index.js.map +1 -0
- package/lib/commonjs/index.js +5 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/pid/sd-jwt/types.js +18 -2
- package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/index.test.js +22 -34
- package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/types.test.js +11 -23
- package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/index.js +1 -7
- package/lib/commonjs/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +5 -21
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/trust/README.md +147 -0
- package/lib/commonjs/trust/chain.js +153 -0
- package/lib/commonjs/trust/chain.js.map +1 -0
- package/lib/commonjs/trust/errors.js +133 -0
- package/lib/commonjs/trust/errors.js.map +1 -0
- package/lib/commonjs/trust/index.js +288 -0
- package/lib/commonjs/trust/index.js.map +1 -0
- package/lib/commonjs/{entity/trust → trust}/types.js +27 -47
- package/lib/commonjs/trust/types.js.map +1 -0
- package/lib/commonjs/trust/utils.js +70 -0
- package/lib/commonjs/trust/utils.js.map +1 -0
- package/lib/commonjs/utils/crypto.js +5 -112
- package/lib/commonjs/utils/crypto.js.map +1 -1
- package/lib/commonjs/utils/decoder.js +2 -0
- package/lib/commonjs/utils/decoder.js.map +1 -1
- package/lib/commonjs/utils/error-codes.js +22 -2
- package/lib/commonjs/utils/error-codes.js.map +1 -1
- package/lib/commonjs/utils/errors.js +72 -4
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/commonjs/utils/logging.js +68 -0
- package/lib/commonjs/utils/logging.js.map +1 -0
- package/lib/commonjs/utils/misc.js +2 -0
- package/lib/commonjs/utils/misc.js.map +1 -1
- package/lib/commonjs/utils/par.js +17 -10
- package/lib/commonjs/utils/par.js.map +1 -1
- package/lib/commonjs/utils/string.js +1 -12
- package/lib/commonjs/utils/string.js.map +1 -1
- package/lib/commonjs/wallet-instance/index.js +14 -0
- package/lib/commonjs/wallet-instance/index.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/README.md +8 -3
- package/lib/commonjs/wallet-instance-attestation/issuing.js +15 -8
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/types.js +16 -20
- package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
- package/lib/module/client/generated/wallet-provider.js +40 -15
- package/lib/module/client/generated/wallet-provider.js.map +1 -1
- package/lib/module/credential/index.js +3 -1
- package/lib/module/credential/index.js.map +1 -1
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +20 -0
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
- package/lib/module/credential/issuance/03-start-user-authorization.js +25 -16
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +30 -18
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +17 -11
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +36 -28
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +27 -205
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/issuance/README.md +23 -20
- package/lib/module/credential/issuance/const.js +1 -1
- package/lib/module/credential/issuance/const.js.map +1 -1
- package/lib/module/credential/issuance/index.js +2 -2
- package/lib/module/credential/issuance/index.js.map +1 -1
- package/lib/module/credential/presentation/01-start-flow.js +14 -15
- package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js +5 -3
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/module/credential/presentation/03-get-request-object.js +34 -7
- package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +2 -124
- package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
- package/lib/module/credential/presentation/05-verify-request-object.js +78 -23
- package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/module/credential/presentation/06-fetch-presentation-definition.js +6 -30
- package/lib/module/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js +97 -118
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +83 -186
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js +107 -170
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/module/credential/presentation/README.md +74 -79
- package/lib/module/credential/presentation/errors.js +30 -17
- package/lib/module/credential/presentation/errors.js.map +1 -1
- package/lib/module/credential/presentation/index.js +6 -6
- package/lib/module/credential/presentation/index.js.map +1 -1
- package/lib/module/credential/presentation/types.js +49 -27
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/credential/status/01-start-flow.js +2 -0
- package/lib/module/credential/status/01-start-flow.js.map +1 -0
- package/lib/module/credential/status/02-status-attestation.js +66 -0
- package/lib/module/credential/status/02-status-attestation.js.map +1 -0
- package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +49 -0
- package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
- package/lib/module/credential/status/README.md +67 -0
- package/lib/module/credential/status/index.js +5 -0
- package/lib/module/credential/status/index.js.map +1 -0
- package/lib/module/credential/status/types.js +40 -0
- package/lib/module/credential/status/types.js.map +1 -0
- package/lib/module/credential/trustmark/README.md +62 -0
- package/lib/module/credential/trustmark/get-credential-trustmark.js +77 -0
- package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -0
- package/lib/module/credential/trustmark/index.js +3 -0
- package/lib/module/credential/trustmark/index.js.map +1 -0
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/pid/sd-jwt/types.js +16 -1
- package/lib/module/pid/sd-jwt/types.js.map +1 -1
- package/lib/module/sd-jwt/__test__/index.test.js +22 -34
- package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/types.test.js +11 -23
- package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/module/sd-jwt/index.js +1 -7
- package/lib/module/sd-jwt/index.js.map +1 -1
- package/lib/module/sd-jwt/types.js +4 -19
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/trust/README.md +147 -0
- package/lib/module/trust/chain.js +145 -0
- package/lib/module/trust/chain.js.map +1 -0
- package/lib/module/trust/errors.js +115 -0
- package/lib/module/trust/errors.js.map +1 -0
- package/lib/module/trust/index.js +269 -0
- package/lib/module/trust/index.js.map +1 -0
- package/lib/module/{entity/trust → trust}/types.js +25 -46
- package/lib/module/trust/types.js.map +1 -0
- package/lib/module/trust/utils.js +60 -0
- package/lib/module/trust/utils.js.map +1 -0
- package/lib/module/utils/crypto.js +4 -107
- package/lib/module/utils/crypto.js.map +1 -1
- package/lib/module/utils/decoder.js +3 -0
- package/lib/module/utils/decoder.js.map +1 -1
- package/lib/module/utils/error-codes.js +20 -1
- package/lib/module/utils/error-codes.js.map +1 -1
- package/lib/module/utils/errors.js +61 -4
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/module/utils/logging.js +62 -0
- package/lib/module/utils/logging.js.map +1 -0
- package/lib/module/utils/misc.js +2 -0
- package/lib/module/utils/misc.js.map +1 -1
- package/lib/module/utils/par.js +17 -9
- package/lib/module/utils/par.js.map +1 -1
- package/lib/module/utils/string.js +0 -10
- package/lib/module/utils/string.js.map +1 -1
- package/lib/module/wallet-instance/index.js +13 -0
- package/lib/module/wallet-instance/index.js.map +1 -1
- package/lib/module/wallet-instance-attestation/README.md +8 -3
- package/lib/module/wallet-instance-attestation/index.js +2 -2
- package/lib/module/wallet-instance-attestation/index.js.map +1 -1
- package/lib/module/wallet-instance-attestation/issuing.js +16 -9
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/wallet-instance-attestation/types.js +14 -18
- package/lib/module/wallet-instance-attestation/types.js.map +1 -1
- package/lib/typescript/client/generated/wallet-provider.d.ts +206 -51
- package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
- package/lib/typescript/credential/index.d.ts +3 -1
- 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-evaluate-issuer-trust.d.ts +19 -0
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.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 +9 -9
- 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 +4 -4
- 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 -15
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/const.d.ts +1 -1
- package/lib/typescript/credential/issuance/const.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/index.d.ts +3 -3
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/types.d.ts +8 -3
- package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/01-start-flow.d.ts +28 -9
- package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +2 -1
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts +7 -5
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts +4 -30
- package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +17 -4
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts +4 -9
- package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +13 -12
- package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +40 -42
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +30 -43
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/errors.d.ts +25 -10
- package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/index.d.ts +7 -8
- package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +137 -307
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
- package/lib/typescript/credential/status/01-start-flow.d.ts +10 -0
- package/lib/typescript/credential/status/01-start-flow.d.ts.map +1 -0
- package/lib/typescript/credential/status/02-status-attestation.d.ts +19 -0
- package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -0
- package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts +24 -0
- package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -0
- package/lib/typescript/credential/status/index.d.ts +7 -0
- package/lib/typescript/credential/status/index.d.ts.map +1 -0
- package/lib/typescript/credential/status/types.d.ts +305 -0
- package/lib/typescript/credential/status/types.d.ts.map +1 -0
- package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts +52 -0
- package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -0
- package/lib/typescript/credential/trustmark/index.d.ts +4 -0
- package/lib/typescript/credential/trustmark/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/pid/sd-jwt/types.d.ts +103 -25
- package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/index.d.ts +20 -72
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +24 -129
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/trust/chain.d.ts +23 -0
- package/lib/typescript/trust/chain.d.ts.map +1 -0
- package/lib/typescript/trust/errors.d.ts +102 -0
- package/lib/typescript/trust/errors.d.ts.map +1 -0
- package/lib/typescript/{entity/trust → trust}/index.d.ts +308 -281
- package/lib/typescript/trust/index.d.ts.map +1 -0
- package/lib/typescript/{entity/trust → trust}/types.d.ts +1714 -1301
- package/lib/typescript/{entity/trust → trust}/types.d.ts.map +1 -1
- package/lib/typescript/trust/utils.d.ts +22 -0
- package/lib/typescript/trust/utils.d.ts.map +1 -0
- package/lib/typescript/utils/crypto.d.ts +0 -32
- package/lib/typescript/utils/crypto.d.ts.map +1 -1
- package/lib/typescript/utils/decoder.d.ts.map +1 -1
- package/lib/typescript/utils/error-codes.d.ts +20 -0
- package/lib/typescript/utils/error-codes.d.ts.map +1 -1
- package/lib/typescript/utils/errors.d.ts +55 -10
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/logging.d.ts +35 -0
- package/lib/typescript/utils/logging.d.ts.map +1 -0
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/utils/par.d.ts +8 -1
- package/lib/typescript/utils/par.d.ts.map +1 -1
- package/lib/typescript/utils/string.d.ts +0 -7
- package/lib/typescript/utils/string.d.ts.map +1 -1
- package/lib/typescript/wallet-instance/index.d.ts +8 -0
- package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/index.d.ts +1 -2
- package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts +4 -2
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +60 -102
- package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
- package/package.json +9 -10
- package/src/client/generated/wallet-provider.ts +52 -17
- package/src/credential/index.ts +4 -1
- package/src/credential/issuance/01-start-flow.ts +1 -1
- package/src/credential/issuance/02-evaluate-issuer-trust.ts +32 -0
- package/src/credential/issuance/03-start-user-authorization.ts +48 -22
- package/src/credential/issuance/04-complete-user-authorization.ts +74 -18
- package/src/credential/issuance/05-authorize-access.ts +29 -11
- package/src/credential/issuance/06-obtain-credential.ts +61 -36
- package/src/credential/issuance/07-verify-and-parse-credential.ts +37 -264
- package/src/credential/issuance/README.md +23 -20
- package/src/credential/issuance/const.ts +1 -1
- package/src/credential/issuance/index.ts +6 -3
- package/src/credential/presentation/01-start-flow.ts +19 -22
- package/src/credential/presentation/02-evaluate-rp-trust.ts +5 -4
- package/src/credential/presentation/03-get-request-object.ts +36 -8
- package/src/credential/presentation/04-retrieve-rp-jwks.ts +6 -148
- package/src/credential/presentation/05-verify-request-object.ts +115 -30
- package/src/credential/presentation/06-fetch-presentation-definition.ts +5 -35
- package/src/credential/presentation/07-evaluate-dcql-query.ts +132 -161
- package/src/credential/presentation/07-evaluate-input-descriptor.ts +136 -254
- package/src/credential/presentation/08-send-authorization-response.ts +178 -260
- package/src/credential/presentation/README.md +74 -79
- package/src/credential/presentation/errors.ts +38 -15
- package/src/credential/presentation/index.ts +18 -19
- package/src/credential/presentation/types.ts +67 -64
- package/src/credential/status/01-start-flow.ts +9 -0
- package/src/credential/status/02-status-attestation.ts +105 -0
- package/src/credential/status/03-verify-and-parse-status-attestation.ts +70 -0
- package/src/credential/status/README.md +67 -0
- package/src/credential/status/index.ts +22 -0
- package/src/credential/status/types.ts +43 -0
- package/src/credential/trustmark/README.md +62 -0
- package/src/credential/trustmark/get-credential-trustmark.ts +139 -0
- package/src/credential/trustmark/index.ts +8 -0
- package/src/index.ts +4 -0
- package/src/pid/sd-jwt/types.ts +18 -1
- package/src/sd-jwt/__test__/index.test.ts +36 -55
- package/src/sd-jwt/__test__/types.test.ts +16 -29
- package/src/sd-jwt/index.ts +1 -5
- package/src/sd-jwt/types.ts +2 -19
- package/src/trust/README.md +147 -0
- package/src/trust/chain.ts +227 -0
- package/src/trust/errors.ts +136 -0
- package/src/{entity/trust → trust}/index.ts +207 -25
- package/src/{entity/trust → trust}/types.ts +24 -37
- package/src/trust/utils.ts +70 -0
- package/src/utils/crypto.ts +4 -106
- package/src/utils/decoder.ts +6 -1
- package/src/utils/error-codes.ts +23 -0
- package/src/utils/errors.ts +119 -15
- package/src/utils/logging.ts +68 -0
- package/src/utils/misc.ts +5 -0
- package/src/utils/par.ts +19 -6
- package/src/utils/string.ts +0 -10
- package/src/wallet-instance/index.ts +30 -1
- package/src/wallet-instance-attestation/README.md +8 -3
- package/src/wallet-instance-attestation/index.ts +2 -2
- package/src/wallet-instance-attestation/issuing.ts +33 -12
- package/src/wallet-instance-attestation/types.ts +18 -22
- package/lib/commonjs/credential/issuance/02-get-issuer-config.js +0 -48
- package/lib/commonjs/credential/issuance/02-get-issuer-config.js.map +0 -1
- package/lib/commonjs/entity/openid-connect/issuer/index.js +0 -25
- package/lib/commonjs/entity/openid-connect/issuer/index.js.map +0 -1
- package/lib/commonjs/entity/openid-connect/issuer/types.js +0 -64
- package/lib/commonjs/entity/openid-connect/issuer/types.js.map +0 -1
- package/lib/commonjs/entity/trust/chain.js +0 -122
- package/lib/commonjs/entity/trust/chain.js.map +0 -1
- package/lib/commonjs/entity/trust/index.js +0 -148
- package/lib/commonjs/entity/trust/index.js.map +0 -1
- package/lib/commonjs/entity/trust/types.js.map +0 -1
- package/lib/commonjs/mdoc/converters.js +0 -26
- package/lib/commonjs/mdoc/converters.js.map +0 -1
- package/lib/commonjs/mdoc/index.js +0 -68
- package/lib/commonjs/mdoc/index.js.map +0 -1
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -469
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -90
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
- package/lib/module/credential/issuance/02-get-issuer-config.js +0 -42
- package/lib/module/credential/issuance/02-get-issuer-config.js.map +0 -1
- package/lib/module/entity/openid-connect/issuer/index.js +0 -20
- package/lib/module/entity/openid-connect/issuer/index.js.map +0 -1
- package/lib/module/entity/openid-connect/issuer/types.js +0 -48
- package/lib/module/entity/openid-connect/issuer/types.js.map +0 -1
- package/lib/module/entity/trust/chain.js +0 -113
- package/lib/module/entity/trust/chain.js.map +0 -1
- package/lib/module/entity/trust/index.js +0 -131
- package/lib/module/entity/trust/index.js.map +0 -1
- package/lib/module/entity/trust/types.js.map +0 -1
- package/lib/module/mdoc/converters.js +0 -20
- package/lib/module/mdoc/converters.js.map +0 -1
- package/lib/module/mdoc/index.js +0 -60
- package/lib/module/mdoc/index.js.map +0 -1
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -462
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -83
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
- package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts +0 -32
- package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts.map +0 -1
- package/lib/typescript/entity/openid-connect/issuer/index.d.ts +0 -12
- package/lib/typescript/entity/openid-connect/issuer/index.d.ts.map +0 -1
- package/lib/typescript/entity/openid-connect/issuer/types.d.ts +0 -777
- package/lib/typescript/entity/openid-connect/issuer/types.d.ts.map +0 -1
- package/lib/typescript/entity/trust/chain.d.ts +0 -26
- package/lib/typescript/entity/trust/chain.d.ts.map +0 -1
- package/lib/typescript/entity/trust/index.d.ts.map +0 -1
- package/lib/typescript/mdoc/converters.d.ts +0 -8
- package/lib/typescript/mdoc/converters.d.ts.map +0 -1
- package/lib/typescript/mdoc/index.d.ts +0 -10
- package/lib/typescript/mdoc/index.d.ts.map +0 -1
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts +0 -3
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts.map +0 -1
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts +0 -42
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts.map +0 -1
- package/src/credential/issuance/02-get-issuer-config.ts +0 -67
- package/src/entity/openid-connect/issuer/index.ts +0 -27
- package/src/entity/openid-connect/issuer/types.ts +0 -76
- package/src/entity/trust/chain.ts +0 -154
- package/src/mdoc/converters.ts +0 -26
- package/src/mdoc/index.ts +0 -95
- package/src/utils/credential/issuance/07-verify-and-parse-credentials-inputs.ts +0 -615
- package/src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts +0 -171
@@ -3,16 +3,14 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.sendLegacyAuthorizationResponse = exports.sendAuthorizationResponse = exports.sendAuthorizationErrorResponse = exports.choosePublicKeyToEncrypt = exports.buildDirectPostJwtBody = exports.buildDirectPostBody = exports.AuthorizationResponse = void 0;
|
7
7
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
8
8
|
var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
|
9
|
+
var _retrieveRpJwks = require("./04-retrieve-rp-jwks");
|
9
10
|
var _errors = require("./errors");
|
10
11
|
var _misc = require("../../utils/misc");
|
11
12
|
var z = _interopRequireWildcard(require("zod"));
|
12
|
-
var
|
13
|
-
var _mdoc = require("../../mdoc");
|
14
|
-
var _crypto = require("../../utils/crypto");
|
15
|
-
var _sdJwt = require("../../sd-jwt");
|
13
|
+
var _errors2 = require("../../utils/errors");
|
16
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
17
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -30,25 +28,13 @@ const AuthorizationResponse = z.object({
|
|
30
28
|
* Selects a public key (with `use = enc`) from the set of JWK keys
|
31
29
|
* offered by the Relying Party (RP) for encryption.
|
32
30
|
*
|
33
|
-
* Preference is given to EC keys (P-256 or P-384), followed by RSA keys,
|
34
|
-
* based on compatibility and common usage for encryption.
|
35
|
-
*
|
36
31
|
* @param rpJwkKeys - The array of JWKs retrieved from the RP entity configuration.
|
37
32
|
* @returns The first suitable public key found in the list.
|
38
33
|
* @throws {NoSuitableKeysFoundInEntityConfiguration} If no suitable encryption key is found.
|
39
34
|
*/
|
40
35
|
exports.AuthorizationResponse = AuthorizationResponse;
|
41
36
|
const choosePublicKeyToEncrypt = rpJwkKeys => {
|
42
|
-
|
43
|
-
const encKeys = rpJwkKeys.filter(jwk => jwk.use === "enc");
|
44
|
-
|
45
|
-
// Prioritize EC keys first, then fall back to RSA keys if needed
|
46
|
-
// io-react-native-jwt support only EC keys with P-256 or P-384 curves
|
47
|
-
const ecEncKeys = encKeys.filter(jwk => jwk.kty === "EC" && (jwk.crv === "P-256" || jwk.crv === "P-384"));
|
48
|
-
const rsaEncKeys = encKeys.filter(jwk => jwk.kty === "RSA");
|
49
|
-
|
50
|
-
// Select the first available key based on priority
|
51
|
-
const encKey = ecEncKeys[0] || rsaEncKeys[0] || encKeys[0];
|
37
|
+
const encKey = rpJwkKeys.find(jwk => jwk.use === "enc");
|
52
38
|
if (encKey) {
|
53
39
|
return encKey;
|
54
40
|
}
|
@@ -57,58 +43,37 @@ const choosePublicKeyToEncrypt = rpJwkKeys => {
|
|
57
43
|
throw new _errors.NoSuitableKeysFoundInEntityConfiguration("No suitable public key found for encryption.");
|
58
44
|
};
|
59
45
|
|
60
|
-
/**
|
61
|
-
* Builds a URL-encoded form body for a direct POST response without encryption.
|
62
|
-
*
|
63
|
-
* @param requestObject - Contains state, nonce, and other relevant info.
|
64
|
-
* @param payload - Object that contains either the VP token to encrypt and the stringified mapping of the credential disclosures or the error code
|
65
|
-
* @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
|
66
|
-
*/
|
67
|
-
exports.choosePublicKeyToEncrypt = choosePublicKeyToEncrypt;
|
68
|
-
const buildDirectPostBody = async (requestObject, payload) => {
|
69
|
-
const formUrlEncodedBody = new URLSearchParams({
|
70
|
-
...(requestObject.state ? {
|
71
|
-
state: requestObject.state
|
72
|
-
} : {}),
|
73
|
-
...Object.fromEntries(Object.entries(payload).map(_ref => {
|
74
|
-
let [key, value] = _ref;
|
75
|
-
return [key, Array.isArray(value) || typeof value === "object" ? JSON.stringify(value) : value];
|
76
|
-
}))
|
77
|
-
});
|
78
|
-
return formUrlEncodedBody.toString();
|
79
|
-
};
|
80
|
-
|
81
46
|
/**
|
82
47
|
* Builds a URL-encoded form body for a direct POST response using JWT encryption.
|
83
48
|
*
|
84
49
|
* @param jwkKeys - Array of JWKs from the Relying Party for encryption.
|
85
50
|
* @param requestObject - Contains state, nonce, and other relevant info.
|
86
|
-
* @param payload - Object that contains
|
87
|
-
* @
|
88
|
-
* @returns A URL-encoded string for an `application/x-www-form-urlencoded` POST body,
|
89
|
-
* where `response` contains the encrypted JWE.
|
51
|
+
* @param payload - Object that contains the VP token to encrypt and the mapping of the credential disclosures
|
52
|
+
* @returns A URL-encoded string for an `application/x-www-form-urlencoded` POST body, where `response` contains the encrypted JWE.
|
90
53
|
*/
|
91
|
-
exports.
|
92
|
-
const buildDirectPostJwtBody = async (
|
54
|
+
exports.choosePublicKeyToEncrypt = choosePublicKeyToEncrypt;
|
55
|
+
const buildDirectPostJwtBody = async (requestObject, rpConf, payload) => {
|
93
56
|
// Prepare the authorization response payload to be encrypted
|
94
57
|
const authzResponsePayload = JSON.stringify({
|
95
58
|
state: requestObject.state,
|
96
59
|
...payload
|
97
60
|
});
|
98
|
-
|
61
|
+
// Choose a suitable public key for encryption
|
62
|
+
const {
|
63
|
+
keys
|
64
|
+
} = (0, _retrieveRpJwks.getJwksFromConfig)(rpConf);
|
65
|
+
const encPublicJwk = choosePublicKeyToEncrypt(keys);
|
66
|
+
|
99
67
|
// Encrypt the authorization payload
|
100
68
|
const {
|
101
|
-
|
102
|
-
|
69
|
+
authorization_encrypted_response_alg,
|
70
|
+
authorization_encrypted_response_enc
|
71
|
+
} = rpConf.openid_credential_verifier;
|
72
|
+
const defaultAlg = encPublicJwk.kty === "EC" ? "ECDH-ES" : "RSA-OAEP-256";
|
103
73
|
const encryptedResponse = await new _ioReactNativeJwt.EncryptJwe(authzResponsePayload, {
|
104
|
-
alg:
|
105
|
-
enc:
|
106
|
-
kid: encPublicJwk.kid
|
107
|
-
/* ISO 18013-7 */
|
108
|
-
apv: _jsBase.Base64.encodeURI(requestObject.nonce),
|
109
|
-
...(generatedNonce ? {
|
110
|
-
apu: _jsBase.Base64.encodeURI(generatedNonce)
|
111
|
-
} : {})
|
74
|
+
alg: authorization_encrypted_response_alg || defaultAlg,
|
75
|
+
enc: authorization_encrypted_response_enc || "A256CBC-HS512",
|
76
|
+
kid: encPublicJwk.kid
|
112
77
|
}).encrypt(encPublicJwk);
|
113
78
|
|
114
79
|
// Build the x-www-form-urlencoded form body
|
@@ -122,15 +87,36 @@ const buildDirectPostJwtBody = async (jwkKeys, requestObject, payload, generated
|
|
122
87
|
};
|
123
88
|
|
124
89
|
/**
|
125
|
-
*
|
126
|
-
*
|
90
|
+
* Builds a URL-encoded form body for a direct POST response without encryption.
|
91
|
+
*
|
92
|
+
* @param requestObject - Contains state, nonce, and other relevant info.
|
93
|
+
* @param payload - Object that contains either the VP token to encrypt and the stringified mapping of the credential disclosures or the error code
|
94
|
+
* @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
|
127
95
|
*/
|
96
|
+
exports.buildDirectPostJwtBody = buildDirectPostJwtBody;
|
97
|
+
const buildDirectPostBody = async (requestObject, payload) => {
|
98
|
+
const formUrlEncodedBody = new URLSearchParams({
|
99
|
+
...(requestObject.state && {
|
100
|
+
state: requestObject.state
|
101
|
+
}),
|
102
|
+
...Object.entries(payload).reduce((acc, _ref) => {
|
103
|
+
let [key, value] = _ref;
|
104
|
+
return {
|
105
|
+
...acc,
|
106
|
+
[key]: Array.isArray(value) || typeof value === "object" ? JSON.stringify(value) : value
|
107
|
+
};
|
108
|
+
}, {})
|
109
|
+
});
|
110
|
+
return formUrlEncodedBody.toString();
|
111
|
+
};
|
128
112
|
|
129
113
|
/**
|
130
114
|
* Type definition for the function that sends the authorization response
|
131
115
|
* to the Relying Party, completing the presentation flow.
|
116
|
+
* Use with `presentation_definition`.
|
117
|
+
* @deprecated Use `sendAuthorizationResponse`
|
132
118
|
*/
|
133
|
-
exports.
|
119
|
+
exports.buildDirectPostBody = buildDirectPostBody;
|
134
120
|
/**
|
135
121
|
* Sends the authorization response to the Relying Party (RP) using the specified `response_mode`.
|
136
122
|
* This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
|
@@ -142,175 +128,125 @@ exports.buildDirectPostJwtBody = buildDirectPostJwtBody;
|
|
142
128
|
* @param context - Contains optional custom fetch implementation.
|
143
129
|
* @returns Parsed and validated authorization response from the Relying Party.
|
144
130
|
*/
|
145
|
-
const
|
146
|
-
var
|
131
|
+
const sendLegacyAuthorizationResponse = async function (requestObject, presentationDefinitionId, remotePresentations, rpConf) {
|
132
|
+
var _remotePresentations$;
|
147
133
|
let {
|
148
134
|
appFetch = fetch
|
149
135
|
} = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
150
|
-
const {
|
151
|
-
generatedNonce,
|
152
|
-
presentations
|
153
|
-
} = remotePresentation;
|
154
136
|
/**
|
155
137
|
* 1. Prepare the VP token and presentation submission
|
156
138
|
* If there is only one credential, `vpToken` is a single string.
|
157
139
|
* If there are multiple credential, `vpToken` is an array of string.
|
158
140
|
**/
|
159
|
-
const vp_token = (
|
160
|
-
const descriptor_map =
|
161
|
-
id:
|
162
|
-
path:
|
163
|
-
format:
|
141
|
+
const vp_token = (remotePresentations === null || remotePresentations === void 0 ? void 0 : remotePresentations.length) === 1 ? (_remotePresentations$ = remotePresentations[0]) === null || _remotePresentations$ === void 0 ? void 0 : _remotePresentations$.vpToken : remotePresentations.map(remotePresentation => remotePresentation.vpToken);
|
142
|
+
const descriptor_map = remotePresentations.map((remotePresentation, index) => ({
|
143
|
+
id: remotePresentation.inputDescriptor.id,
|
144
|
+
path: remotePresentations.length === 1 ? `$` : `$[${index}]`,
|
145
|
+
format: remotePresentation.format
|
164
146
|
}));
|
165
147
|
const presentation_submission = {
|
166
148
|
id: _reactNativeUuid.default.v4(),
|
167
149
|
definition_id: presentationDefinitionId,
|
168
150
|
descriptor_map
|
169
151
|
};
|
170
|
-
|
171
|
-
// 2. Choose the appropriate request body builder based on response mode
|
172
|
-
const requestBody = requestObject.response_mode === "direct_post.jwt" ? await buildDirectPostJwtBody(jwkKeys, requestObject, {
|
152
|
+
const requestBody = await buildDirectPostJwtBody(requestObject, rpConf, {
|
173
153
|
vp_token,
|
174
154
|
presentation_submission
|
175
|
-
}, generatedNonce) : await buildDirectPostBody(requestObject, {
|
176
|
-
vp_token,
|
177
|
-
presentation_submission: presentation_submission
|
178
155
|
});
|
179
156
|
|
180
157
|
// 3. Send the authorization response via HTTP POST and validate the response
|
181
|
-
|
158
|
+
return await appFetch(requestObject.response_uri, {
|
182
159
|
method: "POST",
|
183
160
|
headers: {
|
184
161
|
"Content-Type": "application/x-www-form-urlencoded"
|
185
162
|
},
|
186
163
|
body: requestBody
|
187
|
-
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.
|
188
|
-
|
189
|
-
// Some Relying Parties may return an empty body.
|
190
|
-
return authResponse.success ? authResponse.data : {};
|
164
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse);
|
191
165
|
};
|
192
166
|
|
193
167
|
/**
|
194
168
|
* Type definition for the function that sends the authorization response
|
195
169
|
* to the Relying Party, completing the presentation flow.
|
170
|
+
* Use with DCQL queries.
|
196
171
|
*/
|
197
|
-
exports.
|
198
|
-
|
199
|
-
* Sends the authorization error response to the Relying Party (RP) using the specified `response_mode`.
|
200
|
-
* This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
|
201
|
-
*
|
202
|
-
* @param requestObject - The request details, including presentation requirements.
|
203
|
-
* @param error - The response error value
|
204
|
-
* @param jwkKeys - Array of JWKs from the Relying Party for optional encryption.
|
205
|
-
* @param context - Contains optional custom fetch implementation.
|
206
|
-
* @returns Parsed and validated authorization response from the Relying Party.
|
207
|
-
*/
|
208
|
-
const sendAuthorizationErrorResponse = async function (requestObject, error, jwkKeys) {
|
172
|
+
exports.sendLegacyAuthorizationResponse = sendLegacyAuthorizationResponse;
|
173
|
+
const sendAuthorizationResponse = async function (requestObject, remotePresentations, rpConf) {
|
209
174
|
let {
|
210
175
|
appFetch = fetch
|
211
176
|
} = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
212
|
-
//
|
213
|
-
const requestBody =
|
214
|
-
|
215
|
-
|
216
|
-
|
177
|
+
// 1. Prepare the VP token as a JSON object with keys corresponding to the DCQL query credential IDs
|
178
|
+
const requestBody = await buildDirectPostJwtBody(requestObject, rpConf, {
|
179
|
+
vp_token: remotePresentations.reduce((acc, presentation) => ({
|
180
|
+
...acc,
|
181
|
+
[presentation.credentialId]: presentation.vpToken
|
182
|
+
}), {})
|
217
183
|
});
|
218
|
-
|
184
|
+
|
185
|
+
// 2. Send the authorization response via HTTP POST and validate the response
|
219
186
|
return await appFetch(requestObject.response_uri, {
|
220
187
|
method: "POST",
|
221
188
|
headers: {
|
222
189
|
"Content-Type": "application/x-www-form-urlencoded"
|
223
190
|
},
|
224
191
|
body: requestBody
|
225
|
-
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse);
|
192
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse).catch(handleAuthorizationResponseError);
|
226
193
|
};
|
227
|
-
|
228
|
-
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Type definition for the function that sends the authorization response
|
197
|
+
* to the Relying Party, completing the presentation flow.
|
198
|
+
*/
|
199
|
+
exports.sendAuthorizationResponse = sendAuthorizationResponse;
|
200
|
+
/**
|
201
|
+
* Sends the authorization error response to the Relying Party (RP) using the specified `response_mode`.
|
202
|
+
* This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
|
203
|
+
*
|
204
|
+
* @param requestObject - The request details, including presentation requirements.
|
205
|
+
* @param error - The response error value, with description
|
206
|
+
* @param context - Contains optional custom fetch implementation.
|
207
|
+
* @returns Parsed and validated authorization response from the Relying Party.
|
208
|
+
*/
|
209
|
+
const sendAuthorizationErrorResponse = async function (requestObject, _ref2) {
|
210
|
+
let {
|
211
|
+
error,
|
212
|
+
errorDescription
|
213
|
+
} = _ref2;
|
229
214
|
let {
|
230
215
|
appFetch = fetch
|
231
|
-
} = arguments.length >
|
232
|
-
const {
|
233
|
-
|
234
|
-
|
235
|
-
}
|
236
|
-
// 1. Prepare the VP token as a JSON object with keys corresponding to the DCQL query credential IDs
|
237
|
-
const requestBody = await buildDirectPostJwtBody(jwkKeys, requestObject, {
|
238
|
-
vp_token: presentations.reduce((acc, presentation) => ({
|
239
|
-
...acc,
|
240
|
-
[presentation.credentialId]: presentation.vpToken
|
241
|
-
}), {})
|
242
|
-
}, generatedNonce);
|
243
|
-
|
244
|
-
// 2. Send the authorization response via HTTP POST and validate the response
|
216
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
217
|
+
const requestBody = await buildDirectPostBody(requestObject, {
|
218
|
+
error,
|
219
|
+
error_description: errorDescription
|
220
|
+
});
|
245
221
|
return await appFetch(requestObject.response_uri, {
|
246
222
|
method: "POST",
|
247
223
|
headers: {
|
248
224
|
"Content-Type": "application/x-www-form-urlencoded"
|
249
225
|
},
|
250
226
|
body: requestBody
|
251
|
-
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse);
|
227
|
+
}).then((0, _misc.hasStatusOrThrow)(200, _errors2.RelyingPartyResponseError)).then(res => res.json()).then(AuthorizationResponse.parse);
|
252
228
|
};
|
253
229
|
|
254
230
|
/**
|
255
|
-
*
|
256
|
-
*
|
257
|
-
*
|
258
|
-
*
|
259
|
-
* - Generates a verifiable presentation token (vpToken) using the appropriate method.
|
260
|
-
* - For ISO 18013-7, generates a special nonce with minimum entropy of 16.
|
261
|
-
*
|
262
|
-
* @param credentials - An array of credential items containing format, credential data, requested claims, and key information.
|
263
|
-
* @param authRequestObject - The authentication request object containing nonce, clientId, and responseUri.
|
264
|
-
* @returns A promise that resolves to an object containing an array of presentations and the generated nonce.
|
265
|
-
* @throws {CredentialNotFoundError} When the credential format is unsupported.
|
231
|
+
* Handle the the presentation error by mapping it to a custom exception.
|
232
|
+
* If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
|
233
|
+
* @param e - The error to be handled
|
234
|
+
* @throws {RelyingPartyResponseError} with a specific code for more context
|
266
235
|
*/
|
267
|
-
exports.
|
268
|
-
const
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
let {
|
283
|
-
name
|
284
|
-
} = _ref2;
|
285
|
-
return name;
|
286
|
-
})],
|
287
|
-
credentialId: credentialInputId,
|
288
|
-
vpToken: vp_token,
|
289
|
-
format: "mso_mdoc"
|
290
|
-
};
|
291
|
-
}
|
292
|
-
if (format === "vc+sd-jwt") {
|
293
|
-
const {
|
294
|
-
vp_token
|
295
|
-
} = await (0, _sdJwt.prepareVpToken)(authRequestObject.nonce, authRequestObject.clientId, [item.credential, item.requestedClaims, (0, _crypto.createCryptoContextFor)(item.keyTag)]);
|
296
|
-
return {
|
297
|
-
requestedClaims: [...item.requestedClaims.map(_ref3 => {
|
298
|
-
let {
|
299
|
-
name
|
300
|
-
} = _ref3;
|
301
|
-
return name;
|
302
|
-
})],
|
303
|
-
credentialId: credentialInputId,
|
304
|
-
vpToken: vp_token,
|
305
|
-
format: "vc+sd-jwt"
|
306
|
-
};
|
307
|
-
}
|
308
|
-
throw new _errors.CredentialNotFoundError(`${format} format is not supported.`);
|
309
|
-
}));
|
310
|
-
return {
|
311
|
-
presentations,
|
312
|
-
generatedNonce
|
313
|
-
};
|
236
|
+
exports.sendAuthorizationErrorResponse = sendAuthorizationErrorResponse;
|
237
|
+
const handleAuthorizationResponseError = e => {
|
238
|
+
if (!(e instanceof _errors2.UnexpectedStatusCodeError)) {
|
239
|
+
throw e;
|
240
|
+
}
|
241
|
+
throw new _errors2.ResponseErrorBuilder(_errors2.RelyingPartyResponseError).handle(400, {
|
242
|
+
code: _errors2.RelyingPartyResponseErrorCodes.InvalidAuthorizationResponse,
|
243
|
+
message: "The Authorization Response contains invalid parameters or it is malformed"
|
244
|
+
}).handle(403, {
|
245
|
+
code: _errors2.RelyingPartyResponseErrorCodes.InvalidAuthorizationResponse,
|
246
|
+
message: "The Authorization Response was forbidden"
|
247
|
+
}).handle("*", {
|
248
|
+
code: _errors2.RelyingPartyResponseErrorCodes.RelyingPartyGenericError,
|
249
|
+
message: "Unable to successfully send the Authorization Response"
|
250
|
+
}).buildFrom(e);
|
314
251
|
};
|
315
|
-
exports.prepareRemotePresentations = prepareRemotePresentations;
|
316
252
|
//# sourceMappingURL=08-send-authorization-response.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","_errors","_misc","z","_interopRequireWildcard","_jsBase","_mdoc","_crypto","_sdJwt","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationResponse","object","status","string","optional","response_code","redirect_uri","exports","choosePublicKeyToEncrypt","rpJwkKeys","encKeys","filter","jwk","use","ecEncKeys","kty","crv","rsaEncKeys","encKey","NoSuitableKeysFoundInEntityConfiguration","buildDirectPostBody","requestObject","payload","formUrlEncodedBody","URLSearchParams","state","fromEntries","entries","map","_ref","value","Array","isArray","JSON","stringify","toString","buildDirectPostJwtBody","jwkKeys","generatedNonce","authzResponsePayload","encPublicJwk","client_metadata","encryptedResponse","EncryptJwe","alg","authorization_encrypted_response_alg","enc","authorization_encrypted_response_enc","kid","apv","Base64","encodeURI","nonce","apu","encrypt","formBody","response","sendAuthorizationResponse","presentationDefinitionId","remotePresentation","_presentations$","appFetch","fetch","arguments","length","undefined","presentations","vp_token","vpToken","presentation","descriptor_map","index","id","credentialId","path","format","presentation_submission","uuid","v4","definition_id","requestBody","response_mode","authResponse","response_uri","method","headers","body","then","hasStatusOrThrow","res","json","safeParse","success","data","sendAuthorizationErrorResponse","error","parse","sendAuthorizationResponseDcql","reduce","acc","prepareRemotePresentations","credentials","authRequestObject","generateRandomAlphaNumericString","Promise","all","item","credentialInputId","prepareVpTokenMdoc","clientId","responseUri","doctype","keyTag","credential","requestedClaims","createCryptoContextFor","_ref2","name","prepareVpToken","_ref3","CredentialNotFoundError"],"sourceRoot":"../../../../src","sources":["credential/presentation/08-send-authorization-response.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,OAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AAOA,IAAAK,CAAA,GAAAC,uBAAA,CAAAN,OAAA;AAEA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,KAAA,GAAAR,OAAA;AAEA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAA8C,SAAAW,yBAAAC,WAAA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uid","_interopRequireDefault","_retrieveRpJwks","_errors","_misc","z","_interopRequireWildcard","_errors2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationResponse","object","status","string","optional","response_code","redirect_uri","exports","choosePublicKeyToEncrypt","rpJwkKeys","encKey","find","jwk","use","NoSuitableKeysFoundInEntityConfiguration","buildDirectPostJwtBody","requestObject","rpConf","payload","authzResponsePayload","JSON","stringify","state","keys","getJwksFromConfig","encPublicJwk","authorization_encrypted_response_alg","authorization_encrypted_response_enc","openid_credential_verifier","defaultAlg","kty","encryptedResponse","EncryptJwe","alg","enc","kid","encrypt","formBody","URLSearchParams","response","toString","buildDirectPostBody","formUrlEncodedBody","entries","reduce","acc","_ref","value","Array","isArray","sendLegacyAuthorizationResponse","presentationDefinitionId","remotePresentations","_remotePresentations$","appFetch","fetch","arguments","length","undefined","vp_token","vpToken","map","remotePresentation","descriptor_map","index","id","inputDescriptor","path","format","presentation_submission","uuid","v4","definition_id","requestBody","response_uri","method","headers","body","then","hasStatusOrThrow","res","json","parse","sendAuthorizationResponse","presentation","credentialId","catch","handleAuthorizationResponseError","sendAuthorizationErrorResponse","_ref2","error","errorDescription","error_description","RelyingPartyResponseError","e","UnexpectedStatusCodeError","ResponseErrorBuilder","handle","code","RelyingPartyResponseErrorCodes","InvalidAuthorizationResponse","message","RelyingPartyGenericError","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/presentation/08-send-authorization-response.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAOA,IAAAM,CAAA,GAAAC,uBAAA,CAAA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