@pagopa/io-react-native-wallet 1.7.1 → 2.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -1
- package/lib/commonjs/client/generated/wallet-provider.js +49 -20
- package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
- package/lib/commonjs/credential/index.js +5 -1
- package/lib/commonjs/credential/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +27 -0
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +25 -16
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +30 -18
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +17 -12
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +36 -29
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +27 -207
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/README.md +23 -20
- package/lib/commonjs/credential/issuance/const.js +1 -1
- package/lib/commonjs/credential/issuance/const.js.map +1 -1
- package/lib/commonjs/credential/issuance/index.js +3 -3
- package/lib/commonjs/credential/issuance/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/01-start-flow.js +14 -15
- package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +6 -4
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/commonjs/credential/presentation/03-get-request-object.js +34 -7
- package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js +4 -126
- package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
- package/lib/commonjs/credential/presentation/05-verify-request-object.js +80 -25
- package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js +6 -30
- package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +97 -117
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +86 -191
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js +112 -176
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/commonjs/credential/presentation/README.md +74 -79
- package/lib/commonjs/credential/presentation/errors.js +42 -21
- package/lib/commonjs/credential/presentation/errors.js.map +1 -1
- package/lib/commonjs/credential/presentation/index.js +13 -13
- package/lib/commonjs/credential/presentation/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js +53 -29
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/credential/status/01-start-flow.js +2 -0
- package/lib/commonjs/credential/status/01-start-flow.js.map +1 -0
- package/lib/commonjs/credential/status/02-status-attestation.js +73 -0
- package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -0
- package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +55 -0
- package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
- package/lib/commonjs/credential/status/README.md +67 -0
- package/lib/commonjs/credential/status/index.js +27 -0
- package/lib/commonjs/credential/status/index.js.map +1 -0
- package/lib/commonjs/credential/status/types.js +48 -0
- package/lib/commonjs/credential/status/types.js.map +1 -0
- package/lib/commonjs/credential/trustmark/README.md +62 -0
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +86 -0
- package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -0
- package/lib/commonjs/credential/trustmark/index.js +13 -0
- package/lib/commonjs/credential/trustmark/index.js.map +1 -0
- package/lib/commonjs/index.js +5 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/pid/sd-jwt/types.js +18 -2
- package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/index.test.js +22 -34
- package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/types.test.js +11 -23
- package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/index.js +1 -7
- package/lib/commonjs/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +5 -21
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/trust/README.md +147 -0
- package/lib/commonjs/trust/chain.js +153 -0
- package/lib/commonjs/trust/chain.js.map +1 -0
- package/lib/commonjs/trust/errors.js +133 -0
- package/lib/commonjs/trust/errors.js.map +1 -0
- package/lib/commonjs/trust/index.js +288 -0
- package/lib/commonjs/trust/index.js.map +1 -0
- package/lib/commonjs/{entity/trust → trust}/types.js +27 -47
- package/lib/commonjs/trust/types.js.map +1 -0
- package/lib/commonjs/trust/utils.js +70 -0
- package/lib/commonjs/trust/utils.js.map +1 -0
- package/lib/commonjs/utils/crypto.js +5 -112
- package/lib/commonjs/utils/crypto.js.map +1 -1
- package/lib/commonjs/utils/decoder.js +2 -0
- package/lib/commonjs/utils/decoder.js.map +1 -1
- package/lib/commonjs/utils/error-codes.js +22 -2
- package/lib/commonjs/utils/error-codes.js.map +1 -1
- package/lib/commonjs/utils/errors.js +72 -4
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/commonjs/utils/logging.js +68 -0
- package/lib/commonjs/utils/logging.js.map +1 -0
- package/lib/commonjs/utils/misc.js +2 -0
- package/lib/commonjs/utils/misc.js.map +1 -1
- package/lib/commonjs/utils/par.js +17 -10
- package/lib/commonjs/utils/par.js.map +1 -1
- package/lib/commonjs/utils/string.js +1 -12
- package/lib/commonjs/utils/string.js.map +1 -1
- package/lib/commonjs/wallet-instance/index.js +14 -0
- package/lib/commonjs/wallet-instance/index.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/README.md +8 -3
- package/lib/commonjs/wallet-instance-attestation/issuing.js +15 -8
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/types.js +16 -20
- package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
- package/lib/module/client/generated/wallet-provider.js +40 -15
- package/lib/module/client/generated/wallet-provider.js.map +1 -1
- package/lib/module/credential/index.js +3 -1
- package/lib/module/credential/index.js.map +1 -1
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +20 -0
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
- package/lib/module/credential/issuance/03-start-user-authorization.js +25 -16
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +30 -18
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +17 -11
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +36 -28
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +27 -205
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/issuance/README.md +23 -20
- package/lib/module/credential/issuance/const.js +1 -1
- package/lib/module/credential/issuance/const.js.map +1 -1
- package/lib/module/credential/issuance/index.js +2 -2
- package/lib/module/credential/issuance/index.js.map +1 -1
- package/lib/module/credential/presentation/01-start-flow.js +14 -15
- package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js +5 -3
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/module/credential/presentation/03-get-request-object.js +34 -7
- package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +2 -124
- package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
- package/lib/module/credential/presentation/05-verify-request-object.js +78 -23
- package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/module/credential/presentation/06-fetch-presentation-definition.js +6 -30
- package/lib/module/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js +97 -118
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +83 -186
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js +107 -170
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/module/credential/presentation/README.md +74 -79
- package/lib/module/credential/presentation/errors.js +30 -17
- package/lib/module/credential/presentation/errors.js.map +1 -1
- package/lib/module/credential/presentation/index.js +6 -6
- package/lib/module/credential/presentation/index.js.map +1 -1
- package/lib/module/credential/presentation/types.js +49 -27
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/credential/status/01-start-flow.js +2 -0
- package/lib/module/credential/status/01-start-flow.js.map +1 -0
- package/lib/module/credential/status/02-status-attestation.js +66 -0
- package/lib/module/credential/status/02-status-attestation.js.map +1 -0
- package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +49 -0
- package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
- package/lib/module/credential/status/README.md +67 -0
- package/lib/module/credential/status/index.js +5 -0
- package/lib/module/credential/status/index.js.map +1 -0
- package/lib/module/credential/status/types.js +40 -0
- package/lib/module/credential/status/types.js.map +1 -0
- package/lib/module/credential/trustmark/README.md +62 -0
- package/lib/module/credential/trustmark/get-credential-trustmark.js +77 -0
- package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -0
- package/lib/module/credential/trustmark/index.js +3 -0
- package/lib/module/credential/trustmark/index.js.map +1 -0
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/pid/sd-jwt/types.js +16 -1
- package/lib/module/pid/sd-jwt/types.js.map +1 -1
- package/lib/module/sd-jwt/__test__/index.test.js +22 -34
- package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/types.test.js +11 -23
- package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/module/sd-jwt/index.js +1 -7
- package/lib/module/sd-jwt/index.js.map +1 -1
- package/lib/module/sd-jwt/types.js +4 -19
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/trust/README.md +147 -0
- package/lib/module/trust/chain.js +145 -0
- package/lib/module/trust/chain.js.map +1 -0
- package/lib/module/trust/errors.js +115 -0
- package/lib/module/trust/errors.js.map +1 -0
- package/lib/module/trust/index.js +269 -0
- package/lib/module/trust/index.js.map +1 -0
- package/lib/module/{entity/trust → trust}/types.js +25 -46
- package/lib/module/trust/types.js.map +1 -0
- package/lib/module/trust/utils.js +60 -0
- package/lib/module/trust/utils.js.map +1 -0
- package/lib/module/utils/crypto.js +4 -107
- package/lib/module/utils/crypto.js.map +1 -1
- package/lib/module/utils/decoder.js +3 -0
- package/lib/module/utils/decoder.js.map +1 -1
- package/lib/module/utils/error-codes.js +20 -1
- package/lib/module/utils/error-codes.js.map +1 -1
- package/lib/module/utils/errors.js +61 -4
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/module/utils/logging.js +62 -0
- package/lib/module/utils/logging.js.map +1 -0
- package/lib/module/utils/misc.js +2 -0
- package/lib/module/utils/misc.js.map +1 -1
- package/lib/module/utils/par.js +17 -9
- package/lib/module/utils/par.js.map +1 -1
- package/lib/module/utils/string.js +0 -10
- package/lib/module/utils/string.js.map +1 -1
- package/lib/module/wallet-instance/index.js +13 -0
- package/lib/module/wallet-instance/index.js.map +1 -1
- package/lib/module/wallet-instance-attestation/README.md +8 -3
- package/lib/module/wallet-instance-attestation/index.js +2 -2
- package/lib/module/wallet-instance-attestation/index.js.map +1 -1
- package/lib/module/wallet-instance-attestation/issuing.js +16 -9
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/wallet-instance-attestation/types.js +14 -18
- package/lib/module/wallet-instance-attestation/types.js.map +1 -1
- package/lib/typescript/client/generated/wallet-provider.d.ts +206 -51
- package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
- package/lib/typescript/credential/index.d.ts +3 -1
- package/lib/typescript/credential/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -1
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +19 -0
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +3 -3
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +9 -9
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts +3 -3
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +4 -4
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +3 -15
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/const.d.ts +1 -1
- package/lib/typescript/credential/issuance/const.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/index.d.ts +3 -3
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/types.d.ts +8 -3
- package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/01-start-flow.d.ts +28 -9
- package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +2 -1
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts +7 -5
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts +4 -30
- package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +17 -4
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts +4 -9
- package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +13 -12
- package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +40 -42
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +30 -43
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/errors.d.ts +25 -10
- package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/index.d.ts +7 -8
- package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +137 -307
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
- package/lib/typescript/credential/status/01-start-flow.d.ts +10 -0
- package/lib/typescript/credential/status/01-start-flow.d.ts.map +1 -0
- package/lib/typescript/credential/status/02-status-attestation.d.ts +19 -0
- package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -0
- package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts +24 -0
- package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -0
- package/lib/typescript/credential/status/index.d.ts +7 -0
- package/lib/typescript/credential/status/index.d.ts.map +1 -0
- package/lib/typescript/credential/status/types.d.ts +305 -0
- package/lib/typescript/credential/status/types.d.ts.map +1 -0
- package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts +52 -0
- package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -0
- package/lib/typescript/credential/trustmark/index.d.ts +4 -0
- package/lib/typescript/credential/trustmark/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/pid/sd-jwt/types.d.ts +103 -25
- package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/index.d.ts +20 -72
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +24 -129
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/trust/chain.d.ts +23 -0
- package/lib/typescript/trust/chain.d.ts.map +1 -0
- package/lib/typescript/trust/errors.d.ts +102 -0
- package/lib/typescript/trust/errors.d.ts.map +1 -0
- package/lib/typescript/{entity/trust → trust}/index.d.ts +308 -281
- package/lib/typescript/trust/index.d.ts.map +1 -0
- package/lib/typescript/{entity/trust → trust}/types.d.ts +1714 -1301
- package/lib/typescript/{entity/trust → trust}/types.d.ts.map +1 -1
- package/lib/typescript/trust/utils.d.ts +22 -0
- package/lib/typescript/trust/utils.d.ts.map +1 -0
- package/lib/typescript/utils/crypto.d.ts +0 -32
- package/lib/typescript/utils/crypto.d.ts.map +1 -1
- package/lib/typescript/utils/decoder.d.ts.map +1 -1
- package/lib/typescript/utils/error-codes.d.ts +20 -0
- package/lib/typescript/utils/error-codes.d.ts.map +1 -1
- package/lib/typescript/utils/errors.d.ts +55 -10
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/logging.d.ts +35 -0
- package/lib/typescript/utils/logging.d.ts.map +1 -0
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/utils/par.d.ts +8 -1
- package/lib/typescript/utils/par.d.ts.map +1 -1
- package/lib/typescript/utils/string.d.ts +0 -7
- package/lib/typescript/utils/string.d.ts.map +1 -1
- package/lib/typescript/wallet-instance/index.d.ts +8 -0
- package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/index.d.ts +1 -2
- package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts +4 -2
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +60 -102
- package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
- package/package.json +9 -10
- package/src/client/generated/wallet-provider.ts +52 -17
- package/src/credential/index.ts +4 -1
- package/src/credential/issuance/01-start-flow.ts +1 -1
- package/src/credential/issuance/02-evaluate-issuer-trust.ts +32 -0
- package/src/credential/issuance/03-start-user-authorization.ts +48 -22
- package/src/credential/issuance/04-complete-user-authorization.ts +74 -18
- package/src/credential/issuance/05-authorize-access.ts +29 -11
- package/src/credential/issuance/06-obtain-credential.ts +61 -36
- package/src/credential/issuance/07-verify-and-parse-credential.ts +37 -264
- package/src/credential/issuance/README.md +23 -20
- package/src/credential/issuance/const.ts +1 -1
- package/src/credential/issuance/index.ts +6 -3
- package/src/credential/presentation/01-start-flow.ts +19 -22
- package/src/credential/presentation/02-evaluate-rp-trust.ts +5 -4
- package/src/credential/presentation/03-get-request-object.ts +36 -8
- package/src/credential/presentation/04-retrieve-rp-jwks.ts +6 -148
- package/src/credential/presentation/05-verify-request-object.ts +115 -30
- package/src/credential/presentation/06-fetch-presentation-definition.ts +5 -35
- package/src/credential/presentation/07-evaluate-dcql-query.ts +132 -161
- package/src/credential/presentation/07-evaluate-input-descriptor.ts +136 -254
- package/src/credential/presentation/08-send-authorization-response.ts +178 -260
- package/src/credential/presentation/README.md +74 -79
- package/src/credential/presentation/errors.ts +38 -15
- package/src/credential/presentation/index.ts +18 -19
- package/src/credential/presentation/types.ts +67 -64
- package/src/credential/status/01-start-flow.ts +9 -0
- package/src/credential/status/02-status-attestation.ts +105 -0
- package/src/credential/status/03-verify-and-parse-status-attestation.ts +70 -0
- package/src/credential/status/README.md +67 -0
- package/src/credential/status/index.ts +22 -0
- package/src/credential/status/types.ts +43 -0
- package/src/credential/trustmark/README.md +62 -0
- package/src/credential/trustmark/get-credential-trustmark.ts +139 -0
- package/src/credential/trustmark/index.ts +8 -0
- package/src/index.ts +4 -0
- package/src/pid/sd-jwt/types.ts +18 -1
- package/src/sd-jwt/__test__/index.test.ts +36 -55
- package/src/sd-jwt/__test__/types.test.ts +16 -29
- package/src/sd-jwt/index.ts +1 -5
- package/src/sd-jwt/types.ts +2 -19
- package/src/trust/README.md +147 -0
- package/src/trust/chain.ts +227 -0
- package/src/trust/errors.ts +136 -0
- package/src/{entity/trust → trust}/index.ts +207 -25
- package/src/{entity/trust → trust}/types.ts +24 -37
- package/src/trust/utils.ts +70 -0
- package/src/utils/crypto.ts +4 -106
- package/src/utils/decoder.ts +6 -1
- package/src/utils/error-codes.ts +23 -0
- package/src/utils/errors.ts +119 -15
- package/src/utils/logging.ts +68 -0
- package/src/utils/misc.ts +5 -0
- package/src/utils/par.ts +19 -6
- package/src/utils/string.ts +0 -10
- package/src/wallet-instance/index.ts +30 -1
- package/src/wallet-instance-attestation/README.md +8 -3
- package/src/wallet-instance-attestation/index.ts +2 -2
- package/src/wallet-instance-attestation/issuing.ts +33 -12
- package/src/wallet-instance-attestation/types.ts +18 -22
- package/lib/commonjs/credential/issuance/02-get-issuer-config.js +0 -48
- package/lib/commonjs/credential/issuance/02-get-issuer-config.js.map +0 -1
- package/lib/commonjs/entity/openid-connect/issuer/index.js +0 -25
- package/lib/commonjs/entity/openid-connect/issuer/index.js.map +0 -1
- package/lib/commonjs/entity/openid-connect/issuer/types.js +0 -64
- package/lib/commonjs/entity/openid-connect/issuer/types.js.map +0 -1
- package/lib/commonjs/entity/trust/chain.js +0 -122
- package/lib/commonjs/entity/trust/chain.js.map +0 -1
- package/lib/commonjs/entity/trust/index.js +0 -148
- package/lib/commonjs/entity/trust/index.js.map +0 -1
- package/lib/commonjs/entity/trust/types.js.map +0 -1
- package/lib/commonjs/mdoc/converters.js +0 -26
- package/lib/commonjs/mdoc/converters.js.map +0 -1
- package/lib/commonjs/mdoc/index.js +0 -68
- package/lib/commonjs/mdoc/index.js.map +0 -1
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -469
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -90
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
- package/lib/module/credential/issuance/02-get-issuer-config.js +0 -42
- package/lib/module/credential/issuance/02-get-issuer-config.js.map +0 -1
- package/lib/module/entity/openid-connect/issuer/index.js +0 -20
- package/lib/module/entity/openid-connect/issuer/index.js.map +0 -1
- package/lib/module/entity/openid-connect/issuer/types.js +0 -48
- package/lib/module/entity/openid-connect/issuer/types.js.map +0 -1
- package/lib/module/entity/trust/chain.js +0 -113
- package/lib/module/entity/trust/chain.js.map +0 -1
- package/lib/module/entity/trust/index.js +0 -131
- package/lib/module/entity/trust/index.js.map +0 -1
- package/lib/module/entity/trust/types.js.map +0 -1
- package/lib/module/mdoc/converters.js +0 -20
- package/lib/module/mdoc/converters.js.map +0 -1
- package/lib/module/mdoc/index.js +0 -60
- package/lib/module/mdoc/index.js.map +0 -1
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -462
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -83
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
- package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts +0 -32
- package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts.map +0 -1
- package/lib/typescript/entity/openid-connect/issuer/index.d.ts +0 -12
- package/lib/typescript/entity/openid-connect/issuer/index.d.ts.map +0 -1
- package/lib/typescript/entity/openid-connect/issuer/types.d.ts +0 -777
- package/lib/typescript/entity/openid-connect/issuer/types.d.ts.map +0 -1
- package/lib/typescript/entity/trust/chain.d.ts +0 -26
- package/lib/typescript/entity/trust/chain.d.ts.map +0 -1
- package/lib/typescript/entity/trust/index.d.ts.map +0 -1
- package/lib/typescript/mdoc/converters.d.ts +0 -8
- package/lib/typescript/mdoc/converters.d.ts.map +0 -1
- package/lib/typescript/mdoc/index.d.ts +0 -10
- package/lib/typescript/mdoc/index.d.ts.map +0 -1
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts +0 -3
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts.map +0 -1
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts +0 -42
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts.map +0 -1
- package/src/credential/issuance/02-get-issuer-config.ts +0 -67
- package/src/entity/openid-connect/issuer/index.ts +0 -27
- package/src/entity/openid-connect/issuer/types.ts +0 -76
- package/src/entity/trust/chain.ts +0 -154
- package/src/mdoc/converters.ts +0 -26
- package/src/mdoc/index.ts +0 -95
- package/src/utils/credential/issuance/07-verify-and-parse-credentials-inputs.ts +0 -615
- package/src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts +0 -171
@@ -1,112 +1,107 @@
|
|
1
1
|
# Credential Presentation
|
2
2
|
|
3
|
+
This flow is used for remote presentation, allowing a user with a valid Wallet Instance to remotely present credentials to a Relying Party (Verifier). The presentation flow adheres to the [IT Wallet 0.9.x specification](https://italia.github.io/eid-wallet-it-docs/v0.9.3/en/relying-party-solution.html).
|
4
|
+
|
5
|
+
The Relying Party provides the Wallet with a Request Object that contains the requested credentials and claims. The Wallet validates the Request Object and asks the user for consent. Then the Wallet creates an encrypted Authorization Response that contains the Verifiable Presentation with the requested data (`vp_token`) and sends it to the Relying Party.
|
6
|
+
|
3
7
|
## Sequence Diagram
|
4
8
|
|
5
9
|
```mermaid
|
6
10
|
sequenceDiagram
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
O->>+A: GET: /.well-known/jwt-vc-issuer/jwk
|
20
|
-
A->>+O: Respond with the public key
|
21
|
-
O->>+I: Redirect: Authorisation response
|
11
|
+
autonumber
|
12
|
+
participant I as User (Wallet Instance)
|
13
|
+
participant O as Relying Party (Verifier)
|
14
|
+
|
15
|
+
O->>+I: QR-CODE: Authorization Request (`request_uri`)
|
16
|
+
I->>+O: GET: Verifier's Entity Configuration
|
17
|
+
O->>+I: Respond with metadata (including public keys)
|
18
|
+
I->>+O: GET: Request Object, resolved from `request_uri`
|
19
|
+
O->>+I: Respond with the Request Object
|
20
|
+
I->>+I: Validate Request Object and give consent
|
21
|
+
I->>+O: POST: Authorization Response with encrypted VP token
|
22
|
+
O->>+I: Respond with optional `redirect_uri`
|
22
23
|
```
|
23
24
|
|
24
25
|
## Mapped results
|
25
26
|
|
27
|
+
| Error | Description|
|
28
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
29
|
+
| `InvalidRequestObject` | The Request Object is not valid, for instance it is malformed or its signature cannot be verified. |
|
30
|
+
| `DcqlError` | The DCQL query cannot be evaluated because it contains errors. |
|
31
|
+
| `CredentialsNotFoundError` | The presentation cannot be completed because the Wallet does not contain all requested credentials. The missing credentials can be found in `details`. |
|
32
|
+
| `RelyingPartyResponseError` | Error in the Relying Party's response. See the next table for more details. |
|
33
|
+
|
34
|
+
#### RelyingPartyResponseError
|
35
|
+
The following HTTP errors are mapped to a `RelyingPartyResponseError` with specific codes.
|
36
|
+
|
37
|
+
| HTTP Status | Error Code | Description |
|
38
|
+
| ------------ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
39
|
+
| `400`, `403` | `ERR_RP_INVALID_AUTHORIZATION_RESPONSE` | The Relying Party rejected the Authorization Response sent by the Wallet because it was deemed invalid. |
|
40
|
+
| `*` | `ERR_RP_GENERIC_ERROR` | This is a generic error code to map unexpected errors that occurred when interacting with the Relying Party. |
|
41
|
+
|
42
|
+
|
26
43
|
## Examples
|
27
44
|
|
28
45
|
<details>
|
29
46
|
<summary>Remote Presentation flow</summary>
|
30
47
|
|
48
|
+
**Note:** To successfully complete a remote presentation, the Wallet Instance must be in a valid state with a valid Wallet Instance Attestation.
|
49
|
+
|
31
50
|
```ts
|
32
|
-
//
|
33
|
-
const
|
34
|
-
|
35
|
-
// Retrieve the integrity key tag from the store and create its context
|
36
|
-
const integrityKeyTag = "example"; // Let's assume this is the key tag used to create the wallet instance
|
37
|
-
const integrityContext = getIntegrityContext(integrityKeyTag);
|
38
|
-
|
39
|
-
// Let's assume the key esists befor starting the presentation process
|
40
|
-
const wiaCryptoContext = createCryptoContextFor(WIA_KEYTAG);
|
41
|
-
|
42
|
-
const { WALLET_PROVIDER_BASE_URL, WALLET_EAA_PROVIDER_BASE_URL, REDIRECT_URI } =
|
43
|
-
env; // Let's assume these are the environment variables
|
44
|
-
|
45
|
-
/**
|
46
|
-
* Obtains a new Wallet Instance Attestation.
|
47
|
-
* WARNING: The integrity context must be the same used when creating the Wallet Instance with the same keytag.
|
48
|
-
*/
|
49
|
-
const walletInstanceAttestation =
|
50
|
-
await WalletInstanceAttestation.getAttestation({
|
51
|
-
wiaCryptoContext,
|
52
|
-
integrityContext,
|
53
|
-
walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
|
54
|
-
appFetch,
|
55
|
-
});
|
51
|
+
// Retrieve and scan the qr-code, decode it and get its parameters
|
52
|
+
const qrCodeParams = decodeQrCode(qrCode)
|
56
53
|
|
57
54
|
// Start the issuance flow
|
58
|
-
const {
|
55
|
+
const {
|
56
|
+
request_uri,
|
57
|
+
client_id,
|
58
|
+
request_uri_method,
|
59
|
+
state
|
60
|
+
} = Credential.Presentation.startFlowFromQR(qrCodeParams);
|
59
61
|
|
60
|
-
//
|
61
|
-
const { rpConf } = await Credential.Presentation.evaluateRelyingPartyTrust(
|
62
|
+
// Get the Relying Party's Entity Configuration and evaluate trust
|
63
|
+
const { rpConf } = await Credential.Presentation.evaluateRelyingPartyTrust(client_id);
|
62
64
|
|
65
|
+
// Get the Request Object from the RP
|
63
66
|
const { requestObjectEncodedJwt } =
|
64
|
-
|
65
|
-
appFetch: appFetch
|
66
|
-
});
|
67
|
-
|
68
|
-
// Retrieve RP JWK
|
69
|
-
// If use trust federation: Fetch Jwks from rpConf
|
70
|
-
const jwks = await Credential.Presentation.fetchJwksFromConfig(rpConf);
|
67
|
+
await Credential.Presentation.getRequestObject(request_uri);
|
71
68
|
|
72
|
-
//
|
73
|
-
const
|
69
|
+
// Validate the Request Object
|
70
|
+
const { requestObject } = await Credential.Presentation.verifyRequestObject(
|
74
71
|
requestObjectEncodedJwt,
|
75
|
-
{
|
72
|
+
{ clientId: client_id, rpConf }
|
76
73
|
);
|
77
74
|
|
78
|
-
//
|
79
|
-
const
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
);
|
75
|
+
// All the credentials that might be requested by the Relying Party
|
76
|
+
const credentialsSdJwt = [
|
77
|
+
["credential1_keytag", "eyJraWQiOiItRl82VWdhOG4zVmVnalkyVTdZVUhLMXpMb2FELU5QVGM2M1JNSVNuTGF3IiwidHlwIjoidmMrc2Qtand0IiwiYWxnIjoiRVMyNTYifQ.eyJfc2"],
|
78
|
+
["credential2_keytag", "eyJ0eXAiOiJ2YytzZC1qd3QiLCJhbGciOiJFUzI1NiIsImtpZCI6Ii1GXzZVZ2E4bjNWZWdqWTJVN1lVSEsxekxvYUQtTlBUYzYzUk1JU25MYXcifQ.ew0KIC"]
|
79
|
+
];
|
84
80
|
|
85
|
-
|
86
|
-
|
87
|
-
requestObject
|
88
|
-
{
|
89
|
-
appFetch: appFetch,
|
90
|
-
},
|
91
|
-
rpConf // If trust federation is used
|
81
|
+
const result = Credential.Presentation.evaluateDcqlQuery(
|
82
|
+
credentialsSdJwt,
|
83
|
+
requestObject.dcql_query as DcqlQuery
|
92
84
|
);
|
93
85
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
86
|
+
const credentialsToPresent = result.map(
|
87
|
+
({ requiredDisclosures, ...rest }) => ({
|
88
|
+
...rest,
|
89
|
+
requestedClaims: requiredDisclosures.map(([, claimName]) => claimName),
|
90
|
+
})
|
91
|
+
);
|
100
92
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
[credential, disclosuresRequested, { appFetch: appFetch }]
|
93
|
+
const remotePresentations =
|
94
|
+
await Credential.Presentation.prepareRemotePresentations(
|
95
|
+
credentialsToPresent,
|
96
|
+
requestObject.nonce,
|
97
|
+
requestObject.client_id
|
107
98
|
);
|
108
99
|
|
109
|
-
|
100
|
+
const authResponse = await Credential.Presentation.sendAuthorizationResponse(
|
101
|
+
requestObject,
|
102
|
+
remotePresentations,
|
103
|
+
rpConf
|
104
|
+
);
|
110
105
|
```
|
111
106
|
|
112
|
-
</details>
|
107
|
+
</details>
|
@@ -3,8 +3,16 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.CredentialsNotFoundError = exports.AuthRequestDecodeError = void 0;
|
7
|
+
Object.defineProperty(exports, "DcqlError", {
|
8
|
+
enumerable: true,
|
9
|
+
get: function () {
|
10
|
+
return _dcql.DcqlError;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
exports.NoSuitableKeysFoundInEntityConfiguration = exports.MissingDataError = exports.InvalidRequestObjectError = exports.InvalidQRCodeError = void 0;
|
7
14
|
var _errors = require("../../utils/errors");
|
15
|
+
var _dcql = require("dcql");
|
8
16
|
/**
|
9
17
|
* An error subclass thrown when auth request decode fail
|
10
18
|
*
|
@@ -47,19 +55,34 @@ class NoSuitableKeysFoundInEntityConfiguration extends _errors.IoWalletError {
|
|
47
55
|
}
|
48
56
|
|
49
57
|
/**
|
50
|
-
* When
|
58
|
+
* When a QR code is not valid.
|
51
59
|
*
|
52
60
|
*/
|
53
61
|
exports.NoSuitableKeysFoundInEntityConfiguration = NoSuitableKeysFoundInEntityConfiguration;
|
54
|
-
class
|
55
|
-
code = "
|
62
|
+
class InvalidQRCodeError extends _errors.IoWalletError {
|
63
|
+
code = "ERR_INVALID_QR_CODE";
|
64
|
+
|
65
|
+
/** Detailed reason for the QR code validation failure. */
|
56
66
|
|
57
|
-
/**
|
58
|
-
* @param reason A description of why the entity cannot be verified.
|
59
|
-
*/
|
60
67
|
constructor(reason) {
|
61
|
-
|
68
|
+
super("Invalid QR code");
|
69
|
+
this.reason = reason;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* When the Request Object sent by the Relying Party is not valid
|
75
|
+
*/
|
76
|
+
exports.InvalidQRCodeError = InvalidQRCodeError;
|
77
|
+
class InvalidRequestObjectError extends _errors.IoWalletError {
|
78
|
+
code = "ERR_INVALID_REQUEST_OBJECT";
|
79
|
+
|
80
|
+
/** Detailed reason for the Request Object validation failure. */
|
81
|
+
|
82
|
+
constructor(message) {
|
83
|
+
let reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
62
84
|
super(message);
|
85
|
+
this.reason = reason;
|
63
86
|
}
|
64
87
|
}
|
65
88
|
|
@@ -67,7 +90,7 @@ class UnverifiedEntityError extends _errors.IoWalletError {
|
|
67
90
|
* When some required data is missing to continue because certain attributes are not contained inside the wallet.
|
68
91
|
*
|
69
92
|
*/
|
70
|
-
exports.
|
93
|
+
exports.InvalidRequestObjectError = InvalidRequestObjectError;
|
71
94
|
class MissingDataError extends _errors.IoWalletError {
|
72
95
|
code = "ERR_MISSING_DATA";
|
73
96
|
|
@@ -79,22 +102,20 @@ class MissingDataError extends _errors.IoWalletError {
|
|
79
102
|
super(message);
|
80
103
|
}
|
81
104
|
}
|
82
|
-
|
105
|
+
exports.MissingDataError = MissingDataError;
|
83
106
|
/**
|
84
|
-
*
|
85
|
-
*
|
107
|
+
* Error thrown when one or more credentials cannot be found in the wallet
|
108
|
+
* and the presentation request cannot be satisfied.
|
86
109
|
*/
|
87
|
-
|
88
|
-
|
89
|
-
code = "ERR_CREDENTIAL_NOT_FOUND";
|
90
|
-
|
110
|
+
class CredentialsNotFoundError extends _errors.IoWalletError {
|
111
|
+
code = "ERR_CREDENTIALS_NOT_FOUND";
|
91
112
|
/**
|
92
|
-
* @param
|
113
|
+
* @param details The details of the credentials that could not be found.
|
93
114
|
*/
|
94
|
-
constructor(
|
95
|
-
|
96
|
-
|
115
|
+
constructor(details) {
|
116
|
+
super("One or more credentials cannot be found in the wallet");
|
117
|
+
this.details = details;
|
97
118
|
}
|
98
119
|
}
|
99
|
-
exports.
|
120
|
+
exports.CredentialsNotFoundError = CredentialsNotFoundError;
|
100
121
|
//# sourceMappingURL=errors.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_errors","require","AuthRequestDecodeError","IoWalletError","code","constructor","message","claim","arguments","length","undefined","reason","serializeAttrs","exports","NoSuitableKeysFoundInEntityConfiguration","scenario","
|
1
|
+
{"version":3,"names":["_errors","require","_dcql","AuthRequestDecodeError","IoWalletError","code","constructor","message","claim","arguments","length","undefined","reason","serializeAttrs","exports","NoSuitableKeysFoundInEntityConfiguration","scenario","InvalidQRCodeError","InvalidRequestObjectError","MissingDataError","missingAttributes","CredentialsNotFoundError","details"],"sourceRoot":"../../../../src","sources":["credential/presentation/errors.ts"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAME,sBAAsB,SAASC,qBAAa,CAAC;EACxDC,IAAI,GAAG,oDAAoD;;EAE3D;;EAGA;;EAGAC,WAAWA,CACTC,OAAe,EAGf;IAAA,IAFAC,KAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAAA,IAC7BG,MAAc,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAE9B,KAAK,CAAC,IAAAI,sBAAc,EAAC;MAAEN,OAAO;MAAEC,KAAK;MAAEI;IAAO,CAAC,CAAC,CAAC;IACjD,IAAI,CAACJ,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACI,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AACA;AAHAE,OAAA,CAAAX,sBAAA,GAAAA,sBAAA;AAIO,MAAMY,wCAAwC,SAASX,qBAAa,CAAC;EAC1EC,IAAI,GAAG,gCAAgC;;EAEvC;AACF;AACA;EACEC,WAAWA,CAACU,QAAgB,EAAE;IAC5B,MAAMT,OAAO,GAAI,0DAAyDS,QAAS,IAAG;IACtF,KAAK,CAACT,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AAHAO,OAAA,CAAAC,wCAAA,GAAAA,wCAAA;AAIO,MAAME,kBAAkB,SAASb,qBAAa,CAAC;EACpDC,IAAI,GAAG,qBAAqB;;EAE5B;;EAGAC,WAAWA,CAACM,MAAc,EAAE;IAC1B,KAAK,CAAC,iBAAiB,CAAC;IACxB,IAAI,CAACA,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AAFAE,OAAA,CAAAG,kBAAA,GAAAA,kBAAA;AAGO,MAAMC,yBAAyB,SAASd,qBAAa,CAAC;EAC3DC,IAAI,GAAG,4BAA4B;;EAEnC;;EAGAC,WAAWA,CAACC,OAAe,EAA0B;IAAA,IAAxBK,MAAM,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IACjD,KAAK,CAACF,OAAO,CAAC;IACd,IAAI,CAACK,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AACA;AAHAE,OAAA,CAAAI,yBAAA,GAAAA,yBAAA;AAIO,MAAMC,gBAAgB,SAASf,qBAAa,CAAC;EAClDC,IAAI,GAAG,kBAAkB;;EAEzB;AACF;AACA;EACEC,WAAWA,CAACc,iBAAyB,EAAE;IACrC,MAAMb,OAAO,GAAI,kCAAiCa,iBAAkB,GAAE;IACtE,KAAK,CAACb,OAAO,CAAC;EAChB;AACF;AAACO,OAAA,CAAAK,gBAAA,GAAAA,gBAAA;AAQD;AACA;AACA;AACA;AACO,MAAME,wBAAwB,SAASjB,qBAAa,CAAC;EAC1DC,IAAI,GAAG,2BAA2B;EAGlC;AACF;AACA;EACEC,WAAWA,CAACgB,OAAyB,EAAE;IACrC,KAAK,CAAC,uDAAuD,CAAC;IAC9D,IAAI,CAACA,OAAO,GAAGA,OAAO;EACxB;AACF;AAACR,OAAA,CAAAO,wBAAA,GAAAA,wBAAA"}
|
@@ -22,34 +22,34 @@ Object.defineProperty(exports, "evaluateRelyingPartyTrust", {
|
|
22
22
|
return _evaluateRpTrust.evaluateRelyingPartyTrust;
|
23
23
|
}
|
24
24
|
});
|
25
|
-
Object.defineProperty(exports, "
|
25
|
+
Object.defineProperty(exports, "fetchPresentDefinition", {
|
26
26
|
enumerable: true,
|
27
27
|
get: function () {
|
28
|
-
return
|
28
|
+
return _fetchPresentationDefinition.fetchPresentDefinition;
|
29
29
|
}
|
30
30
|
});
|
31
|
-
Object.defineProperty(exports, "
|
31
|
+
Object.defineProperty(exports, "getJwksFromConfig", {
|
32
32
|
enumerable: true,
|
33
33
|
get: function () {
|
34
|
-
return _retrieveRpJwks.
|
34
|
+
return _retrieveRpJwks.getJwksFromConfig;
|
35
35
|
}
|
36
36
|
});
|
37
|
-
Object.defineProperty(exports, "
|
37
|
+
Object.defineProperty(exports, "getRequestObject", {
|
38
38
|
enumerable: true,
|
39
39
|
get: function () {
|
40
|
-
return
|
40
|
+
return _getRequestObject.getRequestObject;
|
41
41
|
}
|
42
42
|
});
|
43
|
-
Object.defineProperty(exports, "
|
43
|
+
Object.defineProperty(exports, "prepareLegacyRemotePresentations", {
|
44
44
|
enumerable: true,
|
45
45
|
get: function () {
|
46
|
-
return
|
46
|
+
return _evaluateInputDescriptor.prepareLegacyRemotePresentations;
|
47
47
|
}
|
48
48
|
});
|
49
49
|
Object.defineProperty(exports, "prepareRemotePresentations", {
|
50
50
|
enumerable: true,
|
51
51
|
get: function () {
|
52
|
-
return
|
52
|
+
return _evaluateDcqlQuery.prepareRemotePresentations;
|
53
53
|
}
|
54
54
|
});
|
55
55
|
Object.defineProperty(exports, "sendAuthorizationErrorResponse", {
|
@@ -64,10 +64,10 @@ Object.defineProperty(exports, "sendAuthorizationResponse", {
|
|
64
64
|
return _sendAuthorizationResponse.sendAuthorizationResponse;
|
65
65
|
}
|
66
66
|
});
|
67
|
-
Object.defineProperty(exports, "
|
67
|
+
Object.defineProperty(exports, "sendLegacyAuthorizationResponse", {
|
68
68
|
enumerable: true,
|
69
69
|
get: function () {
|
70
|
-
return _sendAuthorizationResponse.
|
70
|
+
return _sendAuthorizationResponse.sendLegacyAuthorizationResponse;
|
71
71
|
}
|
72
72
|
});
|
73
73
|
Object.defineProperty(exports, "startFlowFromQR", {
|
@@ -76,10 +76,10 @@ Object.defineProperty(exports, "startFlowFromQR", {
|
|
76
76
|
return _startFlow.startFlowFromQR;
|
77
77
|
}
|
78
78
|
});
|
79
|
-
Object.defineProperty(exports, "
|
79
|
+
Object.defineProperty(exports, "verifyRequestObject", {
|
80
80
|
enumerable: true,
|
81
81
|
get: function () {
|
82
|
-
return _verifyRequestObject.
|
82
|
+
return _verifyRequestObject.verifyRequestObject;
|
83
83
|
}
|
84
84
|
});
|
85
85
|
var _startFlow = require("./01-start-flow");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_startFlow","require","_evaluateRpTrust","_getRequestObject","_retrieveRpJwks","_verifyRequestObject","_fetchPresentationDefinition","_evaluateInputDescriptor","_evaluateDcqlQuery","_sendAuthorizationResponse","Errors","_interopRequireWildcard","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAIA,IAAAE,iBAAA,GAAAF,OAAA;AAIA,IAAAG,eAAA,GAAAH,OAAA;
|
1
|
+
{"version":3,"names":["_startFlow","require","_evaluateRpTrust","_getRequestObject","_retrieveRpJwks","_verifyRequestObject","_fetchPresentationDefinition","_evaluateInputDescriptor","_evaluateDcqlQuery","_sendAuthorizationResponse","Errors","_interopRequireWildcard","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":";;;;;;;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wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
|
@@ -3,10 +3,9 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.RequestObject = exports.PresentationDefinition = exports.InputDescriptor = exports.ErrorResponse = exports.DirectAuthorizationBodyPayload = void 0;
|
6
|
+
exports.WalletMetadata = exports.RequestObjectWalletCapabilities = exports.RequestObject = exports.PresentationDefinition = exports.InputDescriptor = exports.ErrorResponse = exports.DirectAuthorizationBodyPayload = void 0;
|
7
7
|
var _types = require("../../sd-jwt/types");
|
8
8
|
var z = _interopRequireWildcard(require("zod"));
|
9
|
-
var _jwk = require("../../utils/jwk");
|
10
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
11
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
12
11
|
/**
|
@@ -15,6 +14,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
15
14
|
|
16
15
|
/**
|
17
16
|
* A object that associate the information needed to multiple remote presentation
|
17
|
+
* Used with `presentation_definition`
|
18
|
+
* @deprecated Use `RemotePresentation`
|
19
|
+
*/
|
20
|
+
|
21
|
+
/**
|
22
|
+
* A object that associate the information needed to multiple remote presentation
|
23
|
+
* Used with DCQL queries
|
18
24
|
*/
|
19
25
|
|
20
26
|
const Fields = z.object({
|
@@ -82,52 +88,70 @@ const PresentationDefinition = z.object({
|
|
82
88
|
});
|
83
89
|
exports.PresentationDefinition = PresentationDefinition;
|
84
90
|
const RequestObject = z.object({
|
85
|
-
iss: z.string()
|
86
|
-
|
87
|
-
|
88
|
-
exp: _types.UnixTime.optional(),
|
91
|
+
iss: z.string(),
|
92
|
+
iat: _types.UnixTime,
|
93
|
+
exp: _types.UnixTime,
|
89
94
|
state: z.string().optional(),
|
90
95
|
nonce: z.string(),
|
91
96
|
response_uri: z.string(),
|
97
|
+
response_uri_method: z.string().optional(),
|
92
98
|
response_type: z.literal("vp_token"),
|
93
|
-
response_mode: z.
|
99
|
+
response_mode: z.literal("direct_post.jwt"),
|
94
100
|
client_id: z.string(),
|
95
|
-
client_id_scheme: z.string().optional(),
|
96
|
-
// previous z.literal("entity_id"),
|
97
|
-
client_metadata: z.object({
|
98
|
-
authorization_encrypted_response_alg: z.string().optional(),
|
99
|
-
authorization_encrypted_response_enc: z.string().optional(),
|
100
|
-
jwks_uri: z.string().optional(),
|
101
|
-
jwks: _jwk.JWKS.optional()
|
102
|
-
}).optional(),
|
103
|
-
// previous z.literal("entity_id"),
|
104
101
|
dcql_query: z.record(z.string(), z.any()).optional(),
|
105
102
|
// Validation happens within the `dcql` library, no need to duplicate it here
|
106
103
|
scope: z.string().optional(),
|
107
104
|
presentation_definition: PresentationDefinition.optional()
|
108
105
|
});
|
106
|
+
exports.RequestObject = RequestObject;
|
107
|
+
const WalletMetadata = z.object({
|
108
|
+
presentation_definition_uri_supported: z.boolean().optional(),
|
109
|
+
client_id_schemes_supported: z.array(z.string()).optional(),
|
110
|
+
request_object_signing_alg_values_supported: z.array(z.string()).optional(),
|
111
|
+
vp_formats_supported: z.record(z.string(),
|
112
|
+
// TODO [SIW-2110]: use explicit credential format?
|
113
|
+
z.object({
|
114
|
+
"sd-jwt_alg_values": z.array(z.string()).optional() // alg_values_supported?
|
115
|
+
}))
|
116
|
+
// TODO [SIW-2110]: include other metadata?
|
117
|
+
});
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Wallet capabilities that must be submitted to get the Request Object
|
121
|
+
* via POST request when the `request_uri_method` is `post`.
|
122
|
+
*/
|
123
|
+
exports.WalletMetadata = WalletMetadata;
|
124
|
+
const RequestObjectWalletCapabilities = z.object({
|
125
|
+
wallet_metadata: WalletMetadata,
|
126
|
+
wallet_nonce: z.string().optional()
|
127
|
+
});
|
109
128
|
|
110
129
|
/**
|
111
130
|
* This type models the possible error responses the OpenID4VP protocol allows for a presentation of a credential.
|
112
|
-
*
|
131
|
+
* When the Wallet encounters one of these errors, it will notify the Relying Party through the `response_uri` endpoint.
|
132
|
+
* See https://italia.github.io/eid-wallet-it-docs/versione-corrente/en/pid-eaa-presentation.html#authorization-response-errors for more information.
|
113
133
|
*/
|
114
|
-
exports.
|
115
|
-
const ErrorResponse = z.enum(["
|
134
|
+
exports.RequestObjectWalletCapabilities = RequestObjectWalletCapabilities;
|
135
|
+
const ErrorResponse = z.enum(["invalid_request_object", "invalid_request_uri", "vp_formats_not_supported", "invalid_request", "access_denied", "invalid_client"]);
|
116
136
|
|
117
137
|
/**
|
118
|
-
*
|
138
|
+
* @deprecated Use `DirectAuthorizationBodyPayload`
|
119
139
|
*/
|
120
140
|
exports.ErrorResponse = ErrorResponse;
|
141
|
+
const LegacyDirectAuthorizationBodyPayload = z.object({
|
142
|
+
vp_token: z.union([z.string(), z.array(z.string())]).optional(),
|
143
|
+
presentation_submission: z.record(z.string(), z.unknown())
|
144
|
+
});
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Authorization Response payload sent to the Relying Party.
|
148
|
+
*/
|
149
|
+
|
121
150
|
const DirectAuthorizationBodyPayload = z.union([z.object({
|
122
|
-
vp_token: z.
|
123
|
-
// Presentation Definition with one credential
|
124
|
-
z.array(z.string()),
|
125
|
-
// Presentation Definition with more credential
|
126
|
-
z.record(z.string(), z.string()) // DCQL query
|
127
|
-
]).optional(),
|
128
|
-
presentation_submission: z.record(z.string(), z.unknown()).optional()
|
151
|
+
vp_token: z.record(z.string(), z.string())
|
129
152
|
}), z.object({
|
130
|
-
error: ErrorResponse
|
131
|
-
|
153
|
+
error: ErrorResponse,
|
154
|
+
error_description: z.string()
|
155
|
+
}), LegacyDirectAuthorizationBodyPayload]);
|
132
156
|
exports.DirectAuthorizationBodyPayload = DirectAuthorizationBodyPayload;
|
133
157
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","z","_interopRequireWildcard","
|
1
|
+
{"version":3,"names":["_types","require","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Fields","object","path","array","string","min","id","optional","purpose","name","filter","any","boolean","intent_to_retain","Constraints","fields","limit_disclosure","enum","InputDescriptor","format","record","constraints","group","exports","SubmissionRequirement","rule","from","from_nested","count","number","PresentationDefinition","input_descriptors","submission_requirements","RequestObject","iss","iat","UnixTime","exp","state","nonce","response_uri","response_uri_method","response_type","literal","response_mode","client_id","dcql_query","scope","presentation_definition","WalletMetadata","presentation_definition_uri_supported","client_id_schemes_supported","request_object_signing_alg_values_supported","vp_formats_supported","RequestObjectWalletCapabilities","wallet_metadata","wallet_nonce","ErrorResponse","LegacyDirectAuthorizationBodyPayload","vp_token","union","presentation_submission","unknown","DirectAuthorizationBodyPayload","error","error_description"],"sourceRoot":"../../../../src","sources":["credential/presentation/types.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAyB,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK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AAoC,CACrC,CAAC;AAACnC,OAAA,CAAAwC,8BAAA,GAAAA,8BAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["credential/status/01-start-flow.ts"],"mappings":""}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.statusAttestation = void 0;
|
7
|
+
var _misc = require("../../utils/misc");
|
8
|
+
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
9
|
+
var _uuid = require("uuid");
|
10
|
+
var _types = require("./types");
|
11
|
+
var _errors = require("../../utils/errors");
|
12
|
+
var _logging = require("../../utils/logging");
|
13
|
+
/**
|
14
|
+
* WARNING: This function must be called after {@link startFlow}.
|
15
|
+
* Verify the status of the credential attestation.
|
16
|
+
* @param issuerConf - The issuer's configuration
|
17
|
+
* @param credential - The credential to be verified
|
18
|
+
* @param credentialCryptoContext - The credential's crypto context
|
19
|
+
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
20
|
+
* @throws {IssuerResponseError} with a specific code for more context
|
21
|
+
* @returns The credential status attestation
|
22
|
+
*/
|
23
|
+
const statusAttestation = async function (issuerConf, credential, credentialCryptoContext) {
|
24
|
+
let appFetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : fetch;
|
25
|
+
const jwk = await credentialCryptoContext.getPublicKey();
|
26
|
+
const credentialHash = await (0, _misc.getCredentialHashWithouDiscloures)(credential);
|
27
|
+
const statusAttUrl = issuerConf.openid_credential_issuer.status_attestation_endpoint;
|
28
|
+
const credentialPop = await new _ioReactNativeJwt.SignJWT(credentialCryptoContext).setPayload({
|
29
|
+
aud: statusAttUrl,
|
30
|
+
jti: (0, _uuid.v4)().toString(),
|
31
|
+
credential_hash: credentialHash,
|
32
|
+
credential_hash_alg: "S256"
|
33
|
+
}).setProtectedHeader({
|
34
|
+
alg: "ES256",
|
35
|
+
typ: "status-attestation-request+jwt",
|
36
|
+
kid: jwk.kid
|
37
|
+
}).setIssuedAt().setExpirationTime("5m").sign();
|
38
|
+
const body = {
|
39
|
+
credential_pop: credentialPop
|
40
|
+
};
|
41
|
+
_logging.Logger.log(_logging.LogLevel.DEBUG, `Credential pop: ${credentialPop}`);
|
42
|
+
const result = await appFetch(statusAttUrl, {
|
43
|
+
method: "POST",
|
44
|
+
headers: {
|
45
|
+
"Content-Type": "application/json"
|
46
|
+
},
|
47
|
+
body: JSON.stringify(body)
|
48
|
+
}).then((0, _misc.hasStatusOrThrow)(201)).then(raw => raw.json()).then(json => _types.StatusAttestationResponse.parse(json)).catch(handleStatusAttestationError);
|
49
|
+
return {
|
50
|
+
statusAttestation: result.status_attestation
|
51
|
+
};
|
52
|
+
};
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Handle the status attestation error by mapping it to a custom exception.
|
56
|
+
* If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
|
57
|
+
* @param e - The error to be handled
|
58
|
+
* @throws {IssuerResponseError} with a specific code for more context
|
59
|
+
*/
|
60
|
+
exports.statusAttestation = statusAttestation;
|
61
|
+
const handleStatusAttestationError = e => {
|
62
|
+
if (!(e instanceof _errors.UnexpectedStatusCodeError)) {
|
63
|
+
throw e;
|
64
|
+
}
|
65
|
+
throw new _errors.ResponseErrorBuilder(_errors.IssuerResponseError).handle(404, {
|
66
|
+
code: _errors.IssuerResponseErrorCodes.CredentialInvalidStatus,
|
67
|
+
message: "Invalid status found for the given credential"
|
68
|
+
}).handle("*", {
|
69
|
+
code: _errors.IssuerResponseErrorCodes.StatusAttestationRequestFailed,
|
70
|
+
message: `Unable to obtain the status attestation for the given credential`
|
71
|
+
}).buildFrom(e);
|
72
|
+
};
|
73
|
+
//# sourceMappingURL=02-status-attestation.js.map
|