@pagopa/io-react-native-wallet 3.0.1 → 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/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/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/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/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/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/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/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/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/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 +15 -15
- 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.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/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/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/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/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,7 +1,7 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
+
import { jsonWebKeySchema } from "@pagopa/io-wallet-oid-federation";
|
|
2
3
|
import { JWK } from "../../utils/jwk";
|
|
3
4
|
import { BaseEntityConfiguration } from "../common/types";
|
|
4
|
-
import { jsonWebKeySchema } from "@openid-federation/core";
|
|
5
5
|
|
|
6
6
|
const RelyingPartyMetadata = z.object({
|
|
7
7
|
application_type: z.string().optional(),
|
|
@@ -65,7 +65,9 @@ const SupportedCredentialMetadata = z.intersection(
|
|
|
65
65
|
cryptographic_binding_methods_supported: z.array(z.string()),
|
|
66
66
|
credential_signing_alg_values_supported: z.array(z.string()),
|
|
67
67
|
authentic_source: z.string().optional(),
|
|
68
|
-
issuance_errors_supported: z
|
|
68
|
+
issuance_errors_supported: z
|
|
69
|
+
.record(z.string(), IssuanceErrorSupported)
|
|
70
|
+
.optional(),
|
|
69
71
|
})
|
|
70
72
|
);
|
|
71
73
|
|
|
@@ -92,6 +94,7 @@ export const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(
|
|
|
92
94
|
status_attestation_endpoint: z.string(),
|
|
93
95
|
display: z.array(CredentialIssuerDisplayMetadata),
|
|
94
96
|
credential_configurations_supported: z.record(
|
|
97
|
+
z.string(),
|
|
95
98
|
SupportedCredentialMetadata
|
|
96
99
|
),
|
|
97
100
|
jwks: z.object({ keys: z.array(JWK) }),
|
|
@@ -157,7 +160,7 @@ export const WalletProviderEntityConfiguration = BaseEntityConfiguration.and(
|
|
|
157
160
|
),
|
|
158
161
|
jwks: z.object({ keys: z.array(JWK) }),
|
|
159
162
|
})
|
|
160
|
-
.
|
|
163
|
+
.loose(),
|
|
161
164
|
}),
|
|
162
165
|
}),
|
|
163
166
|
})
|
|
@@ -165,14 +168,11 @@ export const WalletProviderEntityConfiguration = BaseEntityConfiguration.and(
|
|
|
165
168
|
|
|
166
169
|
// Maps any entity configuration by the union of every possible shapes
|
|
167
170
|
export type EntityConfiguration = z.infer<typeof EntityConfiguration>;
|
|
168
|
-
export const EntityConfiguration = z
|
|
169
|
-
[
|
|
171
|
+
export const EntityConfiguration = z
|
|
172
|
+
.union([
|
|
170
173
|
WalletProviderEntityConfiguration,
|
|
171
174
|
CredentialIssuerEntityConfiguration,
|
|
172
175
|
TrustAnchorEntityConfiguration,
|
|
173
176
|
RelyingPartyEntityConfiguration,
|
|
174
|
-
]
|
|
175
|
-
|
|
176
|
-
description: "Any kind of Entity Configuration allowed in the ecosystem",
|
|
177
|
-
}
|
|
178
|
-
);
|
|
177
|
+
])
|
|
178
|
+
.describe("Any kind of Entity Configuration allowed in the ecosystem");
|
|
@@ -56,13 +56,10 @@ export const WalletProviderEntityConfiguration = BaseEntityConfiguration.and(
|
|
|
56
56
|
|
|
57
57
|
// Maps any entity configuration by the union of every possible shapes
|
|
58
58
|
export type EntityConfiguration = z.infer<typeof EntityConfiguration>;
|
|
59
|
-
export const EntityConfiguration = z
|
|
60
|
-
[
|
|
59
|
+
export const EntityConfiguration = z
|
|
60
|
+
.union([
|
|
61
61
|
WalletProviderEntityConfiguration,
|
|
62
62
|
CredentialIssuerEntityConfiguration,
|
|
63
63
|
RelyingPartyEntityConfiguration,
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
description: "Any kind of Entity Configuration allowed in the ecosystem",
|
|
67
|
-
}
|
|
68
|
-
);
|
|
64
|
+
])
|
|
65
|
+
.describe("Any kind of Entity Configuration allowed in the ecosystem");
|
package/src/utils/callbacks.ts
CHANGED
|
@@ -12,6 +12,12 @@ type PartialCallbackContext = Omit<
|
|
|
12
12
|
"signJwt" | "clientAuthentication"
|
|
13
13
|
>;
|
|
14
14
|
|
|
15
|
+
// Fix incompatibility between ArrayBuffer types
|
|
16
|
+
type DigestFixed = (
|
|
17
|
+
data: string | ArrayBuffer | ArrayBufferView,
|
|
18
|
+
algorithm?: string
|
|
19
|
+
) => Uint8Array;
|
|
20
|
+
|
|
15
21
|
/**
|
|
16
22
|
* Shared callbacks with React Native implementations for use
|
|
17
23
|
* in IO Wallet SDK. Callbacks not found here must be provided by the caller,
|
|
@@ -19,7 +25,7 @@ type PartialCallbackContext = Omit<
|
|
|
19
25
|
*/
|
|
20
26
|
export const partialCallbacks: PartialCallbackContext = {
|
|
21
27
|
generateRandom: generateRandomBytes,
|
|
22
|
-
hash: digest,
|
|
28
|
+
hash: digest as DigestFixed,
|
|
23
29
|
encryptJwe: async ({ publicJwk, alg, enc, kid }, data) => ({
|
|
24
30
|
// @ts-expect-error `alg` and `enc` are strings, but EncryptJwe expects specific string literals
|
|
25
31
|
jwe: await new EncryptJwe(data, { alg, enc, kid }).encrypt(publicJwk),
|
package/src/utils/crypto.ts
CHANGED
|
@@ -90,3 +90,21 @@ export const getSigninJwkFromCert = (pemCert: string): JWK => {
|
|
|
90
90
|
"Unable to find the signing key inside the PEM certificate"
|
|
91
91
|
);
|
|
92
92
|
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Extension of the {@link CryptoContext} that adds key generation with optional key attestation.
|
|
96
|
+
*
|
|
97
|
+
* This context requires the consumer to provide an additional method for **key generation**;
|
|
98
|
+
* on Android this method should also generate a key attestation as a certificate chain
|
|
99
|
+
* to ensure the key pair is hardware-backed.
|
|
100
|
+
*/
|
|
101
|
+
export type KeyAttestationCryptoContext = CryptoContext & {
|
|
102
|
+
/**
|
|
103
|
+
* Generate a key pair with an **optional key attestation** (Android).
|
|
104
|
+
* @param challenge The challenge for the key attestation.
|
|
105
|
+
* @returns An object with a success flag and a key attestation, if it was generated.
|
|
106
|
+
*/
|
|
107
|
+
generateKeyWithAttestation(
|
|
108
|
+
challenge: string
|
|
109
|
+
): Promise<{ success: boolean; attestation?: string }>;
|
|
110
|
+
};
|
package/src/utils/dpop.ts
CHANGED
|
@@ -29,7 +29,7 @@ export const createDPopToken = async (
|
|
|
29
29
|
export type DPoPPayload = z.infer<typeof DPoPPayload>;
|
|
30
30
|
export const DPoPPayload = z.object({
|
|
31
31
|
jti: z.string(),
|
|
32
|
-
htm: z.
|
|
32
|
+
htm: z.enum(["POST", "GET"]),
|
|
33
33
|
htu: z.string(),
|
|
34
34
|
ath: z.string().optional(),
|
|
35
35
|
});
|
package/src/utils/jwk.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const JWK = z.object({
|
|
|
20
20
|
/** JWK "kty" (Key Type) Parameter.
|
|
21
21
|
* This attribute is required to discriminate the
|
|
22
22
|
* type of EC/RSA algorithm */
|
|
23
|
-
kty: z.
|
|
23
|
+
kty: z.enum(["RSA", "EC"]),
|
|
24
24
|
n: z.string().optional(),
|
|
25
25
|
p: z.string().optional(),
|
|
26
26
|
q: z.string().optional(),
|
package/src/utils/mappers.ts
CHANGED
|
@@ -33,8 +33,8 @@ export function createMapper<I, O>(
|
|
|
33
33
|
export function createMapper<I, O>(
|
|
34
34
|
mapper: (input: I) => O,
|
|
35
35
|
config?: {
|
|
36
|
-
inputSchema?: z.ZodType<I>;
|
|
37
|
-
outputSchema: z.ZodType<O>;
|
|
36
|
+
inputSchema?: z.ZodType<I, any>;
|
|
37
|
+
outputSchema: z.ZodType<O, any>;
|
|
38
38
|
}
|
|
39
39
|
) {
|
|
40
40
|
if (!config) {
|
package/src/utils/zod.ts
CHANGED
|
@@ -11,7 +11,11 @@ type Literal = z.infer<typeof literalSchema>;
|
|
|
11
11
|
type Json = Literal | { [key: string]: Json } | Json[];
|
|
12
12
|
|
|
13
13
|
const jsonSchema: z.ZodType<Json> = z.lazy(() =>
|
|
14
|
-
z.union([
|
|
14
|
+
z.union([
|
|
15
|
+
literalSchema,
|
|
16
|
+
z.array(jsonSchema),
|
|
17
|
+
z.record(z.string(), jsonSchema),
|
|
18
|
+
])
|
|
15
19
|
);
|
|
16
20
|
|
|
17
21
|
export const json = () => jsonSchema;
|
|
@@ -30,16 +30,19 @@ const { WALLET_PROVIDER_BASE_URL } = env; // Let's assume env is an object conta
|
|
|
30
30
|
* WARNING: The integrity context must be the same used when creating the Wallet Instance with the same keytag.
|
|
31
31
|
*/
|
|
32
32
|
const wallet = new IoWallet({ version: "1.0.0" });
|
|
33
|
-
const issuedAttestation = await wallet.WalletInstanceAttestation.getAttestation(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
const issuedAttestation = await wallet.WalletInstanceAttestation.getAttestation(
|
|
34
|
+
{
|
|
35
|
+
walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
|
|
36
|
+
walletSolutionId: "exampleId",
|
|
37
|
+
walletSolutionVersion: "1.2.3",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
wiaCryptoContext,
|
|
41
|
+
integrityContext,
|
|
42
|
+
appFetch,
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
// [{ "format": "jwt", "attestation": "ey..." }, { "format": "dc+sd-jwt", "attestation": "ey..." }]
|
|
43
46
|
return issuedAttestation;
|
|
44
47
|
```
|
|
45
48
|
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import type { CryptoContext } from "@pagopa/io-react-native-jwt";
|
|
2
2
|
import type { IntegrityContext } from "../../utils/integrity";
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
DecodedWalletInstanceAttestation,
|
|
5
|
+
WalletAttestation,
|
|
6
|
+
WalletAttestationRequestParams,
|
|
7
|
+
} from "./types";
|
|
4
8
|
|
|
5
9
|
export interface WalletInstanceAttestationApi {
|
|
6
10
|
/**
|
|
7
11
|
* Request a Wallet Instance Attestation (WIA) to the Wallet provider.
|
|
8
|
-
* The Wallet Attestation may be issued in different formats
|
|
12
|
+
* The Wallet Instance Attestation may be issued in different formats.
|
|
9
13
|
*
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
14
|
+
* @param requestParams Wallet Provider data for the Wallet Attestation request
|
|
15
|
+
* @param ctx.wiaCryptoContext The key pair associated with the WIA. Will be use to prove the ownership of the attestation.
|
|
16
|
+
* @param ctx.integrityContext The hardware key pair associated with the Wallet Instance
|
|
17
|
+
* @param ctx.appFetch (optional) Http client
|
|
13
18
|
* @returns The retrieved Wallet Instance Attestation tokens
|
|
14
19
|
* @throws {WalletProviderResponseError} with a specific code for more context
|
|
15
20
|
*/
|
|
16
|
-
getAttestation(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
getAttestation(
|
|
22
|
+
requestParams: WalletAttestationRequestParams,
|
|
23
|
+
ctx: {
|
|
24
|
+
wiaCryptoContext: CryptoContext;
|
|
25
|
+
integrityContext: IntegrityContext;
|
|
26
|
+
appFetch?: GlobalFetch["fetch"];
|
|
27
|
+
}
|
|
28
|
+
): Promise<WalletAttestation[]>;
|
|
22
29
|
|
|
23
30
|
/**
|
|
24
31
|
* Decode a given JWT to get the parsed Wallet Instance Attestation object they define.
|
|
@@ -32,7 +39,7 @@ export interface WalletInstanceAttestationApi {
|
|
|
32
39
|
* @throws A decoding error if the token doesn't resolve in a valid JWT
|
|
33
40
|
* @throws A validation error if the provided data doesn't result in a valid Wallet Instance Attestation
|
|
34
41
|
*/
|
|
35
|
-
decode(token: string):
|
|
42
|
+
decode(token: string): DecodedWalletInstanceAttestation;
|
|
36
43
|
|
|
37
44
|
/**
|
|
38
45
|
* Verify a given JWT to get the parsed Wallet Instance Attestation object they define.
|
|
@@ -44,5 +51,5 @@ export interface WalletInstanceAttestationApi {
|
|
|
44
51
|
* @throws A validation error if the provided data doesn't result in a valid Wallet Instance Attestation
|
|
45
52
|
* @throws Invalid signature error if the token signature is not valid
|
|
46
53
|
*/
|
|
47
|
-
verify(token: string): Promise<
|
|
54
|
+
verify(token: string): Promise<DecodedWalletInstanceAttestation>;
|
|
48
55
|
}
|
|
@@ -3,23 +3,35 @@ import { UnixTime } from "../../utils/zod";
|
|
|
3
3
|
import { JWK } from "../../utils/jwk";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Common Wallet Attestation shape. This object is
|
|
6
|
+
* Common Wallet Instance Attestation shape. This object is
|
|
7
7
|
* an abstraction over the version-specific JWTs.
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
10
|
-
|
|
9
|
+
export type DecodedWalletInstanceAttestation = z.infer<
|
|
10
|
+
typeof DecodedWalletInstanceAttestation
|
|
11
|
+
>;
|
|
12
|
+
export const DecodedWalletInstanceAttestation = z.object({
|
|
11
13
|
iss: z.string(),
|
|
12
14
|
iat: UnixTime,
|
|
13
15
|
exp: UnixTime,
|
|
14
16
|
cnf: z.object({ jwk: JWK }),
|
|
15
17
|
sub: z.string(),
|
|
18
|
+
wallet_provider_name: z.string().optional(),
|
|
19
|
+
wallet_solution_id: z.string().optional(),
|
|
20
|
+
/** @deprecated */
|
|
16
21
|
wallet_link: z.string().optional(),
|
|
22
|
+
/** @deprecated */
|
|
17
23
|
wallet_name: z.string().optional(),
|
|
24
|
+
/** @deprecated */
|
|
18
25
|
aal: z.string().optional(),
|
|
19
26
|
});
|
|
20
27
|
|
|
21
28
|
export type WalletAttestation = {
|
|
22
|
-
type: "wallet_instance_attestation" | "wallet_unit_attestation";
|
|
23
29
|
format: string;
|
|
24
30
|
attestation: string;
|
|
25
31
|
};
|
|
32
|
+
|
|
33
|
+
export type WalletAttestationRequestParams = {
|
|
34
|
+
walletProviderBaseUrl: string;
|
|
35
|
+
walletSolutionId: string;
|
|
36
|
+
walletSolutionVersion: string;
|
|
37
|
+
};
|
|
@@ -2,10 +2,10 @@ import type { WalletInstanceAttestationApi } from "../api";
|
|
|
2
2
|
import { withMapper, withMapperAsync } from "../../utils/mappers";
|
|
3
3
|
import { getAttestation } from "./issuing";
|
|
4
4
|
import { decode, verify } from "./utils";
|
|
5
|
-
import {
|
|
5
|
+
import { mapToDecodedWalletInstanceAttestation } from "./mappers";
|
|
6
6
|
|
|
7
7
|
export const WalletInstanceAttestation: WalletInstanceAttestationApi = {
|
|
8
8
|
getAttestation,
|
|
9
|
-
decode: withMapper(
|
|
10
|
-
verify: withMapperAsync(
|
|
9
|
+
decode: withMapper(mapToDecodedWalletInstanceAttestation, decode),
|
|
10
|
+
verify: withMapperAsync(mapToDecodedWalletInstanceAttestation, verify),
|
|
11
11
|
};
|
|
@@ -69,14 +69,12 @@ async function getAttestationRequest(
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export const getAttestation: WalletInstanceAttestationApi["getAttestation"] =
|
|
72
|
-
async (
|
|
73
|
-
|
|
74
|
-
integrityContext,
|
|
75
|
-
|
|
76
|
-
appFetch = fetch,
|
|
77
|
-
}) => {
|
|
72
|
+
async (
|
|
73
|
+
requestParams,
|
|
74
|
+
{ wiaCryptoContext, integrityContext, appFetch = fetch }
|
|
75
|
+
) => {
|
|
78
76
|
const api = getWalletProviderClient({
|
|
79
|
-
walletProviderBaseUrl,
|
|
77
|
+
walletProviderBaseUrl: requestParams.walletProviderBaseUrl,
|
|
80
78
|
appFetch,
|
|
81
79
|
});
|
|
82
80
|
|
|
@@ -86,7 +84,7 @@ export const getAttestation: WalletInstanceAttestationApi["getAttestation"] =
|
|
|
86
84
|
.then((response) => response.nonce);
|
|
87
85
|
Logger.log(
|
|
88
86
|
LogLevel.DEBUG,
|
|
89
|
-
`Challenge obtained from ${walletProviderBaseUrl}: ${challenge} `
|
|
87
|
+
`Challenge obtained from ${requestParams.walletProviderBaseUrl}: ${challenge} `
|
|
90
88
|
);
|
|
91
89
|
|
|
92
90
|
// 2. Get a signed attestation request
|
|
@@ -94,7 +92,7 @@ export const getAttestation: WalletInstanceAttestationApi["getAttestation"] =
|
|
|
94
92
|
challenge,
|
|
95
93
|
wiaCryptoContext,
|
|
96
94
|
integrityContext,
|
|
97
|
-
walletProviderBaseUrl
|
|
95
|
+
requestParams.walletProviderBaseUrl
|
|
98
96
|
);
|
|
99
97
|
Logger.log(
|
|
100
98
|
LogLevel.DEBUG,
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { createMapper } from "../../utils/mappers";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DecodedWalletInstanceAttestation,
|
|
4
|
+
type WalletAttestation,
|
|
5
|
+
} from "../api/types";
|
|
3
6
|
import {
|
|
4
7
|
WalletAttestationResponse,
|
|
5
8
|
WalletInstanceAttestationJwt,
|
|
6
9
|
} from "./types";
|
|
7
10
|
|
|
8
|
-
export const
|
|
11
|
+
export const mapToDecodedWalletInstanceAttestation = createMapper<
|
|
9
12
|
WalletInstanceAttestationJwt,
|
|
10
|
-
|
|
13
|
+
DecodedWalletInstanceAttestation
|
|
11
14
|
>((x) => x.payload, {
|
|
12
|
-
outputSchema:
|
|
15
|
+
outputSchema: DecodedWalletInstanceAttestation,
|
|
13
16
|
});
|
|
14
17
|
|
|
15
18
|
export const mapToWalletAttestations = createMapper<
|
|
@@ -17,7 +20,6 @@ export const mapToWalletAttestations = createMapper<
|
|
|
17
20
|
WalletAttestation[]
|
|
18
21
|
>((x) =>
|
|
19
22
|
x.wallet_attestations.map((wa) => ({
|
|
20
|
-
type: "wallet_instance_attestation",
|
|
21
23
|
format: wa.format,
|
|
22
24
|
attestation: wa.wallet_attestation,
|
|
23
25
|
}))
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { withMapper, withMapperAsync } from "../../utils/mappers";
|
|
2
2
|
import type { WalletInstanceAttestationApi } from "../api";
|
|
3
3
|
import { getAttestation } from "./issuing";
|
|
4
|
+
import { decode, verify } from "./utils";
|
|
5
|
+
import { mapToDecodedWalletInstanceAttestation } from "./mappers";
|
|
4
6
|
|
|
5
7
|
export const WalletInstanceAttestation: WalletInstanceAttestationApi = {
|
|
6
8
|
getAttestation,
|
|
7
|
-
decode: ()
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
verify: () => {
|
|
11
|
-
throw new UnimplementedFeatureError("verify", "1.3.3");
|
|
12
|
-
},
|
|
9
|
+
decode: withMapper(mapToDecodedWalletInstanceAttestation, decode),
|
|
10
|
+
verify: withMapperAsync(mapToDecodedWalletInstanceAttestation, verify),
|
|
13
11
|
};
|
|
@@ -1,7 +1,111 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Platform } from "react-native";
|
|
2
|
+
import {
|
|
3
|
+
thumbprint,
|
|
4
|
+
type CryptoContext,
|
|
5
|
+
SignJWT,
|
|
6
|
+
} from "@pagopa/io-react-native-jwt";
|
|
7
|
+
import type { IntegrityContext } from "../../utils/integrity";
|
|
8
|
+
import { LogLevel, Logger } from "../../utils/logging";
|
|
9
|
+
import { fixBase64EncodingOnKey, JWK } from "../../utils/jwk";
|
|
10
|
+
import { getWalletProviderClient } from "../../client";
|
|
11
|
+
import type { WalletAttestationRequestParams } from "../api/types";
|
|
2
12
|
import type { WalletInstanceAttestationApi } from "../api";
|
|
13
|
+
import { WalletInstanceAttestationResponse } from "./types";
|
|
14
|
+
|
|
15
|
+
async function getAttestationRequest(
|
|
16
|
+
{
|
|
17
|
+
challenge,
|
|
18
|
+
walletSolutionId,
|
|
19
|
+
walletSolutionVersion,
|
|
20
|
+
}: WalletAttestationRequestParams & { challenge: string },
|
|
21
|
+
wiaCryptoContext: CryptoContext,
|
|
22
|
+
integrityContext: IntegrityContext
|
|
23
|
+
): Promise<string> {
|
|
24
|
+
const jwk = await wiaCryptoContext.getPublicKey();
|
|
25
|
+
const parsedJwk = JWK.parse(jwk);
|
|
26
|
+
const keyThumbprint = await thumbprint(parsedJwk);
|
|
27
|
+
const publicKey = { ...parsedJwk, kid: keyThumbprint };
|
|
28
|
+
|
|
29
|
+
const clientData = {
|
|
30
|
+
challenge,
|
|
31
|
+
jwk_thumbprint: keyThumbprint,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const hardwareKeyTag = integrityContext.getHardwareKeyTag();
|
|
35
|
+
const { signature, authenticatorData } =
|
|
36
|
+
await integrityContext.getHardwareSignatureWithAuthData(
|
|
37
|
+
JSON.stringify(clientData)
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return new SignJWT(wiaCryptoContext)
|
|
41
|
+
.setPayload({
|
|
42
|
+
iss: hardwareKeyTag,
|
|
43
|
+
nonce: challenge,
|
|
44
|
+
platform: Platform.OS,
|
|
45
|
+
hardware_signature: signature,
|
|
46
|
+
integrity_assertion: authenticatorData,
|
|
47
|
+
hardware_key_tag: hardwareKeyTag,
|
|
48
|
+
wallet_solution_id: walletSolutionId,
|
|
49
|
+
wallet_solution_version: walletSolutionVersion,
|
|
50
|
+
cnf: {
|
|
51
|
+
jwk: fixBase64EncodingOnKey(publicKey),
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
.setProtectedHeader({
|
|
55
|
+
kid: publicKey.kid,
|
|
56
|
+
typ: "wia-request+jwt",
|
|
57
|
+
})
|
|
58
|
+
.setIssuedAt()
|
|
59
|
+
.setExpirationTime("1h")
|
|
60
|
+
.sign();
|
|
61
|
+
}
|
|
3
62
|
|
|
4
63
|
export const getAttestation: WalletInstanceAttestationApi["getAttestation"] =
|
|
5
|
-
(
|
|
6
|
-
|
|
64
|
+
async (
|
|
65
|
+
requestParams,
|
|
66
|
+
{ wiaCryptoContext, integrityContext, appFetch = fetch }
|
|
67
|
+
) => {
|
|
68
|
+
const api = getWalletProviderClient({
|
|
69
|
+
walletProviderBaseUrl: requestParams.walletProviderBaseUrl,
|
|
70
|
+
appFetch,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const challenge = await api
|
|
74
|
+
.get("/nonce")
|
|
75
|
+
.then((response) => response.nonce);
|
|
76
|
+
Logger.log(
|
|
77
|
+
LogLevel.DEBUG,
|
|
78
|
+
`Challenge obtained from ${requestParams.walletProviderBaseUrl}: ${challenge} `
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const signedAttestationRequest = await getAttestationRequest(
|
|
82
|
+
{ challenge, ...requestParams },
|
|
83
|
+
wiaCryptoContext,
|
|
84
|
+
integrityContext
|
|
85
|
+
);
|
|
86
|
+
Logger.log(
|
|
87
|
+
LogLevel.DEBUG,
|
|
88
|
+
`Signed attestation request: ${signedAttestationRequest}`
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const response = await api
|
|
92
|
+
.post("/wallet-instance-attestations", {
|
|
93
|
+
header: {
|
|
94
|
+
"Content-Type": "text/plain",
|
|
95
|
+
},
|
|
96
|
+
body: signedAttestationRequest,
|
|
97
|
+
})
|
|
98
|
+
.then(WalletInstanceAttestationResponse.parse);
|
|
99
|
+
|
|
100
|
+
Logger.log(
|
|
101
|
+
LogLevel.DEBUG,
|
|
102
|
+
`Obtained Wallet Instance Attestation in jwt format: ${response.wallet_instance_attestation}`
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
return [
|
|
106
|
+
{
|
|
107
|
+
format: "jwt",
|
|
108
|
+
attestation: response.wallet_instance_attestation,
|
|
109
|
+
},
|
|
110
|
+
];
|
|
7
111
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createMapper } from "../../utils/mappers";
|
|
2
|
+
import { DecodedWalletInstanceAttestation } from "../api/types";
|
|
3
|
+
import { WalletInstanceAttestationJwt } from "./types";
|
|
4
|
+
|
|
5
|
+
export const mapToDecodedWalletInstanceAttestation = createMapper<
|
|
6
|
+
WalletInstanceAttestationJwt,
|
|
7
|
+
DecodedWalletInstanceAttestation
|
|
8
|
+
>(
|
|
9
|
+
({ payload }) => {
|
|
10
|
+
const { eudi_wallet_info, ...rest } = payload;
|
|
11
|
+
return {
|
|
12
|
+
...rest,
|
|
13
|
+
wallet_provider_name: eudi_wallet_info.general_info.wallet_provider_name,
|
|
14
|
+
wallet_solution_id: eudi_wallet_info.general_info.wallet_solution_id,
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
{ outputSchema: DecodedWalletInstanceAttestation }
|
|
18
|
+
);
|
|
@@ -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
|
+
}
|