@pagopa/io-react-native-wallet 0.15.2 → 0.15.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/lib/commonjs/client/generated/wallet-provider.js +4 -2
  2. package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
  3. package/lib/commonjs/credential/issuance/05-authorize-access.js +13 -9
  4. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  5. package/lib/commonjs/credential/issuance/06-obtain-credential.js +13 -1
  6. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  7. package/lib/commonjs/credential/issuance/const.js +3 -1
  8. package/lib/commonjs/credential/issuance/const.js.map +1 -1
  9. package/lib/commonjs/wallet-instance-attestation/issuing.js +4 -4
  10. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  11. package/lib/commonjs/wallet-instance-attestation/types.js +5 -1
  12. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  13. package/lib/module/client/generated/wallet-provider.js +4 -2
  14. package/lib/module/client/generated/wallet-provider.js.map +1 -1
  15. package/lib/module/credential/issuance/05-authorize-access.js +15 -11
  16. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  17. package/lib/module/credential/issuance/06-obtain-credential.js +13 -2
  18. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  19. package/lib/module/credential/issuance/const.js +1 -0
  20. package/lib/module/credential/issuance/const.js.map +1 -1
  21. package/lib/module/wallet-instance-attestation/issuing.js +4 -4
  22. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  23. package/lib/module/wallet-instance-attestation/types.js +3 -0
  24. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  25. package/lib/typescript/client/generated/wallet-provider.d.ts +21 -3
  26. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
  27. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +1 -1
  28. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  29. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +1 -1
  30. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  31. package/lib/typescript/credential/issuance/const.d.ts +1 -0
  32. package/lib/typescript/credential/issuance/const.d.ts.map +1 -1
  33. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  34. package/lib/typescript/wallet-instance-attestation/types.d.ts +8 -0
  35. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/client/generated/wallet-provider.ts +4 -2
  38. package/src/credential/issuance/05-authorize-access.ts +21 -16
  39. package/src/credential/issuance/06-obtain-credential.ts +23 -3
  40. package/src/credential/issuance/const.ts +2 -0
  41. package/src/wallet-instance-attestation/issuing.ts +4 -4
  42. package/src/wallet-instance-attestation/types.ts +5 -0
@@ -12,7 +12,9 @@ const NonceDetailView = _zod.default.object({
12
12
  nonce: _zod.default.string()
13
13
  });
14
14
  exports.NonceDetailView = NonceDetailView;
15
- const WalletAttestationView = _zod.default.string();
15
+ const WalletAttestationView = _zod.default.object({
16
+ wallet_attestation: _zod.default.string()
17
+ });
16
18
  exports.WalletAttestationView = WalletAttestationView;
17
19
  const CreateWalletInstanceBody = _zod.default.object({
18
20
  challenge: _zod.default.string(),
@@ -59,7 +61,7 @@ const post_CreateWalletAttestation = {
59
61
  parameters: _zod.default.object({
60
62
  body: CreateWalletAttestationBody
61
63
  }),
62
- response: _zod.default.unknown()
64
+ response: WalletAttestationView
63
65
  };
64
66
 
65
67
  // <EndpointByMethod>
@@ -1 +1 @@
1
- {"version":3,"names":["_zod","_interopRequireDefault","require","obj","__esModule","default","NonceDetailView","z","object","nonce","string","exports","WalletAttestationView","CreateWalletInstanceBody","challenge","key_attestation","hardware_key_tag","CreateWalletAttestationBody","grant_type","literal","assertion","ProblemDetail","type","optional","title","status","number","detail","instance","FiscalCode","Id","get_GetNonce","method","path","parameters","never","response","post_CreateWalletInstance","body","unknown","post_CreateWalletAttestation","EndpointByMethod","get","post","ApiClient","baseUrl","constructor","fetcher","setBaseUrl","arguments","length","undefined","createApiClient"],"sourceRoot":"../../../../src","sources":["client/generated/wallet-provider.ts"],"mappings":";;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoB,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGb,MAAMG,eAAe,GAAGC,YAAC,CAACC,MAAM,CAAC;EACtCC,KAAK,EAAEF,YAAC,CAACG,MAAM,CAAC;AAClB,CAAC,CAAC;AAACC,OAAA,CAAAL,eAAA,GAAAA,eAAA;AAGI,MAAMM,qBAAqB,GAAGL,YAAC,CAACG,MAAM,CAAC,CAAC;AAACC,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAGzC,MAAMC,wBAAwB,GAAGN,YAAC,CAACC,MAAM,CAAC;EAC/CM,SAAS,EAAEP,YAAC,CAACG,MAAM,CAAC,CAAC;EACrBK,eAAe,EAAER,YAAC,CAACG,MAAM,CAAC,CAAC;EAC3BM,gBAAgB,EAAET,YAAC,CAACG,MAAM,CAAC;AAC7B,CAAC,CAAC;AAACC,OAAA,CAAAE,wBAAA,GAAAA,wBAAA;AAGI,MAAMI,2BAA2B,GAAGV,YAAC,CAACC,MAAM,CAAC;EAClDU,UAAU,EAAEX,YAAC,CAACY,OAAO,CAAC,6CAA6C,CAAC;EACpEC,SAAS,EAAEb,YAAC,CAACG,MAAM,CAAC;AACtB,CAAC,CAAC;AAACC,OAAA,CAAAM,2BAAA,GAAAA,2BAAA;AAGI,MAAMI,aAAa,GAAGd,YAAC,CAACC,MAAM,CAAC;EACpCc,IAAI,EAAEf,YAAC,CAACG,MAAM,CAAC,CAAC,CAACa,QAAQ,CAAC,CAAC;EAC3BC,KAAK,EAAEjB,YAAC,CAACG,MAAM,CAAC,CAAC,CAACa,QAAQ,CAAC,CAAC;EAC5BE,MAAM,EAAElB,YAAC,CAACmB,MAA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA"}
1
+ {"version":3,"names":["_zod","_interopRequireDefault","require","obj","__esModule","default","NonceDetailView","z","object","nonce","string","exports","WalletAttestationView","wallet_attestation","CreateWalletInstanceBody","challenge","key_attestation","hardware_key_tag","CreateWalletAttestationBody","grant_type","literal","assertion","ProblemDetail","type","optional","title","status","number","detail","instance","FiscalCode","Id","get_GetNonce","method","path","parameters","never","response","post_CreateWalletInstance","body","unknown","post_CreateWalletAttestation","EndpointByMethod","get","post","ApiClient","baseUrl","constructor","fetcher","setBaseUrl","arguments","length","undefined","createApiClient"],"sourceRoot":"../../../../src","sources":["client/generated/wallet-provider.ts"],"mappings":";;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoB,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGb,MAAMG,eAAe,GAAGC,YAAC,CAACC,MAAM,CAAC;EACtCC,KAAK,EAAEF,YAAC,CAACG,MAAM,CAAC;AAClB,CAAC,CAAC;AAACC,OAAA,CAAAL,eAAA,GAAAA,eAAA;AAGI,MAAMM,qBAAqB,GAAGL,YAAC,CAACC,MAAM,CAAC;EAC5CK,kBAAkB,EAAEN,YAAC,CAACG,MAAM,CAAC;AAC/B,CAAC,CAAC;AAACC,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAGI,MAAME,wBAAwB,GAAGP,YAAC,CAACC,MAAM,CAAC;EAC/CO,SAAS,EAAER,YAAC,CAACG,MAAM,CAAC,CAAC;EACrBM,eAAe,EAAET,YAAC,CAACG,MAAM,CAAC,CAAC;EAC3BO,gBAAgB,EAAEV,YAAC,CAACG,MAAM,CAAC;AAC7B,CAAC,CAAC;AAACC,OAAA,CAAAG,wBAAA,GAAAA,wBAAA;AAGI,MAAMI,2BAA2B,GAAGX,YAAC,CAACC,MAAM,CAAC;EAClDW,U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V,IAAU,EAE+B;IACzC,OAAO,IAAI,CAACc,OAAO,CAAC,MAAM,EAAE,IAAI,CAACF,OAAO,GAAGZ,IAAI,EAAAgB,SAAA,CAAAC,MAAA,QAAAC,SAAA,GAAAF,SAAA,GAAW,CAAC;EAC7D;EACA;AACF;AAACvC,OAAA,CAAAkC,SAAA,GAAAA,SAAA;AAEM,SAASQ,eAAeA,CAACL,OAAgB,EAAEF,OAAgB,EAAE;EAClE,OAAO,IAAID,SAAS,CAACG,OAAO,CAAC,CAACC,UAAU,CAACH,OAAO,IAAI,EAAE,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA"}
@@ -13,6 +13,7 @@ var WalletInstanceAttestation = _interopRequireWildcard(require("../../wallet-in
13
13
  var _const = require("./const");
14
14
  var _types = require("./types");
15
15
  var _errors = require("../../utils/errors");
16
+ var _ioReactNativeCrypto = require("@pagopa/io-react-native-crypto");
16
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -43,14 +44,17 @@ const authorizeAccess = async (issuerConf, code, clientId, redirectUri, codeVeri
43
44
  const aud = `${parUrl.protocol}//${parUrl.hostname}`;
44
45
  const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
45
46
  const tokenUrl = issuerConf.oauth_authorization_server.token_endpoint;
46
- // Use an ephemeral key to be destroyed after use
47
- const tokenRequestSignedDPop = await (0, _crypto.withEphemeralKey)(async ephimeralContext => {
48
- return await (0, _dpop.createDPopToken)({
49
- htm: "POST",
50
- htu: tokenUrl,
51
- jti: `${_reactNativeUuid.default.v4()}`
52
- }, ephimeralContext);
53
- });
47
+ try {
48
+ await (0, _ioReactNativeCrypto.generate)(_const.DPOP_KET_TAG);
49
+ } catch {
50
+ console.log("DPoP key already exist");
51
+ }
52
+ const dPoPContext = (0, _crypto.createCryptoContextFor)(_const.DPOP_KET_TAG);
53
+ const tokenRequestSignedDPop = await (0, _dpop.createDPopToken)({
54
+ htm: "POST",
55
+ htu: tokenUrl,
56
+ jti: `${_reactNativeUuid.default.v4()}`
57
+ }, dPoPContext);
54
58
  const signedWiaPoP = await (0, _pop.createPopToken)({
55
59
  jti: `${_reactNativeUuid.default.v4()}`,
56
60
  aud,
@@ -79,7 +83,7 @@ const authorizeAccess = async (issuerConf, code, clientId, redirectUri, codeVeri
79
83
  }
80
84
  return {
81
85
  accessToken: tokenRes.data,
82
- tokenRequestSignedDPop
86
+ dPoPContext
83
87
  };
84
88
  };
85
89
  exports.authorizeAccess = authorizeAccess;
@@ -1 +1 @@
1
- {"version":3,"names":["_misc","require","_crypto","_dpop","_reactNativeUuid","_interopRequireDefault","_pop","WalletInstanceAttestation","_interopRequireWildcard","_const","_types","_errors","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","parEndpoint","oauth_authorization_server","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","tokenRequestSignedDPop","withEphemeralKey","ephimeralContext","createDPopToken","htm","htu","jti","uuid","v4","signedWiaPoP","createPopToken","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","ASSERTION_TYPE","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","hasStatus","res","json","TokenResponse","safeParse","success","ValidationFailed","error","message","accessToken","data","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,yBAAA,GAAAC,uBAAA,CAAAP,OAAA;AAEA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AAAsD,SAAAW,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAL,wBAAAS,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,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AAC,CAAC,CACpBD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAAEF,IAAI,IAAKM,oBAAa,CAACC,SAAS,CAACP,IAAI,CAAC,CAAC;EAEhD,IAAI,CAACJ,QAAQ,CAACY,OAAO,EAAE;IACrB,MAAM,IAAIC,wBAAgB,CAACb,QAAQ,CAACc,KAAK,CAACC,OAAO,CAAC;EACpD;EAEA,OAAO;IAAEC,WAAW,EAAEhB,QAAQ,CAACiB,IAAI;IAAEtC;EAAuB,CAAC;AAC/D,CAAC;AAACuC,OAAA,CAAAlE,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["_misc","require","_crypto","_dpop","_reactNativeUuid","_interopRequireDefault","_pop","WalletInstanceAttestation","_interopRequireWildcard","_const","_types","_errors","_ioReactNativeCrypto","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","parEndpoint","oauth_authorization_server","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","generate","DPOP_KET_TAG","console","log","dPoPContext","createCryptoContextFor","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuid","v4","signedWiaPoP","createPopToken","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","ASSERTION_TYPE","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","hasStatus","res","json","TokenResponse","safeParse","success","ValidationFailed","error","message","accessToken","data","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AA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AAtE,eAAA,GAAAA,eAAA"}
@@ -8,6 +8,11 @@ var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
8
8
  var _misc = require("../../utils/misc");
9
9
  var _errors = require("../../utils/errors");
10
10
  var _types = require("./types");
11
+ var _dpop = require("../../utils/dpop");
12
+ var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
13
+ var _ioReactNativeCrypto = require("@pagopa/io-react-native-crypto");
14
+ var _const = require("./const");
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
16
  const createNonceProof = async (nonce, issuer, audience, ctx) => {
12
17
  const jwk = await ctx.getPublicKey();
13
18
  return new _ioReactNativeJwt.SignJWT(ctx).setPayload({
@@ -34,7 +39,7 @@ const createNonceProof = async (nonce, issuer, audience, ctx) => {
34
39
  * @returns The credential response containing the credential
35
40
  */
36
41
  exports.createNonceProof = createNonceProof;
37
- const obtainCredential = async (issuerConf, accessToken, clientId, credentialDefinition, tokenRequestSignedDPop, context) => {
42
+ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDefinition, dPoPContext, context) => {
38
43
  const {
39
44
  credentialCryptoContext,
40
45
  appFetch = fetch
@@ -65,6 +70,13 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
65
70
  proof_type: "jwt"
66
71
  }
67
72
  };
73
+ const tokenRequestSignedDPop = await await (0, _dpop.createDPopToken)({
74
+ htm: "POST",
75
+ htu: credentialUrl,
76
+ jti: `${_reactNativeUuid.default.v4()}`,
77
+ ath: await (0, _ioReactNativeJwt.sha256ToBase64)(accessToken.access_token)
78
+ }, dPoPContext);
79
+ await (0, _ioReactNativeCrypto.deleteKey)(_const.DPOP_KET_TAG);
68
80
  const credentialRes = await appFetch(credentialUrl, {
69
81
  method: "POST",
70
82
  headers: {
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_misc","_errors","_types","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","exports","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","tokenRequestSignedDPop","context","credentialCryptoContext","appFetch","fetch","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","constainsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","ValidationFailed","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","credentialRes","method","headers","DPoP","Authorization","token_type","access_token","body","JSON","stringify","then","hasStatus","res","json","CredentialResponse","safeParse","success","error","message","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAcO,MAAMI,gBAAgB,GAAG,MAAAA,CAC9BC,KAAa,EACbC,MAAc,EACdC,QAAgB,EAChBC,GAAkB,KACE;EACpB,MAAMC,GAAG,GAAG,MAAMD,GAAG,CAACE,YAAY,CAAC,CAAC;EACpC,OAAO,IAAIC,yBAAO,CAACH,GAAG,CAAC,CACpBI,UAAU,CAAC;IACVP;EACF,CAAC,CAAC,CACDQ,kBAAkB,CAAC;IAClBC,GAAG,EAAE,sBAAsB;IAC3BL;EACF,CAAC,CAAC,CACDM,WAAW,CAACR,QAAQ,CAAC,CACrBS,SAAS,CAACV,MAAM,CAAC,CACjBW,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,MAAM,CAAC,CACzBC,IAAI,CAAC,CAAC;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdAC,OAAA,CAAAhB,gBAAA,GAAAA,gBAAA;AAeO,MAAMiB,gBAAkC,GAAG,MAAAA,CAChDC,UAAU,EACVC,WAAW,EACXC,QAAQ,EACRC,oBAAoB,EACpBC,sBAAsB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,GAAG,CAAC,CAAC,CACpBD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAAEH,IAAI,IAAKO,yBAAkB,CAACC,SAAS,CAACR,IAAI,CAAC,CAAC;EAErD,IAAI,CAACP,aAAa,CAACgB,OAAO,EAAE;IAC1B,MAAM,IAAItB,wBAAgB,CAACM,aAAa,CAACiB,KAAK,CAACC,OAAO,CAAC;EACzD;EAEA,OAAOlB,aAAa,CAACmB,IAAI;AAC3B,CAAC;AAAChD,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_misc","_errors","_types","_dpop","_reactNativeUuid","_interopRequireDefault","_ioReactNativeCrypto","_const","obj","__esModule","default","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","exports","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","dPoPContext","context","credentialCryptoContext","appFetch","fetch","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","constainsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","ValidationFailed","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuid","v4","ath","sha256ToBase64","access_token","deleteKey","DPOP_KET_TAG","credentialRes","method","headers","DPoP","Authorization","token_type","body","JSON","stringify","then","hasStatus","res","json","CredentialResponse","safeParse","success","error","message","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAC,sBAAA,CAAAN,O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,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAAEH,IAAI,IAAKO,yBAAkB,CAACC,SAAS,CAACR,IAAI,CAAC,CAAC;EAErD,IAAI,CAACN,aAAa,CAACe,OAAO,EAAE;IAC1B,MAAM,IAAIjC,wBAAgB,CAACkB,aAAa,CAACgB,KAAK,CAACC,OAAO,CAAC;EACzD;EAEA,OAAOjB,aAAa,CAACkB,IAAI;AAC3B,CAAC;AAAC3D,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
@@ -3,12 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.SupportedCredentialFormat = exports.ASSERTION_TYPE = void 0;
6
+ exports.SupportedCredentialFormat = exports.DPOP_KET_TAG = exports.ASSERTION_TYPE = void 0;
7
7
  var z = _interopRequireWildcard(require("zod"));
8
8
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9
9
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
10
10
  const ASSERTION_TYPE = "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation";
11
11
  exports.ASSERTION_TYPE = ASSERTION_TYPE;
12
+ const DPOP_KET_TAG = `dpop`;
13
+ exports.DPOP_KET_TAG = DPOP_KET_TAG;
12
14
  const SupportedCredentialFormat = z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]);
13
15
  exports.SupportedCredentialFormat = SupportedCredentialFormat;
14
16
  //# sourceMappingURL=const.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["z","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ASSERTION_TYPE","exports","SupportedCredentialFormat","union","literal"],"sourceRoot":"../../../../src","sources":["credential/issuance/const.ts"],"mappings":";;;;;;AAAA,IAAAA,CAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAyB,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAClB,MAAMW,cAAc,GACzB,oEAAoE;AAACC,OAAA,CAAAD,cAAA,GAAAA,cAAA;AAKhE,MAAME,yBAAyB,GAAG3B,CAAC,CAAC4B,KAAK,CAAC,CAC/C5B,CAAC,CAAC6B,OAAO,CAAC,WAAW,CAAC,EACtB7B,CAAC,CAAC6B,OAAO,CAAC,cAAc,CAAC,CAC1B,CAAC;AAACH,OAAA,CAAAC,yBAAA,GAAAA,yBAAA"}
1
+ {"version":3,"names":["z","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ASSERTION_TYPE","exports","DPOP_KET_TAG","SupportedCredentialFormat","union","literal"],"sourceRoot":"../../../../src","sources":["credential/issuance/const.ts"],"mappings":";;;;;;AAAA,IAAAA,CAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAyB,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA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,yBAAA,GAAAA,yBAAA"}
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getAttestation = void 0;
7
7
  exports.getAttestationRequest = getAttestationRequest;
8
8
  var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
9
- var _zod = require("zod");
10
9
  var _jwk = require("../utils/jwk");
11
10
  var _client = require("../client");
12
11
  var _errors = require("../utils/errors");
12
+ var _types = require("./types");
13
13
  /**
14
14
  * Getter for an attestation request. The attestation request is a JWT that will be sent to the Wallet Provider to request a Wallet Instance Attestation.
15
15
  *
@@ -81,13 +81,13 @@ const getAttestation = async _ref => {
81
81
  const signedAttestationRequest = await getAttestationRequest(challenge, wiaCryptoContext, integrityContext, walletProviderBaseUrl);
82
82
 
83
83
  // 3. Request WIA
84
- const wia = await api.post("/token", {
84
+ const tokenResponse = await api.post("/token", {
85
85
  body: {
86
86
  grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
87
87
  assertion: signedAttestationRequest
88
88
  }
89
- }).then(result => _zod.z.string().parse(result)).catch(handleAttestationCreationError);
90
- return wia;
89
+ }).then(result => _types.TokenResponse.parse(result)).catch(handleAttestationCreationError);
90
+ return tokenResponse.wallet_attestation;
91
91
  };
92
92
  exports.getAttestation = getAttestation;
93
93
  const handleAttestationCreationError = e => {
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_zod","_jwk","_client","_errors","getAttestationRequest","challenge","wiaCryptoContext","integrityContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","clientData","jwk_thumbprint","hardwareKeyTag","getHardwareKeyTag","signature","authenticatorData","getHardwareSignatureWithAuthData","JSON","stringify","SignJWT","setPayload","iss","sub","hardware_signature","integrity_assertion","hardware_key_tag","cnf","fixBase64EncodingOnKey","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","api","getWalletProviderClient","get","then","response","nonce","signedAttestationRequest","wia","post","body","grant_type","assertion","result","z","string","catch","handleAttestationCreationError","exports","e","WalletProviderResponseError","statusCode","WalletInstanceRevokedError","claim","reason","WalletInstanceNotFoundError","WalletInstanceAttestationIssuingError"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeK,qBAAqBA,CACzCC,SAAiB,EACjBC,gBAA+B,EAC/BC,gBAAkC,EAClCC,qBAA6B,EACZ;EACjB,MAAMC,GAAG,GAAG,MAAMH,gBAAgB,CAACI,YAAY,CAAC,CAAC;EACjD,MAAMC,SAAS,GAAGC,QAAG,CAACC,KAAK,CAACJ,GAAG,CAAC;EAChC,MAAMK,aAAa,GAAG,MAAM,IAAAC,4BAAU,EAACJ,SAAS,CAAC;EACjD,MAAMK,SAAS,GAAG;IAAE,GAAGL,SAAS;IAAEM,GAAG,EAAEH;EAAc,CAAC;EAEtD,MAAMI,UAAU,GAAG;IACjBb,SAAS;IACTc,cAAc,EAAEL;EAClB,CAAC;EAED,MAAMM,cAAc,GAAGb,gBAAgB,CAACc,iBAAiB,CAAC,CAAC;EAC3D,MAAM;IAAEC,SAAS;IAAEC;EAAkB,CAAC,GACpC,MAAMhB,gBAAgB,CAACiB,gCAAgC,CACrDC,IAAI,CAACC,SAAS,CAACR,UAAU,CAC3B,CAAC;EAEH,OAAO,IAAIS,yBAAO,CAACrB,gBAAgB,CAAC,CACjCsB,UAAU,CAAC;IACVC,GAAG,EAAEf,aAAa;IAClBgB,GAAG,EAAEtB,qBAAqB;IAC1BH,SAAS;IACT0B,kBAAkB,EAAET,SAAS;IAC7BU,mBAAmB,EAAET,iBAAiB;IACtCU,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B,GAAIE,CAAU,IAAK;EACrD,IAAI,EAAEA,CAAC,YAAYC,mCAA2B,CAAC,EAAE;IAC/C,MAAMD,CAAC;EACT;EAEA,IAAIA,CAAC,CAACE,UAAU,KAAK,GAAG,EAAE;IACxB,MAAM,IAAIC,kCAA0B,CAClC,4DAA4D,EAC5DH,CAAC,CAACI,KAAK,EACPJ,CAAC,CAACK,MACJ,CAAC;EACH;EAEA,IAAIL,CAAC,CAACE,UAAU,KAAK,GAAG,EAAE;IACxB,MAAM,IAAII,mCAA2B,CACnC,wEAAwE,EACxEN,CAAC,CAACI,KAAK,EACPJ,CAAC,CAACK,MACJ,CAAC;EACH;EAEA,MAAM,IAAIE,6CAAqC,CAC5C,uEAAsEP,CAAC,CAACE,UAAW,GAAE,EACtFF,CAAC,CAACI,KAAK,EACPJ,CAAC,CAACK,MACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_jwk","_client","_errors","_types","getAttestationRequest","challenge","wiaCryptoContext","integrityContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","clientData","jwk_thumbprint","hardwareKeyTag","getHardwareKeyTag","signature","authenticatorData","getHardwareSignatureWithAuthData","JSON","stringify","SignJWT","setPayload","iss","sub","hardware_signature","integrity_assertion","hardware_key_tag","cnf","fixBase64EncodingOnKey","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","api","getWalletProviderClient","get","then","response","nonce","signedAttestationRequest","tokenResponse","post","body","grant_type","assertion","result","TokenResponse","catch","handleAttestationCreationError","wallet_attestation","exports","e","WalletProviderResponseError","statusCode","WalletInstanceRevokedError","claim","reason","WalletInstanceNotFoundError","WalletInstanceAttestationIssuingError"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IA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C,CAACE,UAAU,KAAK,GAAG,EAAE;IACxB,MAAM,IAAII,mCAA2B,CACnC,wEAAwE,EACxEN,CAAC,CAACI,KAAK,EACPJ,CAAC,CAACK,MACJ,CAAC;EACH;EAEA,MAAM,IAAIE,6CAAqC,CAC5C,uEAAsEP,CAAC,CAACE,UAAW,GAAE,EACtFF,CAAC,CAACI,KAAK,EACPJ,CAAC,CAACK,MACJ,CAAC;AACH,CAAC"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WalletInstanceAttestationRequestJwt = exports.WalletInstanceAttestationJwt = void 0;
6
+ exports.WalletInstanceAttestationRequestJwt = exports.WalletInstanceAttestationJwt = exports.TokenResponse = void 0;
7
7
  var _jwk = require("../utils/jwk");
8
8
  var z = _interopRequireWildcard(require("zod"));
9
9
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -63,4 +63,8 @@ const WalletInstanceAttestationJwt = z.object({
63
63
  }))
64
64
  });
65
65
  exports.WalletInstanceAttestationJwt = WalletInstanceAttestationJwt;
66
+ const TokenResponse = z.object({
67
+ wallet_attestation: z.string()
68
+ });
69
+ exports.TokenResponse = TokenResponse;
66
70
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_jwk","require","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","iat","exp","cnf","jwk","intersection","JWK","WalletInstanceAttestationRequestJwt","shape","literal","aud","jti","nonce","exports","WalletInstanceAttestationJwt","sub","aal","authorization_endpoint","response_types_supported","vp_formats_supported","request_object_signing_alg_values_supported","presentation_definition_uri_supported","boolean"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/types.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAyB,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CA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K,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC;MACzC,CAAC,CAAC,CACDK,QAAQ,CAAC,CAAC;MACb,WAAW,EAAErC,CAAC,CACX6B,MAAM,CAAC;QACN,mBAAmB,EAAE7B,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC;MACzC,CAAC,CAAC,CACDK,QAAQ,CAAC;IACd,CAAC,CAAC;IACFuB,2CAA2C,EAAE5D,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC,CAAC;IAChE6B,qCAAqC,EAAE7D,CAAC,CAAC8D,OAAO,CAAC;EACnD,CAAC,CACH;AACF,CAAC,CAAC;AAACT,OAAA,CAAAC,4BAAA,GAAAA,4BAAA"}
1
+ {"version":3,"names":["_jwk","require","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","iat","exp","cnf","jwk","intersection","JWK","WalletInstanceAttestationRequestJwt","shape","literal","aud","jti","nonce","exports","WalletInstanceAttestationJwt","sub","aal","authorization_endpoint","response_types_supported","vp_formats_supported","request_object_signing_alg_values_supported","presentation_definition_uri_supported","boolean","TokenResponse","wallet_attestation"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/types.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAyB,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,W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AAC;AAACT,OAAA,CAAAC,4BAAA,GAAAA,4BAAA;AAGI,MAAMS,aAAa,GAAG/D,CAAC,CAAC6B,MAAM,CAAC;EACpCmC,kBAAkB,EAAEhE,CAAC,CAACgC,MAAM,CAAC;AAC/B,CAAC,CAAC;AAACqB,OAAA,CAAAU,aAAA,GAAAA,aAAA"}
@@ -2,7 +2,9 @@ import z from "zod";
2
2
  export const NonceDetailView = z.object({
3
3
  nonce: z.string()
4
4
  });
5
- export const WalletAttestationView = z.string();
5
+ export const WalletAttestationView = z.object({
6
+ wallet_attestation: z.string()
7
+ });
6
8
  export const CreateWalletInstanceBody = z.object({
7
9
  challenge: z.string(),
8
10
  key_attestation: z.string(),
@@ -41,7 +43,7 @@ export const post_CreateWalletAttestation = {
41
43
  parameters: z.object({
42
44
  body: CreateWalletAttestationBody
43
45
  }),
44
- response: z.unknown()
46
+ response: WalletAttestationView
45
47
  };
46
48
 
47
49
  // <EndpointByMethod>
@@ -1 +1 @@
1
- {"version":3,"names":["z","NonceDetailView","object","nonce","string","WalletAttestationView","CreateWalletInstanceBody","challenge","key_attestation","hardware_key_tag","CreateWalletAttestationBody","grant_type","literal","assertion","ProblemDetail","type","optional","title","status","number","detail","instance","FiscalCode","Id","get_GetNonce","method","path","parameters","never","response","post_CreateWalletInstance","body","unknown","post_CreateWalletAttestation","EndpointByMethod","get","post","ApiClient","baseUrl","constructor","fetcher","setBaseUrl","arguments","length","undefined","createApiClient"],"sourceRoot":"../../../../src","sources":["client/generated/wallet-provider.ts"],"mappings":"AAAA,OAAOA,CAAC,MAAM,KAAK;AAGnB,OAAO,MAAMC,eAAe,GAAGD,CAAC,CAACE,MAAM,CAAC;EACtCC,KAAK,EAAEH,CAAC,CAACI,MAAM,CAAC;AAClB,CAAC,CAAC;AAGF,OAAO,MAAMC,qBAAqB,GAAGL,CAAC,CAACI,MAAM,CAAC,CAAC;AAG/C,OAAO,MAAME,wBAAwB,GAAGN,CAAC,CAACE,MAAM,CAAC;EAC/CK,S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,OAAO,CAAC,MAAM,EAAE,IAAI,CAACF,OAAO,GAAGZ,IAAI,EAAAgB,SAAA,CAAAC,MAAA,QAAAC,SAAA,GAAAF,SAAA,GAAW,CAAC;EAC7D;EACA;AACF;;AAEA,OAAO,SAASG,eAAeA,CAACL,OAAgB,EAAEF,OAAgB,EAAE;EAClE,OAAO,IAAID,SAAS,CAACG,OAAO,CAAC,CAACC,UAAU,CAACH,OAAO,IAAI,EAAE,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA"}
1
+ {"version":3,"names":["z","NonceDetailView","object","nonce","string","WalletAttestationView","wallet_attestation","CreateWalletInstanceBody","challenge","key_attestation","hardware_key_tag","CreateWalletAttestationBody","grant_type","literal","assertion","ProblemDetail","type","optional","title","status","number","detail","instance","FiscalCode","Id","get_GetNonce","method","path","parameters","never","response","post_CreateWalletInstance","body","unknown","post_CreateWalletAttestation","EndpointByMethod","get","post","ApiClient","baseUrl","constructor","fetcher","setBaseUrl","arguments","length","undefined","createApiClient"],"sourceRoot":"../../../../src","sources":["client/generated/wallet-provider.ts"],"mappings":"AAAA,OAAOA,CAAC,MAAM,KAAK;AAGnB,OAAO,MAAMC,eAAe,GAAGD,CAAC,CAACE,MAAM,CAAC;EACtCC,KAAK,EAAEH,CAAC,CAACI,MAAM,CAAC;AAClB,CAAC,CAAC;AAGF,OAAO,MAAMC,qBAAqB,GAAGL,CAAC,CAACE,MAAM,CAAC;EAC5CI,kBAAkB,EAAEN,CAAC,CAACI,MAAM,CAAC;AAC/B,CAAC,CAAC;AAGF,OAAO,MAAMG,wBAAwB,GAAGP,CAAC,CAACE,MAAM,CAAC;EAC/CM,SAAS,EAAER,CAAC,CAACI,MAAM,CAAC,CAAC;EACrBK,eAAe,EAAET,CAAC,CAACI,MAAM,CAAC,CAAC;EAC3BM,gBAAgB,EAAEV,CAAC,CAACI,MAAM,CAAC;AAC7B,CAAC,CAAC;AAGF,OAAO,MAAMO,2BAA2B,GA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AAO,IAAID,SAAS,CAACG,OAAO,CAAC,CAACC,UAAU,CAACH,OAAO,IAAI,EAAE,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA"}
@@ -1,12 +1,13 @@
1
1
  import { hasStatus } from "../../utils/misc";
2
- import { withEphemeralKey } from "../../utils/crypto";
2
+ import { createCryptoContextFor } from "../../utils/crypto";
3
3
  import { createDPopToken } from "../../utils/dpop";
4
4
  import uuid from "react-native-uuid";
5
5
  import { createPopToken } from "../../utils/pop";
6
6
  import * as WalletInstanceAttestation from "../../wallet-instance-attestation";
7
- import { ASSERTION_TYPE } from "./const";
7
+ import { ASSERTION_TYPE, DPOP_KET_TAG } from "./const";
8
8
  import { TokenResponse } from "./types";
9
9
  import { ValidationFailed } from "../../utils/errors";
10
+ import { generate } from "@pagopa/io-react-native-crypto";
10
11
  /**
11
12
  * Creates and sends the DPoP Proof JWT to be presented with the authorization code to the /token endpoint of the authorization server
12
13
  * for requesting the issuance of an access token bound to the public key of the Wallet Instance contained within the DPoP.
@@ -34,14 +35,17 @@ export const authorizeAccess = async (issuerConf, code, clientId, redirectUri, c
34
35
  const aud = `${parUrl.protocol}//${parUrl.hostname}`;
35
36
  const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
36
37
  const tokenUrl = issuerConf.oauth_authorization_server.token_endpoint;
37
- // Use an ephemeral key to be destroyed after use
38
- const tokenRequestSignedDPop = await withEphemeralKey(async ephimeralContext => {
39
- return await createDPopToken({
40
- htm: "POST",
41
- htu: tokenUrl,
42
- jti: `${uuid.v4()}`
43
- }, ephimeralContext);
44
- });
38
+ try {
39
+ await generate(DPOP_KET_TAG);
40
+ } catch {
41
+ console.log("DPoP key already exist");
42
+ }
43
+ const dPoPContext = createCryptoContextFor(DPOP_KET_TAG);
44
+ const tokenRequestSignedDPop = await createDPopToken({
45
+ htm: "POST",
46
+ htu: tokenUrl,
47
+ jti: `${uuid.v4()}`
48
+ }, dPoPContext);
45
49
  const signedWiaPoP = await createPopToken({
46
50
  jti: `${uuid.v4()}`,
47
51
  aud,
@@ -70,7 +74,7 @@ export const authorizeAccess = async (issuerConf, code, clientId, redirectUri, c
70
74
  }
71
75
  return {
72
76
  accessToken: tokenRes.data,
73
- tokenRequestSignedDPop
77
+ dPoPContext
74
78
  };
75
79
  };
76
80
  //# sourceMappingURL=05-authorize-access.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["hasStatus","withEphemeralKey","createDPopToken","uuid","createPopToken","WalletInstanceAttestation","ASSERTION_TYPE","TokenResponse","ValidationFailed","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","parEndpoint","oauth_authorization_server","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","tokenRequestSignedDPop","ephimeralContext","htm","htu","jti","v4","signedWiaPoP","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","res","json","safeParse","success","error","message","accessToken","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":"AAAA,SAASA,SAAS,QAAkB,kBAAkB;AAGtD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,eAAe,QAAQ,kBAAkB;AAClD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,cAAc,QAAQ,iBAAiB;AAChD,OAAO,KAAKC,yBAAyB,MAAM,mCAAmC;AAE9E,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,aAAa,QAAQ,SAAS;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAgBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAgC,GAAG,MAAAA,CAC9CC,UAAU,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,GAAG,IAAIC,eAAe,CAACR,WAAW,CAAC;EACrE,MAAMS,QAAQ,GAAG,MAAMpC,QAAQ,CAACkB,QAAQ,EAAE;IACxCmB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,mCAAmC;MACnDC,IAAI,EAAEnB;IACR,CAAC;IACDoB,IAAI,EAAEN,4BAA4B,CAACO,QAAQ,CAAC;EAC9C,CAAC,CAAC,CACCC,IAAI,CAAC1D,SAAS,CAAC,GAAG,CAAC,CAAC,CACpB0D,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEF,IAAI,IAAKjD,aAAa,CAACsD,SAAS,CAACL,IAAI,CAAC,CAAC;EAEhD,IAAI,CAACJ,QAAQ,CAACU,OAAO,EAAE;IACrB,MAAM,IAAItD,gBAAgB,CAAC4C,QAAQ,CAACW,KAAK,CAACC,OAAO,CAAC;EACpD;EAEA,OAAO;IAAEC,WAAW,EAAEb,QAAQ,CAACc,IAAI;IAAE9B;EAAuB,CAAC;AAC/D,CAAC"}
1
+ {"version":3,"names":["hasStatus","createCryptoContextFor","createDPopToken","uuid","createPopToken","WalletInstanceAttestation","ASSERTION_TYPE","DPOP_KET_TAG","TokenResponse","ValidationFailed","generate","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","parEndpoint","oauth_authorization_server","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","console","log","dPoPContext","tokenRequestSignedDPop","htm","htu","jti","v4","signedWiaPoP","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","res","json","safeParse","success","error","message","accessToken","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":"AAAA,SAAS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,IAAI;IAAE9B;EAAY,CAAC;AACpD,CAAC"}
@@ -1,7 +1,11 @@
1
- import { SignJWT } from "@pagopa/io-react-native-jwt";
1
+ import { sha256ToBase64, SignJWT } from "@pagopa/io-react-native-jwt";
2
2
  import { hasStatus } from "../../utils/misc";
3
3
  import { ValidationFailed } from "../../utils/errors";
4
4
  import { CredentialResponse } from "./types";
5
+ import { createDPopToken } from "../../utils/dpop";
6
+ import uuid from "react-native-uuid";
7
+ import { deleteKey } from "@pagopa/io-react-native-crypto";
8
+ import { DPOP_KET_TAG } from "./const";
5
9
  export const createNonceProof = async (nonce, issuer, audience, ctx) => {
6
10
  const jwk = await ctx.getPublicKey();
7
11
  return new SignJWT(ctx).setPayload({
@@ -27,7 +31,7 @@ export const createNonceProof = async (nonce, issuer, audience, ctx) => {
27
31
  * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
28
32
  * @returns The credential response containing the credential
29
33
  */
30
- export const obtainCredential = async (issuerConf, accessToken, clientId, credentialDefinition, tokenRequestSignedDPop, context) => {
34
+ export const obtainCredential = async (issuerConf, accessToken, clientId, credentialDefinition, dPoPContext, context) => {
31
35
  const {
32
36
  credentialCryptoContext,
33
37
  appFetch = fetch
@@ -58,6 +62,13 @@ export const obtainCredential = async (issuerConf, accessToken, clientId, creden
58
62
  proof_type: "jwt"
59
63
  }
60
64
  };
65
+ const tokenRequestSignedDPop = await await createDPopToken({
66
+ htm: "POST",
67
+ htu: credentialUrl,
68
+ jti: `${uuid.v4()}`,
69
+ ath: await sha256ToBase64(accessToken.access_token)
70
+ }, dPoPContext);
71
+ await deleteKey(DPOP_KET_TAG);
61
72
  const credentialRes = await appFetch(credentialUrl, {
62
73
  method: "POST",
63
74
  headers: {
@@ -1 +1 @@
1
- {"version":3,"names":["SignJWT","hasStatus","ValidationFailed","CredentialResponse","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","tokenRequestSignedDPop","context","credentialCryptoContext","appFetch","fetch","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","constainsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","credentialRes","method","headers","DPoP","Authorization","token_type","access_token","body","JSON","stringify","then","res","json","safeParse","success","error","message","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":"AAAA,SAASA,OAAO,QAA4B,6BAA6B;AAGzE,SAASC,SAAS,QAAkB,kBAAkB;AAEtD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,kBAAkB,QAAQ,SAAS;AAc5C,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAC9BC,KAAa,EACbC,MAAc,EACdC,QAAgB,EAChBC,GAAkB,KACE;EACpB,MAAMC,GAAG,GAAG,MAAMD,GAAG,CAACE,YAAY,CAAC,CAAC;EACpC,OAAO,IAAIV,OAAO,CAACQ,GAAG,CAAC,CACpBG,UAAU,CAAC;IACVN;EACF,CAAC,CAAC,CACDO,kBAAkB,CAAC;IAClBC,GAAG,EAAE,sBAAsB;IAC3BJ;EACF,CAAC,CAAC,CACDK,WAAW,CAACP,QAAQ,CAAC,CACrBQ,SAAS,CAACT,MAAM,CAAC,CACjBU,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,MAAM,CAAC,CACzBC,IAAI,CAAC,CAAC;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAkC,GAAG,MAAAA,CAChDC,UAAU,EACVC,WAAW,EACXC,QAAQ,EACRC,oBAAoB,EACpBC,sBAAsB,EACtBC,OAAO,KACJ;EACH,MAAM;IAAEC,uBAAuB;IAAEC,QAAQ,GAAGC;EAAM,CAAC,GAAGH,OAAO;EAE7D,MAAMI,aA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AAI,IAAKlD,kBAAkB,CAACwD,SAAS,CAACN,IAAI,CAAC,CAAC;EAErD,IAAI,CAACP,aAAa,CAACc,OAAO,EAAE;IAC1B,MAAM,IAAI1D,gBAAgB,CAAC4C,aAAa,CAACe,KAAK,CAACC,OAAO,CAAC;EACzD;EAEA,OAAOhB,aAAa,CAACiB,IAAI;AAC3B,CAAC"}
1
+ {"version":3,"names":["sha256ToBase64","SignJWT","hasStatus","ValidationFailed","CredentialResponse","createDPopToken","uuid","deleteKey","DPOP_KET_TAG","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","dPoPContext","context","credentialCryptoContext","appFetch","fetch","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","constainsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","tokenRequestSignedDPop","htm","htu","jti","v4","ath","access_token","credentialRes","method","headers","DPoP","Authorization","token_type","body","JSON","stringify","then","res","json","safeParse","success","error","message","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":"AAAA,SACEA,cAAc,EACdC,OAAO,QAEF,6BAA6B;AAGpC,SAASC,SAAS,QAAkB,kBAAkB;AAEtD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,kBAAkB,QAAQ,SAAS;AAE5C,SAASC,eAAe,QAAQ,kBAAkB;AAClD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,SAAS,QAAQ,gCAAgC;AAC1D,SAASC,YAAY,QAAQ,SAAS;AActC,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAC9BC,KAAa,EACbC,MAAc,EACdC,QAAgB,EAChBC,GAAkB,KACE;EACpB,MAAMC,GAAG,GAAG,MAAMD,GAAG,CAACE,YAAY,CAAC,CAAC;EACpC,OAA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D,CAAC;IACDC,MAAM,EAAEhB,oBAAoB,CAACgB,MAAM;IACnCI,KAAK,EAAE;MACLC,GAAG,EAAEZ,gBAAgB;MACrBa,UAAU,EAAE;IACd;EACF,CAAC;EAED,MAAMC,sBAAsB,GAAG,MAAM,MAAM9C,eAAe,CACxD;IACE+C,GAAG,EAAE,MAAM;IACXC,GAAG,EAAEnB,aAAa;IAClBoB,GAAG,EAAG,GAAEhD,IAAI,CAACiD,EAAE,CAAC,CAAE,EAAC;IACnBC,GAAG,EAAE,MAAMxD,cAAc,CAAC0B,WAAW,CAAC+B,YAAY;EACpD,CAAC,EACD5B,WACF,CAAC;EAED,MAAMtB,SAAS,CAACC,YAAY,CAAC;EAC7B,MAAMkD,aAAa,GAAG,MAAM1B,QAAQ,CAACE,aAAa,EAAE;IAClDyB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,kBAAkB;MAClCC,IAAI,EAAEV,sBAAsB;MAC5BW,aAAa,EAAG,GAAEpC,WAAW,CAACqC,UAAW,IAAGrC,WAAW,CAAC+B,YAAa;IACvE,CAAC;IACDO,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACpB,yBAAyB;EAChD,CAAC,CAAC,CACCqB,IAAI,CAACjE,SAAS,CAAC,GAAG,CAAC,CAAC,CACpBiE,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEH,IAAI,IAAK5D,kBAAkB,CAACkE,SAAS,CAACN,IAAI,CAAC,CAAC;EAErD,IAAI,CAACN,aAAa,CAACa,OAAO,EAAE;IAC1B,MAAM,IAAIpE,gBAAgB,CAACuD,aAAa,CAACc,KAAK,CAACC,OAAO,CAAC;EACzD;EAEA,OAAOf,aAAa,CAACgB,IAAI;AAC3B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
2
  export const ASSERTION_TYPE = "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation";
3
+ export const DPOP_KET_TAG = `dpop`;
3
4
  export const SupportedCredentialFormat = z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]);
4
5
  //# sourceMappingURL=const.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["z","ASSERTION_TYPE","SupportedCredentialFormat","union","literal"],"sourceRoot":"../../../../src","sources":["credential/issuance/const.ts"],"mappings":"AAAA,OAAO,KAAKA,CAAC,MAAM,KAAK;AACxB,OAAO,MAAMC,cAAc,GACzB,oEAAoE;AAKtE,OAAO,MAAMC,yBAAyB,GAAGF,CAAC,CAACG,KAAK,CAAC,CAC/CH,CAAC,CAACI,OAAO,CAAC,WAAW,CAAC,EACtBJ,CAAC,CAACI,OAAO,CAAC,cAAc,CAAC,CAC1B,CAAC"}
1
+ {"version":3,"names":["z","ASSERTION_TYPE","DPOP_KET_TAG","SupportedCredentialFormat","union","literal"],"sourceRoot":"../../../../src","sources":["credential/issuance/const.ts"],"mappings":"AAAA,OAAO,KAAKA,CAAC,MAAM,KAAK;AACxB,OAAO,MAAMC,cAAc,GACzB,oEAAoE;AAEtE,OAAO,MAAMC,YAAY,GAAI,MAAK;AAKlC,OAAO,MAAMC,yBAAyB,GAAGH,CAAC,CAACI,KAAK,CAAC,CAC/CJ,CAAC,CAACK,OAAO,CAAC,WAAW,CAAC,EACtBL,CAAC,CAACK,OAAO,CAAC,cAAc,CAAC,CAC1B,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { SignJWT, thumbprint } from "@pagopa/io-react-native-jwt";
2
- import { z } from "zod";
3
2
  import { JWK, fixBase64EncodingOnKey } from "../utils/jwk";
4
3
  import { getWalletProviderClient } from "../client";
5
4
  import { WalletProviderResponseError, WalletInstanceRevokedError, WalletInstanceNotFoundError, WalletInstanceAttestationIssuingError } from "../utils/errors";
5
+ import { TokenResponse } from "./types";
6
6
 
7
7
  /**
8
8
  * Getter for an attestation request. The attestation request is a JWT that will be sent to the Wallet Provider to request a Wallet Instance Attestation.
@@ -75,13 +75,13 @@ export const getAttestation = async _ref => {
75
75
  const signedAttestationRequest = await getAttestationRequest(challenge, wiaCryptoContext, integrityContext, walletProviderBaseUrl);
76
76
 
77
77
  // 3. Request WIA
78
- const wia = await api.post("/token", {
78
+ const tokenResponse = await api.post("/token", {
79
79
  body: {
80
80
  grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
81
81
  assertion: signedAttestationRequest
82
82
  }
83
- }).then(result => z.string().parse(result)).catch(handleAttestationCreationError);
84
- return wia;
83
+ }).then(result => TokenResponse.parse(result)).catch(handleAttestationCreationError);
84
+ return tokenResponse.wallet_attestation;
85
85
  };
86
86
  const handleAttestationCreationError = e => {
87
87
  if (!(e instanceof WalletProviderResponseError)) {
@@ -1 +1 @@
1
- {"version":3,"names":["SignJWT","thumbprint","z","JWK","fixBase64EncodingOnKey","getWalletProviderClient","WalletProviderResponseError","WalletInstanceRevokedError","WalletInstanceNotFoundError","WalletInstanceAttestationIssuingError","getAttestationRequest","challenge","wiaCryptoContext","integrityContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","parse","keyThumbprint","publicKey","kid","clientData","jwk_thumbprint","hardwareKeyTag","getHardwareKeyTag","signature","authenticatorData","getHardwareSignatureWithAuthData","JSON","stringify","setPayload","iss","sub","hardware_signature","integrity_assertion","hardware_key_tag","cnf","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","api","get","then","response","nonce","signedAttestationRequest","wia","post","body","grant_type","assertion","result","string","catch","handleAttestationCreationError","e","statusCode","claim","reason"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":"AACA,SAASA,OAAO,EAAEC,UAAU,QAAQ,6BAA6B;AACjE,SAASC,CAAC,QAAQ,KAAK;AACvB,SAASC,GAAG,EAAEC,sBAAsB,QAAQ,cAAc;AAC1D,SAASC,uBAAuB,QAAQ,WAAW;AAEnD,SACEC,2BAA2B,EAC3BC,0BAA0B,EAC1BC,2BAA2B,EAC3BC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CAAC,CAACG,MACJ,CAAC;EACH;EAEA,MAAM,IAAIxD,qCAAqC,CAC5C,uEAAsEqD,CAAC,CAACC,UAAW,GAAE,EACtFD,CAAC,CAACE,KAAK,EACPF,CAAC,CAACG,MACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"names":["SignJWT","thumbprint","JWK","fixBase64EncodingOnKey","getWalletProviderClient","WalletProviderResponseError","WalletInstanceRevokedError","WalletInstanceNotFoundError","WalletInstanceAttestationIssuingError","TokenResponse","getAttestationRequest","challenge","wiaCryptoContext","integrityContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","parse","keyThumbprint","publicKey","kid","clientData","jwk_thumbprint","hardwareKeyTag","getHardwareKeyTag","signature","authenticatorData","getHardwareSignatureWithAuthData","JSON","stringify","setPayload","iss","sub","hardware_signature","integrity_assertion","hardware_key_tag","cnf","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","api","get","then","response","nonce","signedAttestationRequest","tokenResponse","post","body","grant_type","assertion","result","catch","handleAttestationCreationError","wallet_attestation","e","statusCode","claim","reason"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":"AACA,SAASA,OAAO,EAAEC,UAAU,QAAQ,6BAA6B;AACjE,SAASC,GAAG,EAAEC,sBAAsB,QAAQ,cAAc;AAC1D,SAASC,uBAAuB,QAAQ,WAAW;AAEnD,SACEC,2BAA2B,EAC3BC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,qCAAqC,QAChC,iBAAiB;AACxB,SAASC,aAAa,QAAQ,SAAS;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,qBAAqBA,CACzCC,SAAiB,EACjBC,gBAA+B,EAC/BC,gBAAkC,EAClCC,qBAA6B,EACZ;EACjB,MAAMC,GAAG,GAAG,MAAMH,gBAAgB,CAACI,YAAY,CAAC,CAAC;EACjD,MAAMC,SAAS,GAAGf,GAAG,CAACgB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AAS,GAAG,MAAMoC,GAAG,CAACC,GAAG,CAAC,QAAQ,CAAC,CAACC,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,KAAK,CAAC;;EAE5E;EACA,MAAMC,wBAAwB,GAAG,MAAM1C,qBAAqB,CAC1DC,SAAS,EACTC,gBAAgB,EAChBC,gBAAgB,EAChBC,qBACF,CAAC;;EAED;EACA,MAAMuC,aAAa,GAAG,MAAMN,GAAG,CAC5BO,IAAI,CAAC,QAAQ,EAAE;IACdC,IAAI,EAAE;MACJC,UAAU,EAAE,6CAA6C;MACzDC,SAAS,EAAEL;IACb;EACF,CAAC,CAAC,CACDH,IAAI,CAAES,MAAM,IAAKjD,aAAa,CAACS,KAAK,CAACwC,MAAM,CAAC,CAAC,CAC7CC,KAAK,CAACC,8BAA8B,CAAC;EAExC,OAAOP,aAAa,CAACQ,kBAAkB;AACzC,CAAC;AAED,MAAMD,8BAA8B,GAAIE,CAAU,IAAK;EACrD,IAAI,EAAEA,CAAC,YAAYzD,2BAA2B,CAAC,EAAE;IAC/C,MAAMyD,CAAC;EACT;EAEA,IAAIA,CAAC,CAACC,UAAU,KAAK,GAAG,EAAE;IACxB,MAAM,IAAIzD,0BAA0B,CAClC,4DAA4D,EAC5DwD,CAAC,CAACE,KAAK,EACPF,CAAC,CAACG,MACJ,CAAC;EACH;EAEA,IAAIH,CAAC,CAACC,UAAU,KAAK,GAAG,EAAE;IACxB,MAAM,IAAIxD,2BAA2B,CACnC,wEAAwE,EACxEuD,CAAC,CAACE,KAAK,EACPF,CAAC,CAACG,MACJ,CAAC;EACH;EAEA,MAAM,IAAIzD,qCAAqC,CAC5C,uEAAsEsD,CAAC,CAACC,UAAW,GAAE,EACtFD,CAAC,CAACE,KAAK,EACPF,CAAC,CAACG,MACJ,CAAC;AACH,CAAC"}
@@ -53,4 +53,7 @@ export const WalletInstanceAttestationJwt = z.object({
53
53
  presentation_definition_uri_supported: z.boolean()
54
54
  }))
55
55
  });
56
+ export const TokenResponse = z.object({
57
+ wallet_attestation: z.string()
58
+ });
56
59
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["JWK","z","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","iat","exp","cnf","jwk","intersection","WalletInstanceAttestationRequestJwt","shape","literal","aud","jti","nonce","WalletInstanceAttestationJwt","sub","aal","authorization_endpoint","response_types_supported","vp_formats_supported","request_object_signing_alg_values_supported","presentation_definition_uri_supported","boolean"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/types.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAc;AAClC,OAAO,KAAKC,CAAC,MAAM,KAAK;AAExB,MAAMC,QAAQ,GAAGD,CAAC,CAACE,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,aAAa,CAAC;AAGrD,MAAMC,GAAG,GAAGL,CAAC,CAACM,MAAM,CAAC;EACnBC,MAAM,EAAEP,CAAC,CAACM,MAAM,CAAC;IACfE,GAAG,EAAER,CAAC,CAACS,MAAM,CAAC,CAAC;IACfC,GAAG,EAAEV,CAAC,CAACS,MAAM,CAAC,CAAC;IACfE,GAAG,EAAEX,CAAC,CAACS,MAAM,CAAC,CAAC;IACfG,GAAG,EAAEZ,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC,CAAC,CAACK,QAAQ,CAAC,CAAC;IACnCC,WAAW,EAAEf,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC,CAAC,CAACK,QAAQ,CAAC;EAC5C,CAAC,CAAC;EACFE,OAAO,EAAEhB,CAAC,CAACM,MAAM,CAAC;IAChBW,GAAG,EAAEjB,CAAC,CAACS,MAAM,CAAC,CAAC;IACfS,GAAG,EAAEjB,QAAQ;IACbkB,GAAG,EAAElB,QAAQ;IACbmB,GAAG,EAAEpB,CAAC,CAACM,MAAM,CAAC;MACZe,GAAG,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,CAAC;IAClCwB,wBAAwB,EAAEjC,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC,CAAC;IAC7CyB,oBAAoB,EAAElC,CAAC,CAACM,MAAM,CAAC;MAC7B,WAAW,EAAEN,CAAC,CACXM,MAAM,CAAC;QACN,mBAAmB,EAAEN,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC;MACzC,CAAC,CAAC,CACDK,QAAQ,CAAC,CAAC;MACb,WAAW,EAAEd,CAAC,CACXM,MAAM,CAAC;QACN,mBAAmB,EAAEN,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC;MACzC,CAAC,CAAC,CACDK,QAAQ,CAAC;IACd,CAAC,CAAC;IACFqB,2CAA2C,EAAEnC,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC,CAAC;IAChE2B,qCAAqC,EAAEpC,CAAC,CAACqC,OAAO,CAAC;EACnD,CAAC,CACH;AACF,CAAC,CAAC"}
1
+ {"version":3,"names":["JWK","z","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","iat","exp","cnf","jwk","intersection","WalletInstanceAttestationRequestJwt","shape","literal","aud","jti","nonce","WalletInstanceAttestationJwt","sub","aal","authorization_endpoint","response_types_supported","vp_formats_supported","request_object_signing_alg_values_supported","presentation_definition_uri_supported","boolean","TokenResponse","wallet_attestation"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/types.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAc;AAClC,OAAO,KAAKC,CAAC,MAAM,KAAK;AAExB,MAAMC,QAAQ,GAAGD,CAAC,CAACE,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,aAAa,CAAC;AAGrD,MAAMC,GAAG,GAAGL,CAAC,CAACM,MAAM,CAAC;EACnBC,MAAM,EAAEP,CAAC,CAACM,MA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C;AAGF,OAAO,MAAMC,aAAa,GAAGtC,CAAC,CAACM,MAAM,CAAC;EACpCiC,kBAAkB,EAAEvC,CAAC,CAACS,MAAM,CAAC;AAC/B,CAAC,CAAC"}
@@ -8,7 +8,13 @@ export declare const NonceDetailView: z.ZodObject<{
8
8
  nonce: string;
9
9
  }>;
10
10
  export type WalletAttestationView = z.infer<typeof WalletAttestationView>;
11
- export declare const WalletAttestationView: z.ZodString;
11
+ export declare const WalletAttestationView: z.ZodObject<{
12
+ wallet_attestation: z.ZodString;
13
+ }, "strip", z.ZodTypeAny, {
14
+ wallet_attestation: string;
15
+ }, {
16
+ wallet_attestation: string;
17
+ }>;
12
18
  export type CreateWalletInstanceBody = z.infer<typeof CreateWalletInstanceBody>;
13
19
  export declare const CreateWalletInstanceBody: z.ZodObject<{
14
20
  challenge: z.ZodString;
@@ -130,7 +136,13 @@ export declare const post_CreateWalletAttestation: {
130
136
  assertion: string;
131
137
  };
132
138
  }>;
133
- response: z.ZodUnknown;
139
+ response: z.ZodObject<{
140
+ wallet_attestation: z.ZodString;
141
+ }, "strip", z.ZodTypeAny, {
142
+ wallet_attestation: string;
143
+ }, {
144
+ wallet_attestation: string;
145
+ }>;
134
146
  };
135
147
  export declare const EndpointByMethod: {
136
148
  get: {
@@ -205,7 +217,13 @@ export declare const EndpointByMethod: {
205
217
  assertion: string;
206
218
  };
207
219
  }>;
208
- response: z.ZodUnknown;
220
+ response: z.ZodObject<{
221
+ wallet_attestation: z.ZodString;
222
+ }, "strip", z.ZodTypeAny, {
223
+ wallet_attestation: string;
224
+ }, {
225
+ wallet_attestation: string;
226
+ }>;
209
227
  };
210
228
  };
211
229
  };
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-provider.d.ts","sourceRoot":"","sources":["../../../../src/client/generated/wallet-provider.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe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CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAM1C,IAAI,CAAC,IAAI,SAAS,MAAM,aAAa,EAAE,SAAS,SAAS,aAAa,CAAC,IAAI,CAAC,EAC1E,IAAI,EAAE,IAAI,EACV,GAAG,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,GAC5D,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;CAI3C;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,aAEjE;;AAED;;;;;;;;EAQE"}
@@ -10,7 +10,7 @@ export type AuthorizeAccess = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"
10
10
  wiaCryptoContext: CryptoContext;
11
11
  }) => Promise<{
12
12
  accessToken: TokenResponse;
13
- tokenRequestSignedDPop: string;
13
+ dPoPContext: CryptoContext;
14
14
  }>;
15
15
  /**
16
16
  * Creates and sends the DPoP Proof JWT to be presented with the authorization code to the /token endpoint of the authorization server
@@ -1 +1 @@
1
- {"version":3,"file":"05-authorize-access.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/05-authorize-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAM5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,kCAAkC,CAAC;AAE/F,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,GAAG,CAAC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U,CAAC,EACjD,YAAY,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,cAAc,CAAC,EACzD,OAAO,EAAE;IACP,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,gBAAgB,EAAE,aAAa,CAAC;CACjC,KACE,OAAO,CAAC;IAAE,WAAW,EAAE,aAAa,CAAC;IAAC,WAAW,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAEzE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,EAAE,eA6E7B,CAAC"}
@@ -4,7 +4,7 @@ import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
4
4
  import { type Out } from "../../utils/misc";
5
5
  import type { StartUserAuthorization } from "./03-start-user-authorization";
6
6
  import { CredentialResponse } from "./types";
7
- export type ObtainCredential = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], accessToken: Out<AuthorizeAccess>["accessToken"], clientId: Out<StartUserAuthorization>["clientId"], credentialDefinition: Out<StartUserAuthorization>["credentialDefinition"], tokenRequestSignedDPop: Out<AuthorizeAccess>["tokenRequestSignedDPop"], context: {
7
+ export type ObtainCredential = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], accessToken: Out<AuthorizeAccess>["accessToken"], clientId: Out<StartUserAuthorization>["clientId"], credentialDefinition: Out<StartUserAuthorization>["credentialDefinition"], dPoPContext: CryptoContext, context: {
8
8
  credentialCryptoContext: CryptoContext;
9
9
  appFetch?: GlobalFetch["fetch"];
10
10
  }) => Promise<CredentialResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"06-obtain-credential.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/06-obtain-credential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,gBAAgB,GAAG,CAC7B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,WAAW,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC,aAAa,CAAC,EAChD,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,oBAAoB,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,sBAAsB,CAAC,EACzE,sBAAsB,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC,wBAAwB,CAAC,EACtE,OAAO,EAAE;IACP,uBAAuB,EAAE,aAAa,CAAC;IACvC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEjC,eAAO,MAAM,gBAAgB,UACpB,MAAM,UACL,MAAM,YACJ,MAAM,OACX,aAAa,KACjB,QAAQ,MAAM,CAehB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAqE9B,CAAC"}
1
+ {"version":3,"file":"06-obtain-credential.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/06-obtain-credential.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAO7C,MAAM,MAAM,gBAAgB,GAAG,CAC7B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,WAAW,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC,aAAa,CAAC,EAChD,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,oBAAoB,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,sBAAsB,CAAC,EACzE,WAAW,EAAE,aAAa,EAC1B,OAAO,EAAE;IACP,uBAAuB,EAAE,aAAa,CAAC;IACvC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEjC,eAAO,MAAM,gBAAgB,UACpB,MAAM,UACL,MAAM,YACJ,MAAM,OACX,aAAa,KACjB,QAAQ,MAAM,CAehB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAgF9B,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import * as z from "zod";
2
2
  export declare const ASSERTION_TYPE = "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation";
3
+ export declare const DPOP_KET_TAG = "dpop";
3
4
  export type SupportedCredentialFormat = z.infer<typeof SupportedCredentialFormat>;
4
5
  export declare const SupportedCredentialFormat: z.ZodUnion<[z.ZodLiteral<"vc+sd-jwt">, z.ZodLiteral<"vc+mdoc-cbor">]>;
5
6
  //# sourceMappingURL=const.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/const.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,eAAO,MAAM,cAAc,uEAC2C,CAAC;AAEvE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,yBAAyB,CACjC,CAAC;AACF,eAAO,MAAM,yBAAyB,uEAGpC,CAAC"}
1
+ {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/const.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,eAAO,MAAM,cAAc,uEAC2C,CAAC;AAEvE,eAAO,MAAM,YAAY,SAAS,CAAC;AAEnC,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,yBAAyB,CACjC,CAAC;AACF,eAAO,MAAM,yBAAyB,uEAGpC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../src/wallet-instance-attestation/issuing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAKjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAQ3C;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,aAAa,EAC/B,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,MAAM,GAC5B,OAAO,CAAC,MAAM,CAAC,CAoCjB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc;sBAMP,aAAa;sBACb,gBAAgB;2BACX,MAAM;;;;;MAE3B,QAAQ,MAAM,CA6BjB,CAAC"}
1
+ {"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../src/wallet-instance-attestation/issuing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAIjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAS3C;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,aAAa,EAC/B,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,MAAM,GAC5B,OAAO,CAAC,MAAM,CAAC,CAoCjB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc;sBAMP,aAAa;sBACb,gBAAgB;2BACX,MAAM;;;;;MAE3B,QAAQ,MAAM,CA6BjB,CAAC"}
@@ -746,4 +746,12 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
746
746
  presentation_definition_uri_supported: boolean;
747
747
  };
748
748
  }>;
749
+ export type TokenResponse = z.infer<typeof TokenResponse>;
750
+ export declare const TokenResponse: z.ZodObject<{
751
+ wallet_attestation: z.ZodString;
752
+ }, "strip", z.ZodTypeAny, {
753
+ wallet_attestation: string;
754
+ }, {
755
+ wallet_attestation: string;
756
+ }>;
749
757
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/wallet-instance-attestation/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AA2BzB,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,mCAAmC,CAC3C,CAAC;AACF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe9C,CAAC;AAEH,MAAM,MAAM,4BA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9C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,4BAA4B,CACpC,CAAC;AACF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BvC,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,eAAO,MAAM,aAAa;;;;;;EAExB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-wallet",
3
- "version": "0.15.2",
3
+ "version": "0.15.4",
4
4
  "description": "Provide data structures, helpers and API for IO Wallet",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -6,7 +6,9 @@ export const NonceDetailView = z.object({
6
6
  });
7
7
 
8
8
  export type WalletAttestationView = z.infer<typeof WalletAttestationView>;
9
- export const WalletAttestationView = z.string();
9
+ export const WalletAttestationView = z.object({
10
+ wallet_attestation: z.string(),
11
+ });
10
12
 
11
13
  export type CreateWalletInstanceBody = z.infer<typeof CreateWalletInstanceBody>;
12
14
  export const CreateWalletInstanceBody = z.object({
@@ -61,7 +63,7 @@ export const post_CreateWalletAttestation = {
61
63
  parameters: z.object({
62
64
  body: CreateWalletAttestationBody,
63
65
  }),
64
- response: z.unknown(),
66
+ response: WalletAttestationView,
65
67
  };
66
68
 
67
69
  // <EndpointByMethod>
@@ -1,16 +1,17 @@
1
1
  import { hasStatus, type Out } from "../../utils/misc";
2
2
  import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
3
3
  import type { StartUserAuthorization } from "./03-start-user-authorization";
4
- import { withEphemeralKey } from "../../utils/crypto";
4
+ import { createCryptoContextFor } from "../../utils/crypto";
5
5
  import { createDPopToken } from "../../utils/dpop";
6
6
  import uuid from "react-native-uuid";
7
7
  import { createPopToken } from "../../utils/pop";
8
8
  import * as WalletInstanceAttestation from "../../wallet-instance-attestation";
9
9
  import type { CryptoContext } from "@pagopa/io-react-native-jwt";
10
- import { ASSERTION_TYPE } from "./const";
10
+ import { ASSERTION_TYPE, DPOP_KET_TAG } from "./const";
11
11
  import { TokenResponse } from "./types";
12
12
  import { ValidationFailed } from "../../utils/errors";
13
13
  import type { CompleteUserAuthorizationWithQueryMode } from "./04-complete-user-authorization";
14
+ import { generate } from "@pagopa/io-react-native-crypto";
14
15
 
15
16
  export type AuthorizeAccess = (
16
17
  issuerConf: Out<EvaluateIssuerTrust>["issuerConf"],
@@ -23,7 +24,7 @@ export type AuthorizeAccess = (
23
24
  appFetch?: GlobalFetch["fetch"];
24
25
  wiaCryptoContext: CryptoContext;
25
26
  }
26
- ) => Promise<{ accessToken: TokenResponse; tokenRequestSignedDPop: string }>;
27
+ ) => Promise<{ accessToken: TokenResponse; dPoPContext: CryptoContext }>;
27
28
 
28
29
  /**
29
30
  * Creates and sends the DPoP Proof JWT to be presented with the authorization code to the /token endpoint of the authorization server
@@ -63,18 +64,22 @@ export const authorizeAccess: AuthorizeAccess = async (
63
64
  .payload.cnf.jwk.kid;
64
65
 
65
66
  const tokenUrl = issuerConf.oauth_authorization_server.token_endpoint;
66
- // Use an ephemeral key to be destroyed after use
67
- const tokenRequestSignedDPop = await withEphemeralKey(
68
- async (ephimeralContext) => {
69
- return await createDPopToken(
70
- {
71
- htm: "POST",
72
- htu: tokenUrl,
73
- jti: `${uuid.v4()}`,
74
- },
75
- ephimeralContext
76
- );
77
- }
67
+
68
+ try {
69
+ await generate(DPOP_KET_TAG);
70
+ } catch {
71
+ console.log("DPoP key already exist");
72
+ }
73
+
74
+ const dPoPContext = createCryptoContextFor(DPOP_KET_TAG);
75
+
76
+ const tokenRequestSignedDPop = await createDPopToken(
77
+ {
78
+ htm: "POST",
79
+ htu: tokenUrl,
80
+ jti: `${uuid.v4()}`,
81
+ },
82
+ dPoPContext
78
83
  );
79
84
 
80
85
  const signedWiaPoP = await createPopToken(
@@ -113,5 +118,5 @@ export const authorizeAccess: AuthorizeAccess = async (
113
118
  throw new ValidationFailed(tokenRes.error.message);
114
119
  }
115
120
 
116
- return { accessToken: tokenRes.data, tokenRequestSignedDPop };
121
+ return { accessToken: tokenRes.data, dPoPContext };
117
122
  };
@@ -1,4 +1,8 @@
1
- import { SignJWT, type CryptoContext } from "@pagopa/io-react-native-jwt";
1
+ import {
2
+ sha256ToBase64,
3
+ SignJWT,
4
+ type CryptoContext,
5
+ } from "@pagopa/io-react-native-jwt";
2
6
  import type { AuthorizeAccess } from "./05-authorize-access";
3
7
  import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
4
8
  import { hasStatus, type Out } from "../../utils/misc";
@@ -6,12 +10,17 @@ import type { StartUserAuthorization } from "./03-start-user-authorization";
6
10
  import { ValidationFailed } from "../../utils/errors";
7
11
  import { CredentialResponse } from "./types";
8
12
 
13
+ import { createDPopToken } from "../../utils/dpop";
14
+ import uuid from "react-native-uuid";
15
+ import { deleteKey } from "@pagopa/io-react-native-crypto";
16
+ import { DPOP_KET_TAG } from "./const";
17
+
9
18
  export type ObtainCredential = (
10
19
  issuerConf: Out<EvaluateIssuerTrust>["issuerConf"],
11
20
  accessToken: Out<AuthorizeAccess>["accessToken"],
12
21
  clientId: Out<StartUserAuthorization>["clientId"],
13
22
  credentialDefinition: Out<StartUserAuthorization>["credentialDefinition"],
14
- tokenRequestSignedDPop: Out<AuthorizeAccess>["tokenRequestSignedDPop"],
23
+ dPoPContext: CryptoContext,
15
24
  context: {
16
25
  credentialCryptoContext: CryptoContext;
17
26
  appFetch?: GlobalFetch["fetch"];
@@ -60,7 +69,7 @@ export const obtainCredential: ObtainCredential = async (
60
69
  accessToken,
61
70
  clientId,
62
71
  credentialDefinition,
63
- tokenRequestSignedDPop,
72
+ dPoPContext,
64
73
  context
65
74
  ) => {
66
75
  const { credentialCryptoContext, appFetch = fetch } = context;
@@ -106,6 +115,17 @@ export const obtainCredential: ObtainCredential = async (
106
115
  },
107
116
  };
108
117
 
118
+ const tokenRequestSignedDPop = await await createDPopToken(
119
+ {
120
+ htm: "POST",
121
+ htu: credentialUrl,
122
+ jti: `${uuid.v4()}`,
123
+ ath: await sha256ToBase64(accessToken.access_token),
124
+ },
125
+ dPoPContext
126
+ );
127
+
128
+ await deleteKey(DPOP_KET_TAG);
109
129
  const credentialRes = await appFetch(credentialUrl, {
110
130
  method: "POST",
111
131
  headers: {
@@ -2,6 +2,8 @@ import * as z from "zod";
2
2
  export const ASSERTION_TYPE =
3
3
  "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation";
4
4
 
5
+ export const DPOP_KET_TAG = `dpop`;
6
+
5
7
  export type SupportedCredentialFormat = z.infer<
6
8
  typeof SupportedCredentialFormat
7
9
  >;
@@ -1,6 +1,5 @@
1
1
  import { type CryptoContext } from "@pagopa/io-react-native-jwt";
2
2
  import { SignJWT, thumbprint } from "@pagopa/io-react-native-jwt";
3
- import { z } from "zod";
4
3
  import { JWK, fixBase64EncodingOnKey } from "../utils/jwk";
5
4
  import { getWalletProviderClient } from "../client";
6
5
  import type { IntegrityContext } from "..";
@@ -10,6 +9,7 @@ import {
10
9
  WalletInstanceNotFoundError,
11
10
  WalletInstanceAttestationIssuingError,
12
11
  } from "../utils/errors";
12
+ import { TokenResponse } from "./types";
13
13
 
14
14
  /**
15
15
  * Getter for an attestation request. The attestation request is a JWT that will be sent to the Wallet Provider to request a Wallet Instance Attestation.
@@ -101,17 +101,17 @@ export const getAttestation = async ({
101
101
  );
102
102
 
103
103
  // 3. Request WIA
104
- const wia = await api
104
+ const tokenResponse = await api
105
105
  .post("/token", {
106
106
  body: {
107
107
  grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
108
108
  assertion: signedAttestationRequest,
109
109
  },
110
110
  })
111
- .then((result) => z.string().parse(result))
111
+ .then((result) => TokenResponse.parse(result))
112
112
  .catch(handleAttestationCreationError);
113
113
 
114
- return wia;
114
+ return tokenResponse.wallet_attestation;
115
115
  };
116
116
 
117
117
  const handleAttestationCreationError = (e: unknown) => {
@@ -80,3 +80,8 @@ export const WalletInstanceAttestationJwt = z.object({
80
80
  })
81
81
  ),
82
82
  });
83
+
84
+ export type TokenResponse = z.infer<typeof TokenResponse>;
85
+ export const TokenResponse = z.object({
86
+ wallet_attestation: z.string(),
87
+ });