@pagopa/io-react-native-wallet 1.7.0 → 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,18 +1,17 @@
|
|
1
|
-
import { decode } from "../../sd-jwt";
|
1
|
+
import { decode, prepareVpToken } from "../../sd-jwt";
|
2
|
+
import { createCryptoContextFor } from "../../utils/crypto";
|
2
3
|
import { JSONPath } from "jsonpath-plus";
|
3
|
-
import {
|
4
|
+
import { CredentialsNotFoundError, MissingDataError } from "./errors";
|
4
5
|
import Ajv from "ajv";
|
5
|
-
import { CBOR } from "@pagopa/io-react-native-cbor";
|
6
6
|
const ajv = new Ajv({
|
7
7
|
allErrors: true
|
8
8
|
});
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
};
|
9
|
+
const INDEX_CLAIM_NAME = 1;
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @deprecated Use `prepareRemotePresentations` from DCQL
|
13
|
+
*/
|
14
|
+
|
16
15
|
/**
|
17
16
|
* Transforms an array of DisclosureWithEncoded objects into a key-value map.
|
18
17
|
* @param disclosures - An array of DisclosureWithEncoded, each containing a decoded property with [?, claimName, claimValue].
|
@@ -29,22 +28,6 @@ const mapDisclosuresToObject = disclosures => {
|
|
29
28
|
}, {});
|
30
29
|
};
|
31
30
|
|
32
|
-
/**
|
33
|
-
* Transforms the issuer's namespaces from a CBOR structure into a plain JavaScript object.
|
34
|
-
*
|
35
|
-
* @param namespaces - The CBOR-based namespaces object where each key corresponds to a namespace,
|
36
|
-
* and each value is an array of elements containing identifiers and values.
|
37
|
-
* @returns A record (plain object) where each key is a namespace, and its value is another object
|
38
|
-
* mapping element identifiers to their corresponding element values.
|
39
|
-
*/
|
40
|
-
const mapNamespacesToObject = namespaces => {
|
41
|
-
return Object.entries(namespaces).reduce((obj, _ref2) => {
|
42
|
-
let [namespace, elements] = _ref2;
|
43
|
-
obj[namespace] = Object.fromEntries(elements.map(element => [element.elementIdentifier, element.elementValue]));
|
44
|
-
return obj;
|
45
|
-
}, {});
|
46
|
-
};
|
47
|
-
|
48
31
|
/**
|
49
32
|
* Finds a claim within the payload based on provided JSONPath expressions.
|
50
33
|
* @param paths - An array of JSONPath expressions to search for in the payload.
|
@@ -92,91 +75,10 @@ const extractClaimName = path => {
|
|
92
75
|
// match[2] corresponds to the second capture group (\w+) inside [""] or ['']
|
93
76
|
return match[1] || match[2];
|
94
77
|
}
|
95
|
-
throw new Error(`Invalid input format: "${path}". Expected formats are "$.propertyName", "$['propertyName']", or '$["propertyName"]'.`);
|
96
|
-
};
|
97
|
-
|
98
|
-
/**
|
99
|
-
* Extracts the namespace and claim name from a path in the following format:
|
100
|
-
* $['nameSpace']['propertyName']
|
101
|
-
*
|
102
|
-
* @param path - The path string containing the claim reference.
|
103
|
-
* @returns An object with the extracted namespace and claim name.
|
104
|
-
* @throws An error if the input format is invalid.
|
105
|
-
*/
|
106
|
-
const extractNamespaceAndClaimName = path => {
|
107
|
-
const regex = /^\$\[(?:'|")([^'"\]]+)(?:'|")\]\[(?:'|")([^'"\]]+)(?:'|")\]$/;
|
108
|
-
const match = path.match(regex);
|
109
|
-
if (match) {
|
110
|
-
return {
|
111
|
-
nameSpace: match[1],
|
112
|
-
propertyName: match[2]
|
113
|
-
};
|
114
|
-
}
|
115
|
-
throw new Error(`Invalid input format: "${path}". Expected format is "$['nameSpace']['propertyName']".`);
|
116
|
-
};
|
117
|
-
/**
|
118
|
-
* Evaluates the input descriptor for an mDoc by verifying that the issuerSigned claims meet
|
119
|
-
* the constraints defined in the input descriptor. It categorizes disclosures as either required
|
120
|
-
* or optional based on the field definitions.
|
121
|
-
*
|
122
|
-
* @param inputDescriptor - Contains constraints and field definitions specifying required/optional claims.
|
123
|
-
* @param issuerSigned - Contains the issuerSigned with namespaces and their associated claims.
|
124
|
-
* @returns An object with two arrays: one for required disclosures and one for optional disclosures.
|
125
|
-
* @throws MissingDataError - If a required field is missing or if a claim fails JSON Schema validation.
|
126
|
-
*/
|
127
|
-
export const evaluateInputDescriptorForMdoc = (inputDescriptor, issuerSigned) => {
|
128
|
-
var _inputDescriptor$cons;
|
129
|
-
if (!(inputDescriptor !== null && inputDescriptor !== void 0 && (_inputDescriptor$cons = inputDescriptor.constraints) !== null && _inputDescriptor$cons !== void 0 && _inputDescriptor$cons.fields)) {
|
130
|
-
// No validation, no field are required
|
131
|
-
return {
|
132
|
-
requiredDisclosures: [],
|
133
|
-
optionalDisclosures: []
|
134
|
-
};
|
135
|
-
}
|
136
|
-
const requiredDisclosures = [];
|
137
|
-
const optionalDisclosures = [];
|
138
78
|
|
139
|
-
//
|
140
|
-
const namespacesAsPayload = mapNamespacesToObject(issuerSigned.nameSpaces);
|
141
|
-
const allFieldsValid = inputDescriptor.constraints.fields.every(field => {
|
142
|
-
const [matchedPath, matchedValue] = findMatchedClaim(field.path, namespacesAsPayload);
|
79
|
+
// If the input doesn't match any of the expected formats, return null
|
143
80
|
|
144
|
-
|
145
|
-
if (matchedValue === undefined || !matchedPath) {
|
146
|
-
return field === null || field === void 0 ? void 0 : field.optional;
|
147
|
-
} else {
|
148
|
-
// Extract the namespace and property name from the matched path.
|
149
|
-
const {
|
150
|
-
nameSpace,
|
151
|
-
propertyName
|
152
|
-
} = extractNamespaceAndClaimName(matchedPath);
|
153
|
-
if (nameSpace && propertyName) {
|
154
|
-
(field !== null && field !== void 0 && field.optional ? optionalDisclosures : requiredDisclosures).push({
|
155
|
-
namespace: nameSpace,
|
156
|
-
name: propertyName,
|
157
|
-
value: matchedValue
|
158
|
-
});
|
159
|
-
}
|
160
|
-
}
|
161
|
-
if (field.filter) {
|
162
|
-
try {
|
163
|
-
const validateSchema = ajv.compile(field.filter);
|
164
|
-
if (!validateSchema(matchedValue)) {
|
165
|
-
throw new MissingDataError(`Claim value "${matchedValue}" for path "${matchedPath}" does not match the provided JSON Schema.`);
|
166
|
-
}
|
167
|
-
} catch (error) {
|
168
|
-
return false;
|
169
|
-
}
|
170
|
-
}
|
171
|
-
return true;
|
172
|
-
});
|
173
|
-
if (!allFieldsValid) {
|
174
|
-
throw new MissingDataError("Credential validation failed: Required fields are missing or do not match the input descriptor.");
|
175
|
-
}
|
176
|
-
return {
|
177
|
-
requiredDisclosures,
|
178
|
-
optionalDisclosures
|
179
|
-
};
|
81
|
+
throw new Error(`Invalid input format: "${path}". Expected formats are "$.propertyName", "$['propertyName']", or '$["propertyName"]'.`);
|
180
82
|
};
|
181
83
|
|
182
84
|
/**
|
@@ -187,27 +89,30 @@ export const evaluateInputDescriptorForMdoc = (inputDescriptor, issuerSigned) =>
|
|
187
89
|
* - Validates whether required fields are present (unless marked optional)
|
188
90
|
* and match any specified JSONPath.
|
189
91
|
* - If a field includes a JSON Schema filter, validates the claim value against that schema.
|
92
|
+
* - Enforces `limit_disclosure` rules by returning only disclosures, required and optional, matching the specified fields
|
93
|
+
* if set to "required". Otherwise also return the array unrequestedDisclosures with disclosures which can be passed for a particular use case.
|
190
94
|
* - Throws an error if a required field is invalid or missing.
|
191
95
|
*
|
192
96
|
* @param inputDescriptor - Describes constraints (fields, filters, etc.) that must be satisfied.
|
193
97
|
* @param payloadCredential - The credential payload to check against.
|
194
98
|
* @param disclosures - An array of DisclosureWithEncoded objects representing selective disclosures.
|
195
|
-
* @returns
|
99
|
+
* @returns A filtered list of disclosures satisfying the descriptor constraints, or throws an error if not.
|
196
100
|
* @throws Will throw an error if any required constraint fails or if JSONPath lookups are invalid.
|
197
101
|
*/
|
198
102
|
export const evaluateInputDescriptorForSdJwt4VC = (inputDescriptor, payloadCredential, disclosures) => {
|
199
|
-
var _inputDescriptor$
|
200
|
-
if (!(inputDescriptor !== null && inputDescriptor !== void 0 && (_inputDescriptor$
|
103
|
+
var _inputDescriptor$cons;
|
104
|
+
if (!(inputDescriptor !== null && inputDescriptor !== void 0 && (_inputDescriptor$cons = inputDescriptor.constraints) !== null && _inputDescriptor$cons !== void 0 && _inputDescriptor$cons.fields)) {
|
201
105
|
// No validation, all field are optional
|
202
106
|
return {
|
203
107
|
requiredDisclosures: [],
|
204
|
-
optionalDisclosures: []
|
108
|
+
optionalDisclosures: [],
|
109
|
+
unrequestedDisclosures: disclosures
|
205
110
|
};
|
206
111
|
}
|
207
|
-
const
|
208
|
-
const
|
112
|
+
const requiredClaimNames = [];
|
113
|
+
const optionalClaimNames = [];
|
209
114
|
|
210
|
-
// Transform disclosures
|
115
|
+
// Transform disclosures to find claim using JSONPath
|
211
116
|
const disclosuresAsPayload = mapDisclosuresToObject(disclosures);
|
212
117
|
|
213
118
|
// For each field, we need at least one matching path
|
@@ -227,10 +132,7 @@ export const evaluateInputDescriptorForSdJwt4VC = (inputDescriptor, payloadCrede
|
|
227
132
|
// if match a disclouse we save which is required or optional
|
228
133
|
const claimName = extractClaimName(matchedPath);
|
229
134
|
if (claimName) {
|
230
|
-
(field !== null && field !== void 0 && field.optional ?
|
231
|
-
value: matchedValue,
|
232
|
-
name: claimName
|
233
|
-
});
|
135
|
+
(field !== null && field !== void 0 && field.optional ? optionalClaimNames : requiredClaimNames).push(claimName);
|
234
136
|
}
|
235
137
|
}
|
236
138
|
|
@@ -254,12 +156,19 @@ export const evaluateInputDescriptorForSdJwt4VC = (inputDescriptor, payloadCrede
|
|
254
156
|
if (!allFieldsValid) {
|
255
157
|
throw new MissingDataError("Credential validation failed: Required fields are missing or do not match the input descriptor.");
|
256
158
|
}
|
159
|
+
|
160
|
+
// Categorizes disclosures into required and optional based on claim names and disclosure constraints.
|
161
|
+
|
162
|
+
const requiredDisclosures = disclosures.filter(disclosure => requiredClaimNames.includes(disclosure.decoded[INDEX_CLAIM_NAME]));
|
163
|
+
const optionalDisclosures = disclosures.filter(disclosure => optionalClaimNames.includes(disclosure.decoded[INDEX_CLAIM_NAME]));
|
164
|
+
const isNotLimitDisclosure = !(inputDescriptor.constraints.limit_disclosure === "required");
|
165
|
+
const unrequestedDisclosures = isNotLimitDisclosure ? disclosures.filter(disclosure => !optionalClaimNames.includes(disclosure.decoded[INDEX_CLAIM_NAME]) && !requiredClaimNames.includes(disclosure.decoded[INDEX_CLAIM_NAME])) : [];
|
257
166
|
return {
|
258
167
|
requiredDisclosures,
|
259
|
-
optionalDisclosures
|
168
|
+
optionalDisclosures,
|
169
|
+
unrequestedDisclosures
|
260
170
|
};
|
261
171
|
};
|
262
|
-
|
263
172
|
/**
|
264
173
|
* Finds the first credential that satisfies the input descriptor constraints.
|
265
174
|
* @param inputDescriptor The input descriptor to evaluate.
|
@@ -285,34 +194,10 @@ export const findCredentialSdJwt = (inputDescriptor, decodedSdJwtCredentials) =>
|
|
285
194
|
continue;
|
286
195
|
}
|
287
196
|
}
|
288
|
-
throw new
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
* Finds the first credential that satisfies the input descriptor constraints.
|
293
|
-
* @param inputDescriptor The input descriptor to evaluate.
|
294
|
-
* @param decodedMdocCredentials An array of decoded MDOC credentials.
|
295
|
-
* @returns An object containing the matched evaluation, keyTag, and credential.
|
296
|
-
*/
|
297
|
-
export const findCredentialMDoc = (inputDescriptor, decodedMDocCredentials) => {
|
298
|
-
for (const {
|
299
|
-
keyTag,
|
300
|
-
credential,
|
301
|
-
issuerSigned
|
302
|
-
} of decodedMDocCredentials) {
|
303
|
-
try {
|
304
|
-
const evaluatedDisclosure = evaluateInputDescriptorForMdoc(inputDescriptor, issuerSigned);
|
305
|
-
return {
|
306
|
-
matchedEvaluation: evaluatedDisclosure,
|
307
|
-
matchedKeyTag: keyTag,
|
308
|
-
matchedCredential: credential
|
309
|
-
};
|
310
|
-
} catch {
|
311
|
-
// skip to next credential
|
312
|
-
continue;
|
313
|
-
}
|
314
|
-
}
|
315
|
-
throw new CredentialNotFoundError("None of the mso_mdoc credentials satisfy the requirements.");
|
197
|
+
throw new CredentialsNotFoundError([{
|
198
|
+
id: "",
|
199
|
+
reason: "None of the vc+sd-jwt credentials satisfy the requirements."
|
200
|
+
}]);
|
316
201
|
};
|
317
202
|
|
318
203
|
/**
|
@@ -325,15 +210,14 @@ export const findCredentialMDoc = (inputDescriptor, decodedMDocCredentials) => {
|
|
325
210
|
*
|
326
211
|
* @param inputDescriptors - An array of input descriptors.
|
327
212
|
* @param credentialsSdJwt - An array of tuples containing keyTag and SD-JWT credential.
|
328
|
-
* @param credentialsMdoc - An array of tuples containing keyTag and MDOC credential.
|
329
213
|
* @returns An array of objects, each containing the evaluated disclosures,
|
330
214
|
* the input descriptor, the credential, and the keyTag.
|
331
215
|
* @throws {CredentialNotFoundError} When the credential format is unsupported.
|
332
216
|
*/
|
333
|
-
export const evaluateInputDescriptors = async (inputDescriptors, credentialsSdJwt
|
217
|
+
export const evaluateInputDescriptors = async (inputDescriptors, credentialsSdJwt) => {
|
334
218
|
// We need decode SD-JWT credentials for evaluation
|
335
|
-
const decodedSdJwtCredentials = (credentialsSdJwt === null || credentialsSdJwt === void 0 ? void 0 : credentialsSdJwt.map(
|
336
|
-
let [
|
219
|
+
const decodedSdJwtCredentials = (credentialsSdJwt === null || credentialsSdJwt === void 0 ? void 0 : credentialsSdJwt.map(_ref2 => {
|
220
|
+
let [keyTag, credential] = _ref2;
|
337
221
|
const {
|
338
222
|
sdJwt,
|
339
223
|
disclosures
|
@@ -345,31 +229,20 @@ export const evaluateInputDescriptors = async (inputDescriptors, credentialsSdJw
|
|
345
229
|
disclosures
|
346
230
|
};
|
347
231
|
})) || [];
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
return {
|
357
|
-
keyTag,
|
358
|
-
credential,
|
359
|
-
issuerSigned
|
360
|
-
};
|
361
|
-
}))) || [];
|
362
|
-
const results = Promise.all(inputDescriptors.map(async descriptor => {
|
363
|
-
var _descriptor$format, _descriptor$format2;
|
364
|
-
if ((_descriptor$format = descriptor.format) !== null && _descriptor$format !== void 0 && _descriptor$format.mso_mdoc) {
|
365
|
-
if (!credentialsMdoc.length) {
|
366
|
-
throw new CredentialNotFoundError("mso_mdoc credential is not supported.");
|
232
|
+
return Promise.all(inputDescriptors.map(async descriptor => {
|
233
|
+
var _descriptor$format;
|
234
|
+
if ((_descriptor$format = descriptor.format) !== null && _descriptor$format !== void 0 && _descriptor$format["vc+sd-jwt"]) {
|
235
|
+
if (!decodedSdJwtCredentials.length) {
|
236
|
+
throw new CredentialsNotFoundError([{
|
237
|
+
id: descriptor.id,
|
238
|
+
reason: "vc+sd-jwt credential is not supported."
|
239
|
+
}]);
|
367
240
|
}
|
368
241
|
const {
|
369
242
|
matchedEvaluation,
|
370
243
|
matchedKeyTag,
|
371
244
|
matchedCredential
|
372
|
-
} =
|
245
|
+
} = findCredentialSdJwt(descriptor, decodedSdJwtCredentials);
|
373
246
|
return {
|
374
247
|
evaluatedDisclosure: matchedEvaluation,
|
375
248
|
inputDescriptor: descriptor,
|
@@ -377,24 +250,48 @@ export const evaluateInputDescriptors = async (inputDescriptors, credentialsSdJw
|
|
377
250
|
keyTag: matchedKeyTag
|
378
251
|
};
|
379
252
|
}
|
253
|
+
throw new CredentialsNotFoundError([{
|
254
|
+
id: descriptor.id,
|
255
|
+
reason: `${descriptor.format} format is not supported.`
|
256
|
+
}]);
|
257
|
+
}));
|
258
|
+
};
|
259
|
+
|
260
|
+
/**
|
261
|
+
* Prepares remote presentations for a set of credentials based on input descriptors.
|
262
|
+
*
|
263
|
+
* For each credential and its corresponding input descriptor, this function:
|
264
|
+
* - Validates the credential format.
|
265
|
+
* - Generates a verifiable presentation token (vpToken) using the provided nonce and client identifier.
|
266
|
+
*
|
267
|
+
* @deprecated Use `prepareRemotePresentations` from DCQL
|
268
|
+
*
|
269
|
+
* @param credentialAndDescriptors - An array containing objects with requested claims,
|
270
|
+
* input descriptor, credential, and keyTag.
|
271
|
+
* @param nonce - A unique nonce for the verifiable presentation token.
|
272
|
+
* @param client_id - The client identifier.
|
273
|
+
* @returns A promise that resolves to an array of RemotePresentation objects.
|
274
|
+
* @throws {CredentialNotFoundError} When the credential format is unsupported.
|
275
|
+
*/
|
276
|
+
export const prepareLegacyRemotePresentations = async (credentialAndDescriptors, nonce, client_id) => {
|
277
|
+
return Promise.all(credentialAndDescriptors.map(async item => {
|
278
|
+
var _descriptor$format2;
|
279
|
+
const descriptor = item.inputDescriptor;
|
380
280
|
if ((_descriptor$format2 = descriptor.format) !== null && _descriptor$format2 !== void 0 && _descriptor$format2["vc+sd-jwt"]) {
|
381
|
-
if (!decodedSdJwtCredentials.length) {
|
382
|
-
throw new CredentialNotFoundError("vc+sd-jwt credential is not supported.");
|
383
|
-
}
|
384
281
|
const {
|
385
|
-
|
386
|
-
|
387
|
-
matchedCredential
|
388
|
-
} = findCredentialSdJwt(descriptor, decodedSdJwtCredentials);
|
282
|
+
vp_token
|
283
|
+
} = await prepareVpToken(nonce, client_id, [item.credential, item.requestedClaims, createCryptoContextFor(item.keyTag)]);
|
389
284
|
return {
|
390
|
-
|
285
|
+
requestedClaims: item.requestedClaims,
|
391
286
|
inputDescriptor: descriptor,
|
392
|
-
|
393
|
-
|
287
|
+
vpToken: vp_token,
|
288
|
+
format: "vc+sd-jwt"
|
394
289
|
};
|
395
290
|
}
|
396
|
-
throw new
|
291
|
+
throw new CredentialsNotFoundError([{
|
292
|
+
id: descriptor.id,
|
293
|
+
reason: `${descriptor.format} format is not supported.`
|
294
|
+
}]);
|
397
295
|
}));
|
398
|
-
return results;
|
399
296
|
};
|
400
297
|
//# sourceMappingURL=07-evaluate-input-descriptor.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["decode","
|
1
|
+
{"version":3,"names":["decode","prepareVpToken","createCryptoContextFor","JSONPath","CredentialsNotFoundError","MissingDataError","Ajv","ajv","allErrors","INDEX_CLAIM_NAME","mapDisclosuresToObject","disclosures","reduce","obj","_ref","decoded","claimName","claimValue","findMatchedClaim","paths","payload","matchedPath","matchedValue","some","singlePath","result","path","json","length","error","extractClaimName","regex","match","Error","evaluateInputDescriptorForSdJwt4VC","inputDescriptor","payloadCredential","_inputDescriptor$cons","constraints","fields","requiredDisclosures","optionalDisclosures","unrequestedDisclosures","requiredClaimNames","optionalClaimNames","disclosuresAsPayload","allFieldsValid","every","field","optional","push","filter","validateSchema","compile","disclosure","includes","isNotLimitDisclosure","limit_disclosure","findCredentialSdJwt","decodedSdJwtCredentials","keyTag","credential","sdJwt","evaluatedDisclosure","matchedEvaluation","matchedKeyTag","matchedCredential","id","reason","evaluateInputDescriptors","inputDescriptors","credentialsSdJwt","map","_ref2","Promise","all","descriptor","_descriptor$format","format","prepareLegacyRemotePresentations","credentialAndDescriptors","nonce","client_id","item","_descriptor$format2","vp_token","requestedClaims","vpToken"],"sourceRoot":"../../../../src","sources":["credential/presentation/07-evaluate-input-descriptor.ts"],"mappings":"AAEA,SAASA,MAAM,EAAEC,cAAc,QAAQ,cAAc;AACrD,SAASC,sBAAsB,QAAQ,oBAAoB;AAC3D,SAASC,QAAQ,QAAQ,eAAe;AACxC,SAASC,wBAAwB,EAAEC,gBAAgB,QAAQ,UAAU;AACrE,OAAOC,GAAG,MAAM,KAAK;AAErB,MAAMC,GAAG,GAAG,IAAID,GAAG,CAAC;EAAEE,SAAS,EAAE;AAAK,CAAC,CAAC;AACxC,MAAMC,gBAAgB,GAAG,CAAC;;AA0B1B;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAC1BC,WAAoC,IACR;EAC5B,OAAOA,WAAW,CAACC,MAAM,CACvB,CAACC,GAAG,EAAAC,IAAA,KAAkB;IAAA,IAAhB;MAAEC;IAAQ,CAAC,GAAAD,IAAA;IACf,MAAM,GAAGE,SAAS,EAAEC,UAAU,CAAC,GAAGF,OAAO;IACzCF,GAAG,CAACG,SAAS,CAAC,GAAGC,UAAU;IAC3B,OAAOJ,GAAG;EACZ,CAAC,EACD,CAAC,CACH,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,gBAAgB,GAAGA,CACvBC,KAAe,EACfC,OAAY,KACW;EACvB,IAAIC,WAAW;EACf,IAAIC,YAAY;EAChBH,KAAK,CAACI,IAAI,CAAEC,UAAU,IAAK;IACzB,IAAI;MACF,MAAMC,MAAM,GAAGtB,QAAQ,CAAC;QAAEuB,IAAI,EAAEF,UAAU;QAAEG,IAAI,EAAEP;MAAQ,CAAC,CAAC;MAC5D,IAAIK,MAAM,CAACG,MAAM,GAAG,CAAC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