@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,16 +1,14 @@
|
|
1
1
|
import { IoWalletError } from "../../utils/errors";
|
2
2
|
import { SdJwt4VC } from "../../sd-jwt/types";
|
3
3
|
import { verify as verifySdJwt } from "../../sd-jwt";
|
4
|
-
import { verify as verifyMdoc } from "../../mdoc";
|
5
4
|
import { getValueFromDisclosures } from "../../sd-jwt/converters";
|
6
|
-
import {
|
5
|
+
import { LogLevel, Logger } from "../../utils/logging";
|
7
6
|
|
8
7
|
// The credential as a collection of attributes in plain value
|
9
8
|
|
10
9
|
// handy alias
|
11
10
|
|
12
|
-
|
13
|
-
export const parseCredentialSdJwt = function (credentials_supported, _ref) {
|
11
|
+
const parseCredentialSdJwt = function (credentials_supported, _ref) {
|
14
12
|
let {
|
15
13
|
sdJwt,
|
16
14
|
disclosures
|
@@ -19,32 +17,35 @@ export const parseCredentialSdJwt = function (credentials_supported, _ref) {
|
|
19
17
|
let includeUndefinedAttributes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
20
18
|
const credentialSubject = credentials_supported[sdJwt.payload.vct];
|
21
19
|
if (!credentialSubject) {
|
20
|
+
Logger.log(LogLevel.ERROR, `Credential type not supported by the issuer: ${sdJwt.payload.vct}`);
|
22
21
|
throw new IoWalletError("Credential type not supported by the issuer");
|
23
22
|
}
|
24
23
|
if (credentialSubject.format !== sdJwt.header.typ) {
|
24
|
+
Logger.log(LogLevel.ERROR, `Received credential is of an unknwown type. Expected one of [${credentialSubject.format}], received '${sdJwt.header.typ}'`);
|
25
25
|
throw new IoWalletError(`Received credential is of an unknwown type. Expected one of [${credentialSubject.format}], received '${sdJwt.header.typ}', `);
|
26
26
|
}
|
27
27
|
|
28
28
|
// transfrom a record { key: value } in an iterable of pairs [key, value]
|
29
29
|
if (!credentialSubject.claims) {
|
30
|
+
Logger.log(LogLevel.ERROR, "Missing claims in the credential subject");
|
30
31
|
throw new IoWalletError("Missing claims in the credential subject"); // TODO [SIW-1268]: should not be optional
|
31
32
|
}
|
32
33
|
|
33
|
-
const
|
34
|
-
const attrDefinitions = Object.entries(claims);
|
34
|
+
const attrDefinitions = Object.entries(credentialSubject.claims);
|
35
35
|
|
36
36
|
// the key of the attribute defintion must match the disclosure's name
|
37
37
|
const attrsNotInDisclosures = attrDefinitions.filter(_ref2 => {
|
38
|
-
let [attrKey
|
38
|
+
let [attrKey] = _ref2;
|
39
39
|
return !disclosures.some(_ref3 => {
|
40
40
|
let [, name] = _ref3;
|
41
41
|
return name === attrKey;
|
42
|
-
})
|
42
|
+
});
|
43
43
|
});
|
44
44
|
if (attrsNotInDisclosures.length > 0) {
|
45
45
|
const missing = attrsNotInDisclosures.map(_ => _[0 /* key */]).join(", ");
|
46
46
|
const received = disclosures.map(_ => _[1 /* name */]).join(", ");
|
47
47
|
if (!ignoreMissingAttributes) {
|
48
|
+
Logger.log(LogLevel.ERROR, `Some attributes are missing in the credential. Missing: [${missing}], received: [${received}]`);
|
48
49
|
throw new IoWalletError(`Some attributes are missing in the credential. Missing: [${missing}], received: [${received}]`);
|
49
50
|
}
|
50
51
|
}
|
@@ -61,25 +62,20 @@ export const parseCredentialSdJwt = function (credentials_supported, _ref) {
|
|
61
62
|
value: (_disclosures$find = disclosures.find(_ => _[1 /* name */] === attrKey)) === null || _disclosures$find === void 0 ? void 0 : _disclosures$find[2 /* value */]
|
62
63
|
}];
|
63
64
|
})
|
64
|
-
//filter the not found elements
|
65
|
-
.filter(_ref5 => {
|
66
|
-
let [_, definition] = _ref5;
|
67
|
-
return definition.value !== undefined;
|
68
|
-
})
|
69
65
|
// add a human readable attribute name, with i18n, in the form { locale: name }
|
70
66
|
// example: { "it-IT": "Nome", "en-EN": "Name", "es-ES": "Nombre" }
|
71
|
-
.map(
|
67
|
+
.map(_ref5 => {
|
72
68
|
let [attrKey, {
|
73
69
|
display,
|
74
70
|
...definition
|
75
|
-
}] =
|
71
|
+
}] = _ref5;
|
76
72
|
return [attrKey, {
|
77
73
|
...definition,
|
78
|
-
name: display.reduce((names,
|
74
|
+
name: display.reduce((names, _ref6) => {
|
79
75
|
let {
|
80
76
|
locale,
|
81
77
|
name
|
82
|
-
} =
|
78
|
+
} = _ref6;
|
83
79
|
return {
|
84
80
|
...names,
|
85
81
|
[locale]: name
|
@@ -90,119 +86,8 @@ export const parseCredentialSdJwt = function (credentials_supported, _ref) {
|
|
90
86
|
if (includeUndefinedAttributes) {
|
91
87
|
// attributes that are in the disclosure set
|
92
88
|
// but are not defined in the issuer configuration
|
93
|
-
const undefinedValues = Object.fromEntries(disclosures.filter(_ => !Object.keys(definedValues).includes(_[1])).map(
|
94
|
-
let [, key, value] =
|
95
|
-
return [key, {
|
96
|
-
value,
|
97
|
-
name: key
|
98
|
-
}];
|
99
|
-
}));
|
100
|
-
return {
|
101
|
-
...definedValues,
|
102
|
-
...undefinedValues
|
103
|
-
};
|
104
|
-
}
|
105
|
-
return definedValues;
|
106
|
-
};
|
107
|
-
|
108
|
-
//Exported for testing purposes
|
109
|
-
export const parseCredentialMDoc = function (credentials_supported, credential_type, _ref9) {
|
110
|
-
let {
|
111
|
-
issuerSigned
|
112
|
-
} = _ref9;
|
113
|
-
let ignoreMissingAttributes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
114
|
-
let includeUndefinedAttributes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
115
|
-
const credentialSubject = credentials_supported[credential_type];
|
116
|
-
if (!credentialSubject) {
|
117
|
-
throw new IoWalletError("Credential type not supported by the issuer");
|
118
|
-
}
|
119
|
-
|
120
|
-
// transfrom a record { key: value } in an iterable of pairs [key, value]
|
121
|
-
if (!credentialSubject.claims) {
|
122
|
-
throw new IoWalletError("Missing claims in the credential subject"); // TODO [SIW-1268]: should not be optional
|
123
|
-
}
|
124
|
-
|
125
|
-
const claims = credentialSubject.claims;
|
126
|
-
const attrDefinitions = Object.entries(claims).flatMap(_ref10 => {
|
127
|
-
let [namespace, claimName] = _ref10;
|
128
|
-
return Object.entries(claimName).map(_ref11 => {
|
129
|
-
let [claimNameKey, definition] = _ref11;
|
130
|
-
return [namespace, claimNameKey, definition];
|
131
|
-
});
|
132
|
-
});
|
133
|
-
if (!issuerSigned.nameSpaces) {
|
134
|
-
throw new IoWalletError("Missing claims in the credential");
|
135
|
-
}
|
136
|
-
const flatNamespaces = Object.entries(issuerSigned.nameSpaces).flatMap(_ref12 => {
|
137
|
-
let [namespace, values] = _ref12;
|
138
|
-
return values.map(v => [namespace, v.elementIdentifier, v.elementValue]);
|
139
|
-
});
|
140
|
-
|
141
|
-
// Check that all mandatory attributes defined in the issuer configuration are present in the disclosure set
|
142
|
-
// and filter the non present ones
|
143
|
-
const attrsNotInDisclosures = attrDefinitions.filter(_ref13 => {
|
144
|
-
let [attrDefNamespace, attrKey, definition] = _ref13;
|
145
|
-
const isClaimPresent = flatNamespaces.find(_ref14 => {
|
146
|
-
let [namespace, name] = _ref14;
|
147
|
-
return attrDefNamespace === namespace && name === attrKey;
|
148
|
-
});
|
149
|
-
return isClaimPresent === undefined && definition.mandatory;
|
150
|
-
});
|
151
|
-
if (attrsNotInDisclosures.length > 0) {
|
152
|
-
const missing = attrsNotInDisclosures.map(_ => _[1 /* claim key */]).join(", ");
|
153
|
-
const received = flatNamespaces.map(_ => _[1 /*name*/]);
|
154
|
-
if (!ignoreMissingAttributes) {
|
155
|
-
throw new IoWalletError(`Some attributes are missing in the credential. Missing: [${missing}], received: [${received}]`);
|
156
|
-
}
|
157
|
-
}
|
158
|
-
|
159
|
-
// Attributes defined in the issuer configuration and present in the disclosure set
|
160
|
-
const definedValues = Object.fromEntries(attrDefinitions
|
161
|
-
// Retrieve the value from the corresponding disclosure
|
162
|
-
.map(_ref15 => {
|
163
|
-
var _flatNamespaces$find;
|
164
|
-
let [attrDefNamespace, attrKey, definition] = _ref15;
|
165
|
-
return [attrKey, {
|
166
|
-
...definition,
|
167
|
-
value: (_flatNamespaces$find = flatNamespaces.find(_ref16 => {
|
168
|
-
let [namespace, name] = _ref16;
|
169
|
-
return attrDefNamespace === namespace && name === attrKey;
|
170
|
-
})) === null || _flatNamespaces$find === void 0 ? void 0 : _flatNamespaces$find[2]
|
171
|
-
}];
|
172
|
-
})
|
173
|
-
//filter the not found elements
|
174
|
-
.filter(_ref17 => {
|
175
|
-
let [_, definition] = _ref17;
|
176
|
-
return definition.value !== undefined;
|
177
|
-
})
|
178
|
-
// Add a human-readable attribute name, with i18n, in the form { locale: name }
|
179
|
-
// Example: { "it-IT": "Nome", "en-EN": "Name", "es-ES": "Nombre" }
|
180
|
-
.map(_ref18 => {
|
181
|
-
let [attrKey, {
|
182
|
-
display,
|
183
|
-
...definition
|
184
|
-
}] = _ref18;
|
185
|
-
return [attrKey, {
|
186
|
-
...definition,
|
187
|
-
name: display.reduce((names, _ref19) => {
|
188
|
-
let {
|
189
|
-
locale,
|
190
|
-
name
|
191
|
-
} = _ref19;
|
192
|
-
return {
|
193
|
-
...names,
|
194
|
-
[locale]: name
|
195
|
-
};
|
196
|
-
}, {})
|
197
|
-
}];
|
198
|
-
}));
|
199
|
-
if (includeUndefinedAttributes) {
|
200
|
-
// Attributes that are present in the disclosure set but not defined in the issuer configuration
|
201
|
-
const undefinedValues = Object.fromEntries(flatNamespaces.filter(_ref20 => {
|
202
|
-
let [, key] = _ref20;
|
203
|
-
return !Object.keys(definedValues).includes(key);
|
204
|
-
}).map(_ref21 => {
|
205
|
-
let [, key, value] = _ref21;
|
89
|
+
const undefinedValues = Object.fromEntries(disclosures.filter(_ => !Object.keys(definedValues).includes(_[1])).map(_ref7 => {
|
90
|
+
let [, key, value] = _ref7;
|
206
91
|
return [key, {
|
207
92
|
value,
|
208
93
|
name: key
|
@@ -239,97 +124,35 @@ async function verifyCredentialSdJwt(rawCredential, issuerKeys, holderBindingCon
|
|
239
124
|
cnf
|
240
125
|
} = decodedCredential.sdJwt.payload;
|
241
126
|
if (!cnf.jwk.kid || cnf.jwk.kid !== holderBindingKey.kid) {
|
127
|
+
Logger.log(LogLevel.ERROR, `Failed to verify holder binding, expected kid: ${holderBindingKey.kid}, got: ${decodedCredential.sdJwt.payload.cnf.jwk.kid}`);
|
242
128
|
throw new IoWalletError(`Failed to verify holder binding, expected kid: ${holderBindingKey.kid}, got: ${decodedCredential.sdJwt.payload.cnf.jwk.kid}`);
|
243
129
|
}
|
244
130
|
return decodedCredential;
|
245
131
|
}
|
246
132
|
|
247
|
-
/**
|
248
|
-
* Given a credential, verify it's in the supported format
|
249
|
-
* and the credential is correctly signed
|
250
|
-
* and it's bound to the given key
|
251
|
-
*
|
252
|
-
* @param rawCredential The received credential
|
253
|
-
* @param issuerKeys The set of public keys of the issuer,
|
254
|
-
* which will be used to verify the signature
|
255
|
-
* @param holderBindingContext The access to the holder's key
|
256
|
-
*
|
257
|
-
* @throws If the signature verification fails
|
258
|
-
* @throws If the credential is not in the SdJwt4VC format
|
259
|
-
* @throws If the holder binding is not properly configured
|
260
|
-
*
|
261
|
-
*/
|
262
|
-
async function verifyCredentialMDoc(rawCredential, issuerKeys, holderBindingContext) {
|
263
|
-
/**
|
264
|
-
* For the moment, being that issues in the crypto key generation
|
265
|
-
* have been found on Android, the check for the deviceKey inside
|
266
|
-
* of the mDoc is skipped, so we are not interested in the holderBindingKey
|
267
|
-
*/
|
268
|
-
const [decodedCredential, _] =
|
269
|
-
// parallel for optimization
|
270
|
-
await Promise.all([verifyMdoc(rawCredential, issuerKeys), holderBindingContext.getPublicKey()]);
|
271
|
-
if (!decodedCredential) {
|
272
|
-
throw new IoWalletError("No MDOC credentials found!");
|
273
|
-
}
|
274
|
-
|
275
|
-
/**
|
276
|
-
* For the moment, being that issues in the crypto key generation
|
277
|
-
* have been found on Android, the check for the deviceKey inside
|
278
|
-
* of the mDoc is skipped.
|
279
|
-
*/
|
280
|
-
//const key = decodedCredential.mDoc.issuerSigned.issuerAuth.payload.deviceKeyInfo.deviceKey;
|
281
|
-
//
|
282
|
-
//if (!compareKeysByThumbprint(key, holderBindingKey as PublicKey)) {
|
283
|
-
// throw new IoWalletError(
|
284
|
-
// `Failed to verify holder binding, holder binding key and mDoc deviceKey don't match`
|
285
|
-
// );
|
286
|
-
//}
|
287
|
-
|
288
|
-
return decodedCredential;
|
289
|
-
}
|
290
|
-
|
291
133
|
// utility type that specialize VerifyAndParseCredential for given format
|
292
134
|
|
293
|
-
const verifyAndParseCredentialSdJwt = async (issuerConf, credential, _,
|
135
|
+
const verifyAndParseCredentialSdJwt = async (issuerConf, credential, _, _ref8) => {
|
294
136
|
let {
|
295
137
|
credentialCryptoContext,
|
296
138
|
ignoreMissingAttributes,
|
297
139
|
includeUndefinedAttributes
|
298
|
-
} =
|
299
|
-
const decoded = await verifyCredentialSdJwt(credential, issuerConf.keys, credentialCryptoContext);
|
300
|
-
|
140
|
+
} = _ref8;
|
141
|
+
const decoded = await verifyCredentialSdJwt(credential, issuerConf.openid_credential_issuer.jwks.keys, credentialCryptoContext);
|
142
|
+
Logger.log(LogLevel.DEBUG, `Decoded credential: ${JSON.stringify(decoded)}`);
|
143
|
+
const parsedCredential = parseCredentialSdJwt(issuerConf.openid_credential_issuer.credential_configurations_supported, decoded, ignoreMissingAttributes, includeUndefinedAttributes);
|
301
144
|
const maybeIssuedAt = getValueFromDisclosures(decoded.disclosures, "iat");
|
145
|
+
Logger.log(LogLevel.DEBUG, `Parsed credential: ${JSON.stringify(parsedCredential)}\nIssued at: ${maybeIssuedAt}`);
|
302
146
|
return {
|
303
147
|
parsedCredential,
|
304
148
|
expiration: new Date(decoded.sdJwt.payload.exp * 1000),
|
305
149
|
issuedAt: typeof maybeIssuedAt === "number" ? new Date(maybeIssuedAt * 1000) : undefined
|
306
150
|
};
|
307
151
|
};
|
308
|
-
const verifyAndParseCredentialMDoc = async (issuerConf, credential, _, credentialType, _ref23) => {
|
309
|
-
var _parsedCredential$exp, _parsedCredential$iss;
|
310
|
-
let {
|
311
|
-
credentialCryptoContext,
|
312
|
-
ignoreMissingAttributes
|
313
|
-
} = _ref23;
|
314
|
-
const decoded = await verifyCredentialMDoc(credential, issuerConf.keys, credentialCryptoContext);
|
315
|
-
const parsedCredential = parseCredentialMDoc(issuerConf.credential_configurations_supported, credentialType, decoded, undefined, ignoreMissingAttributes);
|
316
|
-
const expirationDate = extractElementValueAsDate(parsedCredential === null || parsedCredential === void 0 || (_parsedCredential$exp = parsedCredential.expiry_date) === null || _parsedCredential$exp === void 0 ? void 0 : _parsedCredential$exp.value);
|
317
|
-
if (!expirationDate) {
|
318
|
-
throw new IoWalletError(`expirationDate must be present!!`);
|
319
|
-
}
|
320
|
-
expirationDate === null || expirationDate === void 0 ? void 0 : expirationDate.setDate(expirationDate.getDate() + 1);
|
321
|
-
const maybeIssuedAt = extractElementValueAsDate(parsedCredential === null || parsedCredential === void 0 || (_parsedCredential$iss = parsedCredential.issue_date) === null || _parsedCredential$iss === void 0 ? void 0 : _parsedCredential$iss.value);
|
322
|
-
maybeIssuedAt === null || maybeIssuedAt === void 0 ? void 0 : maybeIssuedAt.setDate(maybeIssuedAt.getDate() + 1);
|
323
|
-
return {
|
324
|
-
parsedCredential,
|
325
|
-
expiration: expirationDate ?? new Date(),
|
326
|
-
issuedAt: maybeIssuedAt ?? undefined
|
327
|
-
};
|
328
|
-
};
|
329
152
|
|
330
153
|
/**
|
331
154
|
* Verify and parse an encoded credential.
|
332
|
-
* @param issuerConf The Issuer configuration returned by {@link
|
155
|
+
* @param issuerConf The Issuer configuration returned by {@link evaluateIssuerTrust}
|
333
156
|
* @param credential The encoded credential returned by {@link obtainCredential}
|
334
157
|
* @param format The format of the credentual returned by {@link obtainCredential}
|
335
158
|
* @param context.credentialCryptoContext The crypto context used to obtain the credential in {@link obtainCredential}
|
@@ -340,13 +163,12 @@ const verifyAndParseCredentialMDoc = async (issuerConf, credential, _, credentia
|
|
340
163
|
* @throws {IoWalletError} If the credential is not bound to the provided user key
|
341
164
|
* @throws {IoWalletError} If the credential data fail to parse
|
342
165
|
*/
|
343
|
-
export const verifyAndParseCredential = async (issuerConf, credential, format,
|
166
|
+
export const verifyAndParseCredential = async (issuerConf, credential, format, context) => {
|
344
167
|
if (format === "vc+sd-jwt") {
|
345
|
-
|
346
|
-
|
347
|
-
if (format === "mso_mdoc") {
|
348
|
-
return verifyAndParseCredentialMDoc(issuerConf, credential, format, credentialType, context);
|
168
|
+
Logger.log(LogLevel.DEBUG, "Parsing credential in vc+sd-jwt format");
|
169
|
+
return verifyAndParseCredentialSdJwt(issuerConf, credential, format, context);
|
349
170
|
}
|
171
|
+
Logger.log(LogLevel.ERROR, `Unsupported credential format: ${format}`);
|
350
172
|
throw new IoWalletError(`Unsupported credential format: ${format}`);
|
351
173
|
};
|
352
174
|
//# sourceMappingURL=07-verify-and-parse-credential.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["IoWalletError","SdJwt4VC","verify","verifySdJwt","verifyMdoc","getValueFromDisclosures","extractElementValueAsDate","parseCredentialSdJwt","credentials_supported","_ref","sdJwt","disclosures","ignoreMissingAttributes","arguments","length","undefined","includeUndefinedAttributes","credentialSubject","payload","vct","format","header","typ","claims","attrDefinitions","Object","entries","attrsNotInDisclosures","filter","_ref2","attrKey","definition","some","_ref3","name","mandatory","missing","map","_","join","received","definedValues","fromEntries","_ref4","_disclosures$find","value","find","_ref5","_ref6","display","reduce","names","_ref7","locale","undefinedValues","keys","includes","_ref8","key","parseCredentialMDoc","credential_type","_ref9","issuerSigned","flatMap","_ref10","namespace","claimName","_ref11","claimNameKey","nameSpaces","flatNamespaces","_ref12","values","v","elementIdentifier","elementValue","_ref13","attrDefNamespace","isClaimPresent","_ref14","_ref15","_flatNamespaces$find","_ref16","_ref17","_ref18","_ref19","_ref20","_ref21","verifyCredentialSdJwt","rawCredential","issuerKeys","holderBindingContext","decodedCredential","holderBindingKey","Promise","all","getPublicKey","cnf","jwk","kid","verifyCredentialMDoc","verifyAndParseCredentialSdJwt","issuerConf","credential","__","_ref22","credentialCryptoContext","decoded","parsedCredential","credential_configurations_supported","maybeIssuedAt","expiration","Date","exp","issuedAt","verifyAndParseCredentialMDoc","credentialType","_ref23","_parsedCredential$exp","_parsedCredential$iss","expirationDate","expiry_date","setDate","getDate","issue_date","verifyAndParseCredential","context"],"sourceRoot":"../../../../src","sources":["credential/issuance/07-verify-and-par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CACjCb,UAAU,EACVC,UAAU,EACVnF,MAAM,EACNgG,cAAc,EACdU,OACF,CAAC;EACH;EAEA,MAAM,IAAI9H,aAAa,CAAE,kCAAiCoB,MAAO,EAAC,CAAC;AACrE,CAAC"}
|
1
|
+
{"version":3,"names":["IoWalletError","SdJwt4VC","verify","verifySdJwt","getValueFromDisclosures","LogLevel","Logger","parseCredentialSdJwt","credentials_supported","_ref","sdJwt","disclosures","ignoreMissingAttributes","arguments","length","undefined","includeUndefinedAttributes","credentialSubject","payload","vct","log","ERROR","format","header","typ","claims","attrDefinitions","Object","entries","attrsNotInDisclosures","filter","_ref2","attrKey","some","_ref3","name","missing","map","_","join","received","definedValues","fromEntries","_ref4","_disclosures$find","definition","value","find","_ref5","display","reduce","names","_ref6","locale","undefinedValues","keys","includes","_ref7","key","verifyCredentialSdJwt","rawCredential","issuerKeys","holderBindingContext","decodedCredential","holderBindingKey","Promise","all","getPublicKey","cnf","jwk","kid","verifyAndParseCredentialSdJwt","issuerConf","credential","_ref8","credentialCryptoContext","decoded","openid_credential_issuer","jwks","DEBUG","JSON","stringify","parsedCredential","credential_configurations_supported","maybeIssuedAt","expiration","Date","exp","issuedAt","verifyAndParseCredential","context"],"sourceRoot":"../../../../src","sources":["credential/issuance/07-verify-and-parse-credential.ts"],"mappings":"AAGA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,MAAM,IAAIC,WAAW,QAAQ,cAAc;AACpD,SAASC,uBAAuB,QAAQ,yBAAyB;AAGjE,SAASC,QAAQ,EAAEC,MAAM,QAAQ,qBAAqB;;AAuBtD;;AAkBA;;AAKA,MAAMC,oBAAoB,GAAG,SAAAA,CAE3BC,qBAAgI,EAAAC,IAAA,EAI3G;EAAA,IAHrB;IAAEC,KAAK;IAAEC;EAAoC,CAAC,GAAAF,IAAA;EAAA,IAC9CG,uBAAgC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAA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U,EAAE,IAAIC,IAAI,CAACV,OAAO,CAAClE,KAAK,CAACQ,OAAO,CAACqE,GAAG,GAAG,IAAI,CAAC;IACtDC,QAAQ,EACN,OAAOJ,aAAa,KAAK,QAAQ,GAC7B,IAAIE,IAAI,CAACF,aAAa,GAAG,IAAI,CAAC,GAC9BrE;EACR,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM0E,wBAAkD,GAAG,MAAAA,CAChEjB,UAAU,EACVC,UAAU,EACVnD,MAAM,EACNoE,OAAO,KACJ;EACH,IAAIpE,MAAM,KAAK,WAAW,EAAE;IAC1BhB,MAAM,CAACc,GAAG,CAACf,QAAQ,CAAC0E,KAAK,EAAE,wCAAwC,CAAC;IACpE,OAAOR,6BAA6B,CAClCC,UAAU,EACVC,UAAU,EACVnD,MAAM,EACNoE,OACF,CAAC;EACH;EAEApF,MAAM,CAACc,GAAG,CAACf,QAAQ,CAACgB,KAAK,EAAG,kCAAiCC,MAAO,EAAC,CAAC;EACtE,MAAM,IAAItB,aAAa,CAAE,kCAAiCsB,MAAO,EAAC,CAAC;AACrE,CAAC"}
|
@@ -6,7 +6,7 @@ There's a fork in the flow which is based on the type of the credential that is
|
|
6
6
|
This is due to the fact that eID credentials require a different authorization flow than other credentials, which is accomplished by a strong authentication method like SPID or CIE.
|
7
7
|
Credentials instead require a simpler authorization flow and they require other credentials to be presented in order to be issued.
|
8
8
|
|
9
|
-
The supported credentials are defined in the entity configuration of the issuer which is evaluted and parsed in the `
|
9
|
+
The supported credentials are defined in the entity configuration of the issuer which is evaluted and parsed in the `evaluateIssuerTrust` step.
|
10
10
|
|
11
11
|
## Sequence Diagram
|
12
12
|
|
@@ -14,7 +14,7 @@ The supported credentials are defined in the entity configuration of the issuer
|
|
14
14
|
graph TD;
|
15
15
|
0[WalletInstanceAttestation.getAttestation]
|
16
16
|
1[startFlow]
|
17
|
-
2[
|
17
|
+
2[evaluateIssuerTrust]
|
18
18
|
3[startUserAuthorization]
|
19
19
|
C4[getRequestedCredentialToBePresented]
|
20
20
|
C4.1[completeUserAuthorizationWithFormPostJwtMode]
|
@@ -41,9 +41,12 @@ graph TD;
|
|
41
41
|
|
42
42
|
The following errors are mapped to a `IssuerResponseError` with specific codes.
|
43
43
|
|
44
|
-
|
|
45
|
-
|
46
|
-
|
44
|
+
|HTTP Status|Error Code|Description|
|
45
|
+
|-----------|----------|-----------|
|
46
|
+
|`201 Created`|`ERR_CREDENTIAL_ISSUING_NOT_SYNCHRONOUS`| This response is returned by the credential issuer when the request has been queued because the credential cannot be issued synchronously. The consumer should try to obtain the credential at a later time. Although `201 Created` is not considered an error, it is mapped as an error in this context in order to handle the case where the credential issuance is not synchronous. This allows keeping the flow consistent and handle the case where the credential is not immediately available.|
|
47
|
+
|`403 Forbidden`|`ERR_CREDENTIAL_INVALID_STATUS`|This response is returned by the credential issuer when the requested credential has an invalid status. It might contain more details in the `reason` property.|
|
48
|
+
|`404 Not Found`|`ERR_CREDENTIAL_INVALID_STATUS`| This response is returned by the credential issuer when the authenticated user is not entitled to receive the requested credential. It might contain more details in the `reason` property.|
|
49
|
+
|`*`|`ERR_ISSUER_GENERIC_ERROR`|This is a generic error code to map unexpected errors that occurred when interacting with the Issuer.|
|
47
50
|
|
48
51
|
## Strong authentication for eID issuance (Query Mode)
|
49
52
|
|
@@ -105,7 +108,7 @@ const eid = {
|
|
105
108
|
const eidCryptoContext = createCryptoContextFor(eid.keyTag);
|
106
109
|
|
107
110
|
// Create credential crypto context
|
108
|
-
const credentialKeyTag =
|
111
|
+
const credentialKeyTag = uuidv4().toString();
|
109
112
|
await generate(credentialKeyTag); // Let's assume this function generates a new hardware-backed key pair
|
110
113
|
const credentialCryptoContext = createCryptoContextFor(credentialKeyTag);
|
111
114
|
|
@@ -118,7 +121,7 @@ const startFlow: Credential.Issuance.StartFlow = () => ({
|
|
118
121
|
const { issuerUrl } = startFlow();
|
119
122
|
|
120
123
|
// Evaluate issuer trust
|
121
|
-
const { issuerConf } = await Credential.Issuance.
|
124
|
+
const { issuerConf } = await Credential.Issuance.evaluateIssuerTrust(issuerUrl);
|
122
125
|
|
123
126
|
// Start user authorization
|
124
127
|
const { issuerRequestUri, clientId, codeVerifier, credentialDefinition } =
|
@@ -241,23 +244,24 @@ const authorizationContext = idpHint.includes("servizicie")
|
|
241
244
|
* Create credential crypto context for the PID
|
242
245
|
* WARNING: The eID keytag must be persisted and later used when requesting a credential which requires a eID presentation
|
243
246
|
*/
|
244
|
-
const credentialKeyTag =
|
247
|
+
const credentialKeyTag = uuidv4().toString();
|
245
248
|
await generate(credentialKeyTag);
|
246
249
|
const credentialCryptoContext = createCryptoContextFor(credentialKeyTag);
|
247
250
|
|
248
251
|
// Start the issuance flow
|
249
252
|
const startFlow: Credential.Issuance.StartFlow = () => ({
|
250
253
|
issuerUrl: WALLET_EID_PROVIDER_BASE_URL,
|
251
|
-
credentialType: "
|
254
|
+
credentialType: "PersonIdentificationData",
|
252
255
|
appFetch,
|
253
256
|
});
|
254
257
|
|
255
258
|
const { issuerUrl } = startFlow();
|
256
259
|
|
257
260
|
// Evaluate issuer trust
|
258
|
-
const { issuerConf } = await Credential.Issuance.
|
259
|
-
|
260
|
-
}
|
261
|
+
const { issuerConf } = await Credential.Issuance.evaluateIssuerTrust(
|
262
|
+
issuerUrl,
|
263
|
+
{ appFetch }
|
264
|
+
);
|
261
265
|
|
262
266
|
// Start user authorization
|
263
267
|
const { issuerRequestUri, clientId, codeVerifier, credentialDefinition } =
|
@@ -311,13 +315,12 @@ const { credential, format } = await Credential.Issuance.obtainCredential(
|
|
311
315
|
);
|
312
316
|
|
313
317
|
// Parse and verify the eID credential
|
314
|
-
const { parsedCredential, issuedAt, expiration } =
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
);
|
318
|
+
const { parsedCredential, issuedAt, expiration } = await Credential.Issuance.verifyAndParseCredential(
|
319
|
+
issuerConf,
|
320
|
+
credential,
|
321
|
+
format,
|
322
|
+
{ credentialCryptoContext }
|
323
|
+
);
|
321
324
|
|
322
325
|
return {
|
323
326
|
parsedCredential,
|
@@ -325,7 +328,7 @@ return {
|
|
325
328
|
keyTag: credentialKeyTag,
|
326
329
|
credentialType,
|
327
330
|
issuedAt,
|
328
|
-
expiration
|
331
|
+
expiration
|
329
332
|
};
|
330
333
|
```
|
331
334
|
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import * as z from "zod";
|
2
2
|
export const ASSERTION_TYPE = "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation";
|
3
|
-
export const SupportedCredentialFormat = z.union([z.literal("vc+sd-jwt"), z.literal("
|
3
|
+
export const SupportedCredentialFormat = z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]);
|
4
4
|
//# sourceMappingURL=const.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["z","ASSERTION_TYPE","SupportedCredentialFormat","union","literal"],"sourceRoot":"../../../../src","sources":["credential/issuance/const.ts"],"mappings":"AAAA,OAAO,KAAKA,CAAC,MAAM,KAAK;AACxB,OAAO,MAAMC,cAAc,GACzB,oEAAoE;AAKtE,OAAO,MAAMC,yBAAyB,GAAGF,CAAC,CAACG,KAAK,CAAC,CAC/CH,CAAC,CAACI,OAAO,CAAC,WAAW,CAAC,EACtBJ,CAAC,CAACI,OAAO,CAAC,
|
1
|
+
{"version":3,"names":["z","ASSERTION_TYPE","SupportedCredentialFormat","union","literal"],"sourceRoot":"../../../../src","sources":["credential/issuance/const.ts"],"mappings":"AAAA,OAAO,KAAKA,CAAC,MAAM,KAAK;AACxB,OAAO,MAAMC,cAAc,GACzB,oEAAoE;AAKtE,OAAO,MAAMC,yBAAyB,GAAGF,CAAC,CAACG,KAAK,CAAC,CAC/CH,CAAC,CAACI,OAAO,CAAC,WAAW,CAAC,EACtBJ,CAAC,CAACI,OAAO,CAAC,cAAc,CAAC,CAC1B,CAAC"}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import {
|
1
|
+
import { evaluateIssuerTrust } from "./02-evaluate-issuer-trust";
|
2
2
|
import { startUserAuthorization } from "./03-start-user-authorization";
|
3
3
|
import { completeUserAuthorizationWithQueryMode, completeUserAuthorizationWithFormPostJwtMode, parseAuthorizationResponse, buildAuthorizationUrl, getRequestedCredentialToBePresented } from "./04-complete-user-authorization";
|
4
4
|
import { authorizeAccess } from "./05-authorize-access";
|
5
5
|
import { obtainCredential } from "./06-obtain-credential";
|
6
6
|
import { verifyAndParseCredential } from "./07-verify-and-parse-credential";
|
7
7
|
import * as Errors from "./errors";
|
8
|
-
export {
|
8
|
+
export { evaluateIssuerTrust, startUserAuthorization, buildAuthorizationUrl, completeUserAuthorizationWithQueryMode, getRequestedCredentialToBePresented, completeUserAuthorizationWithFormPostJwtMode, authorizeAccess, obtainCredential, verifyAndParseCredential, parseAuthorizationResponse, Errors };
|
9
9
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["evaluateIssuerTrust","startUserAuthorization","completeUserAuthorizationWithQueryMode","completeUserAuthorizationWithFormPostJwtMode","parseAuthorizationResponse","buildAuthorizationUrl","getRequestedCredentialToBePresented","authorizeAccess","obtainCredential","verifyAndParseCredential","Errors"],"sourceRoot":"../../../../src","sources":["credential/issuance/index.ts"],"mappings":"AACA,SACEA,mBAAmB,QAEd,4BAA4B;AACnC,SACEC,sBAAsB,QAEjB,+BAA+B;AACtC,SACEC,sCAAsC,EACtCC,4CAA4C,EAC5CC,0BAA0B,EAC1BC,qBAAqB,EAKrBC,mCAAmC,QAC9B,kCAAkC;AACzC,SAASC,eAAe,QAA8B,uBAAuB;AAC7E,SACEC,gBAAgB,QAEX,wBAAwB;AAC/B,SACEC,wBAAwB,QAEnB,kCAAkC;AACzC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAElC,SACEV,mBAAmB,EACnBC,sBAAsB,EACtBI,qBAAqB,EACrBH,sCAAsC,EACtCI,mCAAmC,EACnCH,4CAA4C,EAC5CI,eAAe,EACfC,gBAAgB,EAChBC,wBAAwB,EACxBL,0BAA0B,EAC1BM,MAAM"}
|
@@ -1,37 +1,36 @@
|
|
1
1
|
import * as z from "zod";
|
2
|
-
import {
|
2
|
+
import { InvalidQRCodeError } from "./errors";
|
3
3
|
const PresentationParams = z.object({
|
4
|
-
|
5
|
-
|
4
|
+
client_id: z.string().nonempty(),
|
5
|
+
request_uri: z.string().url(),
|
6
|
+
request_uri_method: z.enum(["get", "post"]),
|
7
|
+
state: z.string().optional()
|
6
8
|
});
|
7
9
|
|
8
10
|
/**
|
9
11
|
* The beginning of the presentation flow.
|
10
12
|
* To be implemented accordind to the user touchpoint
|
11
13
|
*
|
12
|
-
* @param
|
14
|
+
* @param params Presentation parameters, depending on the starting touchpoint
|
13
15
|
* @returns The url for the Relying Party to connect with
|
14
16
|
*/
|
15
17
|
|
16
18
|
/**
|
17
|
-
* Start a presentation flow by
|
19
|
+
* Start a presentation flow by validating the required parameters.
|
20
|
+
* Parameters are extracted from a url encoded in a QR code or in a deep link.
|
18
21
|
*
|
19
|
-
* @param
|
22
|
+
* @param params The parameters to be validated
|
20
23
|
* @returns The url for the Relying Party to connect with
|
21
|
-
* @throws If the provided
|
24
|
+
* @throws If the provided parameters are not valid
|
22
25
|
*/
|
23
|
-
export const startFlowFromQR =
|
26
|
+
export const startFlowFromQR = params => {
|
24
27
|
const result = PresentationParams.safeParse({
|
25
|
-
|
26
|
-
|
28
|
+
...params,
|
29
|
+
request_uri_method: params.request_uri_method ?? "get"
|
27
30
|
});
|
28
31
|
if (result.success) {
|
29
32
|
return result.data;
|
30
|
-
} else {
|
31
|
-
throw new ValidationFailed({
|
32
|
-
message: "Invalid parameters provided",
|
33
|
-
reason: result.error.message
|
34
|
-
});
|
35
33
|
}
|
34
|
+
throw new InvalidQRCodeError(result.error.message);
|
36
35
|
};
|
37
36
|
//# sourceMappingURL=01-start-flow.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["z","
|
1
|
+
{"version":3,"names":["z","InvalidQRCodeError","PresentationParams","object","client_id","string","nonempty","request_uri","url","request_uri_method","enum","state","optional","startFlowFromQR","params","result","safeParse","success","data","error","message"],"sourceRoot":"../../../../src","sources":["credential/presentation/01-start-flow.ts"],"mappings":"AAAA,OAAO,KAAKA,CAAC,MAAM,KAAK;AACxB,SAASC,kBAAkB,QAAQ,UAAU;AAE7C,MAAMC,kBAAkB,GAAGF,CAAC,CAACG,MAAM,CAAC;EAClCC,SAAS,EAAEJ,CAAC,CAACK,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAChCC,WAAW,EAAEP,CAAC,CAACK,MAAM,CAAC,CAAC,CAACG,GAAG,CAAC,CAAC;EAC7BC,kBAAkB,EAAET,CAAC,CAACU,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;EAC3CC,KAAK,EAAEX,CAAC,CAACK,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC;AAC7B,CAAC,CAAC;;AAGF;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAA0B,GAAIC,MAAM,IAAK;EACpD,MAAMC,MAAM,GAAGb,kBAAkB,CAACc,SAAS,CAAC;IAC1C,GAAGF,MAAM;IACTL,kBAAkB,EAAEK,MAAM,CAACL,kBAAkB,IAAI;EACnD,CAAC,CAAC;EAEF,IAAIM,MAAM,CAACE,OAAO,EAAE;IAClB,OAAOF,MAAM,CAACG,IAAI;EACpB;EAEA,MAAM,IAAIjB,kBAAkB,CAACc,MAAM,CAACI,KAAK,CAACC,OAAO,CAAC;AACpD,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { getRelyingPartyEntityConfiguration } from "../../
|
1
|
+
import { getRelyingPartyEntityConfiguration } from "../../trust";
|
2
2
|
/**
|
3
3
|
* The Relying Party trust evaluation phase.
|
4
4
|
* Fetch the Relying Party's configuration and verify trust.
|
@@ -13,13 +13,15 @@ export const evaluateRelyingPartyTrust = async function (rpUrl) {
|
|
13
13
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
14
14
|
const {
|
15
15
|
payload: {
|
16
|
-
metadata: rpConf
|
16
|
+
metadata: rpConf,
|
17
|
+
sub
|
17
18
|
}
|
18
19
|
} = await getRelyingPartyEntityConfiguration(rpUrl, {
|
19
20
|
appFetch
|
20
21
|
});
|
21
22
|
return {
|
22
|
-
rpConf
|
23
|
+
rpConf,
|
24
|
+
subject: sub
|
23
25
|
};
|
24
26
|
};
|
25
27
|
//# sourceMappingURL=02-evaluate-rp-trust.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getRelyingPartyEntityConfiguration","evaluateRelyingPartyTrust","rpUrl","appFetch","fetch","arguments","length","undefined","payload","metadata","rpConf"],"sourceRoot":"../../../../src","sources":["credential/presentation/02-evaluate-rp-trust.ts"],"mappings":"AAAA,SAASA,kCAAkC,QAAQ,
|
1
|
+
{"version":3,"names":["getRelyingPartyEntityConfiguration","evaluateRelyingPartyTrust","rpUrl","appFetch","fetch","arguments","length","undefined","payload","metadata","rpConf","sub","subject"],"sourceRoot":"../../../../src","sources":["credential/presentation/02-evaluate-rp-trust.ts"],"mappings":"AAAA,SAASA,kCAAkC,QAAQ,aAAa;AAehE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAoD,GAAG,eAAAA,CAClEC,KAAK,EAEF;EAAA,IADH;IAAEC,QAAQ,GAAGC;EAAM,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEzB,MAAM;IACJG,OAAO,EAAE;MAAEC,QAAQ,EAAEC,MAAM;MAAEC;IAAI;EACnC,CAAC,GAAG,MAAMX,kCAAkC,CAACE,KAAK,EAAE;IAClDC;EACF,CAAC,CAAC;EACF,OAAO;IAAEO,MAAM;IAAEE,OAAO,EAAED;EAAI,CAAC;AACjC,CAAC"}
|