@pagopa/io-react-native-wallet 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/api/index.js +3 -0
- package/lib/commonjs/api/index.js.map +1 -1
- package/lib/commonjs/client/generated/wallet-provider.js +42 -4
- package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
- package/lib/commonjs/client/index.js +5 -3
- package/lib/commonjs/client/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/README.md +2 -0
- package/lib/commonjs/credential/issuance/api/IssuerConfig.js +2 -2
- package/lib/commonjs/credential/issuance/api/IssuerConfig.js.map +1 -1
- package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +2 -1
- package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +2 -0
- package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js +2 -0
- package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js +15 -8
- package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/mappers.js +0 -1
- package/lib/commonjs/credential/issuance/v1.3.3/mappers.js.map +1 -1
- package/lib/commonjs/credential/presentation/api/RelyingPartyConfig.js +2 -2
- package/lib/commonjs/credential/presentation/api/RelyingPartyConfig.js.map +1 -1
- package/lib/commonjs/credential/presentation/common/utils/sd-jwt.js +2 -1
- package/lib/commonjs/credential/presentation/common/utils/sd-jwt.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/04-verify-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/04-verify-request-object.js +4 -2
- package/lib/commonjs/credential/presentation/v1.3.3/04-verify-request-object.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js +37 -11
- package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.0.0/mappers.js +16 -5
- package/lib/commonjs/credentials-catalogue/v1.0.0/mappers.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js +4 -2
- package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/types.js +91 -30
- package/lib/commonjs/credentials-catalogue/v1.3.3/types.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/utils.js +4 -4
- package/lib/commonjs/credentials-catalogue/v1.3.3/utils.js.map +1 -1
- package/lib/commonjs/index.js +3 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/index.js +3 -2
- package/lib/commonjs/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/utils.js +2 -1
- package/lib/commonjs/sd-jwt/utils.js.map +1 -1
- package/lib/commonjs/trust/common/types.js +3 -3
- package/lib/commonjs/trust/common/types.js.map +1 -1
- package/lib/commonjs/trust/v1.0.0/types.js +6 -8
- package/lib/commonjs/trust/v1.0.0/types.js.map +1 -1
- package/lib/commonjs/trust/v1.3.3/types.js +1 -3
- package/lib/commonjs/trust/v1.3.3/types.js.map +1 -1
- package/lib/commonjs/utils/callbacks.js +2 -0
- package/lib/commonjs/utils/callbacks.js.map +1 -1
- package/lib/commonjs/utils/credentials.js +17 -2
- package/lib/commonjs/utils/credentials.js.map +1 -1
- package/lib/commonjs/utils/crypto.js +8 -0
- package/lib/commonjs/utils/crypto.js.map +1 -1
- package/lib/commonjs/utils/dpop.js +1 -1
- package/lib/commonjs/utils/dpop.js.map +1 -1
- package/lib/commonjs/utils/jwk.js +1 -1
- package/lib/commonjs/utils/jwk.js.map +1 -1
- package/lib/commonjs/utils/zod.js +1 -1
- package/lib/commonjs/utils/zod.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/README.md +13 -10
- package/lib/commonjs/wallet-instance-attestation/api/types.js +9 -4
- package/lib/commonjs/wallet-instance-attestation/api/types.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/v1.0.0/index.js +2 -2
- package/lib/commonjs/wallet-instance-attestation/v1.0.0/index.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/v1.0.0/issuing.js +4 -5
- package/lib/commonjs/wallet-instance-attestation/v1.0.0/issuing.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/v1.0.0/mappers.js +4 -5
- package/lib/commonjs/wallet-instance-attestation/v1.0.0/mappers.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/index.js +5 -7
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/index.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/issuing.js +73 -3
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/issuing.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/mappers.js +26 -0
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/mappers.js.map +1 -0
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js +13 -24
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/utils.js +35 -0
- package/lib/commonjs/wallet-instance-attestation/v1.3.3/utils.js.map +1 -0
- package/lib/commonjs/wallet-unit-attestation/README.md +73 -0
- package/lib/commonjs/wallet-unit-attestation/api/index.js +6 -0
- package/lib/commonjs/wallet-unit-attestation/api/index.js.map +1 -0
- package/lib/commonjs/wallet-unit-attestation/api/types.js +45 -0
- package/lib/commonjs/wallet-unit-attestation/api/types.js.map +1 -0
- package/lib/commonjs/wallet-unit-attestation/index.js +20 -0
- package/lib/commonjs/wallet-unit-attestation/index.js.map +1 -0
- package/lib/commonjs/wallet-unit-attestation/v1.0.0/index.js +11 -0
- package/lib/commonjs/wallet-unit-attestation/v1.0.0/index.js.map +1 -0
- package/lib/commonjs/wallet-unit-attestation/v1.3.3/index.js +17 -0
- package/lib/commonjs/wallet-unit-attestation/v1.3.3/index.js.map +1 -0
- package/lib/commonjs/wallet-unit-attestation/v1.3.3/issuing.js +118 -0
- package/lib/commonjs/wallet-unit-attestation/v1.3.3/issuing.js.map +1 -0
- package/lib/commonjs/wallet-unit-attestation/v1.3.3/mappers.js +13 -0
- package/lib/commonjs/wallet-unit-attestation/v1.3.3/mappers.js.map +1 -0
- package/lib/commonjs/wallet-unit-attestation/v1.3.3/types.js +23 -0
- package/lib/commonjs/wallet-unit-attestation/v1.3.3/types.js.map +1 -0
- package/lib/commonjs/wallet-unit-attestation/v1.3.3/utils.js +20 -0
- package/lib/commonjs/wallet-unit-attestation/v1.3.3/utils.js.map +1 -0
- package/lib/module/api/index.js +3 -0
- package/lib/module/api/index.js.map +1 -1
- package/lib/module/client/generated/wallet-provider.js +33 -1
- package/lib/module/client/generated/wallet-provider.js.map +1 -1
- package/lib/module/client/index.js +4 -2
- package/lib/module/client/index.js.map +1 -1
- package/lib/module/credential/issuance/README.md +2 -0
- package/lib/module/credential/issuance/api/IssuerConfig.js +2 -2
- package/lib/module/credential/issuance/api/IssuerConfig.js.map +1 -1
- package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +2 -1
- package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +2 -0
- package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js +2 -0
- package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js +16 -9
- package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/mappers.js +0 -1
- package/lib/module/credential/issuance/v1.3.3/mappers.js.map +1 -1
- package/lib/module/credential/presentation/api/RelyingPartyConfig.js +1 -1
- package/lib/module/credential/presentation/api/RelyingPartyConfig.js.map +1 -1
- package/lib/module/credential/presentation/common/utils/sd-jwt.js +2 -1
- package/lib/module/credential/presentation/common/utils/sd-jwt.js.map +1 -1
- package/lib/module/credential/presentation/v1.0.0/04-verify-request-object.js.map +1 -1
- package/lib/module/credential/presentation/v1.3.3/04-verify-request-object.js +4 -2
- package/lib/module/credential/presentation/v1.3.3/04-verify-request-object.js.map +1 -1
- package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js +37 -11
- package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.0.0/mappers.js +16 -5
- package/lib/module/credentials-catalogue/v1.0.0/mappers.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/mappers.js +4 -2
- package/lib/module/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/types.js +91 -30
- package/lib/module/credentials-catalogue/v1.3.3/types.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/utils.js +4 -4
- package/lib/module/credentials-catalogue/v1.3.3/utils.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/sd-jwt/index.js +3 -2
- package/lib/module/sd-jwt/index.js.map +1 -1
- package/lib/module/sd-jwt/utils.js +2 -1
- package/lib/module/sd-jwt/utils.js.map +1 -1
- package/lib/module/trust/common/types.js +3 -3
- package/lib/module/trust/common/types.js.map +1 -1
- package/lib/module/trust/v1.0.0/types.js +5 -7
- package/lib/module/trust/v1.0.0/types.js.map +1 -1
- package/lib/module/trust/v1.3.3/types.js +1 -3
- package/lib/module/trust/v1.3.3/types.js.map +1 -1
- package/lib/module/utils/callbacks.js +3 -0
- package/lib/module/utils/callbacks.js.map +1 -1
- package/lib/module/utils/credentials.js +15 -1
- package/lib/module/utils/credentials.js.map +1 -1
- package/lib/module/utils/crypto.js +8 -0
- package/lib/module/utils/crypto.js.map +1 -1
- package/lib/module/utils/dpop.js +1 -1
- package/lib/module/utils/dpop.js.map +1 -1
- package/lib/module/utils/jwk.js +1 -1
- package/lib/module/utils/jwk.js.map +1 -1
- package/lib/module/utils/zod.js +1 -1
- package/lib/module/utils/zod.js.map +1 -1
- package/lib/module/wallet-instance-attestation/README.md +13 -10
- package/lib/module/wallet-instance-attestation/api/types.js +7 -2
- package/lib/module/wallet-instance-attestation/api/types.js.map +1 -1
- package/lib/module/wallet-instance-attestation/v1.0.0/index.js +3 -3
- package/lib/module/wallet-instance-attestation/v1.0.0/index.js.map +1 -1
- package/lib/module/wallet-instance-attestation/v1.0.0/issuing.js +4 -5
- package/lib/module/wallet-instance-attestation/v1.0.0/issuing.js.map +1 -1
- package/lib/module/wallet-instance-attestation/v1.0.0/mappers.js +3 -4
- package/lib/module/wallet-instance-attestation/v1.0.0/mappers.js.map +1 -1
- package/lib/module/wallet-instance-attestation/v1.3.3/index.js +5 -7
- package/lib/module/wallet-instance-attestation/v1.3.3/index.js.map +1 -1
- package/lib/module/wallet-instance-attestation/v1.3.3/issuing.js +73 -3
- package/lib/module/wallet-instance-attestation/v1.3.3/issuing.js.map +1 -1
- package/lib/module/wallet-instance-attestation/v1.3.3/mappers.js +19 -0
- package/lib/module/wallet-instance-attestation/v1.3.3/mappers.js.map +1 -0
- package/lib/module/wallet-instance-attestation/v1.3.3/types.js +10 -21
- package/lib/module/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
- package/lib/module/wallet-instance-attestation/v1.3.3/utils.js +29 -0
- package/lib/module/wallet-instance-attestation/v1.3.3/utils.js.map +1 -0
- package/lib/module/wallet-unit-attestation/README.md +73 -0
- package/lib/module/wallet-unit-attestation/api/index.js +2 -0
- package/lib/module/wallet-unit-attestation/api/index.js.map +1 -0
- package/lib/module/wallet-unit-attestation/api/types.js +36 -0
- package/lib/module/wallet-unit-attestation/api/types.js.map +1 -0
- package/lib/module/wallet-unit-attestation/index.js +3 -0
- package/lib/module/wallet-unit-attestation/index.js.map +1 -0
- package/lib/module/wallet-unit-attestation/v1.0.0/index.js +4 -0
- package/lib/module/wallet-unit-attestation/v1.0.0/index.js.map +1 -0
- package/lib/module/wallet-unit-attestation/v1.3.3/index.js +10 -0
- package/lib/module/wallet-unit-attestation/v1.3.3/index.js.map +1 -0
- package/lib/module/wallet-unit-attestation/v1.3.3/issuing.js +112 -0
- package/lib/module/wallet-unit-attestation/v1.3.3/issuing.js.map +1 -0
- package/lib/module/wallet-unit-attestation/v1.3.3/mappers.js +6 -0
- package/lib/module/wallet-unit-attestation/v1.3.3/mappers.js.map +1 -0
- package/lib/module/wallet-unit-attestation/v1.3.3/types.js +14 -0
- package/lib/module/wallet-unit-attestation/v1.3.3/types.js.map +1 -0
- package/lib/module/wallet-unit-attestation/v1.3.3/utils.js +15 -0
- package/lib/module/wallet-unit-attestation/v1.3.3/utils.js.map +1 -0
- package/lib/typescript/api/index.d.ts +2 -0
- package/lib/typescript/api/index.d.ts.map +1 -1
- package/lib/typescript/client/generated/wallet-provider.d.ts +122 -358
- package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
- package/lib/typescript/client/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/api/05-obtain-credential.d.ts +2 -0
- package/lib/typescript/credential/issuance/api/05-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/api/IssuerConfig.d.ts +21 -357
- package/lib/typescript/credential/issuance/api/IssuerConfig.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/api/types.d.ts +5 -41
- package/lib/typescript/credential/issuance/api/types.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/common/02-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/common/06-verify-and-parse-credential.sdjwt.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/common/authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.0.0/03-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.0.0/05-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts +103 -106
- package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.0.0/types.d.ts +4 -26
- package/lib/typescript/credential/issuance/v1.0.0/types.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/01-evaluate-issuer-trust.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/03-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/05-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts +594 -2095
- package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/types.d.ts +1 -5
- package/lib/typescript/credential/issuance/v1.3.3/types.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/api/RelyingPartyConfig.d.ts +9 -154
- package/lib/typescript/credential/presentation/api/RelyingPartyConfig.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/api/types.d.ts +30 -106
- package/lib/typescript/credential/presentation/api/types.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/common/utils/dcql.d.ts +29 -244
- package/lib/typescript/credential/presentation/common/utils/dcql.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/common/utils/http.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/common/utils/sd-jwt.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/common/utils.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/06-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/mappers.d.ts +56 -58
- package/lib/typescript/credential/presentation/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/types.d.ts +13 -52
- package/lib/typescript/credential/presentation/v1.0.0/types.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/utils.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/utils.jwks.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/04-verify-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/mappers.d.ts +133 -525
- package/lib/typescript/credential/presentation/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/sdkErrorMapper.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/types.d.ts +39 -3672
- package/lib/typescript/credential/presentation/v1.3.3/types.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/utils.mdoc.d.ts.map +1 -1
- package/lib/typescript/credential/status/v1.0.0/mappers.d.ts +6 -6
- package/lib/typescript/credential/status/v1.0.0/types.d.ts +33 -659
- package/lib/typescript/credential/status/v1.0.0/types.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts +111 -525
- package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts +48 -20
- package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.0.0/types.d.ts +41 -737
- package/lib/typescript/credentials-catalogue/v1.0.0/types.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts +147 -62
- package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/types.d.ts +180 -941
- package/lib/typescript/credentials-catalogue/v1.3.3/types.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/utils.d.ts +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/utils.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +4 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/mdoc/index.d.ts.map +1 -1
- package/lib/typescript/mdoc/utils.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/index.d.ts +16 -16
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +33 -492
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/utils.d.ts.map +1 -1
- package/lib/typescript/trust/api/TrustAnchorConfig.d.ts +12 -201
- package/lib/typescript/trust/api/TrustAnchorConfig.d.ts.map +1 -1
- package/lib/typescript/trust/common/build-chain.d.ts.map +1 -1
- package/lib/typescript/trust/common/types.d.ts +32 -1198
- package/lib/typescript/trust/common/types.d.ts.map +1 -1
- package/lib/typescript/trust/common/utils.d.ts.map +1 -1
- package/lib/typescript/trust/v1.0.0/build-chain.d.ts +1 -53
- package/lib/typescript/trust/v1.0.0/build-chain.d.ts.map +1 -1
- package/lib/typescript/trust/v1.0.0/entities.d.ts +324 -347
- package/lib/typescript/trust/v1.0.0/entities.d.ts.map +1 -1
- package/lib/typescript/trust/v1.0.0/mappers.d.ts +31 -35
- package/lib/typescript/trust/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/trust/v1.0.0/types.d.ts +678 -12454
- package/lib/typescript/trust/v1.0.0/types.d.ts.map +1 -1
- package/lib/typescript/trust/v1.0.0/verify-chain.d.ts +4 -56
- package/lib/typescript/trust/v1.0.0/verify-chain.d.ts.map +1 -1
- package/lib/typescript/trust/v1.3.3/entities.d.ts +43 -47
- package/lib/typescript/trust/v1.3.3/entities.d.ts.map +1 -1
- package/lib/typescript/trust/v1.3.3/types.d.ts +655 -14339
- package/lib/typescript/trust/v1.3.3/types.d.ts.map +1 -1
- package/lib/typescript/utils/auth.d.ts +3 -25
- package/lib/typescript/utils/auth.d.ts.map +1 -1
- package/lib/typescript/utils/callbacks.d.ts.map +1 -1
- package/lib/typescript/utils/config.d.ts +3 -3
- package/lib/typescript/utils/config.d.ts.map +1 -1
- package/lib/typescript/utils/credentials.d.ts +5 -0
- package/lib/typescript/utils/credentials.d.ts.map +1 -1
- package/lib/typescript/utils/crypto.d.ts +18 -0
- package/lib/typescript/utils/crypto.d.ts.map +1 -1
- package/lib/typescript/utils/decoder.d.ts.map +1 -1
- package/lib/typescript/utils/dpop.d.ts +5 -12
- package/lib/typescript/utils/dpop.d.ts.map +1 -1
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/jwk.d.ts +15 -175
- package/lib/typescript/utils/jwk.d.ts.map +1 -1
- package/lib/typescript/utils/mappers.d.ts.map +1 -1
- package/lib/typescript/utils/misc.d.ts +2 -2
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/utils/object.d.ts.map +1 -1
- package/lib/typescript/utils/par.d.ts +7 -45
- package/lib/typescript/utils/par.d.ts.map +1 -1
- package/lib/typescript/utils/parser.d.ts.map +1 -1
- package/lib/typescript/utils/pop.d.ts +1 -9
- package/lib/typescript/utils/pop.d.ts.map +1 -1
- package/lib/typescript/utils/string.d.ts.map +1 -1
- package/lib/typescript/utils/zod.d.ts +4 -4
- package/lib/typescript/utils/zod.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/api/index.d.ts +9 -9
- package/lib/typescript/wallet-instance-attestation/api/index.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/api/types.d.ts +19 -174
- package/lib/typescript/wallet-instance-attestation/api/types.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/common/types.d.ts +14 -273
- package/lib/typescript/wallet-instance-attestation/common/types.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.0.0/issuing.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.0.0/mappers.d.ts +5 -3
- package/lib/typescript/wallet-instance-attestation/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.0.0/types.d.ts +39 -629
- package/lib/typescript/wallet-instance-attestation/v1.0.0/types.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.3.3/index.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.3.3/issuing.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts +90 -0
- package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts.map +1 -0
- package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts +29 -891
- package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/v1.3.3/utils.d.ts +15 -0
- package/lib/typescript/wallet-instance-attestation/v1.3.3/utils.d.ts.map +1 -0
- package/lib/typescript/wallet-unit-attestation/api/index.d.ts +39 -0
- package/lib/typescript/wallet-unit-attestation/api/index.d.ts.map +1 -0
- package/lib/typescript/wallet-unit-attestation/api/types.d.ts +67 -0
- package/lib/typescript/wallet-unit-attestation/api/types.d.ts.map +1 -0
- package/lib/typescript/wallet-unit-attestation/index.d.ts +4 -0
- package/lib/typescript/wallet-unit-attestation/index.d.ts.map +1 -0
- package/lib/typescript/wallet-unit-attestation/v1.0.0/index.d.ts +3 -0
- package/lib/typescript/wallet-unit-attestation/v1.0.0/index.d.ts.map +1 -0
- package/lib/typescript/wallet-unit-attestation/v1.3.3/index.d.ts +3 -0
- package/lib/typescript/wallet-unit-attestation/v1.3.3/index.d.ts.map +1 -0
- package/lib/typescript/wallet-unit-attestation/v1.3.3/issuing.d.ts +3 -0
- package/lib/typescript/wallet-unit-attestation/v1.3.3/issuing.d.ts.map +1 -0
- package/lib/typescript/wallet-unit-attestation/v1.3.3/mappers.d.ts +107 -0
- package/lib/typescript/wallet-unit-attestation/v1.3.3/mappers.d.ts.map +1 -0
- package/lib/typescript/wallet-unit-attestation/v1.3.3/types.d.ts +69 -0
- package/lib/typescript/wallet-unit-attestation/v1.3.3/types.d.ts.map +1 -0
- package/lib/typescript/wallet-unit-attestation/v1.3.3/utils.d.ts +7 -0
- package/lib/typescript/wallet-unit-attestation/v1.3.3/utils.d.ts.map +1 -0
- package/package.json +8 -8
- package/src/api/index.ts +4 -0
- package/src/client/generated/wallet-provider.ts +44 -0
- package/src/client/index.ts +5 -1
- package/src/credential/issuance/README.md +2 -0
- package/src/credential/issuance/api/05-obtain-credential.ts +2 -0
- package/src/credential/issuance/api/IssuerConfig.ts +4 -2
- package/src/credential/issuance/common/06-verify-and-parse-credential.sdjwt.ts +2 -1
- package/src/credential/issuance/v1.3.3/01-evaluate-issuer-trust.ts +8 -3
- package/src/credential/issuance/v1.3.3/03-complete-user-authorization.ts +2 -0
- package/src/credential/issuance/v1.3.3/05-obtain-credential.ts +25 -11
- package/src/credential/issuance/v1.3.3/mappers.ts +10 -9
- package/src/credential/presentation/api/RelyingPartyConfig.ts +1 -1
- package/src/credential/presentation/common/utils/sd-jwt.ts +4 -1
- package/src/credential/presentation/v1.0.0/04-verify-request-object.ts +2 -2
- package/src/credential/presentation/v1.3.3/04-verify-request-object.ts +4 -2
- package/src/credentials-catalogue/api/DigitalCredentialsCatalogue.ts +42 -10
- package/src/credentials-catalogue/v1.0.0/mappers.ts +27 -12
- package/src/credentials-catalogue/v1.3.3/mappers.ts +10 -4
- package/src/credentials-catalogue/v1.3.3/types.ts +102 -29
- package/src/credentials-catalogue/v1.3.3/utils.ts +9 -4
- package/src/index.ts +11 -2
- package/src/sd-jwt/index.ts +8 -3
- package/src/sd-jwt/utils.ts +5 -1
- package/src/trust/common/types.ts +3 -3
- package/src/trust/v1.0.0/types.ts +10 -10
- package/src/trust/v1.3.3/types.ts +4 -7
- package/src/utils/callbacks.ts +7 -1
- package/src/utils/credentials.ts +17 -1
- package/src/utils/crypto.ts +18 -0
- package/src/utils/dpop.ts +1 -1
- package/src/utils/jwk.ts +1 -1
- package/src/utils/mappers.ts +2 -2
- package/src/utils/zod.ts +5 -1
- package/src/wallet-instance-attestation/README.md +13 -10
- package/src/wallet-instance-attestation/api/index.ts +20 -13
- package/src/wallet-instance-attestation/api/types.ts +16 -4
- package/src/wallet-instance-attestation/v1.0.0/index.ts +3 -3
- package/src/wallet-instance-attestation/v1.0.0/issuing.ts +7 -9
- package/src/wallet-instance-attestation/v1.0.0/mappers.ts +7 -5
- package/src/wallet-instance-attestation/v1.3.3/index.ts +5 -7
- package/src/wallet-instance-attestation/v1.3.3/issuing.ts +107 -3
- package/src/wallet-instance-attestation/v1.3.3/mappers.ts +18 -0
- package/src/wallet-instance-attestation/v1.3.3/types.ts +16 -30
- package/src/wallet-instance-attestation/v1.3.3/utils.ts +35 -0
- package/src/wallet-unit-attestation/README.md +73 -0
- package/src/wallet-unit-attestation/api/index.ts +51 -0
- package/src/wallet-unit-attestation/api/types.ts +49 -0
- package/src/wallet-unit-attestation/index.ts +3 -0
- package/src/wallet-unit-attestation/v1.0.0/index.ts +5 -0
- package/src/wallet-unit-attestation/v1.3.3/index.ts +11 -0
- package/src/wallet-unit-attestation/v1.3.3/issuing.ts +147 -0
- package/src/wallet-unit-attestation/v1.3.3/mappers.ts +10 -0
- package/src/wallet-unit-attestation/v1.3.3/types.ts +21 -0
- package/src/wallet-unit-attestation/v1.3.3/utils.ts +14 -0
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
import { JWK } from "../../utils/jwk";
|
|
3
2
|
import { Jwt } from "../common/types";
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export type WalletAppAttestationJwt = z.infer<typeof WalletAppAttestationJwt>;
|
|
13
|
-
export const WalletAppAttestationJwt = z.object({
|
|
4
|
+
export type WalletInstanceAttestationJwt = z.infer<
|
|
5
|
+
typeof WalletInstanceAttestationJwt
|
|
6
|
+
>;
|
|
7
|
+
export const WalletInstanceAttestationJwt = z.object({
|
|
14
8
|
header: z.intersection(
|
|
15
9
|
Jwt.shape.header,
|
|
16
10
|
z.object({
|
|
@@ -21,28 +15,20 @@ export const WalletAppAttestationJwt = z.object({
|
|
|
21
15
|
Jwt.shape.payload,
|
|
22
16
|
z.object({
|
|
23
17
|
sub: z.string(),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
eudi_wallet_info: z.object({
|
|
19
|
+
general_info: z.object({
|
|
20
|
+
wallet_provider_name: z.string(),
|
|
21
|
+
wallet_solution_id: z.string(),
|
|
22
|
+
wallet_solution_version: z.string(),
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
27
25
|
})
|
|
28
26
|
),
|
|
29
27
|
});
|
|
30
28
|
|
|
31
|
-
export type
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
typ: z.literal("key-attestation+jwt"),
|
|
37
|
-
})
|
|
38
|
-
),
|
|
39
|
-
payload: z.intersection(
|
|
40
|
-
Jwt.shape.payload,
|
|
41
|
-
z.object({
|
|
42
|
-
attested_keys: z.array(JWK),
|
|
43
|
-
user_authentication: z.array(z.string()),
|
|
44
|
-
key_storage: z.array(z.string()),
|
|
45
|
-
status: Status,
|
|
46
|
-
})
|
|
47
|
-
),
|
|
29
|
+
export type WalletInstanceAttestationResponse = z.infer<
|
|
30
|
+
typeof WalletInstanceAttestationResponse
|
|
31
|
+
>;
|
|
32
|
+
export const WalletInstanceAttestationResponse = z.object({
|
|
33
|
+
wallet_instance_attestation: z.string(),
|
|
48
34
|
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { WalletInstanceAttestationJwt } from "./types";
|
|
2
|
+
import {
|
|
3
|
+
decode as decodeJwt,
|
|
4
|
+
verify as verifyJwt,
|
|
5
|
+
} from "@pagopa/io-react-native-jwt";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Decode a given JWT to get the parsed Wallet Instance Attestation object they define.
|
|
9
|
+
* It ensures provided data is in a valid shape.
|
|
10
|
+
*
|
|
11
|
+
* It DOES NOT verify token signature nor check disclosures are correctly referenced by the JWT.
|
|
12
|
+
* Use {@link verify} instead
|
|
13
|
+
*/
|
|
14
|
+
export function decode(token: string): WalletInstanceAttestationJwt {
|
|
15
|
+
const decodedJwt = decodeJwt(token);
|
|
16
|
+
return WalletInstanceAttestationJwt.parse({
|
|
17
|
+
header: decodedJwt.protectedHeader,
|
|
18
|
+
payload: decodedJwt.payload,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Verify a given JWT to get the parsed Wallet Instance Attestation object they define.
|
|
24
|
+
* Same as {@link decode} plus token signature verification
|
|
25
|
+
*/
|
|
26
|
+
export async function verify(
|
|
27
|
+
token: string
|
|
28
|
+
): Promise<WalletInstanceAttestationJwt> {
|
|
29
|
+
const decoded = decode(token);
|
|
30
|
+
const pubKey = decoded.payload.cnf.jwk;
|
|
31
|
+
|
|
32
|
+
await verifyJwt(token, pubKey);
|
|
33
|
+
|
|
34
|
+
return decoded;
|
|
35
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Wallet Unit Attestation
|
|
2
|
+
|
|
3
|
+
This flow is used to obtain a [**Wallet Unit Attestation**](https://italia.github.io/eid-wallet-it-docs/releases/1.3.3/en/wallet-solution-requirements.html#wallet-unit-attestation-requirements). The WUA is bound to one or more cryptographic keys, that must be provided by the consumer application:
|
|
4
|
+
- `keyAttestationCryptoContext` one or more objects that extend the `CryptoContext` with a function to generate a WSCD-stored key with an optional key attestation (Android only); these are the keys that will be attested in the WUA.
|
|
5
|
+
- `integrityContext` object that is used to verify the integrity of the device where the app is running. The key tag must be the same used when creating the Wallet Instance.
|
|
6
|
+
|
|
7
|
+
#### Note
|
|
8
|
+
Before invoking `WalletUnitAttestation`'s functions, it is necessary to check whether the feature is supported by the current IoWallet instance.
|
|
9
|
+
```ts
|
|
10
|
+
const wallet = new IoWallet({ version: "1.3.3" });
|
|
11
|
+
|
|
12
|
+
if (wallet.WalletUnitAttestation.isSupported) {
|
|
13
|
+
// Get the WUA
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Example usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import {
|
|
21
|
+
IoWallet,
|
|
22
|
+
createCryptoContextFor,
|
|
23
|
+
KeyAttestationCryptoContext
|
|
24
|
+
} from "@pagopa/io-react-native-wallet";
|
|
25
|
+
|
|
26
|
+
// Retrieve the integrity key tag from the store and create its context
|
|
27
|
+
const integrityKeyTag = "example"; // Let's assume this is the same key used when creating the Wallet Instance
|
|
28
|
+
const integrityContext = getIntegrityContext(integrityKeyTag);
|
|
29
|
+
|
|
30
|
+
// Get env URLs
|
|
31
|
+
const { WALLET_PROVIDER_BASE_URL } = env; // Let's assume env is an object containing the environment variables
|
|
32
|
+
|
|
33
|
+
// The list of crypto contexts for each key to attest.
|
|
34
|
+
const keysToAttest: KeyAttestationCryptoContext[] = [
|
|
35
|
+
{
|
|
36
|
+
...createCryptoContextFor("example-keytag"),
|
|
37
|
+
generateKeyWithAttestation(challenge: string) {
|
|
38
|
+
// Generate a key stored in a trustworthy WSCD.
|
|
39
|
+
// On Android this function must return a key attestation.
|
|
40
|
+
return {
|
|
41
|
+
success: true,
|
|
42
|
+
attestation: "android-key-attestation-string",
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Obtain a new Wallet Unit Attestation.
|
|
50
|
+
* WARNING: The integrity context must be the same used when creating the Wallet Instance with the same keytag.
|
|
51
|
+
*/
|
|
52
|
+
const wallet = new IoWallet({ version: "1.3.3" });
|
|
53
|
+
const issuedAttestation = await wallet.WalletUnitAttestation.getAttestation(
|
|
54
|
+
{
|
|
55
|
+
walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
|
|
56
|
+
walletSolutionId: "exampleId",
|
|
57
|
+
walletSolutionVersion: "1.2.3",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
keysToAttest,
|
|
61
|
+
integrityContext,
|
|
62
|
+
appFetch,
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
```
|
|
66
|
+
## Mapped results
|
|
67
|
+
|
|
68
|
+
The following errors are mapped to a `WalletProviderResponseError` with specific codes.
|
|
69
|
+
|
|
70
|
+
|HTTP Status|Error Code|Description|
|
|
71
|
+
|-----------|----------|-----------|
|
|
72
|
+
|`*`|`ERR_IO_WALLET_PROVIDER_GENERIC_ERROR`|This is a generic error code to map unexpected errors that occurred when interacting with the Wallet Provider.|
|
|
73
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { IntegrityContext } from "../../utils/integrity";
|
|
2
|
+
import type { KeyAttestationCryptoContext } from "../../utils/crypto";
|
|
3
|
+
import type {
|
|
4
|
+
DecodedWalletUnitAttestation,
|
|
5
|
+
WalletAttestation,
|
|
6
|
+
WalletAttestationRequestParams,
|
|
7
|
+
} from "./types";
|
|
8
|
+
|
|
9
|
+
interface UnsupportedApi {
|
|
10
|
+
isSupported: false;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type WalletUnitAttestationApi =
|
|
14
|
+
| WalletUnitAttestationSupportedApi
|
|
15
|
+
| UnsupportedApi;
|
|
16
|
+
|
|
17
|
+
export interface WalletUnitAttestationSupportedApi {
|
|
18
|
+
isSupported: true;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Request a Wallet Unit Attestation (WUA) to the Wallet provider with one or more keys to attest.
|
|
22
|
+
* Each key must be provided as a {@link KeyAttestationCryptoContext}.
|
|
23
|
+
*
|
|
24
|
+
* @param requestParams Wallet Provider data for the Wallet Attestation request
|
|
25
|
+
* @param ctx.keysToAttest The list of KeyAttestationCryptoContext's of the keys to attest
|
|
26
|
+
* @param ctx.integrityContext The hardware key pair associated with the Wallet Instance
|
|
27
|
+
* @param ctx.appFetch (optional) Http client
|
|
28
|
+
* @returns The generated Wallet Unit Attestation with the attested keys
|
|
29
|
+
*/
|
|
30
|
+
getAttestation(
|
|
31
|
+
requestParams: WalletAttestationRequestParams,
|
|
32
|
+
ctx: {
|
|
33
|
+
keysToAttest: KeyAttestationCryptoContext[];
|
|
34
|
+
integrityContext: IntegrityContext;
|
|
35
|
+
appFetch?: GlobalFetch["fetch"];
|
|
36
|
+
}
|
|
37
|
+
): Promise<WalletAttestation>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Decode a given JWT to get the parsed Wallet Unit Attestation object they define.
|
|
41
|
+
* It ensures provided data is in a valid shape.
|
|
42
|
+
*
|
|
43
|
+
* It DOES NOT verify token signature.
|
|
44
|
+
*
|
|
45
|
+
* @param token The encoded token that represents a valid jwt for Wallet Unit Attestation
|
|
46
|
+
* @returns The validated Wallet Unit Attestation object
|
|
47
|
+
* @throws A decoding error if the token doesn't resolve in a valid JWT
|
|
48
|
+
* @throws A validation error if the provided data doesn't result in a valid Wallet Unit Attestation
|
|
49
|
+
*/
|
|
50
|
+
decode(token: string): DecodedWalletUnitAttestation;
|
|
51
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { UnixTime } from "../../utils/zod";
|
|
3
|
+
import { JWK } from "../../utils/jwk";
|
|
4
|
+
|
|
5
|
+
const Status = z.object({
|
|
6
|
+
status_list: z.object({
|
|
7
|
+
idx: z.number(),
|
|
8
|
+
uri: z.string(),
|
|
9
|
+
}),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Common Wallet Unit Attestation shape. This object is
|
|
14
|
+
* an abstraction over the version-specific JWTs.
|
|
15
|
+
*/
|
|
16
|
+
export type DecodedWalletUnitAttestation = z.infer<
|
|
17
|
+
typeof DecodedWalletUnitAttestation
|
|
18
|
+
>;
|
|
19
|
+
export const DecodedWalletUnitAttestation = z.object({
|
|
20
|
+
attested_keys: z.array(JWK),
|
|
21
|
+
user_authentication: z.array(z.string()),
|
|
22
|
+
key_storage: z.array(z.string()),
|
|
23
|
+
status: Status,
|
|
24
|
+
eudi_wallet_info: z.object({
|
|
25
|
+
general_info: z.object({
|
|
26
|
+
wallet_provider_name: z.string(),
|
|
27
|
+
wallet_solution_id: z.string(),
|
|
28
|
+
wallet_solution_version: z.string(),
|
|
29
|
+
}),
|
|
30
|
+
key_storage_info: z.object({
|
|
31
|
+
keys_exportable: z.boolean(),
|
|
32
|
+
storage_type: z.string(),
|
|
33
|
+
}),
|
|
34
|
+
}),
|
|
35
|
+
iss: z.string(),
|
|
36
|
+
iat: UnixTime,
|
|
37
|
+
exp: UnixTime,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export type WalletAttestation = {
|
|
41
|
+
format: string;
|
|
42
|
+
attestation: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type WalletAttestationRequestParams = {
|
|
46
|
+
walletProviderBaseUrl: string;
|
|
47
|
+
walletSolutionId: string;
|
|
48
|
+
walletSolutionVersion: string;
|
|
49
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { withMapper } from "../../utils/mappers";
|
|
2
|
+
import type { WalletUnitAttestationApi } from "../api";
|
|
3
|
+
import { decode } from "./utils";
|
|
4
|
+
import { mapToDecodedWalletUnitAttestation } from "./mappers";
|
|
5
|
+
import { getAttestation } from "./issuing";
|
|
6
|
+
|
|
7
|
+
export const WalletUnitAttestation: WalletUnitAttestationApi = {
|
|
8
|
+
isSupported: true,
|
|
9
|
+
getAttestation,
|
|
10
|
+
decode: withMapper(mapToDecodedWalletUnitAttestation, decode),
|
|
11
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Platform } from "react-native";
|
|
2
|
+
import { SignJWT, thumbprint } from "@pagopa/io-react-native-jwt";
|
|
3
|
+
import { Logger, LogLevel } from "../../utils/logging";
|
|
4
|
+
import { getWalletProviderClient } from "../../client";
|
|
5
|
+
import { fixBase64EncodingOnKey, JWK } from "../../utils/jwk";
|
|
6
|
+
import { IoWalletError } from "../../utils/errors";
|
|
7
|
+
import type { KeyAttestationCryptoContext } from "../../utils/crypto";
|
|
8
|
+
import type { WalletUnitAttestationSupportedApi } from "../api";
|
|
9
|
+
import { WalletUnitAttestationResponse } from "./types";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Create a Key Attestation Request in JWT format for the provided key.
|
|
13
|
+
* @param challenge The challenge for key attestation
|
|
14
|
+
* @param cryptoContext The crypto context of the key to attest
|
|
15
|
+
* @returns The key attestation request JWT, the public key and the original crypto context
|
|
16
|
+
*/
|
|
17
|
+
const createKeyAttestationRequest = async (
|
|
18
|
+
challenge: string,
|
|
19
|
+
cryptoContext: KeyAttestationCryptoContext
|
|
20
|
+
) => {
|
|
21
|
+
const { success, attestation } =
|
|
22
|
+
await cryptoContext.generateKeyWithAttestation(challenge);
|
|
23
|
+
|
|
24
|
+
if (!success) {
|
|
25
|
+
throw new IoWalletError(
|
|
26
|
+
"generateKeyWithAttestation failed to generate a cryptographic key for the Wallet Unit Attestation request"
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (Platform.OS === "android" && !attestation) {
|
|
31
|
+
throw new IoWalletError(
|
|
32
|
+
"Missing key attestation: on Android the generated key must have a key attestation to request a Wallet Unit Attestation"
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const publicKey = JWK.parse(await cryptoContext.getPublicKey());
|
|
37
|
+
|
|
38
|
+
const requestJwt = await new SignJWT(cryptoContext)
|
|
39
|
+
.setPayload({
|
|
40
|
+
wscd_key_attestation: {
|
|
41
|
+
storage_type: "LOCAL_NATIVE",
|
|
42
|
+
...(attestation && { attestation }),
|
|
43
|
+
},
|
|
44
|
+
cnf: {
|
|
45
|
+
jwk: fixBase64EncodingOnKey(publicKey),
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
.setProtectedHeader({
|
|
49
|
+
kid: publicKey.kid,
|
|
50
|
+
typ: "key-attestation-request+jwt",
|
|
51
|
+
})
|
|
52
|
+
.setIssuedAt()
|
|
53
|
+
.setExpirationTime("1h")
|
|
54
|
+
.sign();
|
|
55
|
+
|
|
56
|
+
return { cryptoContext, publicKey, keyAttestationRequestJwt: requestJwt };
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const getAttestation: WalletUnitAttestationSupportedApi["getAttestation"] =
|
|
60
|
+
async (
|
|
61
|
+
{ walletProviderBaseUrl, walletSolutionId, walletSolutionVersion },
|
|
62
|
+
{ keysToAttest: keysToAttestContexts, integrityContext, appFetch = fetch }
|
|
63
|
+
) => {
|
|
64
|
+
if (keysToAttestContexts.length === 0) {
|
|
65
|
+
throw new IoWalletError("At least one key to attest must be provided");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const api = getWalletProviderClient({ walletProviderBaseUrl, appFetch });
|
|
69
|
+
|
|
70
|
+
const { nonce } = await api.get("/nonce");
|
|
71
|
+
Logger.log(
|
|
72
|
+
LogLevel.DEBUG,
|
|
73
|
+
`Challenge obtained from ${walletProviderBaseUrl}: ${nonce}`
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const keysToAttest = await Promise.all(
|
|
77
|
+
keysToAttestContexts.map((cryptoContext) =>
|
|
78
|
+
createKeyAttestationRequest(nonce, cryptoContext)
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
// Use the first key to attest to sign the WUA Request JWT
|
|
83
|
+
const signatureKey = keysToAttest.at(0)!;
|
|
84
|
+
|
|
85
|
+
const hardwareKeyTag = integrityContext.getHardwareKeyTag();
|
|
86
|
+
|
|
87
|
+
const clientData = {
|
|
88
|
+
challenge: nonce,
|
|
89
|
+
jwk_thumbprints: await Promise.all(
|
|
90
|
+
keysToAttest.map((k) => thumbprint(k.publicKey))
|
|
91
|
+
),
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const { signature, authenticatorData } =
|
|
95
|
+
await integrityContext.getHardwareSignatureWithAuthData(
|
|
96
|
+
JSON.stringify(clientData)
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const signedAttestationRequest = await new SignJWT(
|
|
100
|
+
signatureKey.cryptoContext
|
|
101
|
+
)
|
|
102
|
+
.setPayload({
|
|
103
|
+
nonce,
|
|
104
|
+
hardware_key_tag: hardwareKeyTag,
|
|
105
|
+
iss: hardwareKeyTag,
|
|
106
|
+
keys_to_attest: keysToAttest.map((k) => k.keyAttestationRequestJwt),
|
|
107
|
+
hardware_signature: signature,
|
|
108
|
+
integrity_assertion: authenticatorData,
|
|
109
|
+
platform: Platform.OS,
|
|
110
|
+
wallet_solution_id: walletSolutionId,
|
|
111
|
+
wallet_solution_version: walletSolutionVersion,
|
|
112
|
+
cnf: {
|
|
113
|
+
jwk: fixBase64EncodingOnKey(signatureKey.publicKey),
|
|
114
|
+
},
|
|
115
|
+
})
|
|
116
|
+
.setProtectedHeader({
|
|
117
|
+
kid: signatureKey.publicKey.kid,
|
|
118
|
+
typ: "wua-request+jwt",
|
|
119
|
+
})
|
|
120
|
+
.setIssuedAt()
|
|
121
|
+
.setExpirationTime("1h")
|
|
122
|
+
.sign();
|
|
123
|
+
|
|
124
|
+
Logger.log(
|
|
125
|
+
LogLevel.DEBUG,
|
|
126
|
+
`Signed attestation request: ${signedAttestationRequest}`
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
const response = await api
|
|
130
|
+
.post("/wallet-unit-attestations", {
|
|
131
|
+
header: {
|
|
132
|
+
"Content-Type": "text/plain",
|
|
133
|
+
},
|
|
134
|
+
body: signedAttestationRequest,
|
|
135
|
+
})
|
|
136
|
+
.then(WalletUnitAttestationResponse.parse);
|
|
137
|
+
|
|
138
|
+
Logger.log(
|
|
139
|
+
LogLevel.DEBUG,
|
|
140
|
+
`Obtained Wallet Unit Attestation: ${response.wallet_unit_attestation}`
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
format: "jwt",
|
|
145
|
+
attestation: response.wallet_unit_attestation,
|
|
146
|
+
};
|
|
147
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createMapper } from "../../utils/mappers";
|
|
2
|
+
import { DecodedWalletUnitAttestation } from "../api/types";
|
|
3
|
+
import { WalletUnitAttestationJwt } from "./types";
|
|
4
|
+
|
|
5
|
+
export const mapToDecodedWalletUnitAttestation = createMapper<
|
|
6
|
+
WalletUnitAttestationJwt,
|
|
7
|
+
DecodedWalletUnitAttestation
|
|
8
|
+
>((x) => x.payload, {
|
|
9
|
+
outputSchema: DecodedWalletUnitAttestation,
|
|
10
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { Jwt } from "../../wallet-instance-attestation/common/types";
|
|
3
|
+
import { DecodedWalletUnitAttestation } from "../api/types";
|
|
4
|
+
|
|
5
|
+
export type WalletUnitAttestationJwt = z.infer<typeof WalletUnitAttestationJwt>;
|
|
6
|
+
export const WalletUnitAttestationJwt = z.object({
|
|
7
|
+
header: z.intersection(
|
|
8
|
+
Jwt.shape.header,
|
|
9
|
+
z.object({
|
|
10
|
+
typ: z.literal("key-attestation+jwt"),
|
|
11
|
+
})
|
|
12
|
+
),
|
|
13
|
+
payload: DecodedWalletUnitAttestation, // The payload type matches the public API
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type WalletUnitAttestationResponse = z.infer<
|
|
17
|
+
typeof WalletUnitAttestationResponse
|
|
18
|
+
>;
|
|
19
|
+
export const WalletUnitAttestationResponse = z.object({
|
|
20
|
+
wallet_unit_attestation: z.string(),
|
|
21
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
|
|
2
|
+
import { WalletUnitAttestationJwt } from "./types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Decode a given JWT to get the parsed Wallet Unit Attestation object they define.
|
|
6
|
+
* It ensures the provided data is in a valid shape, but it DOES NOT verify the signature.
|
|
7
|
+
*/
|
|
8
|
+
export function decode(token: string): WalletUnitAttestationJwt {
|
|
9
|
+
const decodedJwt = decodeJwt(token);
|
|
10
|
+
return WalletUnitAttestationJwt.parse({
|
|
11
|
+
header: decodedJwt.protectedHeader,
|
|
12
|
+
payload: decodedJwt.payload,
|
|
13
|
+
});
|
|
14
|
+
}
|