@pagopa/io-react-native-wallet 1.7.1 → 2.0.0-next.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/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/{entity/trust → trust}/chain.js +49 -55
- package/lib/commonjs/trust/chain.js.map +1 -0
- package/lib/commonjs/trust/errors.js +110 -0
- package/lib/commonjs/trust/errors.js.map +1 -0
- package/lib/commonjs/trust/index.js +282 -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 +41 -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/chain.js +108 -0
- package/lib/module/trust/chain.js.map +1 -0
- package/lib/module/trust/errors.js +94 -0
- package/lib/module/trust/errors.js.map +1 -0
- package/lib/module/trust/index.js +263 -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 +33 -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 +30 -82
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +29 -134
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/{entity/trust → trust}/chain.d.ts +5 -10
- package/lib/typescript/trust/chain.d.ts.map +1 -0
- package/lib/typescript/trust/errors.d.ts +80 -0
- package/lib/typescript/trust/errors.d.ts.map +1 -0
- package/lib/typescript/{entity/trust → trust}/index.d.ts +211 -186
- package/lib/typescript/trust/index.d.ts.map +1 -0
- package/lib/typescript/{entity/trust → trust}/types.d.ts +1533 -1120
- package/lib/typescript/{entity/trust → trust}/types.d.ts.map +1 -1
- package/lib/typescript/trust/utils.d.ts +12 -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 +78 -120
- package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
- package/package.json +8 -9
- 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/chain.ts +151 -0
- package/src/trust/errors.ts +105 -0
- package/src/{entity/trust → trust}/index.ts +198 -23
- package/src/{entity/trust → trust}/types.ts +24 -37
- package/src/trust/utils.ts +35 -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.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.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
@@ -0,0 +1,282 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.buildTrustChain = buildTrustChain;
|
7
|
+
exports.getEntityConfiguration = exports.getCredentialIssuerEntityConfiguration = void 0;
|
8
|
+
exports.getEntityStatement = getEntityStatement;
|
9
|
+
exports.getFederationList = getFederationList;
|
10
|
+
exports.getRelyingPartyEntityConfiguration = void 0;
|
11
|
+
exports.getSignedEntityConfiguration = getSignedEntityConfiguration;
|
12
|
+
exports.getSignedEntityStatement = getSignedEntityStatement;
|
13
|
+
exports.getWalletProviderEntityConfiguration = exports.getTrustAnchorEntityConfiguration = void 0;
|
14
|
+
exports.verifyTrustChain = verifyTrustChain;
|
15
|
+
var _utils = require("./utils");
|
16
|
+
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
17
|
+
var _types = require("./types");
|
18
|
+
var _chain = require("./chain");
|
19
|
+
var _misc = require("../utils/misc");
|
20
|
+
var _errors = require("./errors");
|
21
|
+
/**
|
22
|
+
* Verify a given trust chain is actually valid.
|
23
|
+
* It can handle fast chain renewal, which means we try to fetch a fresh version of each statement.
|
24
|
+
*
|
25
|
+
* @param trustAnchorEntity The entity configuration of the known trust anchor
|
26
|
+
* @param chain The chain of statements to be validated
|
27
|
+
* @param renewOnFail Whether to renew the provided chain if the validation fails at first. Default: true
|
28
|
+
* @param appFetch Fetch api implementation. Default: the built-in implementation
|
29
|
+
* @returns The result of the chain validation
|
30
|
+
* @throws {FederationError} If the chain is not valid
|
31
|
+
*/
|
32
|
+
async function verifyTrustChain(trustAnchorEntity, chain) {
|
33
|
+
let {
|
34
|
+
appFetch = fetch,
|
35
|
+
renewOnFail = true
|
36
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
37
|
+
try {
|
38
|
+
return (0, _chain.validateTrustChain)(trustAnchorEntity, chain);
|
39
|
+
} catch (error) {
|
40
|
+
if (renewOnFail) {
|
41
|
+
const renewedChain = await (0, _chain.renewTrustChain)(chain, appFetch);
|
42
|
+
return (0, _chain.validateTrustChain)(trustAnchorEntity, renewedChain);
|
43
|
+
} else {
|
44
|
+
throw error;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Fetch the signed entity configuration token for an entity
|
51
|
+
*
|
52
|
+
* @param entityBaseUrl The url of the entity to fetch
|
53
|
+
* @param appFetch (optional) fetch api implementation
|
54
|
+
* @returns The signed Entity Configuration token
|
55
|
+
*/
|
56
|
+
async function getSignedEntityConfiguration(entityBaseUrl) {
|
57
|
+
let {
|
58
|
+
appFetch = fetch
|
59
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
60
|
+
const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-federation`;
|
61
|
+
return await appFetch(wellKnownUrl, {
|
62
|
+
method: "GET"
|
63
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.text());
|
64
|
+
}
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Fetch and parse the entity configuration document for a given federation entity.
|
68
|
+
* This is an inner method to serve public interfaces.
|
69
|
+
*
|
70
|
+
* To add another entity configuration type (example: Foo entity type):
|
71
|
+
* - create its zod schema and type by inherit from the base type (example: FooEntityConfiguration = BaseEntityConfiguration.and(...))
|
72
|
+
* - add such type to EntityConfiguration union
|
73
|
+
* - add an overload to this function
|
74
|
+
* - create a public function which use such type (example: getFooEntityConfiguration = (url, options) => Promise<FooEntityConfiguration>)
|
75
|
+
*
|
76
|
+
* @param entityBaseUrl The base url of the entity.
|
77
|
+
* @param schema The expected schema of the entity configuration, according to the kind of entity we are fetching from.
|
78
|
+
* @param options An optional object with additional options.
|
79
|
+
* @param options.appFetch An optional instance of the http client to be used.
|
80
|
+
* @returns The parsed entity configuration object
|
81
|
+
* @throws {IoWalletError} If the http request fails
|
82
|
+
* @throws Parse error if the document is not in the expected shape.
|
83
|
+
*/
|
84
|
+
|
85
|
+
async function fetchAndParseEntityConfiguration(entityBaseUrl, schema) {
|
86
|
+
let {
|
87
|
+
appFetch = fetch
|
88
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
89
|
+
const responseText = await getSignedEntityConfiguration(entityBaseUrl, {
|
90
|
+
appFetch
|
91
|
+
});
|
92
|
+
const responseJwt = (0, _ioReactNativeJwt.decode)(responseText);
|
93
|
+
return schema.parse({
|
94
|
+
header: responseJwt.protectedHeader,
|
95
|
+
payload: responseJwt.payload
|
96
|
+
});
|
97
|
+
}
|
98
|
+
const getWalletProviderEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.WalletProviderEntityConfiguration, options);
|
99
|
+
exports.getWalletProviderEntityConfiguration = getWalletProviderEntityConfiguration;
|
100
|
+
const getCredentialIssuerEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.CredentialIssuerEntityConfiguration, options);
|
101
|
+
exports.getCredentialIssuerEntityConfiguration = getCredentialIssuerEntityConfiguration;
|
102
|
+
const getTrustAnchorEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.TrustAnchorEntityConfiguration, options);
|
103
|
+
exports.getTrustAnchorEntityConfiguration = getTrustAnchorEntityConfiguration;
|
104
|
+
const getRelyingPartyEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.RelyingPartyEntityConfiguration, options);
|
105
|
+
exports.getRelyingPartyEntityConfiguration = getRelyingPartyEntityConfiguration;
|
106
|
+
const getEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.EntityConfiguration, options);
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Fetch and parse the entity statement document for a given federation entity.
|
110
|
+
*
|
111
|
+
* @param accreditationBodyBaseUrl The base url of the accreditation body which holds and signs the required entity statement
|
112
|
+
* @param subordinatedEntityBaseUrl The url that identifies the subordinate entity
|
113
|
+
* @param appFetch An optional instance of the http client to be used.
|
114
|
+
* @returns The parsed entity configuration object
|
115
|
+
* @throws {IoWalletError} If the http request fails
|
116
|
+
*/
|
117
|
+
exports.getEntityConfiguration = getEntityConfiguration;
|
118
|
+
async function getEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl) {
|
119
|
+
let {
|
120
|
+
appFetch = fetch
|
121
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
122
|
+
const responseText = await getSignedEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl, {
|
123
|
+
appFetch
|
124
|
+
});
|
125
|
+
const responseJwt = (0, _ioReactNativeJwt.decode)(responseText);
|
126
|
+
return _types.EntityStatement.parse({
|
127
|
+
header: responseJwt.protectedHeader,
|
128
|
+
payload: responseJwt.payload
|
129
|
+
});
|
130
|
+
}
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Fetch the entity statement document for a given federation entity.
|
134
|
+
*
|
135
|
+
* @param federationFetchEndpoint The exact endpoint provided by the parent EC's metadata.
|
136
|
+
* @param subordinatedEntityBaseUrl The url that identifies the subordinate entity.
|
137
|
+
* @param appFetch An optional instance of the http client to be used.
|
138
|
+
* @returns The signed entity statement token.
|
139
|
+
* @throws {IoWalletError} If the http request fails.
|
140
|
+
*/
|
141
|
+
async function getSignedEntityStatement(federationFetchEndpoint, subordinatedEntityBaseUrl) {
|
142
|
+
let {
|
143
|
+
appFetch = fetch
|
144
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
145
|
+
const url = new URL(federationFetchEndpoint);
|
146
|
+
url.searchParams.set("sub", subordinatedEntityBaseUrl);
|
147
|
+
return await appFetch(url.toString(), {
|
148
|
+
method: "GET"
|
149
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.text());
|
150
|
+
}
|
151
|
+
|
152
|
+
/**
|
153
|
+
* Fetch the federation list document from a given endpoint.
|
154
|
+
*
|
155
|
+
* @param federationListEndpoint The URL of the federation list endpoint.
|
156
|
+
* @param appFetch An optional instance of the http client to be used.
|
157
|
+
* @returns The federation list as an array of strings.
|
158
|
+
* @throws {IoWalletError} If the HTTP request fails.
|
159
|
+
* @throws {FederationError} If the result is not in the expected format.
|
160
|
+
*/
|
161
|
+
async function getFederationList(federationListEndpoint) {
|
162
|
+
let {
|
163
|
+
appFetch = fetch
|
164
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
165
|
+
return await appFetch(federationListEndpoint, {
|
166
|
+
method: "GET"
|
167
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(json => {
|
168
|
+
const result = _types.FederationListResponse.safeParse(json);
|
169
|
+
if (!result.success) {
|
170
|
+
throw new _errors.FederationListParseError(`Invalid federation list format received from ${federationListEndpoint}. Error: ${result.error.message}`, {
|
171
|
+
url: federationListEndpoint,
|
172
|
+
parseError: result.error.toString()
|
173
|
+
});
|
174
|
+
}
|
175
|
+
return result.data;
|
176
|
+
});
|
177
|
+
}
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Build a not-verified trust chain for a given Relying Party (RP) entity.
|
181
|
+
*
|
182
|
+
* @param relyingPartyEntityBaseUrl The base URL of the RP entity
|
183
|
+
* @param trustAnchorKey The public key of the Trust Anchor (TA) entity
|
184
|
+
* @param appFetch An optional instance of the http client to be used.
|
185
|
+
* @returns A list of signed tokens that represent the trust chain, in the order of the chain (from the RP to the Trust Anchor)
|
186
|
+
* @throws {FederationError} When an element of the chain fails to parse or other build steps fail.
|
187
|
+
*/
|
188
|
+
async function buildTrustChain(relyingPartyEntityBaseUrl, trustAnchorKey) {
|
189
|
+
let appFetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : fetch;
|
190
|
+
// 1: Recursively gather the trust chain from the RP up to the Trust Anchor
|
191
|
+
const trustChain = await gatherTrustChain(relyingPartyEntityBaseUrl, appFetch);
|
192
|
+
|
193
|
+
// 2: Trust Anchor signature verification
|
194
|
+
const trustAnchorJwt = trustChain[trustChain.length - 1];
|
195
|
+
if (!trustAnchorJwt) {
|
196
|
+
throw new _errors.BuildTrustChainError("Cannot verify trust anchor: missing entity configuration in gathered chain.", {
|
197
|
+
relyingPartyUrl: relyingPartyEntityBaseUrl
|
198
|
+
});
|
199
|
+
}
|
200
|
+
if (!trustAnchorKey.kid) {
|
201
|
+
throw new _errors.TrustAnchorKidMissingError();
|
202
|
+
}
|
203
|
+
await (0, _utils.verify)(trustAnchorJwt, trustAnchorKey.kid, [trustAnchorKey]);
|
204
|
+
|
205
|
+
// 3: Check the federation list
|
206
|
+
const trustAnchorConfig = _types.EntityConfiguration.parse((0, _utils.decode)(trustAnchorJwt));
|
207
|
+
const federationListEndpoint = trustAnchorConfig.payload.metadata.federation_entity.federation_list_endpoint;
|
208
|
+
if (federationListEndpoint) {
|
209
|
+
const federationList = await getFederationList(federationListEndpoint, {
|
210
|
+
appFetch
|
211
|
+
});
|
212
|
+
if (!federationList.includes(relyingPartyEntityBaseUrl)) {
|
213
|
+
throw new _errors.RelyingPartyNotAuthorizedError("Relying Party entity base URL is not authorized by the Trust Anchor's federation list.", {
|
214
|
+
relyingPartyUrl: relyingPartyEntityBaseUrl,
|
215
|
+
federationListEndpoint
|
216
|
+
});
|
217
|
+
}
|
218
|
+
}
|
219
|
+
return trustChain;
|
220
|
+
}
|
221
|
+
|
222
|
+
/**
|
223
|
+
* Recursively gather the trust chain for an entity and all its superiors.
|
224
|
+
* @param entityBaseUrl The base URL of the entity for which to gather the chain.
|
225
|
+
* @param appFetch An optional instance of the http client to be used.
|
226
|
+
* @param isLeaf Whether the current entity is the leaf of the chain.
|
227
|
+
* @returns A full ordered list of JWTs (ECs and ESs) forming the trust chain.
|
228
|
+
* @throws {FederationError} If any of the fetched documents fail to parse or other errors occur during the gathering process.
|
229
|
+
*/
|
230
|
+
async function gatherTrustChain(entityBaseUrl, appFetch) {
|
231
|
+
let isLeaf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
232
|
+
const chain = [];
|
233
|
+
|
234
|
+
// Fetch self-signed EC (only needed for the leaf)
|
235
|
+
const entityECJwt = await getSignedEntityConfiguration(entityBaseUrl, {
|
236
|
+
appFetch
|
237
|
+
});
|
238
|
+
const entityEC = _types.EntityConfiguration.parse((0, _utils.decode)(entityECJwt));
|
239
|
+
if (isLeaf) {
|
240
|
+
// Only push EC for the leaf
|
241
|
+
chain.push(entityECJwt);
|
242
|
+
}
|
243
|
+
|
244
|
+
// Find authority_hints (parent, if any)
|
245
|
+
const authorityHints = entityEC.payload.authority_hints ?? [];
|
246
|
+
if (authorityHints.length === 0) {
|
247
|
+
// This is the Trust Anchor (no parent)
|
248
|
+
if (!isLeaf) {
|
249
|
+
chain.push(entityECJwt);
|
250
|
+
}
|
251
|
+
return chain;
|
252
|
+
}
|
253
|
+
const parentEntityBaseUrl = authorityHints[0];
|
254
|
+
|
255
|
+
// Fetch parent EC
|
256
|
+
const parentECJwt = await getSignedEntityConfiguration(parentEntityBaseUrl, {
|
257
|
+
appFetch
|
258
|
+
});
|
259
|
+
const parentEC = _types.EntityConfiguration.parse((0, _utils.decode)(parentECJwt));
|
260
|
+
|
261
|
+
// Fetch ES
|
262
|
+
const federationFetchEndpoint = parentEC.payload.metadata.federation_entity.federation_fetch_endpoint;
|
263
|
+
if (!federationFetchEndpoint) {
|
264
|
+
throw new _errors.MissingFederationFetchEndpointError(`Missing federation_fetch_endpoint in parent's (${parentEntityBaseUrl}) configuration when gathering chain for ${entityBaseUrl}.`, {
|
265
|
+
entityBaseUrl,
|
266
|
+
missingInEntityUrl: parentEntityBaseUrl
|
267
|
+
});
|
268
|
+
}
|
269
|
+
const entityStatementJwt = await getSignedEntityStatement(federationFetchEndpoint, entityBaseUrl, {
|
270
|
+
appFetch
|
271
|
+
});
|
272
|
+
// Validate the ES
|
273
|
+
_types.EntityStatement.parse((0, _utils.decode)(entityStatementJwt));
|
274
|
+
|
275
|
+
// Push this ES into the chain
|
276
|
+
chain.push(entityStatementJwt);
|
277
|
+
|
278
|
+
// Recurse into the parent
|
279
|
+
const parentChain = await gatherTrustChain(parentEntityBaseUrl, appFetch, false);
|
280
|
+
return chain.concat(parentChain);
|
281
|
+
}
|
282
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_utils","require","_ioReactNativeJwt","_types","_chain","_misc","_errors","verifyTrustChain","trustAnchorEntity","chain","appFetch","fetch","renewOnFail","arguments","length","undefined","validateTrustChain","error","renewedChain","renewTrustChain","getSignedEntityConfiguration","entityBaseUrl","wellKnownUrl","method","then","hasStatusOrThrow","res","text","fetchAndParseEntityConfiguration","schema","responseText","responseJwt","decodeJwt","parse","header","protectedHeader","payload","getWalletProviderEntityConfiguration","options","WalletProviderEntityConfiguration","exports","getCredentialIssuerEntityConfiguration","CredentialIssuerEntityConfiguration","getTrustAnchorEntityConfiguration","TrustAnchorEntityConfiguration","getRelyingPartyEntityConfiguration","RelyingPartyEntityConfiguration","getEntityConfiguration","EntityConfiguration","getEntityStatement","accreditationBodyBaseUrl","subordinatedEntityBaseUrl","getSignedEntityStatement","EntityStatement","federationFetchEndpoint","url","URL","searchParams","set","toString","getFederationList","federationListEndpoint","json","result","FederationListResponse","safeParse","success","FederationListParseError","message","parseError","data","buildTrustChain","relyingPartyEntityBaseUrl","trustAnchorKey","trustChain","gatherTrustChain","trustAnchorJwt","BuildTrustChainError","relyingPartyUrl","kid","TrustAnchorKidMissingError","verify","trustAnchorConfig","decode","metadata","federation_entity","federation_list_endpoint","federationList","includes","RelyingPartyNotAuthorizedError","isLeaf","entityECJwt","entityEC","push","authorityHints","authority_hints","parentEntityBaseUrl","parentECJwt","parentEC","federation_fetch_endpoint","MissingFederationFetchEndpointError","missingInEntityUrl","entityStatementJwt","parentChain","concat"],"sourceRoot":"../../../src","sources":["trust/index.ts"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AASA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KA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|
@@ -3,11 +3,11 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.WalletProviderEntityConfiguration = exports.TrustMark = exports.TrustAnchorEntityConfiguration = exports.RelyingPartyEntityConfiguration = exports.EntityStatement = exports.EntityConfigurationHeader = exports.EntityConfiguration = exports.CredentialIssuerEntityConfiguration = void 0;
|
7
|
-
var _types = require("
|
8
|
-
var _jwk = require("
|
6
|
+
exports.WalletProviderEntityConfiguration = exports.TrustMark = exports.TrustAnchorEntityConfiguration = exports.RelyingPartyEntityConfiguration = exports.FederationListResponse = exports.EntityStatement = exports.EntityConfigurationHeader = exports.EntityConfiguration = exports.CredentialIssuerEntityConfiguration = void 0;
|
7
|
+
var _types = require("../sd-jwt/types");
|
8
|
+
var _jwk = require("../utils/jwk");
|
9
9
|
var z = _interopRequireWildcard(require("zod"));
|
10
|
-
var _types2 = require("
|
10
|
+
var _types2 = require("../credential/presentation/types");
|
11
11
|
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); }
|
12
12
|
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; }
|
13
13
|
const TrustMark = z.object({
|
@@ -24,36 +24,25 @@ const RelyingPartyMetadata = z.object({
|
|
24
24
|
}),
|
25
25
|
contacts: z.array(z.string()).optional(),
|
26
26
|
presentation_definition: _types2.PresentationDefinition.optional(),
|
27
|
-
|
27
|
+
request_uris: z.array(z.string()).optional(),
|
28
|
+
authorization_signed_response_alg: z.string().optional(),
|
29
|
+
authorization_encrypted_response_alg: z.string().optional(),
|
30
|
+
authorization_encrypted_response_enc: z.string().optional()
|
28
31
|
});
|
29
|
-
//.passthrough();
|
30
32
|
|
31
33
|
// Display metadata for a credential, used by the issuer to
|
32
34
|
// instruct the Wallet Solution on how to render the credential correctly
|
33
35
|
const CredentialDisplayMetadata = z.object({
|
34
36
|
name: z.string(),
|
35
|
-
locale: z.string()
|
36
|
-
logo: z.object({
|
37
|
-
url: z.string(),
|
38
|
-
alt_text: z.string()
|
39
|
-
}).optional(),
|
40
|
-
// TODO [SIW-1268]: should not be optional
|
41
|
-
background_color: z.string().optional(),
|
42
|
-
// TODO [SIW-1268]: should not be optional
|
43
|
-
text_color: z.string().optional() // TODO [SIW-1268]: should not be optional
|
37
|
+
locale: z.string()
|
44
38
|
});
|
45
39
|
|
46
40
|
// Metadata for displaying issuer information
|
47
41
|
|
48
42
|
const CredentialIssuerDisplayMetadata = z.object({
|
49
43
|
name: z.string(),
|
50
|
-
locale: z.string()
|
51
|
-
logo: z.object({
|
52
|
-
url: z.string(),
|
53
|
-
alt_text: z.string()
|
54
|
-
}).optional() // TODO [SIW-1268]: should not be optional
|
44
|
+
locale: z.string()
|
55
45
|
});
|
56
|
-
|
57
46
|
const ClaimsMetadata = z.record(z.object({
|
58
47
|
value_type: z.string(),
|
59
48
|
display: z.array(z.object({
|
@@ -69,14 +58,13 @@ const IssuanceErrorSupported = z.object({
|
|
69
58
|
}))
|
70
59
|
});
|
71
60
|
|
72
|
-
// Metadata for a
|
61
|
+
// Metadata for a credential which is supported by an Issuer
|
73
62
|
|
74
63
|
const SupportedCredentialMetadata = z.object({
|
75
|
-
format: z.union([z.literal("vc+sd-jwt"), z.literal("
|
64
|
+
format: z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]),
|
76
65
|
scope: z.string(),
|
77
66
|
display: z.array(CredentialDisplayMetadata),
|
78
|
-
claims: ClaimsMetadata
|
79
|
-
// TODO [SIW-1268]: should not be optional
|
67
|
+
claims: ClaimsMetadata,
|
80
68
|
cryptographic_binding_methods_supported: z.array(z.string()),
|
81
69
|
credential_signing_alg_values_supported: z.array(z.string()),
|
82
70
|
authentic_source: z.string().optional(),
|
@@ -94,7 +82,7 @@ const EntityStatement = z.object({
|
|
94
82
|
jwks: z.object({
|
95
83
|
keys: z.array(_jwk.JWK)
|
96
84
|
}),
|
97
|
-
trust_marks: z.array(TrustMark),
|
85
|
+
trust_marks: z.array(TrustMark).optional(),
|
98
86
|
iat: z.number(),
|
99
87
|
exp: z.number()
|
100
88
|
})
|
@@ -107,7 +95,7 @@ const EntityConfigurationHeader = z.object({
|
|
107
95
|
});
|
108
96
|
|
109
97
|
/**
|
110
|
-
* @see https://openid.net/specs/openid-
|
98
|
+
* @see https://openid.net/specs/openid-federation-1_0-41.html
|
111
99
|
*/
|
112
100
|
exports.EntityConfigurationHeader = EntityConfigurationHeader;
|
113
101
|
const FederationEntityMetadata = z.object({
|
@@ -116,6 +104,9 @@ const FederationEntityMetadata = z.object({
|
|
116
104
|
federation_resolve_endpoint: z.string().optional(),
|
117
105
|
federation_trust_mark_status_endpoint: z.string().optional(),
|
118
106
|
federation_trust_mark_list_endpoint: z.string().optional(),
|
107
|
+
federation_trust_mark_endpoint: z.string().optional(),
|
108
|
+
federation_historical_keys_endpoint: z.string().optional(),
|
109
|
+
endpoint_auth_signing_alg_values_supported: z.string().optional(),
|
119
110
|
organization_name: z.string().optional(),
|
120
111
|
homepage_uri: z.string().optional(),
|
121
112
|
policy_uri: z.string().optional(),
|
@@ -123,7 +114,7 @@ const FederationEntityMetadata = z.object({
|
|
123
114
|
contacts: z.array(z.string()).optional()
|
124
115
|
}).passthrough();
|
125
116
|
|
126
|
-
//
|
117
|
+
// Structure common to every Entity Configuration document
|
127
118
|
const BaseEntityConfiguration = z.object({
|
128
119
|
header: EntityConfigurationHeader,
|
129
120
|
payload: z.object({
|
@@ -167,15 +158,9 @@ const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(z.object
|
|
167
158
|
oauth_authorization_server: z.object({
|
168
159
|
authorization_endpoint: z.string(),
|
169
160
|
pushed_authorization_request_endpoint: z.string(),
|
170
|
-
dpop_signing_alg_values_supported: z.array(z.string()).optional(),
|
171
|
-
// TODO [SIW-1268]: should not be optional
|
172
161
|
token_endpoint: z.string(),
|
173
|
-
introspection_endpoint: z.string().optional(),
|
174
|
-
// TODO [SIW-1268]: should not be optional
|
175
162
|
client_registration_types_supported: z.array(z.string()),
|
176
163
|
code_challenge_methods_supported: z.array(z.string()),
|
177
|
-
authorization_details_types_supported: z.array(z.string()).optional(),
|
178
|
-
// TODO [SIW-1268]: should not be optional,
|
179
164
|
acr_values_supported: z.array(z.string()),
|
180
165
|
grant_types_supported: z.array(z.string()),
|
181
166
|
issuer: z.string(),
|
@@ -183,23 +168,16 @@ const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(z.object
|
|
183
168
|
keys: z.array(_jwk.JWK)
|
184
169
|
}),
|
185
170
|
scopes_supported: z.array(z.string()),
|
186
|
-
request_parameter_supported: z.boolean().optional(),
|
187
|
-
// TODO [SIW-1268]: should not be optional
|
188
|
-
request_uri_parameter_supported: z.boolean().optional(),
|
189
|
-
// TODO [SIW-1268]: should not be optional
|
190
|
-
response_types_supported: z.array(z.string()).optional(),
|
191
|
-
// TODO [SIW-1268]: should not be optional
|
192
171
|
response_modes_supported: z.array(z.string()),
|
193
|
-
subject_types_supported: z.array(z.string()).optional(),
|
194
|
-
// TODO [SIW-1268]: should not be optional
|
195
172
|
token_endpoint_auth_methods_supported: z.array(z.string()),
|
196
173
|
token_endpoint_auth_signing_alg_values_supported: z.array(z.string()),
|
197
174
|
request_object_signing_alg_values_supported: z.array(z.string())
|
198
175
|
}),
|
199
|
-
/**
|
200
|
-
|
201
|
-
|
202
|
-
|
176
|
+
/**
|
177
|
+
* Credential Issuers act as Relying Party when they require the presentation of other credentials.
|
178
|
+
* This does not apply for PID issuance, which requires CIE authz.
|
179
|
+
*/
|
180
|
+
openid_credential_verifier: RelyingPartyMetadata.optional()
|
203
181
|
})
|
204
182
|
})
|
205
183
|
}));
|
@@ -209,7 +187,7 @@ exports.CredentialIssuerEntityConfiguration = CredentialIssuerEntityConfiguratio
|
|
209
187
|
const RelyingPartyEntityConfiguration = BaseEntityConfiguration.and(z.object({
|
210
188
|
payload: z.object({
|
211
189
|
metadata: z.object({
|
212
|
-
|
190
|
+
openid_credential_verifier: RelyingPartyMetadata
|
213
191
|
})
|
214
192
|
})
|
215
193
|
}));
|
@@ -239,4 +217,6 @@ const EntityConfiguration = z.union([WalletProviderEntityConfiguration, Credenti
|
|
239
217
|
description: "Any kind of Entity Configuration allowed in the ecosystem"
|
240
218
|
});
|
241
219
|
exports.EntityConfiguration = EntityConfiguration;
|
220
|
+
const FederationListResponse = z.array(z.string());
|
221
|
+
exports.FederationListResponse = FederationListResponse;
|
242
222
|
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_types","require","_jwk","z","_interopRequireWildcard","_types2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","TrustMark","object","id","string","trust_mark","exports","RelyingPartyMetadata","application_type","optional","client_id","client_name","jwks","keys","array","JWK","contacts","presentation_definition","PresentationDefinition","request_uris","authorization_signed_response_alg","authorization_encrypted_response_alg","authorization_encrypted_response_enc","CredentialDisplayMetadata","name","locale","CredentialIssuerDisplayMetadata","ClaimsMetadata","record","value_type","display","IssuanceErrorSupported","title","description","SupportedCredentialMetadata","format","union","literal","scope","claims","cryptographic_binding_methods_supported","credential_signing_alg_values_supported","authentic_source","issuance_errors_supported","EntityStatement","header","typ","alg","kid","payload","iss","sub","trust_marks","iat","number","exp","EntityConfigurationHeader","FederationEntityMetadata","federation_fetch_endpoint","federation_list_endpoint","federation_resolve_endpoint","federation_trust_mark_status_endpoint","federation_trust_mark_list_endpoint","federation_trust_mark_endpoint","federation_historical_keys_endpoint","endpoint_auth_signing_alg_values_supported","organization_name","homepage_uri","policy_uri","logo_uri","passthrough","BaseEntityConfiguration","UnixTime","authority_hints","metadata","federation_entity","TrustAnchorEntityConfiguration","CredentialIssuerEntityConfiguration","and","openid_credential_issuer","credential_issuer","credential_endpoint","revocation_endpoint","status_attestation_endpoint","credential_configurations_supported","oauth_authorization_server","authorization_endpoint","pushed_authorization_request_endpoint","token_endpoint","client_registration_types_supported","code_challenge_methods_supported","acr_values_supported","grant_types_supported","issuer","scopes_supported","response_modes_supported","token_endpoint_auth_methods_supported","token_endpoint_auth_signing_alg_values_supported","request_object_signing_alg_values_supported","openid_credential_verifier","RelyingPartyEntityConfiguration","WalletProviderEntityConfiguration","wallet_provider","aal_values_supported","EntityConfiguration","FederationListResponse"],"sourceRoot":"../../../src","sources":["trust/types.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAA0E,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,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,qBAAqB,EAAEpH,CAAC,CAACsC,KAAK,CAACtC,CAAC,CAAC4B,MAAM,CAAC,CAAC,CAAC;QAC1C4F,qCAAqC,EAAExH,CAAC,CAACsC,KAAK,CAACtC,CAAC,CAAC4B,MAAM,CAAC,CAAC,CAAC;QAC1D6F,gDAAgD,EAAEzH,CAAC,CAACsC,KAAK,CACvDtC,CAAC,CAAC4B,MAAM,CAAC,CACX,CAAC;QACDQ,IAAI,EAAEpC,CAAC,CAAC0B,MAAM,CAAC;UAAEW,IAAI,EAAErC,CAAC,CAACsC,KAAK,CAACC,QAAG;QAAE,CAAC;MACvC,CAAC,CAAC,CACDuD,WAAW,CAAC;IACjB,CAAC;EACH,CAAC;AACH,CAAC,CACH,CAAC;;AAED;AAAAhE,OAAA,CAAA+F,iCAAA,GAAAA,iCAAA;AAEO,MAAMG,mBAAmB,GAAGhI,CAAC,CAAC4D,KAAK,CACxC,CACEiE,iCAAiC,EACjCxB,mCAAmC,EACnCD,8BAA8B,EAC9BwB,+BAA+B,CAChC,EACD;EACEnE,WAAW,EAAE;AACf,CACF,CAAC;AAAC3B,OAAA,CAAAkG,mBAAA,GAAAA,mBAAA;AAEK,MAAMC,sBAAsB,GAAGjI,CAAC,CAACsC,KAAK,CAACtC,CAAC,CAAC4B,MAAM,CAAC,CAAC,CAAC;AAACE,OAAA,CAAAmG,sBAAA,GAAAA,sBAAA"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.verify = exports.decode = void 0;
|
7
|
+
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
8
|
+
// Verify a token signature
|
9
|
+
// The kid is extracted from the token header
|
10
|
+
const verify = async (token, kid, jwks) => {
|
11
|
+
const jwk = jwks.find(k => k.kid === kid);
|
12
|
+
if (!jwk) {
|
13
|
+
throw new Error(`Invalid kid: ${kid}, token: ${token}`);
|
14
|
+
}
|
15
|
+
const {
|
16
|
+
protectedHeader: header,
|
17
|
+
payload
|
18
|
+
} = await (0, _ioReactNativeJwt.verify)(token, jwk);
|
19
|
+
return {
|
20
|
+
header,
|
21
|
+
payload
|
22
|
+
};
|
23
|
+
};
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Return type for this function is necessary to avoid an issue during the bob build process.
|
27
|
+
* It seems like typescript can't correctly infer the return type of the function.
|
28
|
+
*/
|
29
|
+
exports.verify = verify;
|
30
|
+
const decode = token => {
|
31
|
+
const {
|
32
|
+
protectedHeader: header,
|
33
|
+
payload
|
34
|
+
} = (0, _ioReactNativeJwt.decode)(token);
|
35
|
+
return {
|
36
|
+
header,
|
37
|
+
payload
|
38
|
+
};
|
39
|
+
};
|
40
|
+
exports.decode = decode;
|
41
|
+
//# sourceMappingURL=utils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","verify","token","kid","jwks","jwk","find","k","Error","protectedHeader","header","payload","verifyJwt","exports","decode","decodeJwt"],"sourceRoot":"../../../src","sources":["trust/utils.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAYA;AACA;AACO,MAAMC,MAAM,GAAG,MAAAA,CACpBC,KAAa,EACbC,GAAW,EACXC,IAAW,KACc;EACzB,MAAMC,GAAG,GAAGD,IAAI,CAACE,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACJ,GAAG,KAAKA,GAAG,CAAC;EAC3C,IAAI,CAACE,GAAG,EAAE;IACR,MAAM,IAAIG,KAAK,CAAE,gBAAeL,GAAI,YAAWD,KAAM,EAAC,CAAC;EACzD;EACA,MAAM;IAAEO,eAAe,EAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,MAAM,IAAAC,wBAAS,EAACV,KAAK,EAAEG,GAAG,CAAC;EACxE,OAAO;IAAEK,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AAHAE,OAAA,CAAAZ,MAAA,GAAAA,MAAA;AAIO,MAAMa,MAAM,GAAIZ,KAAa,IAAkB;EACpD,MAAM;IAAEO,eAAe,EAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAI,wBAAS,EAACb,KAAK,CAAC;EAC7D,OAAO;IAAEQ,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAC,MAAA,GAAAA,MAAA"}
|