@pagopa/io-react-native-wallet 0.19.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WalletAttestationView = exports.ProblemDetail = exports.NonceDetailView = exports.EndpointByMethod = exports.CreateWalletInstanceBody = exports.CreateWalletAttestationBody = exports.ApiClient = void 0;
6
+ exports.WalletAttestationView = exports.SetCurrentWalletInstanceStatusBody = exports.ProblemDetail = exports.NonceDetailView = exports.EndpointByMethod = exports.CreateWalletInstanceBody = exports.CreateWalletAttestationBody = exports.ApiClient = void 0;
7
7
  exports.createApiClient = createApiClient;
8
- exports.post_CreateWalletInstance = exports.post_CreateWalletAttestation = exports.get_GetNonce = void 0;
8
+ exports.put_SetCurrentWalletInstanceStatus = exports.post_CreateWalletInstance = exports.post_CreateWalletAttestation = exports.get_GetNonce = void 0;
9
9
  var _zod = _interopRequireDefault(require("zod"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  const NonceDetailView = _zod.default.object({
@@ -35,6 +35,10 @@ const ProblemDetail = _zod.default.object({
35
35
  instance: _zod.default.string().optional()
36
36
  });
37
37
  exports.ProblemDetail = ProblemDetail;
38
+ const SetCurrentWalletInstanceStatusBody = _zod.default.object({
39
+ status: _zod.default.literal("REVOKED")
40
+ });
41
+ exports.SetCurrentWalletInstanceStatusBody = SetCurrentWalletInstanceStatusBody;
38
42
  const get_GetNonce = {
39
43
  method: _zod.default.literal("GET"),
40
44
  path: _zod.default.literal("/nonce"),
@@ -59,9 +63,18 @@ const post_CreateWalletAttestation = {
59
63
  }),
60
64
  response: WalletAttestationView
61
65
  };
66
+ exports.post_CreateWalletAttestation = post_CreateWalletAttestation;
67
+ const put_SetCurrentWalletInstanceStatus = {
68
+ method: _zod.default.literal("PUT"),
69
+ path: _zod.default.literal("/wallet-instances/current/status"),
70
+ parameters: _zod.default.object({
71
+ body: SetCurrentWalletInstanceStatusBody
72
+ }),
73
+ response: _zod.default.unknown()
74
+ };
62
75
 
63
76
  // <EndpointByMethod>
64
- exports.post_CreateWalletAttestation = post_CreateWalletAttestation;
77
+ exports.put_SetCurrentWalletInstanceStatus = put_SetCurrentWalletInstanceStatus;
65
78
  const EndpointByMethod = {
66
79
  get: {
67
80
  "/nonce": get_GetNonce
@@ -69,6 +82,9 @@ const EndpointByMethod = {
69
82
  post: {
70
83
  "/wallet-instances": post_CreateWalletInstance,
71
84
  "/token": post_CreateWalletAttestation
85
+ },
86
+ put: {
87
+ "/wallet-instances/current/status": put_SetCurrentWalletInstanceStatus
72
88
  }
73
89
  };
74
90
 
@@ -104,6 +120,12 @@ class ApiClient {
104
120
  return this.fetcher("post", this.baseUrl + path, arguments.length <= 1 ? undefined : arguments[1]);
105
121
  }
106
122
  // </ApiClient.post>
123
+
124
+ // <ApiClient.put>
125
+ put(path) {
126
+ return this.fetcher("put", this.baseUrl + path, arguments.length <= 1 ? undefined : arguments[1]);
127
+ }
128
+ // </ApiClient.put>
107
129
  }
108
130
  exports.ApiClient = ApiClient;
109
131
  function createApiClient(fetcher, baseUrl) {
@@ -1 +1 @@
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","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,KA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AyCA;;AAEA;AACO,MAAMG,SAAS,CAAC;EACrBC,OAAO,GAAW,EAAE;EAEpBC,WAAWA,CAAQC,OAAgB,EAAE;IAAA,KAAlBA,OAAgB,GAAhBA,OAAgB;EAAG;EAEtCC,UAAUA,CAACH,OAAe,EAAE;IAC1B,IAAI,CAACA,OAAO,GAAGA,OAAO;IACtB,OAAO,IAAI;EACb;;EAEA;EACAH,GAAGA,CACDT,IAAU,EAE+B;IACzC,OAAO,IAAI,CAACc,OAAO,CAAC,KAAK,EAAE,IAAI,CAACF,OAAO,GAAGZ,IAAI,EAAAgB,SAAA,CAAAC,MAAA,QAAAC,SAAA,GAAAF,SAAA,GAAW,CAAC;EAC5D;EACA;;EAEA;EACAN,IAAIA,CACFV,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;AAACrC,OAAA,CAAAgC,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"}
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","SetCurrentWalletInstanceStatusBody","get_GetNonce","method","path","parameters","never","response","post_CreateWalletInstance","body","unknown","post_CreateWalletAttestation","put_SetCurrentWalletInstanceStatus","EndpointByMethod","get","post","put","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,UAAU,EAAEZ,YAAC,CAACa,OAAO,CAAC,6CAA6C,CAAC;EACpEC,SAAS,EAAEd,YAAC,CAACG,MAAM,CAAC;AACtB,CAAC,CAAC;AAACC,OAAA,CAAAO,2BAAA,GAAAA,2BAAA;AAGI,MAAMI,aAAa,GAAGf,YAAC,CAACC,MAAM,CAAC;EACpCe,IAAI,EAAEhB,YAAC,CAACG,MAAM,CAAC,CAAC,CAACc,QAAQ,CAAC,CAAC;EAC3BC,KAAK,EAAElB,YAAC,CAACG,MAAM,CAAC,CAAC,CAACc,QAAQ,CAAC,CAAC;EAC5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AE+B;IACzC,OAAO,IAAI,CAACgB,OAAO,CAAC,MAAM,EAAE,IAAI,CAACF,OAAO,GAAGd,IAAI,EAAAkB,SAAA,CAAAC,MAAA,QAAAC,SAAA,GAAAF,SAAA,GAAW,CAAC;EAC7D;EACA;;EAEA;EACAN,GAAGA,CACDZ,IAAU,EAE+B;IACzC,OAAO,IAAI,CAACgB,OAAO,CAAC,KAAK,EAAE,IAAI,CAACF,OAAO,GAAGd,IAAI,EAAAkB,SAAA,CAAAC,MAAA,QAAAC,SAAA,GAAAF,SAAA,GAAW,CAAC;EAC5D;EACA;AACF;AAACxC,OAAA,CAAAmC,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"}
@@ -1,9 +1,16 @@
1
1
  # Wallet Instance
2
2
 
3
- This flow which consists of a single step, is used to create a wallet instance. The wallet provider must implement its endpoints based on the OpenAPI specification provided in the [wallet-instance.yaml](../../openapi/wallet-provider.yaml) file.
3
+ This flow handles the wallet instance lifecycle: creation and revocation. The wallet provider must implement its endpoints based on the OpenAPI specification provided in the [wallet-instance.yaml](../../openapi/wallet-provider.yaml) file.
4
4
  A service that is responsible for ensuring the integrity of the device where the app is running is required and it's supposed to use [Google Play Integrity API](https://developer.android.com/google/play/integrity/overview) and [Key Attestation](https://developer.android.com/privacy-and-security/security-key-attestation) on Android, [DCAppAttestService](https://developer.apple.com/documentation/devicecheck/establishing-your-app-s-integrity) on iOS.
5
5
  The suggested way to implement this service is to use [io-react-native-integrity](https://github.com/pagopa/io-react-native-integrity) by providing an [IntegrityContext](../utils/integrity.ts) object.
6
- An example is provided as follows:
6
+
7
+ The following methods are available:
8
+ - `createWalletInstance` creates a new wallet instance;
9
+ - `revokeCurrentWalletInstance` revokes the currently valid wallet instance of the user who made the request.
10
+
11
+ Examples are provided as follows:
12
+
13
+ ### Wallet instance creation
7
14
 
8
15
  ```ts
9
16
  // Get env
@@ -28,6 +35,17 @@ return integrityKeyTag;
28
35
 
29
36
  The returned `integrityKeyTag` is supposed to be stored and used to verify the integrity of the device in the future when using an `IntegrityContext` object. It must be regenerated if another wallet instance is created.
30
37
 
38
+ ### Wallet instance revocation
39
+
40
+ ```ts
41
+ const { WALLET_PROVIDER_BASE_URL } = env;
42
+
43
+ await WalletInstance.revokeCurrentWalletInstance({
44
+ walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
45
+ appFetch,
46
+ });
47
+ ```
48
+
31
49
  ## Mapped results
32
50
 
33
51
  ### 409 Conflict (WalletInstanceCreationIntegrityError)
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createWalletInstance = createWalletInstance;
7
+ exports.revokeCurrentWalletInstance = revokeCurrentWalletInstance;
7
8
  var _client = require("../client");
8
9
  var _errors = require("../utils/errors");
9
10
  async function createWalletInstance(context) {
@@ -36,4 +37,12 @@ const handleCreateWalletInstanceError = e => {
36
37
  }
37
38
  throw new _errors.WalletInstanceCreationError(`Unable to obtain wallet instance attestation [response status code: ${e.statusCode}]`, e.claim, e.reason);
38
39
  };
40
+ async function revokeCurrentWalletInstance(context) {
41
+ const api = (0, _client.getWalletProviderClient)(context);
42
+ await api.put("/wallet-instances/current/status", {
43
+ body: {
44
+ status: "REVOKED"
45
+ }
46
+ });
47
+ }
39
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_client","require","_errors","createWalletInstance","context","integrityContext","api","getWalletProviderClient","challenge","get","then","response","nonce","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag","catch","handleCreateWalletInstanceError","e","WalletProviderResponseError","statusCode","WalletInstanceCreationIntegrityError","claim","reason","WalletInstanceCreationError"],"sourceRoot":"../../../src","sources":["wallet-instance/index.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAMO,eAAeE,oBAAoBA,CAACC,OAI1C,EAAE;EACD,MAAM;IAAEC;EAAiB,CAAC,GAAGD,OAAO;EAEpC,MAAME,GAAG,GAAG,IAAAC,+BAAuB,EAACH,OAAO,CAAC;;EAE5C;EACA,MAAMI,SAAS,GAAG,MAAMF,GAAG,CAACG,GAAG,CAAC,QAAQ,CAAC,CAACC,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,KAAK,CAAC;EAE5E,MAAMC,cAAc,GAAG,MAAMR,gBAAgB,CAACS,cAAc,CAACN,SAAS,CAAC;EACvE,MAAMO,cAAc,GAAGV,gBAAgB,CAACW,iBAAiB,CAAC,CAAC;;EAE3D;EACA,MAAMV,GAAG,CACNW,IAAI,CAAC,mBAAmB,EAAE;IACzBC,IAAI,EAAE;MACJV,SAAS;MACTW,eAAe,EAAEN,cAAc;MAC/BO,gBAAgB,EAAEL;IACpB;EACF,CAAC,CAAC,CACDM,KAAK,CAACC,+BAA+B,CAAC;EAEzC,OAAOP,cAAc;AACvB;AAEA,MAAMO,+BAA+B,GAAIC,CAAU,IAAK;EACtD,IAAI,EAAEA,CAAC,YAAYC,mCAA2B,CAAC,EAAE;IAC/C,MAAMD,CAAC;EACT;EAEA,IAAIA,CAAC,CAACE,UAAU,KAAK,GAAG,EAAE;IACxB,MAAM,IAAIC,4CAAoC,CAC5C,oFAAoF,EACpFH,CAAC,CAACI,KAAK,EACPJ,CAAC,CAACK,MACJ,CAAC;EACH;EAEA,MAAM,IAAIC,mCAA2B,CAClC,uEAAsEN,CAAC,CAACE,UAAW,GAAE,EACtFF,CAAC,CAACI,KAAK,EACPJ,CAAC,CAACK,MACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"names":["_client","require","_errors","createWalletInstance","context","integrityContext","api","getWalletProviderClient","challenge","get","then","response","nonce","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag","catch","handleCreateWalletInstanceError","e","WalletProviderResponseError","statusCode","WalletInstanceCreationIntegrityError","claim","reason","WalletInstanceCreationError","revokeCurrentWalletInstance","put","status"],"sourceRoot":"../../../src","sources":["wallet-instance/index.ts"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAMO,eAAeE,oBAAoBA,CAACC,OAI1C,EAAE;EACD,MAAM;IAAEC;EAAiB,CAAC,GAAGD,OAAO;EAEpC,MAAME,GAAG,GAAG,IAAAC,+BAAuB,EAACH,OAAO,CAAC;;EAE5C;EACA,MAAMI,SAAS,GAAG,MAAMF,GAAG,CAACG,GAAG,CAAC,QAAQ,CAAC,CAACC,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,KAAK,CAAC;EAE5E,MAAMC,cAAc,GAAG,MAAMR,gBAAgB,CAACS,cAAc,CAACN,SAAS,CAAC;EACvE,MAAMO,cAAc,GAAGV,gBAAgB,CAACW,iBAAiB,CAAC,CAAC;;EAE3D;EACA,MAAMV,GAAG,CACNW,IAAI,CAAC,mBAAmB,EAAE;IACzBC,IAAI,EAAE;MACJV,SAAS;MACTW,eAAe,EAAEN,cAAc;MAC/BO,gBAAgB,EAAEL;IACpB;EACF,CAAC,CAAC,CACDM,KAAK,CAACC,+BAA+B,CAAC;EAEzC,OAAOP,cAAc;AACvB;AAEA,MAAMO,+BAA+B,GAAIC,CAAU,IAAK;EACtD,IAAI,EAAEA,CAAC,YAAYC,mCAA2B,CAAC,EAAE;IAC/C,MAAMD,CAAC;EACT;EAEA,IAAIA,CAAC,CAACE,UAAU,KAAK,GAAG,EAAE;IACxB,MAAM,IAAIC,4CAAoC,CAC5C,oFAAoF,EACpFH,CAAC,CAACI,KAAK,EACPJ,CAAC,CAACK,MACJ,CAAC;EACH;EAEA,MAAM,IAAIC,mCAA2B,CAClC,uEAAsEN,CAAC,CAACE,UAAW,GAAE,EACtFF,CAAC,CAACI,KAAK,EACPJ,CAAC,CAACK,MACJ,CAAC;AACH,CAAC;AAEM,eAAeE,2BAA2BA,CAAC1B,OAGjD,EAAiB;EAChB,MAAME,GAAG,GAAG,IAAAC,+BAAuB,EAACH,OAAO,CAAC;EAE5C,MAAME,GAAG,CAACyB,GAAG,CAAC,kCAAkC,EAAE;IAChDb,IAAI,EAAE;MAAEc,MAAM,EAAE;IAAU;EAC5B,CAAC,CAAC;AACJ"}
@@ -21,6 +21,9 @@ export const ProblemDetail = z.object({
21
21
  detail: z.string().optional(),
22
22
  instance: z.string().optional()
23
23
  });
24
+ export const SetCurrentWalletInstanceStatusBody = z.object({
25
+ status: z.literal("REVOKED")
26
+ });
24
27
  export const get_GetNonce = {
25
28
  method: z.literal("GET"),
26
29
  path: z.literal("/nonce"),
@@ -43,6 +46,14 @@ export const post_CreateWalletAttestation = {
43
46
  }),
44
47
  response: WalletAttestationView
45
48
  };
49
+ export const put_SetCurrentWalletInstanceStatus = {
50
+ method: z.literal("PUT"),
51
+ path: z.literal("/wallet-instances/current/status"),
52
+ parameters: z.object({
53
+ body: SetCurrentWalletInstanceStatusBody
54
+ }),
55
+ response: z.unknown()
56
+ };
46
57
 
47
58
  // <EndpointByMethod>
48
59
  export const EndpointByMethod = {
@@ -52,6 +63,9 @@ export const EndpointByMethod = {
52
63
  post: {
53
64
  "/wallet-instances": post_CreateWalletInstance,
54
65
  "/token": post_CreateWalletAttestation
66
+ },
67
+ put: {
68
+ "/wallet-instances/current/status": put_SetCurrentWalletInstanceStatus
55
69
  }
56
70
  };
57
71
 
@@ -82,6 +96,12 @@ export class ApiClient {
82
96
  return this.fetcher("post", this.baseUrl + path, arguments.length <= 1 ? undefined : arguments[1]);
83
97
  }
84
98
  // </ApiClient.post>
99
+
100
+ // <ApiClient.put>
101
+ put(path) {
102
+ return this.fetcher("put", this.baseUrl + path, arguments.length <= 1 ? undefined : arguments[1]);
103
+ }
104
+ // </ApiClient.put>
85
105
  }
86
106
 
87
107
  export function createApiClient(fetcher, baseUrl) {
@@ -1 +1 @@
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","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,GAAGX,CAAC,CAACE,MAAM,CAAC;EAClDU,UAAU,EAAEZ,CAAC,CAACa,OAAO,CAAC,6CAA6C,CAAC;EACpEC,SAAS,EAAEd,CAAC,CAACI,MAAM,CAAC;AACtB,CAAC,CAAC;AAGF,OAAO,MAAMW,aAAa,GAAGf,CAAC,CAACE,MAAM,CAAC;EACpCc,IAAI,EAAEhB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACa,QA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,CAAC;EACDY,IAAI,EAAE;IACJ,mBAAmB,EAAEN,yBAAyB;IAC9C,QAAQ,EAAEG;EACZ;AACF,CAAC;;AAED;AAEA;AAIA;AAEA;AAyCA;AAEA;AACA,OAAO,MAAMI,SAAS,CAAC;EACrBC,OAAO,GAAW,EAAE;EAEpBC,WAAWA,CAAQC,OAAgB,EAAE;IAAA,KAAlBA,OAAgB,GAAhBA,OAAgB;EAAG;EAEtCC,UAAUA,CAACH,OAAe,EAAE;IAC1B,IAAI,CAACA,OAAO,GAAGA,OAAO;IACtB,OAAO,IAAI;EACb;;EAEA;EACAH,GAAGA,CACDT,IAAU,EAE+B;IACzC,OAAO,IAAI,CAACc,OAAO,CAAC,KAAK,EAAE,IAAI,CAACF,OAAO,GAAGZ,IAAI,EAAAgB,SAAA,CAAAC,MAAA,QAAAC,SAAA,GAAAF,SAAA,GAAW,CAAC;EAC5D;EACA;;EAEA;EACAN,IAAIA,CACFV,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;;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","SetCurrentWalletInstanceStatusBody","get_GetNonce","method","path","parameters","never","response","post_CreateWalletInstance","body","unknown","post_CreateWalletAttestation","put_SetCurrentWalletInstanceStatus","EndpointByMethod","get","post","put","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,GAAGX,CAAC,CAACE,MAAM,CAAC;EAClDU,UAAU,EAAEZ,CAAC,CAACa,OAAO,CAAC,6CAA6C,CAAC;EACpEC,SAAS,EAAEd,CAAC,CAACI,MAAM,CAAC;AACtB,CAAC,CAAC;AAGF,OAAO,MAAMW,aAAa,GAAGf,CAAC,CAACE,MAAM,CAAC;EACpCc,IAAI,EAAEhB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACa,QAAQ,CAAC,CAAC;EAC3BC,KAAK,EAAElB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACa,QAAQ,CAAC,CAAC;EAC5BE,MAAM,EAAEnB,CAAC,CAACoB,MAAM,CAAC,CAAC,CAACH,QAAQ,CAAC,CAAC;EAC7BI,MAAM,EAAErB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACa,QAAQ,CAAC,CAAC;EAC7BK,QAAQ,EAAEtB,CAAC,CAACI,MAAM,CAAC,CAAC,C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,CAAC,CAACC,UAAU,CAACH,OAAO,IAAI,EAAE,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA"}
@@ -1,9 +1,16 @@
1
1
  # Wallet Instance
2
2
 
3
- This flow which consists of a single step, is used to create a wallet instance. The wallet provider must implement its endpoints based on the OpenAPI specification provided in the [wallet-instance.yaml](../../openapi/wallet-provider.yaml) file.
3
+ This flow handles the wallet instance lifecycle: creation and revocation. The wallet provider must implement its endpoints based on the OpenAPI specification provided in the [wallet-instance.yaml](../../openapi/wallet-provider.yaml) file.
4
4
  A service that is responsible for ensuring the integrity of the device where the app is running is required and it's supposed to use [Google Play Integrity API](https://developer.android.com/google/play/integrity/overview) and [Key Attestation](https://developer.android.com/privacy-and-security/security-key-attestation) on Android, [DCAppAttestService](https://developer.apple.com/documentation/devicecheck/establishing-your-app-s-integrity) on iOS.
5
5
  The suggested way to implement this service is to use [io-react-native-integrity](https://github.com/pagopa/io-react-native-integrity) by providing an [IntegrityContext](../utils/integrity.ts) object.
6
- An example is provided as follows:
6
+
7
+ The following methods are available:
8
+ - `createWalletInstance` creates a new wallet instance;
9
+ - `revokeCurrentWalletInstance` revokes the currently valid wallet instance of the user who made the request.
10
+
11
+ Examples are provided as follows:
12
+
13
+ ### Wallet instance creation
7
14
 
8
15
  ```ts
9
16
  // Get env
@@ -28,6 +35,17 @@ return integrityKeyTag;
28
35
 
29
36
  The returned `integrityKeyTag` is supposed to be stored and used to verify the integrity of the device in the future when using an `IntegrityContext` object. It must be regenerated if another wallet instance is created.
30
37
 
38
+ ### Wallet instance revocation
39
+
40
+ ```ts
41
+ const { WALLET_PROVIDER_BASE_URL } = env;
42
+
43
+ await WalletInstance.revokeCurrentWalletInstance({
44
+ walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
45
+ appFetch,
46
+ });
47
+ ```
48
+
31
49
  ## Mapped results
32
50
 
33
51
  ### 409 Conflict (WalletInstanceCreationIntegrityError)
@@ -30,4 +30,12 @@ const handleCreateWalletInstanceError = e => {
30
30
  }
31
31
  throw new WalletInstanceCreationError(`Unable to obtain wallet instance attestation [response status code: ${e.statusCode}]`, e.claim, e.reason);
32
32
  };
33
+ export async function revokeCurrentWalletInstance(context) {
34
+ const api = getWalletProviderClient(context);
35
+ await api.put("/wallet-instances/current/status", {
36
+ body: {
37
+ status: "REVOKED"
38
+ }
39
+ });
40
+ }
33
41
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getWalletProviderClient","WalletInstanceCreationError","WalletInstanceCreationIntegrityError","WalletProviderResponseError","createWalletInstance","context","integrityContext","api","challenge","get","then","response","nonce","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag","catch","handleCreateWalletInstanceError","e","statusCode","claim","reason"],"sourceRoot":"../../../src","sources":["wallet-instance/index.ts"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,WAAW;AAEnD,SACEC,2BAA2B,EAC3BC,oCAAoC,EACpCC,2BAA2B,QACtB,iBAAiB;AAExB,OAAO,eAAeC,oBAAoBA,CAACC,OAI1C,EAAE;EACD,MAAM;IAAEC;EAAiB,CAAC,GAAGD,OAAO;EAEpC,MAAME,GAAG,GAAGP,uBAAuB,CAACK,OAAO,CAAC;;EAE5C;EACA,MAAMG,SAAS,GAAG,MAAMD,GAAG,CAACE,GAAG,CAAC,QAAQ,CAAC,CAACC,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,KAAK,CAAC;EAE5E,MAAMC,cAAc,GAAG,MAAMP,gBAAgB,CAACQ,cAAc,CAACN,SAAS,CAAC;EACvE,MAAMO,cAAc,GAAGT,gBAAgB,CAACU,iBAAiB,CAAC,CAAC;;EAE3D;EACA,MAAMT,GAAG,CACNU,IAAI,CAAC,mBAAmB,EAAE;IACzBC,IAAI,EAAE;MACJV,SAAS;MACTW,eAAe,EAAEN,cAAc;MAC/BO,gBAAgB,EAAEL;IACpB;EACF,CAAC,CAAC,CACDM,KAAK,CAACC,+BAA+B,CAAC;EAEzC,OAAOP,cAAc;AACvB;AAEA,MAAMO,+BAA+B,GAAIC,CAAU,IAAK;EACtD,IAAI,EAAEA,CAAC,YAAYpB,2BAA2B,CAAC,EAAE;IAC/C,MAAMoB,CAAC;EACT;EAEA,IAAIA,CAAC,CAACC,UAAU,KAAK,GAAG,EAAE;IACxB,MAAM,IAAItB,oCAAoC,CAC5C,oFAAoF,EACpFqB,CAAC,CAACE,KAAK,EACPF,CAAC,CAACG,MACJ,CAAC;EACH;EAEA,MAAM,IAAIzB,2BAA2B,CAClC,uEAAsEsB,CAAC,CAACC,UAAW,GAAE,EACtFD,CAAC,CAACE,KAAK,EACPF,CAAC,CAACG,MACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"names":["getWalletProviderClient","WalletInstanceCreationError","WalletInstanceCreationIntegrityError","WalletProviderResponseError","createWalletInstance","context","integrityContext","api","challenge","get","then","response","nonce","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag","catch","handleCreateWalletInstanceError","e","statusCode","claim","reason","revokeCurrentWalletInstance","put","status"],"sourceRoot":"../../../src","sources":["wallet-instance/index.ts"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,WAAW;AAEnD,SACEC,2BAA2B,EAC3BC,oCAAoC,EACpCC,2BAA2B,QACtB,iBAAiB;AAExB,OAAO,eAAeC,oBAAoBA,CAACC,OAI1C,EAAE;EACD,MAAM;IAAEC;EAAiB,CAAC,GAAGD,OAAO;EAEpC,MAAME,GAAG,GAAGP,uBAAuB,CAACK,OAAO,CAAC;;EAE5C;EACA,MAAMG,SAAS,GAAG,MAAMD,GAAG,CAACE,GAAG,CAAC,QAAQ,CAAC,CAACC,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,KAAK,CAAC;EAE5E,MAAMC,cAAc,GAAG,MAAMP,gBAAgB,CAACQ,cAAc,CAACN,SAAS,CAAC;EACvE,MAAMO,cAAc,GAAGT,gBAAgB,CAACU,iBAAiB,CAAC,CAAC;;EAE3D;EACA,MAAMT,GAAG,CACNU,IAAI,CAAC,mBAAmB,EAAE;IACzBC,IAAI,EAAE;MACJV,SAAS;MACTW,eAAe,EAAEN,cAAc;MAC/BO,gBAAgB,EAAEL;IACpB;EACF,CAAC,CAAC,CACDM,KAAK,CAACC,+BAA+B,CAAC;EAEzC,OAAOP,cAAc;AACvB;AAEA,MAAMO,+BAA+B,GAAIC,CAAU,IAAK;EACtD,IAAI,EAAEA,CAAC,YAAYpB,2BAA2B,CAAC,EAAE;IAC/C,MAAMoB,CAAC;EACT;EAEA,IAAIA,CAAC,CAACC,UAAU,KAAK,GAAG,EAAE;IACxB,MAAM,IAAItB,oCAAoC,CAC5C,oFAAoF,EACpFqB,CAAC,CAACE,KAAK,EACPF,CAAC,CAACG,MACJ,CAAC;EACH;EAEA,MAAM,IAAIzB,2BAA2B,CAClC,uEAAsEsB,CAAC,CAACC,UAAW,GAAE,EACtFD,CAAC,CAACE,KAAK,EACPF,CAAC,CAACG,MACJ,CAAC;AACH,CAAC;AAED,OAAO,eAAeC,2BAA2BA,CAACtB,OAGjD,EAAiB;EAChB,MAAME,GAAG,GAAGP,uBAAuB,CAACK,OAAO,CAAC;EAE5C,MAAME,GAAG,CAACqB,GAAG,CAAC,kCAAkC,EAAE;IAChDV,IAAI,EAAE;MAAEW,MAAM,EAAE;IAAU;EAC5B,CAAC,CAAC;AACJ"}
@@ -60,6 +60,14 @@ export declare const ProblemDetail: z.ZodObject<{
60
60
  detail?: string | undefined;
61
61
  instance?: string | undefined;
62
62
  }>;
63
+ export type SetCurrentWalletInstanceStatusBody = z.infer<typeof SetCurrentWalletInstanceStatusBody>;
64
+ export declare const SetCurrentWalletInstanceStatusBody: z.ZodObject<{
65
+ status: z.ZodLiteral<"REVOKED">;
66
+ }, "strip", z.ZodTypeAny, {
67
+ status: "REVOKED";
68
+ }, {
69
+ status: "REVOKED";
70
+ }>;
63
71
  export type get_GetNonce = typeof get_GetNonce;
64
72
  export declare const get_GetNonce: {
65
73
  method: z.ZodLiteral<"GET">;
@@ -140,6 +148,29 @@ export declare const post_CreateWalletAttestation: {
140
148
  wallet_attestation: string;
141
149
  }>;
142
150
  };
151
+ export type put_SetCurrentWalletInstanceStatus = typeof put_SetCurrentWalletInstanceStatus;
152
+ export declare const put_SetCurrentWalletInstanceStatus: {
153
+ method: z.ZodLiteral<"PUT">;
154
+ path: z.ZodLiteral<"/wallet-instances/current/status">;
155
+ parameters: z.ZodObject<{
156
+ body: z.ZodObject<{
157
+ status: z.ZodLiteral<"REVOKED">;
158
+ }, "strip", z.ZodTypeAny, {
159
+ status: "REVOKED";
160
+ }, {
161
+ status: "REVOKED";
162
+ }>;
163
+ }, "strip", z.ZodTypeAny, {
164
+ body: {
165
+ status: "REVOKED";
166
+ };
167
+ }, {
168
+ body: {
169
+ status: "REVOKED";
170
+ };
171
+ }>;
172
+ response: z.ZodUnknown;
173
+ };
143
174
  export declare const EndpointByMethod: {
144
175
  get: {
145
176
  "/nonce": {
@@ -222,10 +253,35 @@ export declare const EndpointByMethod: {
222
253
  }>;
223
254
  };
224
255
  };
256
+ put: {
257
+ "/wallet-instances/current/status": {
258
+ method: z.ZodLiteral<"PUT">;
259
+ path: z.ZodLiteral<"/wallet-instances/current/status">;
260
+ parameters: z.ZodObject<{
261
+ body: z.ZodObject<{
262
+ status: z.ZodLiteral<"REVOKED">;
263
+ }, "strip", z.ZodTypeAny, {
264
+ status: "REVOKED";
265
+ }, {
266
+ status: "REVOKED";
267
+ }>;
268
+ }, "strip", z.ZodTypeAny, {
269
+ body: {
270
+ status: "REVOKED";
271
+ };
272
+ }, {
273
+ body: {
274
+ status: "REVOKED";
275
+ };
276
+ }>;
277
+ response: z.ZodUnknown;
278
+ };
279
+ };
225
280
  };
226
281
  export type EndpointByMethod = typeof EndpointByMethod;
227
282
  export type GetEndpoints = EndpointByMethod["get"];
228
283
  export type PostEndpoints = EndpointByMethod["post"];
284
+ export type PutEndpoints = EndpointByMethod["put"];
229
285
  export type AllEndpoints = EndpointByMethod[keyof EndpointByMethod];
230
286
  export type EndpointParameters = {
231
287
  body?: unknown;
@@ -263,6 +319,7 @@ export declare class ApiClient {
263
319
  setBaseUrl(baseUrl: string): this;
264
320
  get<Path extends keyof GetEndpoints, TEndpoint extends GetEndpoints[Path]>(path: Path, ...params: MaybeOptionalArg<z.infer<TEndpoint["parameters"]>>): Promise<z.infer<TEndpoint["response"]>>;
265
321
  post<Path extends keyof PostEndpoints, TEndpoint extends PostEndpoints[Path]>(path: Path, ...params: MaybeOptionalArg<z.infer<TEndpoint["parameters"]>>): Promise<z.infer<TEndpoint["response"]>>;
322
+ put<Path extends keyof PutEndpoints, TEndpoint extends PutEndpoints[Path]>(path: Path, ...params: MaybeOptionalArg<z.infer<TEndpoint["parameters"]>>): Promise<z.infer<TEndpoint["response"]>>;
266
323
  }
267
324
  export declare function createApiClient(fetcher: Fetcher, baseUrl?: string): ApiClient;
268
325
  export {};
@@ -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,CAAC,CAAC;AAC9D,eAAO,MAAM,eAAe;;;;;;EAE1B,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC1E,eAAO,MAAM,qBAAqB;;;;;;EAEhC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAChF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAInC,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACt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,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"}
@@ -4,4 +4,8 @@ export declare function createWalletInstance(context: {
4
4
  walletProviderBaseUrl: string;
5
5
  appFetch?: GlobalFetch["fetch"];
6
6
  }): Promise<string>;
7
+ export declare function revokeCurrentWalletInstance(context: {
8
+ walletProviderBaseUrl: string;
9
+ appFetch?: GlobalFetch["fetch"];
10
+ }): Promise<void>;
7
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wallet-instance/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAO3C,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,mBAuBA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wallet-instance/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAO3C,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,mBAuBA;AAsBD,wBAAsB,2BAA2B,CAAC,OAAO,EAAE;IACzD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,GAAG,OAAO,CAAC,IAAI,CAAC,CAMhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-wallet",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Provide data structures, helpers and API for IO Wallet",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -32,6 +32,11 @@ export const ProblemDetail = z.object({
32
32
  instance: z.string().optional(),
33
33
  });
34
34
 
35
+ export type SetCurrentWalletInstanceStatusBody = z.infer<typeof SetCurrentWalletInstanceStatusBody>;
36
+ export const SetCurrentWalletInstanceStatusBody = z.object({
37
+ status: z.literal("REVOKED"),
38
+ });
39
+
35
40
  export type get_GetNonce = typeof get_GetNonce;
36
41
  export const get_GetNonce = {
37
42
  method: z.literal("GET"),
@@ -60,6 +65,16 @@ export const post_CreateWalletAttestation = {
60
65
  response: WalletAttestationView,
61
66
  };
62
67
 
68
+ export type put_SetCurrentWalletInstanceStatus = typeof put_SetCurrentWalletInstanceStatus;
69
+ export const put_SetCurrentWalletInstanceStatus = {
70
+ method: z.literal("PUT"),
71
+ path: z.literal("/wallet-instances/current/status"),
72
+ parameters: z.object({
73
+ body: SetCurrentWalletInstanceStatusBody,
74
+ }),
75
+ response: z.unknown(),
76
+ };
77
+
63
78
  // <EndpointByMethod>
64
79
  export const EndpointByMethod = {
65
80
  get: {
@@ -69,6 +84,9 @@ export const EndpointByMethod = {
69
84
  "/wallet-instances": post_CreateWalletInstance,
70
85
  "/token": post_CreateWalletAttestation,
71
86
  },
87
+ put: {
88
+ "/wallet-instances/current/status": put_SetCurrentWalletInstanceStatus,
89
+ },
72
90
  };
73
91
  export type EndpointByMethod = typeof EndpointByMethod;
74
92
  // </EndpointByMethod>
@@ -76,6 +94,7 @@ export type EndpointByMethod = typeof EndpointByMethod;
76
94
  // <EndpointByMethod.Shorthands>
77
95
  export type GetEndpoints = EndpointByMethod["get"];
78
96
  export type PostEndpoints = EndpointByMethod["post"];
97
+ export type PutEndpoints = EndpointByMethod["put"];
79
98
  export type AllEndpoints = EndpointByMethod[keyof EndpointByMethod];
80
99
  // </EndpointByMethod.Shorthands>
81
100
 
@@ -150,6 +169,15 @@ export class ApiClient {
150
169
  return this.fetcher("post", this.baseUrl + path, params[0]) as Promise<z.infer<TEndpoint["response"]>>;
151
170
  }
152
171
  // </ApiClient.post>
172
+
173
+ // <ApiClient.put>
174
+ put<Path extends keyof PutEndpoints, TEndpoint extends PutEndpoints[Path]>(
175
+ path: Path,
176
+ ...params: MaybeOptionalArg<z.infer<TEndpoint["parameters"]>>
177
+ ): Promise<z.infer<TEndpoint["response"]>> {
178
+ return this.fetcher("put", this.baseUrl + path, params[0]) as Promise<z.infer<TEndpoint["response"]>>;
179
+ }
180
+ // </ApiClient.put>
153
181
  }
154
182
 
155
183
  export function createApiClient(fetcher: Fetcher, baseUrl?: string) {
@@ -1,9 +1,16 @@
1
1
  # Wallet Instance
2
2
 
3
- This flow which consists of a single step, is used to create a wallet instance. The wallet provider must implement its endpoints based on the OpenAPI specification provided in the [wallet-instance.yaml](../../openapi/wallet-provider.yaml) file.
3
+ This flow handles the wallet instance lifecycle: creation and revocation. The wallet provider must implement its endpoints based on the OpenAPI specification provided in the [wallet-instance.yaml](../../openapi/wallet-provider.yaml) file.
4
4
  A service that is responsible for ensuring the integrity of the device where the app is running is required and it's supposed to use [Google Play Integrity API](https://developer.android.com/google/play/integrity/overview) and [Key Attestation](https://developer.android.com/privacy-and-security/security-key-attestation) on Android, [DCAppAttestService](https://developer.apple.com/documentation/devicecheck/establishing-your-app-s-integrity) on iOS.
5
5
  The suggested way to implement this service is to use [io-react-native-integrity](https://github.com/pagopa/io-react-native-integrity) by providing an [IntegrityContext](../utils/integrity.ts) object.
6
- An example is provided as follows:
6
+
7
+ The following methods are available:
8
+ - `createWalletInstance` creates a new wallet instance;
9
+ - `revokeCurrentWalletInstance` revokes the currently valid wallet instance of the user who made the request.
10
+
11
+ Examples are provided as follows:
12
+
13
+ ### Wallet instance creation
7
14
 
8
15
  ```ts
9
16
  // Get env
@@ -28,6 +35,17 @@ return integrityKeyTag;
28
35
 
29
36
  The returned `integrityKeyTag` is supposed to be stored and used to verify the integrity of the device in the future when using an `IntegrityContext` object. It must be regenerated if another wallet instance is created.
30
37
 
38
+ ### Wallet instance revocation
39
+
40
+ ```ts
41
+ const { WALLET_PROVIDER_BASE_URL } = env;
42
+
43
+ await WalletInstance.revokeCurrentWalletInstance({
44
+ walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
45
+ appFetch,
46
+ });
47
+ ```
48
+
31
49
  ## Mapped results
32
50
 
33
51
  ### 409 Conflict (WalletInstanceCreationIntegrityError)
@@ -54,3 +54,14 @@ const handleCreateWalletInstanceError = (e: unknown) => {
54
54
  e.reason
55
55
  );
56
56
  };
57
+
58
+ export async function revokeCurrentWalletInstance(context: {
59
+ walletProviderBaseUrl: string;
60
+ appFetch?: GlobalFetch["fetch"];
61
+ }): Promise<void> {
62
+ const api = getWalletProviderClient(context);
63
+
64
+ await api.put("/wallet-instances/current/status", {
65
+ body: { status: "REVOKED" },
66
+ });
67
+ }