@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,4 +1,5 @@
|
|
1
1
|
import { IoWalletError, serializeAttrs } from "../../utils/errors";
|
2
|
+
export { DcqlError } from "dcql";
|
2
3
|
|
3
4
|
/**
|
4
5
|
* An error subclass thrown when auth request decode fail
|
@@ -41,18 +42,32 @@ export class NoSuitableKeysFoundInEntityConfiguration extends IoWalletError {
|
|
41
42
|
}
|
42
43
|
|
43
44
|
/**
|
44
|
-
* When
|
45
|
+
* When a QR code is not valid.
|
45
46
|
*
|
46
47
|
*/
|
47
|
-
export class
|
48
|
-
code = "
|
48
|
+
export class InvalidQRCodeError extends IoWalletError {
|
49
|
+
code = "ERR_INVALID_QR_CODE";
|
50
|
+
|
51
|
+
/** Detailed reason for the QR code validation failure. */
|
49
52
|
|
50
|
-
/**
|
51
|
-
* @param reason A description of why the entity cannot be verified.
|
52
|
-
*/
|
53
53
|
constructor(reason) {
|
54
|
-
|
54
|
+
super("Invalid QR code");
|
55
|
+
this.reason = reason;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
/**
|
60
|
+
* When the Request Object sent by the Relying Party is not valid
|
61
|
+
*/
|
62
|
+
export class InvalidRequestObjectError extends IoWalletError {
|
63
|
+
code = "ERR_INVALID_REQUEST_OBJECT";
|
64
|
+
|
65
|
+
/** Detailed reason for the Request Object validation failure. */
|
66
|
+
|
67
|
+
constructor(message) {
|
68
|
+
let reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
55
69
|
super(message);
|
70
|
+
this.reason = reason;
|
56
71
|
}
|
57
72
|
}
|
58
73
|
|
@@ -71,20 +86,18 @@ export class MissingDataError extends IoWalletError {
|
|
71
86
|
super(message);
|
72
87
|
}
|
73
88
|
}
|
74
|
-
|
75
89
|
/**
|
76
|
-
*
|
77
|
-
*
|
90
|
+
* Error thrown when one or more credentials cannot be found in the wallet
|
91
|
+
* and the presentation request cannot be satisfied.
|
78
92
|
*/
|
79
|
-
export class
|
80
|
-
code = "
|
81
|
-
|
93
|
+
export class CredentialsNotFoundError extends IoWalletError {
|
94
|
+
code = "ERR_CREDENTIALS_NOT_FOUND";
|
82
95
|
/**
|
83
|
-
* @param
|
96
|
+
* @param details The details of the credentials that could not be found.
|
84
97
|
*/
|
85
|
-
constructor(
|
86
|
-
|
87
|
-
|
98
|
+
constructor(details) {
|
99
|
+
super("One or more credentials cannot be found in the wallet");
|
100
|
+
this.details = details;
|
88
101
|
}
|
89
102
|
}
|
90
103
|
//# sourceMappingURL=errors.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["IoWalletError","serializeAttrs","AuthRequestDecodeError","code","constructor","message","claim","arguments","length","undefined","reason","NoSuitableKeysFoundInEntityConfiguration","scenario","
|
1
|
+
{"version":3,"names":["IoWalletError","serializeAttrs","DcqlError","AuthRequestDecodeError","code","constructor","message","claim","arguments","length","undefined","reason","NoSuitableKeysFoundInEntityConfiguration","scenario","InvalidQRCodeError","InvalidRequestObjectError","MissingDataError","missingAttributes","CredentialsNotFoundError","details"],"sourceRoot":"../../../../src","sources":["credential/presentation/errors.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,cAAc,QAAQ,oBAAoB;AAClE,SAASC,SAAS,QAAQ,MAAM;;AAEhC;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASH,aAAa,CAAC;EACxDI,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,CAACP,cAAc,CAAC;MAAEK,OAAO;MAAEC,KAAK;MAAEI;IAAO,CAAC,CAAC,CAAC;IACjD,IAAI,CAACJ,KAAK,GAAGA,KAAK;IAClB,I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,CAACA,OAAO,GAAGA,OAAO;EACxB;AACF"}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { startFlowFromQR } from "./01-start-flow";
|
2
2
|
import { evaluateRelyingPartyTrust } from "./02-evaluate-rp-trust";
|
3
3
|
import { getRequestObject } from "./03-get-request-object";
|
4
|
-
import {
|
5
|
-
import {
|
4
|
+
import { getJwksFromConfig } from "./04-retrieve-rp-jwks";
|
5
|
+
import { verifyRequestObject } from "./05-verify-request-object";
|
6
6
|
import { fetchPresentDefinition } from "./06-fetch-presentation-definition";
|
7
|
-
import { evaluateInputDescriptors } from "./07-evaluate-input-descriptor";
|
8
|
-
import { evaluateDcqlQuery } from "./07-evaluate-dcql-query";
|
9
|
-
import {
|
7
|
+
import { evaluateInputDescriptors, prepareLegacyRemotePresentations } from "./07-evaluate-input-descriptor";
|
8
|
+
import { evaluateDcqlQuery, prepareRemotePresentations } from "./07-evaluate-dcql-query";
|
9
|
+
import { sendAuthorizationResponse, sendLegacyAuthorizationResponse, sendAuthorizationErrorResponse } from "./08-send-authorization-response";
|
10
10
|
import * as Errors from "./errors";
|
11
|
-
export { startFlowFromQR, evaluateRelyingPartyTrust, getRequestObject,
|
11
|
+
export { startFlowFromQR, evaluateRelyingPartyTrust, getRequestObject, getJwksFromConfig, verifyRequestObject, fetchPresentDefinition, evaluateInputDescriptors, evaluateDcqlQuery, prepareLegacyRemotePresentations, prepareRemotePresentations, sendAuthorizationResponse, sendLegacyAuthorizationResponse, sendAuthorizationErrorResponse, Errors };
|
12
12
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["startFlowFromQR","evaluateRelyingPartyTrust","getRequestObject","
|
1
|
+
{"version":3,"names":["startFlowFromQR","evaluateRelyingPartyTrust","getRequestObject","getJwksFromConfig","verifyRequestObject","fetchPresentDefinition","evaluateInputDescriptors","prepareLegacyRemotePresentations","evaluateDcqlQuery","prepareRemotePresentations","sendAuthorizationResponse","sendLegacyAuthorizationResponse","sendAuthorizationErrorResponse","Errors"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAwB,iBAAiB;AACjE,SACEC,yBAAyB,QAEpB,wBAAwB;AAC/B,SACEC,gBAAgB,QAEX,yBAAyB;AAChC,SAASC,iBAAiB,QAAwB,uBAAuB;AACzE,SACEC,mBAAmB,QAEd,4BAA4B;AACnC,SACEC,sBAAsB,QAEjB,oCAAoC;AAC3C,SACEC,wBAAwB,EACxBC,gCAAgC,QAG3B,gCAAgC;AACvC,SACEC,iBAAiB,EACjBC,0BAA0B,QAGrB,0BAA0B;AACjC,SACEC,yBAAyB,EAEzBC,+BAA+B,EAE/BC,8BAA8B,QAEzB,kCAAkC;AACzC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAElC,SACEb,eAAe,EACfC,yBAAyB,EACzBC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,sBAAsB,EACtBC,wBAAwB,EACxBE,iBAAiB,EACjBD,gCAAgC,EAChCE,0BAA0B,EAC1BC,yBAAyB,EACzBC,+BAA+B,EAC/BC,8BAA8B,EAC9BC,MAAM"}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { UnixTime } from "../../sd-jwt/types";
|
2
2
|
import * as z from "zod";
|
3
|
-
import { JWKS } from "../../utils/jwk";
|
4
3
|
|
5
4
|
/**
|
6
5
|
* A pair that associate a tokenized Verified Credential with the claims presented or requested to present.
|
@@ -8,6 +7,13 @@ import { JWKS } from "../../utils/jwk";
|
|
8
7
|
|
9
8
|
/**
|
10
9
|
* A object that associate the information needed to multiple remote presentation
|
10
|
+
* Used with `presentation_definition`
|
11
|
+
* @deprecated Use `RemotePresentation`
|
12
|
+
*/
|
13
|
+
|
14
|
+
/**
|
15
|
+
* A object that associate the information needed to multiple remote presentation
|
16
|
+
* Used with DCQL queries
|
11
17
|
*/
|
12
18
|
|
13
19
|
const Fields = z.object({
|
@@ -74,51 +80,67 @@ export const PresentationDefinition = z.object({
|
|
74
80
|
submission_requirements: z.array(SubmissionRequirement).optional()
|
75
81
|
});
|
76
82
|
export const RequestObject = z.object({
|
77
|
-
iss: z.string()
|
78
|
-
|
79
|
-
|
80
|
-
exp: UnixTime.optional(),
|
83
|
+
iss: z.string(),
|
84
|
+
iat: UnixTime,
|
85
|
+
exp: UnixTime,
|
81
86
|
state: z.string().optional(),
|
82
87
|
nonce: z.string(),
|
83
88
|
response_uri: z.string(),
|
89
|
+
response_uri_method: z.string().optional(),
|
84
90
|
response_type: z.literal("vp_token"),
|
85
|
-
response_mode: z.
|
91
|
+
response_mode: z.literal("direct_post.jwt"),
|
86
92
|
client_id: z.string(),
|
87
|
-
client_id_scheme: z.string().optional(),
|
88
|
-
// previous z.literal("entity_id"),
|
89
|
-
client_metadata: z.object({
|
90
|
-
authorization_encrypted_response_alg: z.string().optional(),
|
91
|
-
authorization_encrypted_response_enc: z.string().optional(),
|
92
|
-
jwks_uri: z.string().optional(),
|
93
|
-
jwks: JWKS.optional()
|
94
|
-
}).optional(),
|
95
|
-
// previous z.literal("entity_id"),
|
96
93
|
dcql_query: z.record(z.string(), z.any()).optional(),
|
97
94
|
// Validation happens within the `dcql` library, no need to duplicate it here
|
98
95
|
scope: z.string().optional(),
|
99
96
|
presentation_definition: PresentationDefinition.optional()
|
100
97
|
});
|
98
|
+
export const WalletMetadata = z.object({
|
99
|
+
presentation_definition_uri_supported: z.boolean().optional(),
|
100
|
+
client_id_schemes_supported: z.array(z.string()).optional(),
|
101
|
+
request_object_signing_alg_values_supported: z.array(z.string()).optional(),
|
102
|
+
vp_formats_supported: z.record(z.string(),
|
103
|
+
// TODO [SIW-2110]: use explicit credential format?
|
104
|
+
z.object({
|
105
|
+
"sd-jwt_alg_values": z.array(z.string()).optional() // alg_values_supported?
|
106
|
+
}))
|
107
|
+
// TODO [SIW-2110]: include other metadata?
|
108
|
+
});
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Wallet capabilities that must be submitted to get the Request Object
|
112
|
+
* via POST request when the `request_uri_method` is `post`.
|
113
|
+
*/
|
114
|
+
|
115
|
+
export const RequestObjectWalletCapabilities = z.object({
|
116
|
+
wallet_metadata: WalletMetadata,
|
117
|
+
wallet_nonce: z.string().optional()
|
118
|
+
});
|
101
119
|
|
102
120
|
/**
|
103
121
|
* This type models the possible error responses the OpenID4VP protocol allows for a presentation of a credential.
|
104
|
-
*
|
122
|
+
* When the Wallet encounters one of these errors, it will notify the Relying Party through the `response_uri` endpoint.
|
123
|
+
* See https://italia.github.io/eid-wallet-it-docs/versione-corrente/en/pid-eaa-presentation.html#authorization-response-errors for more information.
|
105
124
|
*/
|
106
125
|
|
107
|
-
export const ErrorResponse = z.enum(["
|
126
|
+
export const ErrorResponse = z.enum(["invalid_request_object", "invalid_request_uri", "vp_formats_not_supported", "invalid_request", "access_denied", "invalid_client"]);
|
127
|
+
|
128
|
+
/**
|
129
|
+
* @deprecated Use `DirectAuthorizationBodyPayload`
|
130
|
+
*/
|
131
|
+
const LegacyDirectAuthorizationBodyPayload = z.object({
|
132
|
+
vp_token: z.union([z.string(), z.array(z.string())]).optional(),
|
133
|
+
presentation_submission: z.record(z.string(), z.unknown())
|
134
|
+
});
|
108
135
|
|
109
136
|
/**
|
110
|
-
*
|
137
|
+
* Authorization Response payload sent to the Relying Party.
|
111
138
|
*/
|
112
139
|
|
113
140
|
export const DirectAuthorizationBodyPayload = z.union([z.object({
|
114
|
-
vp_token: z.
|
115
|
-
// Presentation Definition with one credential
|
116
|
-
z.array(z.string()),
|
117
|
-
// Presentation Definition with more credential
|
118
|
-
z.record(z.string(), z.string()) // DCQL query
|
119
|
-
]).optional(),
|
120
|
-
presentation_submission: z.record(z.string(), z.unknown()).optional()
|
141
|
+
vp_token: z.record(z.string(), z.string())
|
121
142
|
}), z.object({
|
122
|
-
error: ErrorResponse
|
123
|
-
|
143
|
+
error: ErrorResponse,
|
144
|
+
error_description: z.string()
|
145
|
+
}), LegacyDirectAuthorizationBodyPayload]);
|
124
146
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnixTime","z","
|
1
|
+
{"version":3,"names":["UnixTime","z","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","SubmissionRequirement","rule","from","from_nested","count","number","PresentationDefinition","input_descriptors","submission_requirements","RequestObject","iss","iat","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,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAO,KAAKC,CAAC,MAAM,KAAK;;AAExB;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;;AAQA,MAAMC,MAAM,GAAGD,CAAC,CAACE,MAAM,CAAC;EACtBC,IAAI,EAAEH,CAAC,CAACI,KAAK,CAACJ,CAAC,CAACK,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAAC;EAAE;EAClCC,EAAE,EAAEP,CAAC,CAACK,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAAE;EAC3BC,OAAO,EAAET,CAAC,CAACK,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAAE;EAChCE,IAAI,EAAEV,CAAC,CAACK,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAAE;EAC7BG,MAAM,EAAEX,CAAC,CAACY,GAAG,CAAC,CAAC,CAACJ,QAAQ,CAAC,CAAC;EAAE;EAC5BA,QAAQ,EAAER,CAA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CAAC;EAAE6D,KAAK,EAAEP,aAAa;EAAEQ,iBAAiB,EAAEhE,CAAC,CAACK,MAAM,CAAC;AAAE,CAAC,CAAC,EACjEoD,oCAAoC,CACrC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["credential/status/01-start-flow.ts"],"mappings":""}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { getCredentialHashWithouDiscloures, hasStatusOrThrow } from "../../utils/misc";
|
2
|
+
import { SignJWT } from "@pagopa/io-react-native-jwt";
|
3
|
+
import { v4 as uuidv4 } from "uuid";
|
4
|
+
import { StatusAttestationResponse } from "./types";
|
5
|
+
import { IssuerResponseError, IssuerResponseErrorCodes, ResponseErrorBuilder, UnexpectedStatusCodeError } from "../../utils/errors";
|
6
|
+
import { LogLevel, Logger } from "../../utils/logging";
|
7
|
+
/**
|
8
|
+
* WARNING: This function must be called after {@link startFlow}.
|
9
|
+
* Verify the status of the credential attestation.
|
10
|
+
* @param issuerConf - The issuer's configuration
|
11
|
+
* @param credential - The credential to be verified
|
12
|
+
* @param credentialCryptoContext - The credential's crypto context
|
13
|
+
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
14
|
+
* @throws {IssuerResponseError} with a specific code for more context
|
15
|
+
* @returns The credential status attestation
|
16
|
+
*/
|
17
|
+
export const statusAttestation = async function (issuerConf, credential, credentialCryptoContext) {
|
18
|
+
let appFetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : fetch;
|
19
|
+
const jwk = await credentialCryptoContext.getPublicKey();
|
20
|
+
const credentialHash = await getCredentialHashWithouDiscloures(credential);
|
21
|
+
const statusAttUrl = issuerConf.openid_credential_issuer.status_attestation_endpoint;
|
22
|
+
const credentialPop = await new SignJWT(credentialCryptoContext).setPayload({
|
23
|
+
aud: statusAttUrl,
|
24
|
+
jti: uuidv4().toString(),
|
25
|
+
credential_hash: credentialHash,
|
26
|
+
credential_hash_alg: "S256"
|
27
|
+
}).setProtectedHeader({
|
28
|
+
alg: "ES256",
|
29
|
+
typ: "status-attestation-request+jwt",
|
30
|
+
kid: jwk.kid
|
31
|
+
}).setIssuedAt().setExpirationTime("5m").sign();
|
32
|
+
const body = {
|
33
|
+
credential_pop: credentialPop
|
34
|
+
};
|
35
|
+
Logger.log(LogLevel.DEBUG, `Credential pop: ${credentialPop}`);
|
36
|
+
const result = await appFetch(statusAttUrl, {
|
37
|
+
method: "POST",
|
38
|
+
headers: {
|
39
|
+
"Content-Type": "application/json"
|
40
|
+
},
|
41
|
+
body: JSON.stringify(body)
|
42
|
+
}).then(hasStatusOrThrow(201)).then(raw => raw.json()).then(json => StatusAttestationResponse.parse(json)).catch(handleStatusAttestationError);
|
43
|
+
return {
|
44
|
+
statusAttestation: result.status_attestation
|
45
|
+
};
|
46
|
+
};
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Handle the status attestation error by mapping it to a custom exception.
|
50
|
+
* If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
|
51
|
+
* @param e - The error to be handled
|
52
|
+
* @throws {IssuerResponseError} with a specific code for more context
|
53
|
+
*/
|
54
|
+
const handleStatusAttestationError = e => {
|
55
|
+
if (!(e instanceof UnexpectedStatusCodeError)) {
|
56
|
+
throw e;
|
57
|
+
}
|
58
|
+
throw new ResponseErrorBuilder(IssuerResponseError).handle(404, {
|
59
|
+
code: IssuerResponseErrorCodes.CredentialInvalidStatus,
|
60
|
+
message: "Invalid status found for the given credential"
|
61
|
+
}).handle("*", {
|
62
|
+
code: IssuerResponseErrorCodes.StatusAttestationRequestFailed,
|
63
|
+
message: `Unable to obtain the status attestation for the given credential`
|
64
|
+
}).buildFrom(e);
|
65
|
+
};
|
66
|
+
//# sourceMappingURL=02-status-attestation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["getCredentialHashWithouDiscloures","hasStatusOrThrow","SignJWT","v4","uuidv4","StatusAttestationResponse","IssuerResponseError","IssuerResponseErrorCodes","ResponseErrorBuilder","UnexpectedStatusCodeError","LogLevel","Logger","statusAttestation","issuerConf","credential","credentialCryptoContext","appFetch","arguments","length","undefined","fetch","jwk","getPublicKey","credentialHash","statusAttUrl","openid_credential_issuer","status_attestation_endpoint","credentialPop","setPayload","aud","jti","toString","credential_hash","credential_hash_alg","setProtectedHeader","alg","typ","kid","setIssuedAt","setExpirationTime","sign","body","credential_pop","log","DEBUG","result","method","headers","JSON","stringify","then","raw","json","parse","catch","handleStatusAttestationError","status_attestation","e","handle","code","CredentialInvalidStatus","message","StatusAttestationRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/status/02-status-attestation.ts"],"mappings":"AAAA,SACEA,iCAAiC,EACjCC,gBAAgB,QAEX,kBAAkB;AAEzB,SAA6BC,OAAO,QAAQ,6BAA6B;AACzE,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,SAASC,yBAAyB,QAAQ,SAAS;AACnD,SACEC,mBAAmB,EACnBC,wBAAwB,EACxBC,oBAAoB,EACpBC,yBAAyB,QACpB,oBAAoB;AAC3B,SAASC,QAAQ,EAAEC,MAAM,QAAQ,qBAAqB;AAWtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAoC,GAAG,eAAAA,CAClDC,UAAU,EACVC,UAAU,EACVC,uBAAuB,EAEpB;EAAA,IADHC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;EAEtC,MAAMC,GAAG,GAAG,MAAMN,uBAAuB,CAACO,YAAY,CAAC,CAAC;EACxD,MAAMC,cAAc,GAAG,MAAMvB,iCAAiC,CAACc,UAAU,CAAC;EAC1E,MAAMU,YAAY,GAChBX,UAAU,CAACY,wBAAwB,CAACC,2BAA2B;EACjE,MAAMC,aAAa,GAAG,MAAM,IAAIzB,OAAO,CAACa,uBAAuB,CAAC,CAC7Da,UAAU,CAAC;IACVC,GA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AM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEpD,wBAAwB,CAACqD,uBAAuB;IACtDC,OAAO,EAAE;EACX,CAAC,CAAC,CACDH,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEpD,wBAAwB,CAACuD,8BAA8B;IAC7DD,OAAO,EAAG;EACZ,CAAC,CAAC,CACDE,SAAS,CAACN,CAAC,CAAC;AACjB,CAAC"}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { IoWalletError } from "../../utils/errors";
|
2
|
+
import { verify } from "@pagopa/io-react-native-jwt";
|
3
|
+
import { ParsedStatusAttestation } from "./types";
|
4
|
+
import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
|
5
|
+
import { LogLevel, Logger } from "../../utils/logging";
|
6
|
+
/**
|
7
|
+
* Given a status attestation, verifies that:
|
8
|
+
* - It's in the supported format;
|
9
|
+
* - The attestation is correctly signed;
|
10
|
+
* - It's bound to the given key.
|
11
|
+
* @param issuerConf The Issuer configuration returned by {@link evaluateIssuerTrust}
|
12
|
+
* @param statusAttestation The encoded status attestation returned by {@link statusAttestation}
|
13
|
+
* @param context.credentialCryptoContext The crypto context used to obtain the credential in {@link obtainCredential}
|
14
|
+
* @returns A parsed status attestation
|
15
|
+
* @throws {IoWalletError} If the credential signature is not verified with the Issuer key set
|
16
|
+
* @throws {IoWalletError} If the credential is not bound to the provided user key
|
17
|
+
* @throws {IoWalletError} If the credential data fail to parse
|
18
|
+
*/
|
19
|
+
export const verifyAndParseStatusAttestation = async (issuerConf, rawStatusAttestation, context) => {
|
20
|
+
try {
|
21
|
+
const {
|
22
|
+
statusAttestation
|
23
|
+
} = rawStatusAttestation;
|
24
|
+
const {
|
25
|
+
credentialCryptoContext
|
26
|
+
} = context;
|
27
|
+
await verify(statusAttestation, issuerConf.openid_credential_issuer.jwks.keys);
|
28
|
+
const decodedJwt = decodeJwt(statusAttestation);
|
29
|
+
const parsedStatusAttestation = ParsedStatusAttestation.parse({
|
30
|
+
header: decodedJwt.protectedHeader,
|
31
|
+
payload: decodedJwt.payload
|
32
|
+
});
|
33
|
+
Logger.log(LogLevel.DEBUG, `Parsed status attestation: ${JSON.stringify(parsedStatusAttestation)}`);
|
34
|
+
const holderBindingKey = await credentialCryptoContext.getPublicKey();
|
35
|
+
const {
|
36
|
+
cnf
|
37
|
+
} = parsedStatusAttestation.payload;
|
38
|
+
if (!cnf.jwk.kid || cnf.jwk.kid !== holderBindingKey.kid) {
|
39
|
+
Logger.log(LogLevel.ERROR, `Failed to verify holder binding for status attestation, expected kid: ${holderBindingKey.kid}, got: ${parsedStatusAttestation.payload.cnf.jwk.kid}`);
|
40
|
+
throw new IoWalletError(`Failed to verify holder binding for status attestation, expected kid: ${holderBindingKey.kid}, got: ${parsedStatusAttestation.payload.cnf.jwk.kid}`);
|
41
|
+
}
|
42
|
+
return {
|
43
|
+
parsedStatusAttestation
|
44
|
+
};
|
45
|
+
} catch (e) {
|
46
|
+
throw new IoWalletError(`Failed to verify status attestation: ${JSON.stringify(e)}`);
|
47
|
+
}
|
48
|
+
};
|
49
|
+
//# sourceMappingURL=03-verify-and-parse-status-attestation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["IoWalletError","verify","ParsedStatusAttestation","decode","decodeJwt","LogLevel","Logger","verifyAndParseStatusAttestation","issuerConf","rawStatusAttestation","context","statusAttestation","credentialCryptoContext","openid_credential_issuer","jwks","keys","decodedJwt","parsedStatusAttestation","parse","header","protectedHeader","payload","log","DEBUG","JSON","stringify","holderBindingKey","getPublicKey","cnf","jwk","kid","ERROR","e"],"sourceRoot":"../../../../src","sources":["credential/status/03-verify-and-parse-status-attestation.ts"],"mappings":"AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,MAAM,QAA4B,6BAA6B;AAExE,SAASC,uBAAuB,QAAQ,SAAS;AACjD,SAASC,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,QAAQ,EAAEC,MAAM,QAAQ,qBAA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;IAEA,OAAO;MAAEb;IAAwB,CAAC;EACpC,CAAC,CAAC,OAAOe,CAAC,EAAE;IACV,MAAM,IAAIhC,aAAa,CACpB,wCAAuCwB,IAAI,CAACC,SAAS,CAACO,CAAC,CAAE,EAC5D,CAAC;EACH;AACF,CAAC"}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Credential Status Attestation
|
2
|
+
|
3
|
+
This flow is used to obtain a credential status attestation from its credential issuer. Each step in the flow is imported from the related file which is named with a sequential number.
|
4
|
+
The credential status attestation is a JWT which contains the credential status which indicates if the credential is valid or not.
|
5
|
+
The status attestation is supposed to be stored securely along with the credential. It has a limited lifetime and should be refreshed periodically according to the `exp` field in the JWT payload.
|
6
|
+
|
7
|
+
## Sequence Diagram
|
8
|
+
|
9
|
+
```mermaid
|
10
|
+
graph TD;
|
11
|
+
0[startFlow]
|
12
|
+
1[statusAttestation]
|
13
|
+
2[verifyAndParseStatusAttestation]
|
14
|
+
|
15
|
+
0 --> 1
|
16
|
+
1 --> 2
|
17
|
+
```
|
18
|
+
|
19
|
+
|
20
|
+
## Mapped results
|
21
|
+
|
22
|
+
The following errors are mapped to a `IssuerResponseError` with specific codes.
|
23
|
+
|
24
|
+
|HTTP Status|Error Code|Description|
|
25
|
+
|-----------|----------|-----------|
|
26
|
+
|`404 Not Found`|`ERR_CREDENTIAL_INVALID_STATUS`|This response is returned by the credential issuer when the status attestation is invalid. It might contain more details in the `reason` property.|
|
27
|
+
|
28
|
+
## Example
|
29
|
+
|
30
|
+
<details>
|
31
|
+
<summary>Credential status attestation flow</summary>
|
32
|
+
|
33
|
+
```ts
|
34
|
+
// Start the issuance flow
|
35
|
+
const credentialIssuerUrl = "https://issuer.example.com";
|
36
|
+
const startFlow: Credential.Status.StartFlow = () => ({
|
37
|
+
issuerUrl: credentialIssuerUrl, // Let's assum
|
38
|
+
});
|
39
|
+
|
40
|
+
const { issuerUrl } = startFlow();
|
41
|
+
|
42
|
+
// Evaluate issuer trust
|
43
|
+
const { issuerConf } = await Credential.Status.evaluateIssuerTrust(issuerUrl);
|
44
|
+
|
45
|
+
// Get the credential attestation
|
46
|
+
const res = await Credential.Status.statusAttestation(
|
47
|
+
issuerConf,
|
48
|
+
credential,
|
49
|
+
credentialCryptoContext
|
50
|
+
);
|
51
|
+
|
52
|
+
// Verify and parse the status attestation
|
53
|
+
const { parsedStatusAttestation } =
|
54
|
+
await Credential.Status.verifyAndParseStatusAttestation(
|
55
|
+
issuerConf,
|
56
|
+
res.statusAttestation,
|
57
|
+
{ credentialCryptoContext }
|
58
|
+
);
|
59
|
+
|
60
|
+
return {
|
61
|
+
statusAttestation: res.statusAttestation,
|
62
|
+
parsedStatusAttestation,
|
63
|
+
credentialType,
|
64
|
+
};
|
65
|
+
```
|
66
|
+
|
67
|
+
</details>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { statusAttestation } from "./02-status-attestation";
|
2
|
+
import { evaluateIssuerTrust } from "../issuance";
|
3
|
+
import { verifyAndParseStatusAttestation } from "./03-verify-and-parse-status-attestation";
|
4
|
+
export { evaluateIssuerTrust, statusAttestation, verifyAndParseStatusAttestation };
|
5
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["statusAttestation","evaluateIssuerTrust","verifyAndParseStatusAttestation"],"sourceRoot":"../../../../src","sources":["credential/status/index.ts"],"mappings":"AACA,SACEA,iBAAiB,QAEZ,yBAAyB;AAChC,SAASC,mBAAmB,QAAkC,aAAa;AAC3E,SACEC,+BAA+B,QAE1B,0CAA0C;AAEjD,SACED,mBAAmB,EACnBD,iBAAiB,EACjBE,+BAA+B"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { UnixTime } from "../../sd-jwt/types";
|
2
|
+
import { JWK } from "../../utils/jwk";
|
3
|
+
import * as z from "zod";
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Shape from parsing a status attestation response in case of 201.
|
7
|
+
*/
|
8
|
+
export const StatusAttestationResponse = z.object({
|
9
|
+
status_attestation: z.string()
|
10
|
+
});
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Type from parsing a status attestation response in case of 201.
|
14
|
+
* Inferred from {@link StatusAttestationResponse}.
|
15
|
+
*/
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Type for a parsed status attestation.
|
19
|
+
*/
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Shape for parsing a status attestation in a JWT.
|
23
|
+
*/
|
24
|
+
export const ParsedStatusAttestation = z.object({
|
25
|
+
header: z.object({
|
26
|
+
typ: z.literal("status-attestation+jwt"),
|
27
|
+
alg: z.string(),
|
28
|
+
kid: z.string().optional()
|
29
|
+
}),
|
30
|
+
payload: z.object({
|
31
|
+
credential_hash_alg: z.string(),
|
32
|
+
credential_hash: z.string(),
|
33
|
+
cnf: z.object({
|
34
|
+
jwk: JWK
|
35
|
+
}),
|
36
|
+
exp: UnixTime,
|
37
|
+
iat: UnixTime
|
38
|
+
})
|
39
|
+
});
|
40
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["UnixTime","JWK","z","StatusAttestationResponse","object","status_attestation","string","ParsedStatusAttestation","header","typ","literal","alg","kid","optional","payload","credential_hash_alg","credential_hash","cnf","jwk","exp","iat"],"sourceRoot":"../../../../src","sources":["credential/status/types.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,GAAG,QAAQ,iBAAiB;AACrC,OAAO,KAAKC,CAAC,MAAM,KAAK;;AAExB;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAGD,CAAC,CAACE,MAAM,CAAC;EAChDC,kBAAkB,EAAEH,CAAC,CAACI,MAAM,CAAC;AAC/B,CAAC,CAAC;;AAEF;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGL,CAAC,CAACE,MAAM,CAAC;EAC9CI,MAAM,EAAEN,CAAC,CAACE,MAAM,CAAC;IACfK,GAAG,EAAEP,CAAC,CAACQ,OAAO,CAAC,wBAAwB,CAAC;IACxCC,GAAG,EAAET,CAAC,CAACI,MAAM,CAAC,CAAC;IACfM,GAAG,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC;EAC3B,CAAC,CAAC;EACFC,OAAO,EAAEZ,CAAC,CAACE,MAAM,CAAC;IAChBW,mBAAmB,EAAEb,CAAC,CAACI,MAAM,CAAC,CAAC;IAC/BU,eAAe,EAAEd,CAAC,CAACI,MAAM,CAAC,CAAC;IAC3BW,GAAG,EAAEf,CAAC,CAACE,MAAM,CAAC;MACZc,GAAG,EAAEjB;IACP,CAAC,CAAC;IACFkB,GAAG,EAAEnB,QAAQ;IACboB,GAAG,EAAEpB;EACP,CAAC;AACH,CAAC,CAAC"}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Credential Trustmark
|
2
|
+
|
3
|
+
A credential TrustMark is a signed JWT that verifies the authenticity of a credential issued by a trusted source. It serves as proof that a credential is valid and linked to a specific wallet instance.
|
4
|
+
The TrustMark is often presented as a QR code, containing cryptographic data to ensure it hasn't been tampered with. It includes fields like issuer, issuance and expiration timestamps, and credential-specific details. TrustMarks have a short validity period and are used to enhance security and prevent misuse, such as QR code swapping.
|
5
|
+
|
6
|
+
### getCredentialTrustmark
|
7
|
+
|
8
|
+
A function that generates a signed JWT Trustmark to verify the authenticity of a digital credential. The Trustmark serves as a cryptographic proof linking a credential to a specific wallet instance, ensuring the credential's validity and preventing unauthorized modifications or misuse.
|
9
|
+
|
10
|
+
#### Signature
|
11
|
+
|
12
|
+
```typescript
|
13
|
+
function getCredentialTrustmark({
|
14
|
+
walletInstanceAttestation: string,
|
15
|
+
wiaCryptoContext: CryptoContext,
|
16
|
+
credentialType: string,
|
17
|
+
docNumber?: string,
|
18
|
+
expirationTime?: number | string
|
19
|
+
}): Promise<{
|
20
|
+
jwt: string,
|
21
|
+
expirationTime: number
|
22
|
+
}>
|
23
|
+
```
|
24
|
+
|
25
|
+
#### Parameters
|
26
|
+
| Parameter | Type | Required | Description |
|
27
|
+
|-----------|------|----------|-------------|
|
28
|
+
| walletInstanceAttestation | string | Yes | A base64-encoded string containing the Wallet Instance Attestation (WIA). This attestation proves the authenticity of the wallet instance. |
|
29
|
+
| wiaCryptoContext | CryptoContext | Yes | The cryptographic context associated with the wallet instance. Must contain the same key pair used to generate the WIA. |
|
30
|
+
| credentialType | string | Yes | Identifier for the type of credential (e.g., "MDL" for Mobile Driver's License). |
|
31
|
+
| docNumber | string | No | The document number of the credential. If provided, it will be obfuscated in the Trustmark for privacy. |
|
32
|
+
| expirationTime | number \| string | No | Specifies when the Trustmark expires. Can be either:<br>- A timestamp in seconds<br>- A time span string (e.g., "2m" for 2 minutes)<br>Default: "2m" |
|
33
|
+
|
34
|
+
#### Return Value
|
35
|
+
|
36
|
+
Returns a Promise that resolves to an object containing:
|
37
|
+
| Property | Type | Description |
|
38
|
+
|----------|------|-------------|
|
39
|
+
| jwt | string | The signed trustmark JWT string |
|
40
|
+
| expirationTime | number | The expiration timestamp of the JWT in seconds |
|
41
|
+
|
42
|
+
## Example
|
43
|
+
|
44
|
+
```typescript
|
45
|
+
// Required inputs
|
46
|
+
const walletInstanceAttestation = "base64AttestationString";
|
47
|
+
const credentialType = "MDL"; // Credential type (e.g., Mobile Driver's License)
|
48
|
+
const documentNumber = "AB123456"; // Optional document number
|
49
|
+
const cryptoContext = createCryptoContextFor("wiaKeyTag"); // Sample crypto context
|
50
|
+
|
51
|
+
// Generate the TrustMark JWT
|
52
|
+
const { jwt, expirationTime } = await getCredentialTrustmark({
|
53
|
+
walletInstanceAttestation: "eyJ0eXAi...", // WIA JWT
|
54
|
+
wiaCryptoContext: cryptoContext,
|
55
|
+
credentialType: "IdentityCard",
|
56
|
+
docNumber: "AB123456",
|
57
|
+
expirationTime: "5m", // 5 minutes
|
58
|
+
});
|
59
|
+
|
60
|
+
console.log("Generated TrustMark JWT:", jwt);
|
61
|
+
console.log("Expires at:", new Date(expirationTime * 1000));
|
62
|
+
```
|