@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
@@ -1,48 +0,0 @@
|
|
1
|
-
import { JWK } from "../../../utils/jwk";
|
2
|
-
import * as z from "zod";
|
3
|
-
|
4
|
-
// Display metadata for a credential, used by the issuer to
|
5
|
-
// instruct the Wallet Solution on how to render the credential correctly
|
6
|
-
export const CredentialDisplay = z.object({
|
7
|
-
name: z.string(),
|
8
|
-
locale: z.string(),
|
9
|
-
logo: z.object({
|
10
|
-
url: z.string(),
|
11
|
-
alt_text: z.string()
|
12
|
-
}).optional(),
|
13
|
-
background_color: z.string().optional(),
|
14
|
-
text_color: z.string().optional()
|
15
|
-
});
|
16
|
-
export const CredentialClaimDisplay = z.object({
|
17
|
-
name: z.string(),
|
18
|
-
locale: z.string()
|
19
|
-
});
|
20
|
-
export const CredentialFormat = z.union([z.literal("vc+sd-jwt"), z.literal("mso_mdoc")]);
|
21
|
-
export const CredentialClaim = z.object({
|
22
|
-
mandatory: z.boolean(),
|
23
|
-
display: z.array(CredentialClaimDisplay)
|
24
|
-
});
|
25
|
-
export const CredentialSdJwtClaims = z.record(CredentialClaim);
|
26
|
-
export const CredentialConfigurationSupported = z.record(z.object({
|
27
|
-
cryptographic_suites_supported: z.array(z.string()),
|
28
|
-
vct: z.string().optional(),
|
29
|
-
scope: z.string().optional(),
|
30
|
-
cryptographic_binding_methods_supported: z.array(z.string()),
|
31
|
-
display: z.array(CredentialDisplay),
|
32
|
-
format: CredentialFormat,
|
33
|
-
claims: z.union([CredentialSdJwtClaims, z.record(z.string(), CredentialSdJwtClaims)]).optional()
|
34
|
-
}));
|
35
|
-
export const CredentialIssuerKeys = z.object({
|
36
|
-
keys: z.array(JWK)
|
37
|
-
});
|
38
|
-
export const CredentialIssuerConfiguration = z.object({
|
39
|
-
credential_configurations_supported: CredentialConfigurationSupported,
|
40
|
-
pushed_authorization_request_endpoint: z.string(),
|
41
|
-
dpop_signing_alg_values_supported: z.array(z.string()),
|
42
|
-
jwks: CredentialIssuerKeys,
|
43
|
-
credential_issuer: z.string(),
|
44
|
-
authorization_endpoint: z.string(),
|
45
|
-
token_endpoint: z.string(),
|
46
|
-
credential_endpoint: z.string()
|
47
|
-
});
|
48
|
-
//# sourceMappingURL=types.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["JWK","z","CredentialDisplay","object","name","string","locale","logo","url","alt_text","optional","background_color","text_color","CredentialClaimDisplay","CredentialFormat","union","literal","CredentialClaim","mandatory","boolean","display","array","CredentialSdJwtClaims","record","CredentialConfigurationSupported","cryptographic_suites_supported","vct","scope","cryptographic_binding_methods_supported","format","claims","CredentialIssuerKeys","keys","CredentialIssuerConfiguration","credential_configurations_supported","pushed_authorization_request_endpoint","dpop_signing_alg_values_supported","jwks","credential_issuer","authorization_endpoint","token_endpoint","credential_endpoint"],"sourceRoot":"../../../../../src","sources":["entity/openid-connect/issuer/types.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,oBAAoB;AACxC,OAAO,KAAKC,CAAC,MAAM,KAAK;;AAExB;AACA;AAEA,OAAO,MAAMC,iBAAiB,GAAGD,CAAC,CAACE,MAAM,CAAC;EACxCC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EAChBC,MAAM,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EAClBE,IAAI,EAAEN,CAAC,CACJE,MAAM,CAAC;IACNK,GAAG,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC;IACfI,QAAQ,EAAER,CAAC,CAACI,MAAM,CAAC;EACrB,CAAC,CAAC,CACDK,QAAQ,CAAC,CAAC;EACbC,gBAAgB,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACK,QAAQ,CAAC,CAAC;EACvCE,UAAU,EAAEX,CAAC,CAACI,MAAM,CAAC,CAAC,CAACK,QAAQ,CAAC;AAClC,CAAC,CAAC;AAEF,OAAO,MAAMG,sBAAsB,GAAGZ,CAAC,CAACE,MAAM,CAAC;EAC7CC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EAChBC,MAAM,EAAEL,CAAC,CAACI,MAAM,CAAC;AACnB,CAAC,CAAC;AAEF,OAAO,MAAMS,gBAAgB,GAAGb,CAAC,CAACc,KAAK,C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iC,6BAA6B,GAAGhC,CAAC,CAACE,MAAM,CAAC;EACpD+B,mCAAmC,EAAEV,gCAAgC;EACrEW,qCAAqC,EAAElC,CAAC,CAACI,MAAM,CAAC,CAAC;EACjD+B,iCAAiC,EAAEnC,CAAC,CAACoB,KAAK,CAACpB,CAAC,CAACI,MAAM,CAAC,CAAC,CAAC;EACtDgC,IAAI,EAAEN,oBAAoB;EAC1BO,iBAAiB,EAAErC,CAAC,CAACI,MAAM,CAAC,CAAC;EAC7BkC,sBAAsB,EAAEtC,CAAC,CAACI,MAAM,CAAC,CAAC;EAClCmC,cAAc,EAAEvC,CAAC,CAACI,MAAM,CAAC,CAAC;EAC1BoC,mBAAmB,EAAExC,CAAC,CAACI,MAAM,CAAC;AAChC,CAAC,CAAC"}
|
@@ -1,113 +0,0 @@
|
|
1
|
-
import { decode as decodeJwt, verify as verifyJwt } from "@pagopa/io-react-native-jwt";
|
2
|
-
import { EntityConfiguration, EntityStatement, TrustAnchorEntityConfiguration } from "./types";
|
3
|
-
import { IoWalletError } from "../../utils/errors";
|
4
|
-
import * as z from "zod";
|
5
|
-
import { getSignedEntityConfiguration, getSignedEntityStatement } from ".";
|
6
|
-
// Verify a token signature
|
7
|
-
// The kid is extracted from the token header
|
8
|
-
const verify = async (token, kid, jwks) => {
|
9
|
-
const jwk = jwks.find(k => k.kid === kid);
|
10
|
-
if (!jwk) {
|
11
|
-
throw new Error(`Invalid kid: ${kid}, token: ${token}`);
|
12
|
-
}
|
13
|
-
const {
|
14
|
-
protectedHeader: header,
|
15
|
-
payload
|
16
|
-
} = await verifyJwt(token, jwk);
|
17
|
-
return {
|
18
|
-
header,
|
19
|
-
payload
|
20
|
-
};
|
21
|
-
};
|
22
|
-
const decode = token => {
|
23
|
-
const {
|
24
|
-
protectedHeader: header,
|
25
|
-
payload
|
26
|
-
} = decodeJwt(token);
|
27
|
-
return {
|
28
|
-
header,
|
29
|
-
payload
|
30
|
-
};
|
31
|
-
};
|
32
|
-
|
33
|
-
// The first element of the chain is supposed to be the Entity Configuration for the document issuer
|
34
|
-
const FirstElementShape = EntityConfiguration;
|
35
|
-
// Each element but the first is supposed to be an Entity Statement
|
36
|
-
const MiddleElementShape = EntityStatement;
|
37
|
-
// The last element of the chain can either be an Entity Statement
|
38
|
-
// or the Entity Configuration for the known Trust Anchor
|
39
|
-
const LastElementShape = z.union([EntityStatement, TrustAnchorEntityConfiguration]);
|
40
|
-
|
41
|
-
/**
|
42
|
-
* Validates a provided trust chain against a known trust
|
43
|
-
*
|
44
|
-
* @param trustAnchorEntity The entity configuration of the known trust anchor
|
45
|
-
* @param chain The chain of statements to be validate
|
46
|
-
* @returns The list of parsed token representing the chain
|
47
|
-
* @throws {IoWalletError} If the chain is not valid
|
48
|
-
*/
|
49
|
-
export async function validateTrustChain(trustAnchorEntity, chain) {
|
50
|
-
// If the chain is empty, fail
|
51
|
-
if (chain.length === 0) {
|
52
|
-
throw new IoWalletError("Cannot verify empty trust chain");
|
53
|
-
}
|
54
|
-
|
55
|
-
// Select the expected token shape
|
56
|
-
const selectTokenShape = elementIndex => elementIndex === 0 ? FirstElementShape : elementIndex === chain.length - 1 ? LastElementShape : MiddleElementShape;
|
57
|
-
|
58
|
-
// select the kid from the current index
|
59
|
-
const selectKid = currentIndex => {
|
60
|
-
const token = chain[currentIndex];
|
61
|
-
if (!token) {
|
62
|
-
throw new IoWalletError(`Cannot select kid: empty token`);
|
63
|
-
}
|
64
|
-
const shape = selectTokenShape(currentIndex);
|
65
|
-
return shape.parse(decode(token)).header.kid;
|
66
|
-
};
|
67
|
-
|
68
|
-
// select keys from the next token
|
69
|
-
// if the current token is the last, keys fro trust anchor will be used
|
70
|
-
const selectKeys = currentIndex => {
|
71
|
-
if (currentIndex === chain.length - 1) {
|
72
|
-
return trustAnchorEntity.payload.jwks.keys;
|
73
|
-
}
|
74
|
-
const nextIndex = currentIndex + 1;
|
75
|
-
const nextToken = chain[nextIndex];
|
76
|
-
if (!nextToken) {
|
77
|
-
throw new IoWalletError(`Cannot select keys: empty nextToken`);
|
78
|
-
}
|
79
|
-
const shape = selectTokenShape(nextIndex);
|
80
|
-
return shape.parse(decode(nextToken)).payload.jwks.keys;
|
81
|
-
};
|
82
|
-
|
83
|
-
// Iterate the chain and validate each element's signature against the public keys of its next
|
84
|
-
// If there is no next, hence it's the end of the chain and it must be verified by the Trust Anchor
|
85
|
-
return Promise.all(chain.map((token, i) => [token, selectKid(i), selectKeys(i)]).map(args => verify(...args)));
|
86
|
-
}
|
87
|
-
|
88
|
-
/**
|
89
|
-
* Given a trust chain, obtain a new trust chain by fetching each element's fresh version
|
90
|
-
*
|
91
|
-
* @param chain The original chain
|
92
|
-
* @param appFetch (optional) fetch api implementation
|
93
|
-
* @returns A list of signed token that reprensent the trust chain, in the same order of the provided chain
|
94
|
-
* @throws When an element of the chain fails to parse
|
95
|
-
*/
|
96
|
-
export function renewTrustChain(chain) {
|
97
|
-
let appFetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : fetch;
|
98
|
-
return Promise.all(chain
|
99
|
-
// Decode each item to determine its shape
|
100
|
-
.map(decode).map(e => [EntityStatement.safeParse(e), EntityConfiguration.safeParse(e)])
|
101
|
-
// fetch the element according to its shape
|
102
|
-
.map((_ref, i) => {
|
103
|
-
let [es, ec] = _ref;
|
104
|
-
return ec.success ? getSignedEntityConfiguration(ec.data.payload.iss, {
|
105
|
-
appFetch
|
106
|
-
}) : es.success ? getSignedEntityStatement(es.data.payload.iss, es.data.payload.sub, {
|
107
|
-
appFetch
|
108
|
-
}) :
|
109
|
-
// if the element fail to parse in both EntityStatement and EntityConfiguration, raise an error
|
110
|
-
Promise.reject(new IoWalletError(`Cannot renew trust chain because the element #${i} failed to be parsed.`));
|
111
|
-
}));
|
112
|
-
}
|
113
|
-
//# sourceMappingURL=chain.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["decode","decodeJwt","verify","verifyJwt","EntityConfiguration","EntityStatement","TrustAnchorEntityConfiguration","IoWalletError","z","getSignedEntityConfiguration","getSignedEntityStatement","token","kid","jwks","jwk","find","k","Error","protectedHeader","header","payload","FirstElementShape","MiddleElementShape","LastElementShape","union","validateTrustChain","trustAnchorEntity","chain","length","selectTokenShape","elementIndex","selectKid","currentIndex","shape","parse","selectKeys","keys","nextIndex","nextToken","Promise","all","map","i","args","renewTrustChain","appFetch","arguments","undefined","fetch","e","safeParse","_ref","es","ec","success","data","iss","sub","reject"],"sourceRoot":"../../../../src","sources":["entity/trust/chain.ts"],"mappings":"AAAA,SACEA,MAAM,IAAIC,SAAS,EACnBC,MAAM,IAAIC,SAAS,QACd,6BAA6B;AACpC,SACEC,mBAAmB,EACnBC,eAAe,EACfC,8BAA8B,QACzB,SAAS;AAEhB,SAASC,aAAa,QAAQ,oBAAoB;AAClD,OAAO,KAAKC,CAAC,MAAM,KAAK;AACxB,SAASC,4BAA4B,EAAEC,wBAAwB,QAAQ,GAAG;AAO1E;AACA;AACA,MAAMR,MAAM,GAAG,MAAAA,CACbS,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,MAAMjB,SAAS,CAACQ,KAAK,EAAEG,GAAG,CAAC;EACxE,OAAO;IAAEK,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC;AAED,MAAMpB,MAAM,GAAIW,KAAa,IAAK;EAChC,MAAM;IAAEO,eAAe,EAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGnB,SAAS,CAACU,KAAK,CAAC;EAC7D,OAAO;IAAEQ,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC;;AAED;A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AAG,EACnBJ,EAAE,CAACG,IAAI,CAACnC,OAAO,CAACqC,GAAG,EACnB;MACEZ;IACF,CACF,CAAC;IACD;IACAN,OAAO,CAACmB,MAAM,CACZ,IAAInD,aAAa,CACd,iDAAgDmC,CAAE,uBACrD,CACF,CAAC;EAAA,CACT,CACJ,CAAC;AACH"}
|
@@ -1,131 +0,0 @@
|
|
1
|
-
import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
|
2
|
-
import { WalletProviderEntityConfiguration, TrustAnchorEntityConfiguration, CredentialIssuerEntityConfiguration, RelyingPartyEntityConfiguration, EntityConfiguration, EntityStatement } from "./types";
|
3
|
-
import { validateTrustChain, renewTrustChain } from "./chain";
|
4
|
-
import { hasStatusOrThrow } from "../../utils/misc";
|
5
|
-
/**
|
6
|
-
* Verify a given trust chain is actually valid.
|
7
|
-
* It can handle fast chain renewal, which means we try to fetch a fresh version of each statement.
|
8
|
-
*
|
9
|
-
* @param trustAnchorEntity The entity configuration of the known trust anchor
|
10
|
-
* @param chain The chain of statements to be validate
|
11
|
-
* @param options.renewOnFail Whether to renew the provided chain if the validation fails at first. Default: true
|
12
|
-
* @param options.appFetch Fetch api implementation. Default: the built-in implementation
|
13
|
-
* @returns The result of the chain validation
|
14
|
-
* @throws {IoWalletError} When either validation or renewal fail
|
15
|
-
*/
|
16
|
-
export async function verifyTrustChain(trustAnchorEntity, chain) {
|
17
|
-
let {
|
18
|
-
appFetch = fetch,
|
19
|
-
renewOnFail = true
|
20
|
-
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
21
|
-
try {
|
22
|
-
return validateTrustChain(trustAnchorEntity, chain);
|
23
|
-
} catch (error) {
|
24
|
-
if (renewOnFail) {
|
25
|
-
const renewedChain = await renewTrustChain(chain, appFetch);
|
26
|
-
return validateTrustChain(trustAnchorEntity, renewedChain);
|
27
|
-
} else {
|
28
|
-
throw error;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
/**
|
34
|
-
* Fetch the signed entity configuration token for an entity
|
35
|
-
*
|
36
|
-
* @param entityBaseUrl The url of the entity to fetch
|
37
|
-
* @param param.appFetch (optional) fetch api implemention
|
38
|
-
* @returns The signed Entity Configuration token
|
39
|
-
*/
|
40
|
-
export async function getSignedEntityConfiguration(entityBaseUrl) {
|
41
|
-
let {
|
42
|
-
appFetch = fetch
|
43
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
44
|
-
const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-federation`;
|
45
|
-
return await appFetch(wellKnownUrl, {
|
46
|
-
method: "GET"
|
47
|
-
}).then(hasStatusOrThrow(200)).then(res => res.text());
|
48
|
-
}
|
49
|
-
|
50
|
-
/**
|
51
|
-
* Fetch and parse the entity configuration document for a given federation entity.
|
52
|
-
* This is an inner method to serve public interfaces.
|
53
|
-
*
|
54
|
-
* To add another entity configuration type (example: Foo entity type):
|
55
|
-
* - create its zod schema and type by inherit from the base type (example: FooEntityConfiguration = BaseEntityConfiguration.and(...))
|
56
|
-
* - add such type to EntityConfiguration union
|
57
|
-
* - add an overload to this function
|
58
|
-
* - create a public function which use such type (example: getFooEntityConfiguration = (url, options) => Promise<FooEntityConfiguration>)
|
59
|
-
*
|
60
|
-
* @param entityBaseUrl The base url of the entity.
|
61
|
-
* @param schema The expected schema of the entity configuration, according to the kind of entity we are fetching from.
|
62
|
-
* @param options.appFetch An optional instance of the http client to be used.
|
63
|
-
* @returns The parsed entity configuration object
|
64
|
-
* @throws {IoWalletError} If the http request fails
|
65
|
-
* @throws Parse error if the document is not in the expected shape.
|
66
|
-
*/
|
67
|
-
|
68
|
-
async function fetchAndParseEntityConfiguration(entityBaseUrl, schema) {
|
69
|
-
let {
|
70
|
-
appFetch = fetch
|
71
|
-
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
72
|
-
const responseText = await getSignedEntityConfiguration(entityBaseUrl, {
|
73
|
-
appFetch
|
74
|
-
});
|
75
|
-
const responseJwt = decodeJwt(responseText);
|
76
|
-
return schema.parse({
|
77
|
-
header: responseJwt.protectedHeader,
|
78
|
-
payload: responseJwt.payload
|
79
|
-
});
|
80
|
-
}
|
81
|
-
export const getWalletProviderEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, WalletProviderEntityConfiguration, options);
|
82
|
-
export const getCredentialIssuerEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, CredentialIssuerEntityConfiguration, options);
|
83
|
-
export const getTrustAnchorEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, TrustAnchorEntityConfiguration, options);
|
84
|
-
export const getRelyingPartyEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, RelyingPartyEntityConfiguration, options);
|
85
|
-
export const getEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, EntityConfiguration, options);
|
86
|
-
|
87
|
-
/**
|
88
|
-
* Fetch and parse the entity statement document for a given federation entity.
|
89
|
-
*
|
90
|
-
* @param accreditationBodyBaseUrl The base url of the accreditaion body which holds and signs the required entity statement
|
91
|
-
* @param subordinatedEntityBaseUrl The url that identifies the subordinate entity
|
92
|
-
* @param options.appFetch An optional instance of the http client to be used.
|
93
|
-
* @returns The parsed entity configuration object
|
94
|
-
* @throws {IoWalletError} If the http request fails
|
95
|
-
* @throws Parse error if the document is not in the expected shape.
|
96
|
-
*/
|
97
|
-
export async function getEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl) {
|
98
|
-
let {
|
99
|
-
appFetch = fetch
|
100
|
-
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
101
|
-
const responseText = await getSignedEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl, {
|
102
|
-
appFetch
|
103
|
-
});
|
104
|
-
const responseJwt = decodeJwt(responseText);
|
105
|
-
return EntityStatement.parse({
|
106
|
-
header: responseJwt.protectedHeader,
|
107
|
-
payload: responseJwt.payload
|
108
|
-
});
|
109
|
-
}
|
110
|
-
|
111
|
-
/**
|
112
|
-
* Fetch the entity statement document for a given federation entity.
|
113
|
-
*
|
114
|
-
* @param accreditationBodyBaseUrl The base url of the accreditaion body which holds and signs the required entity statement
|
115
|
-
* @param subordinatedEntityBaseUrl The url that identifies the subordinate entity
|
116
|
-
* @param options.appFetch An optional instance of the http client to be used.
|
117
|
-
* @returns The signed entity statement token
|
118
|
-
* @throws {IoWalletError} If the http request fails
|
119
|
-
*/
|
120
|
-
export async function getSignedEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl) {
|
121
|
-
let {
|
122
|
-
appFetch = fetch
|
123
|
-
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
124
|
-
const url = `${accreditationBodyBaseUrl}/fetch?${new URLSearchParams({
|
125
|
-
sub: subordinatedEntityBaseUrl
|
126
|
-
})}`;
|
127
|
-
return await appFetch(url, {
|
128
|
-
method: "GET"
|
129
|
-
}).then(hasStatusOrThrow(200)).then(res => res.text());
|
130
|
-
}
|
131
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["decode","decodeJwt","WalletProviderEntityConfiguration","TrustAnchorEntityConfiguration","CredentialIssuerEntityConfiguration","RelyingPartyEntityConfiguration","EntityConfiguration","EntityStatement","validateTrustChain","renewTrustChain","hasStatusOrThrow","verifyTrustChain","trustAnchorEntity","chain","appFetch","fetch","renewOnFail","arguments","length","undefined","error","renewedChain","getSignedEntityConfiguration","entityBaseUrl","wellKnownUrl","method","then","res","text","fetchAndParseEntityConfiguration","schema","responseText","responseJwt","parse","header","protectedHeader","payload","getWalletProviderEntityConfiguration","options","getCredentialIssuerEntityConfiguration","getTrustAnchorEntityConfiguration","getRelyingPartyEntityConfiguration","getEntityConfiguration","getEntityStatement","accreditationBodyBaseUrl","subordinatedEntityBaseUrl","getSignedEntityStatement","url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version":3,"names":["UnixTime","JWK","z","PresentationDefinition","TrustMark","object","id","string","trust_mark","RelyingPartyMetadata","application_type","optional","client_id","client_name","jwks","keys","array","contacts","presentation_definition","presentation_definition_uri","CredentialDisplayMetadata","name","locale","logo","url","alt_text","background_color","text_color","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","organization_name","homepage_uri","policy_uri","logo_uri","passthrough","BaseEntityConfiguration","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","dpop_signing_alg_values_supported","token_endpoint","introspection_endpoint","client_registration_types_supported","code_challenge_methods_supported","authorization_details_types_supported","acr_values_supported","grant_types_supported","issuer","scopes_supported","request_parameter_supported","boolean","request_uri_parameter_supported","response_types_supported","response_modes_supported","subject_types_supported","token_endpoint_auth_methods_supported","token_endpoint_auth_signing_alg_values_supported","request_object_signing_alg_values_supported","wallet_relying_party","RelyingPartyEntityConfiguration","WalletProviderEntityConfiguration","wallet_provider","aal_values_supported","EntityConfiguration"],"sourceRoot":"../../../../src","sources":["entity/trust/types.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,GAAG,QAAQ,iBAAiB;AACrC,OAAO,KAAKC,CAAC,MAAM,KAAK;AACxB,SAASC,sBAAsB,QAAQ,qCAAqC;AAE5E,OAAO,MAAMC,SAAS,GAAGF,CAAC,CAACG,M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EACEvE,WAAW,EAAE;AACf,CACF,CAAC"}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Extracts the date value of a given elementIdentifier from an MDOC object.
|
3
|
-
* Searches through the issuerSigned namespaces and attempts to parse the value as a Date.
|
4
|
-
* The expected date format is "DD-MM-YYYY".
|
5
|
-
* Returns the Date object if found, otherwise returns null.
|
6
|
-
*/
|
7
|
-
export function extractElementValueAsDate(elementValue) {
|
8
|
-
if (typeof elementValue === "string") {
|
9
|
-
const dateParts = elementValue.split("-");
|
10
|
-
if (dateParts.length === 3) {
|
11
|
-
const [day, month, year] = dateParts.map(part => Number(part));
|
12
|
-
if (day !== undefined && month !== undefined && year !== undefined && !isNaN(day) && !isNaN(month) && !isNaN(year)) {
|
13
|
-
return new Date(year, month - 1, day); // Month is zero-based in JS Date
|
14
|
-
}
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
return null; // Return null if no matching element is found or it's not a valid date
|
19
|
-
}
|
20
|
-
//# sourceMappingURL=converters.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["extractElementValueAsDate","elementValue","dateParts","split","length","day","month","year","map","part","Number","undefined","isNaN","Date"],"sourceRoot":"../../../src","sources":["mdoc/converters.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,yBAAyBA,CAACC,YAAoB,EAAe;EAC3E,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;IACpC,MAAMC,SAAS,GAAGD,YAAY,CAACE,KAAK,CAAC,GAAG,CAAC;IACzC,IAAID,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;MAC1B,MAAM,CAACC,GAAG,EAAEC,KAAK,EAAEC,IAAI,CAAC,GAAGL,SAAS,CAACM,GAAG,CAAEC,IAAI,IAAKC,MAAM,CAACD,IAAI,CAAC,CAAC;MAChE,IACEJ,GAAG,KAAKM,SAAS,IACjBL,KAAK,KAAKK,SAAS,IACnBJ,IAAI,KAAKI,SAAS,IAClB,CAACC,KAAK,CAACP,GAAG,CAAC,IACX,CAACO,KAAK,CAACN,KAAK,CAAC,IACb,CAACM,KAAK,CAACL,IAAI,CAAC,EACZ;QACA,OAAO,IAAIM,IAAI,CAACN,IAAI,EAAED,KAAK,GAAG,CAAC,EAAED,GAAG,CAAC,CAAC,CAAC;MACzC;IACF;EACF;;EAEA,OAAO,IAAI,CAAC,CAAC;AACf"}
|
package/lib/module/mdoc/index.js
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
import { CBOR, COSE, ISO18013 } from "@pagopa/io-react-native-cbor";
|
2
|
-
import { b64utob64 } from "jsrsasign";
|
3
|
-
import { convertCertToPem, getSigningJwk, parsePublicKey } from "../utils/crypto";
|
4
|
-
import { base64ToBase64Url } from "../utils/string";
|
5
|
-
export const verify = async (token, _) => {
|
6
|
-
var _issuerSigned$issuerA;
|
7
|
-
// get decoded data
|
8
|
-
const issuerSigned = await CBOR.decodeIssuerSigned(token);
|
9
|
-
if (!issuerSigned) {
|
10
|
-
throw new Error("Invalid mDoc");
|
11
|
-
}
|
12
|
-
const cert = (_issuerSigned$issuerA = issuerSigned.issuerAuth.unprotectedHeader[0]) === null || _issuerSigned$issuerA === void 0 || (_issuerSigned$issuerA = _issuerSigned$issuerA.x5chain) === null || _issuerSigned$issuerA === void 0 ? void 0 : _issuerSigned$issuerA[0];
|
13
|
-
if (!cert) throw new Error("Certificate not present in credential");
|
14
|
-
const pemcert = convertCertToPem(b64utob64(cert));
|
15
|
-
const publickey = parsePublicKey(pemcert);
|
16
|
-
if (!publickey) throw new Error("Certificate not present in credential");
|
17
|
-
const jwk = getSigningJwk(publickey);
|
18
|
-
jwk.x = b64utob64(jwk.x);
|
19
|
-
jwk.y = b64utob64(jwk.y);
|
20
|
-
const signatureCorrect = await COSE.verify(b64utob64(issuerSigned.issuerAuth.rawValue), jwk).catch(() => false);
|
21
|
-
if (!signatureCorrect) throw new Error("Invalid mDoc signature");
|
22
|
-
return {
|
23
|
-
issuerSigned
|
24
|
-
};
|
25
|
-
};
|
26
|
-
export const prepareVpTokenMdoc = async (requestNonce, generatedNonce, clientId, responseUri, docType, keyTag, _ref) => {
|
27
|
-
let [verifiableCredential, requestedClaims, _] = _ref;
|
28
|
-
/* verifiableCredential is a IssuerSigned structure */
|
29
|
-
const documents = [{
|
30
|
-
issuerSignedContent: verifiableCredential,
|
31
|
-
alias: keyTag,
|
32
|
-
docType
|
33
|
-
}];
|
34
|
-
|
35
|
-
/* we map each requested claim as for ex. { "org.iso.18013.5.1.mDL": { "org.iso.18013.5.1": { <claim-name>: true, ... }}} for selective disclosure */
|
36
|
-
const fieldRequestedAndAccepted = JSON.stringify({
|
37
|
-
[docType]: requestedClaims.reduce((acc, _ref2) => {
|
38
|
-
let {
|
39
|
-
name,
|
40
|
-
namespace
|
41
|
-
} = _ref2;
|
42
|
-
if (namespace) {
|
43
|
-
acc[namespace] ??= {};
|
44
|
-
const existingNamespace = acc[namespace];
|
45
|
-
existingNamespace[name] = true;
|
46
|
-
} else {
|
47
|
-
acc[name] = true;
|
48
|
-
}
|
49
|
-
return acc;
|
50
|
-
}, {})
|
51
|
-
});
|
52
|
-
|
53
|
-
/* clientId,responseUri,requestNonce are retrieved by Auth Request Object */
|
54
|
-
/* create DeviceResponse as { documents: { docType, issuerSigned, deviceSigned }, version, status } */
|
55
|
-
const vp_token = await ISO18013.generateOID4VPDeviceResponse(clientId, responseUri, requestNonce, generatedNonce, documents, fieldRequestedAndAccepted);
|
56
|
-
return {
|
57
|
-
vp_token: base64ToBase64Url(vp_token)
|
58
|
-
};
|
59
|
-
};
|
60
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["CBOR","COSE","ISO18013","b64utob64","convertCertToPem","getSigningJwk","parsePublicKey","base64ToBase64Url","verify","token","_","_issuerSigned$issuerA","issuerSigned","decodeIssuerSigned","Error","cert","issuerAuth","unprotectedHeader","x5chain","pemcert","publickey","jwk","x","y","signatureCorrect","rawValue","catch","prepareVpTokenMdoc","requestNonce","generatedNonce","clientId","responseUri","docType","keyTag","_ref","verifiableCredential","requestedClaims","documents","issuerSignedContent","alias","fieldRequestedAndAccepted","JSON","stringify","reduce","acc","_ref2","name","namespace","existingNamespace","vp_token","generateOID4VPDeviceResponse"],"sourceRoot":"../../../src","sources":["mdoc/index.ts"],"mappings":"AAAA,SAASA,IAAI,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,8BAA8B;AAGnE,SAASC,SAAS,QAAQ,WAAW;AACrC,SACEC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,QACT,iBAAiB;AAExB,SAASC,iBAAiB,QAAQ,iBAAiB;AAEnD,OAAO,MAAMC,MAAM,GAAG,MAAAA,CACpBC,KAAa,EACbC,CAAc,KACmC;EAAA,IAAAC,qBAAA;EACjD;EACA,MAAMC,YAAY,GAAG,MAAMZ,IAAI,CAACa,kBAAkB,CAACJ,KAAK,CAAC;EACzD,IAAI,CAACG,YAAY,EAAE;IACjB,MAAM,IAAIE,KAAK,CAAC,cAAc,CAAC;EACjC;EAEA,MAAMC,IAAI,IAAAJ,qBAAA,GAAGC,YAAY,CAACI,UAAU,CAACC,iBAAiB,CAAC,CAAC,CAAC,cAAAN,qBAAA,gBAAAA,qBAAA,GAA5CA,qBAAA,CAA8CO,OAAO,cAAAP,qBAAA,uBAArDA,qBAAA,CAAwD,CAAC,CAAC;EACvE,IAAI,CAACI,IAAI,EAAE,MAAM,IAAID,KAAK,CAAC,uCAAuC,CAAC;EAEnE,MAAMK,OAAO,GAAGf,gBAAgB,CAACD,SAAS,CAACY,IAAI,CAAC,CAAC;EACjD,MAAMK,SAAS,GAAGd,cAAc,CAACa,OAAO,CAAC;EACzC,IAAI,CAACC,SAAS,EAAE,MAAM,IAAIN,KAAK,CAAC,uCAAuC,CAAC;EAExE,MAAMO,GAAG,GAAGhB,aAAa,CAACe,SAAS,CAAC;EAEpCC,GAAG,CAACC,CAAC,GAAGnB,SAAS,CAAC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