cozy-client 27.6.4 → 27.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,55 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [27.9.0](https://github.com/cozy/cozy-client/compare/v27.8.0...v27.9.0) (2022-01-12)
7
+
8
+ **Note:** Version bump only for package cozy-client
9
+
10
+
11
+
12
+
13
+
14
+ # [27.8.0](https://github.com/cozy/cozy-client/compare/v27.7.0...v27.8.0) (2022-01-11)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * Rebuild `permission.d.ts` to fit CI version ([380db52](https://github.com/cozy/cozy-client/commit/380db528004e9a64b244a99bb238351fac4f2a05))
20
+ * UseQuery returns fetch method ([93e7f3d](https://github.com/cozy/cozy-client/commit/93e7f3d217353003795d43dfedf1397bb64815af))
21
+
22
+
23
+ ### Features
24
+
25
+ * Add `react-native-google-safetynet` module as peerDependencies ([cd4b37f](https://github.com/cozy/cozy-client/commit/cd4b37fc3353b702035e773b2b423ef7e7aa3156))
26
+ * Add `react-native-ios11-devicecheck` module as peerDependencies ([b9ed2e9](https://github.com/cozy/cozy-client/commit/b9ed2e9c42518a50961f5b233b5f6ae1894ed7d6))
27
+ * Add flagship certification mechanism ([fe8474c](https://github.com/cozy/cozy-client/commit/fe8474c3286393c996eb5704184de652aa8028fe))
28
+
29
+
30
+
31
+
32
+
33
+ # [27.7.0](https://github.com/cozy/cozy-client/compare/v27.6.5...v27.7.0) (2022-01-03)
34
+
35
+
36
+ ### Features
37
+
38
+ * Add of missing papers targeted for v1 ([25e4953](https://github.com/cozy/cozy-client/commit/25e4953cee9de7f7043aea33a2f2b67841435529))
39
+
40
+
41
+
42
+
43
+
44
+ ## [27.6.5](https://github.com/cozy/cozy-client/compare/v27.6.4...v27.6.5) (2021-12-20)
45
+
46
+
47
+ ### Bug Fixes
48
+
49
+ * Use fetchOwnPermissions instead of deprecated getOwnPermissions ([fb1dd51](https://github.com/cozy/cozy-client/commit/fb1dd517c3f8ca6e184055ad3194d387a5901027))
50
+
51
+
52
+
53
+
54
+
6
55
  ## [27.6.4](https://github.com/cozy/cozy-client/compare/v27.6.3...v27.6.4) (2021-12-20)
7
56
 
8
57
  **Note:** Version bump only for package cozy-client
@@ -83,6 +83,8 @@ var _jsonStableStringify = _interopRequireDefault(require("json-stable-stringify
83
83
 
84
84
  var _promiseCache = _interopRequireDefault(require("./promise-cache"));
85
85
 
86
+ var _flagshipCertification = require("./flagship-certification/flagship-certification");
87
+
86
88
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
87
89
 
88
90
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -1958,9 +1960,18 @@ var CozyClient = /*#__PURE__*/function () {
1958
1960
  return stackClient.register();
1959
1961
 
1960
1962
  case 3:
1963
+ if (!stackClient.oauthOptions.shouldRequireFlagshipPermissions) {
1964
+ _context14.next = 6;
1965
+ break;
1966
+ }
1967
+
1968
+ _context14.next = 6;
1969
+ return (0, _flagshipCertification.certifyFlagship)(stackClient.oauthOptions.certificationConfig, this);
1970
+
1971
+ case 6:
1961
1972
  return _context14.abrupt("return", this.authorize(openURLCallback));
1962
1973
 
1963
- case 4:
1974
+ case 7:
1964
1975
  case "end":
1965
1976
  return _context14.stop();
1966
1977
  }
@@ -2452,7 +2463,7 @@ var CozyClient = /*#__PURE__*/function () {
2452
2463
  CozyClient.hooks = CozyClient.hooks || {};
2453
2464
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2454
2465
 
2455
- CozyClient.version = "27.6.4";
2466
+ CozyClient.version = "27.9.0";
2456
2467
 
2457
2468
  _microee.default.mixin(CozyClient);
2458
2469
 
@@ -49,7 +49,8 @@
49
49
  },
50
50
  {
51
51
  "label": "other_identity_document",
52
- "purpose": "attestation"
52
+ "purpose": "attestation",
53
+ "subjects": ["identity"]
53
54
  },
54
55
  {
55
56
  "label": "wedding",
@@ -86,7 +87,8 @@
86
87
  "subjects": ["right"]
87
88
  },
88
89
  {
89
- "label": "other_family_document"
90
+ "label": "other_family_document",
91
+ "subjects": ["family"]
90
92
  },
91
93
  {
92
94
  "label": "diploma",
@@ -133,7 +135,7 @@
133
135
  "label": "student_card",
134
136
  "purpose": "attestation",
135
137
  "sourceCategory": "education",
136
- "subjects": ["identity"]
138
+ "subjects": ["identity", "right", "employment", "education"]
137
139
  },
138
140
  {
139
141
  "label": "resume",
@@ -146,39 +148,59 @@
146
148
  "subjects": ["employment"]
147
149
  },
148
150
  {
149
- "label": "other_work_document"
151
+ "label": "other_work_document",
152
+ "purpose": "employment"
150
153
  },
151
154
  {
152
155
  "label": "health_book",
153
156
  "purpose": "attestation",
154
157
  "sourceCategory": "health",
155
- "subjects": ["identity", "capacity", "vaccine"]
158
+ "subjects": ["capacity", "vaccine"]
156
159
  },
157
160
  {
158
161
  "label": "health_certificate",
159
162
  "purpose": "attestation",
160
163
  "sourceCategory": "health",
161
- "subjects": ["identity", "capacity", "vaccine"]
164
+ "subjects": ["capacity", "vaccine"]
165
+ },
166
+ {
167
+ "label": "pregnancy_medical_certificate",
168
+ "purpose": "attestation",
169
+ "sourceCategory": "health",
170
+ "subjects": ["pregnancy"]
171
+ },
172
+ {
173
+ "label": "work_disability_recognition",
174
+ "purpose": "attestation",
175
+ "sourceCategory": "health",
176
+ "subjects": ["right"]
162
177
  },
163
178
  {
164
179
  "label": "national_health_insurance_card",
165
180
  "purpose": "attestation",
166
181
  "sourceCategory": "gov",
167
182
  "sourceSubCategory": "health",
168
- "subjects": ["identity", "insurance"]
183
+ "subjects": ["insurance"]
184
+ },
185
+ {
186
+ "label": "national_health_insurance_right_certificate",
187
+ "purpose": "attestation",
188
+ "sourceCategory": "gov",
189
+ "sourceSubCategory": "health",
190
+ "subjects": ["right", "insurance"]
169
191
  },
170
192
  {
171
193
  "label": "health_insurance_card",
172
194
  "purpose": "attestation",
173
195
  "sourceCategory": "insurance",
174
196
  "sourceSubCategory": "health",
175
- "subjects": ["identity", "insurance"]
197
+ "subjects": ["insurance"]
176
198
  },
177
199
  {
178
200
  "label": "prescription",
179
201
  "purpose": "attestation",
180
202
  "sourceCategory": "health",
181
- "subjects": ["identity", "right", "medecine"]
203
+ "subjects": ["right", "medecine"]
182
204
  },
183
205
  {
184
206
  "label": "health_invoice",
@@ -186,14 +208,15 @@
186
208
  "sourceCategory": "health"
187
209
  },
188
210
  {
189
- "label": "other_health_document"
211
+ "label": "other_health_document",
212
+ "subjects": ["health"]
190
213
  },
191
214
  {
192
215
  "label": "vehicle_registration",
193
216
  "purpose": "attestation",
194
217
  "sourceCategory": "gov",
195
218
  "sourceSubCategory": "transport",
196
- "subjects": ["right", "identity"]
219
+ "subjects": ["vehicule", "indentity", "right"]
197
220
  },
198
221
  {
199
222
  "label": "car_insurance",
@@ -213,7 +236,8 @@
213
236
  "sourceCategory": "transport"
214
237
  },
215
238
  {
216
- "label": "other_transport_document"
239
+ "label": "other_transport_document",
240
+ "sourceCategory": "transport"
217
241
  },
218
242
  {
219
243
  "label": "house_sale_agreeement",
@@ -266,7 +290,8 @@
266
290
  "subjects": ["building", "house"]
267
291
  },
268
292
  {
269
- "label": "other_house_document"
293
+ "label": "other_house_document",
294
+ "subjects": ["house"]
270
295
  },
271
296
  {
272
297
  "label": "phone_invoice",
@@ -338,15 +363,13 @@
338
363
  },
339
364
  {
340
365
  "label": "other_tax_document",
341
- "sourceCategory": "gov",
342
- "sourceSubCategory": "tax",
343
366
  "subjects": ["tax"]
344
367
  },
345
368
  {
346
369
  "label": "bank_details",
347
370
  "purpose": "attestation",
348
371
  "sourceCategory": "bank",
349
- "subjects": ["identity"]
372
+ "subjects": ["bank_account"]
350
373
  },
351
374
  {
352
375
  "label": "bank_statement",
@@ -366,25 +389,66 @@
366
389
  {
367
390
  "label": "receipt",
368
391
  "purpose": "report"
392
+ },
393
+ {
394
+ "label": "payment_proof_family_allowance",
395
+ "purpose": "attestation",
396
+ "sourceCategory": "gov",
397
+ "sourceSubCategory": "tax",
398
+ "subjects": ["subvention"]
399
+ },
400
+ {
401
+ "label": "school_attendance_certificate",
402
+ "purpose": "attestation",
403
+ "sourceCategory": "education",
404
+ "subjects": ["identity", "right", "education"]
405
+ },
406
+ {
407
+ "label": "unfit_for_habitation_declaration",
408
+ "purpose": "attestation",
409
+ "sourceCategory": "gov",
410
+ "sourceSubCategory": "real_estate",
411
+ "subjects": ["compliance"]
412
+ },
413
+ {
414
+ "label": "accommodation_proof",
415
+ "purpose": "attestation",
416
+ "sourceCategory": "individual",
417
+ "subjects": ["address"]
418
+ },
419
+ {
420
+ "label": "citizen_registration_certificate",
421
+ "purpose": "attestation",
422
+ "sourceCategory": "gov",
423
+ "sourceSubCategory": "civil_registration",
424
+ "subjects": ["achievement","education"]
425
+ },
426
+ {
427
+ "label": "personal_sporting_licence",
428
+ "purpose": "attestation",
429
+ "sourceCategory": "gov",
430
+ "sourceSubCategory": "sport",
431
+ "subjects": ["permit", "invoice"]
369
432
  }
370
433
  ],
371
434
  "purposeKnownValues": [
372
- "attestation", "contract", "invoice", "report", "description", "evaluation"
435
+ "attestation", "contract", "invoice", "report", "description", "evaluation", "employment"
373
436
  ],
374
437
  "sourceCategoryKnownValues": [
375
- "bank", "insurance", "retail", "telecom", "energy", "water", "health", "gov",
438
+ "bank", "insurance", "retail", "telecom", "energy", "water", "health", "gov", "association",
376
439
  "education", "employer", "transport", "goods", "alimentation", "building",
377
- "real_estate", "web"
440
+ "real_estate", "web", "individual"
378
441
  ],
379
442
  "sourceSubCategoryKnownValues": [
380
443
  "civil_registration", "immigration", "transport", "family", "tax", "health",
381
- "real_estate", "mobile", "internet"
444
+ "real_estate", "mobile", "internet", "citizen", "sport"
382
445
  ],
383
446
  "subjectsKnownValues": [
384
- "identity", "permit", "family", "driving", "right", "subvention", "achievement",
385
- "degree", "work", "employment", "revenues", "history", "insurance", "drugs",
386
- "medical_act", "car", "moto", "truck", "boat", "subscription", "buy/sale",
387
- "house", "compliance", "building", "food", "real_estate", "tax",
388
- "education", "statement", "course", "internet", "phone", "vaccine", "capacity"
447
+ "identity", "permit", "family", "address", "driving", "right", "subvention", "achievement",
448
+ "degree", "work", "employment", "revenues", "history", "insurance",
449
+ "medical_act", "vehicule", "car", "moto", "truck", "boat", "subscription", "buy/sale",
450
+ "house", "compliance", "building", "food", "real_estate", "tax", "address",
451
+ "education", "statement", "course", "internet", "phone", "vaccine", "capacity",
452
+ "health", "drugs", "child", "pregnancy", "bank_account"
389
453
  ]
390
454
  }
@@ -0,0 +1,96 @@
1
+ # Flagship certification
2
+
3
+ Flagship certification is the process of verifying that the current running app is a genuine Cozy application.
4
+
5
+ This verification is done by querying an app certificate from the app store (Apple AppStore or Google Play) and sending the resulting certificate to `cozy-stack`. Then `cozy-stack` will be able to an analyze the certificate and conclude if the app is genuine or not.
6
+
7
+ ## Nomenclature
8
+
9
+ - `flagship`: refers to the Cozy main application
10
+ - `store certification`: process of verifying app's genuineness through the platform's store
11
+ - `attestation`: result from the `store certification`
12
+ - `challenge`: unique token given to the app by `cozy-stack` that may be encrypted in the `attestation` as a proof of authenticity
13
+ - `nonce`: data type used to store the `challenge` token
14
+ - `SafetyNet`: Google's implementation of the `store certification`
15
+ - `AppAttest`: Apple's implementation of the `store certification`
16
+
17
+ ## Android certification
18
+
19
+ Android certification is based on [SafetyNet](https://developer.android.com/training/safetynet/index.html).
20
+
21
+ This process requires to query a `challenge` from `cozy-stack` and to use it to init the `store certification` process through `SafetyNet`. Then the received `attestation` is send to `cozy-stack` for verification.
22
+
23
+ The resulting `attestation` is in the form of a `JSON Web Signature` that embbed the following `JSON`:
24
+ ```json
25
+ {
26
+ "apkCertificateDigestSha256": [
27
+ "base64 encoded, SHA-256 hash of the certificate used to sign requesting app="
28
+ ],
29
+ "apkDigestSha256": "kNv83tJLFqwliYQ/6HUPCeGkBzLLCX/nvT+EF3OEB2I=",
30
+ "apkPackageName": "com.package.name.of.requesting.app",
31
+ "basicIntegrity": true,
32
+ "ctsProfileMatch": true,
33
+ "evaluationType": "BASIC",
34
+ "nonce": "R2Rra24fVm5xa2Mg",
35
+ "timestampMs": 9860437986543
36
+ }
37
+ ```
38
+
39
+ The `attestation`'s content is described in the SafetyNet's documentation: https://developer.android.com/training/safetynet/attestation#use-response-server
40
+
41
+ ## iOS certification
42
+
43
+ iOS certification is based on [AppAttest](https://developer.apple.com/documentation/devicecheck).
44
+
45
+ This process requires to query a `challenge` from `cozy-stack` and to use it to init the `store certification` process through `AppAttest`. Then the received `attestation` is send to `cozy-stack` for verification.
46
+
47
+ The resulting `attestation` is in the form of a `base64` token.
48
+
49
+ The `attestation`'s content is described in the `AppAttest`'s documentation: https://developer.apple.com/documentation/devicecheck/validating_apps_that_connect_to_your_server#3576643
50
+
51
+ ## Client's configuration
52
+
53
+ In order to configure `flagship` certification on an app, the OAuth property of `cozy-client` must contain `shouldRequireFlagshipPermissions` property set to `true` and `certificationConfig` property filled with required API keys.
54
+
55
+ Example of `cozy-client` configuration:
56
+ ```js
57
+ const client = await initClient(uri, {
58
+ scope: [
59
+ 'io.cozy.apps'
60
+ ],
61
+ oauth: {
62
+ redirectURI: 'REDIRECT_URI',
63
+ softwareID: 'YOUR_APP_ID',
64
+ clientKind: 'mobile',
65
+ clientName: 'YOUR_APP_NAME',
66
+ shouldRequireFlagshipPermissions: true,
67
+ certificationConfig: {
68
+ androidSafetyNetApiKey: 'YOUR_GOOGLE_SAFETY_NET_API_KEY'
69
+ }
70
+ },
71
+ ```
72
+
73
+ ## Stacks' configuration
74
+
75
+ In order to certify an app, the `cozy-stack` needs to have the following data:
76
+ - App's package name
77
+ - The app's package name is set on the react-native project
78
+ - It should be put in `flagship.apk_package_names` in the `cozy-stack`'s configuration file
79
+ - iOS app's id
80
+ - The iOS app's id is the concatenation of the developper team's id and the app's package name as defined in the XCode project
81
+ - If team's id is `ABCDEFGHIJ` and package name is `io.cozy.some_app` then the resulting app's id should be `ABCDEFGHIJ.io.cozy.some_app`
82
+ - It should be put in `flagship.apple_app_ids` in the `cozy-stack`'s configuration file
83
+ - Android app's certificate digest
84
+ - The Android certificate digest can be found in the Google Play app's Console, in `Configuration/App integrity` page
85
+ - On local dev environment, the dev certificate location is:
86
+ - On a ReactNative project: `<project_root>/android/app/debug.keystore`
87
+ - On an Android Studio project:
88
+ - On OSX: `~/.android/debug.keystore`
89
+ - On Windows: `%UserProfile%\.android\debug.keystore`
90
+ - On a Xamarin Project:
91
+ - On OSX: `~/.local/share/Xamarin/Mono for Android/debug.keystore`
92
+ - On Windows: `%LocalAppData%\Xamarin\Mono for Android\debug.keystore`
93
+ - To extract the certificat digest from local dev certificate:
94
+ - `keytool -list -v -keystore ./android/app/debug.keystore -alias androiddebugkey -storepass android -keypass android | grep "SHA256: " | cut -d " " -f 3 | xxd -r -p | openssl base64`
95
+ - The certificate digest is the `App signing key certificate` in SHA-256 format converted from HEX to base64
96
+ - It should be put in `flagship.apk_certificate_digests` in the `cozy-stack`'s configuration file
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.certifyFlagship = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ var _CozyClient = _interopRequireDefault(require("../CozyClient"));
15
+
16
+ var _storeAttestation = require("./store-attestation");
17
+
18
+ /**
19
+ * Request a challenge from the Stack that can be used to request the app attestation from the app store
20
+ *
21
+ * @param {CozyClient} client - the CozyClient instance
22
+ * @returns {Promise<string>} - the Nonce string returned by the stack
23
+ */
24
+ var getStackChallenge = /*#__PURE__*/function () {
25
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(client) {
26
+ var stackClient, result;
27
+ return _regenerator.default.wrap(function _callee$(_context) {
28
+ while (1) {
29
+ switch (_context.prev = _context.next) {
30
+ case 0:
31
+ _context.prev = 0;
32
+ stackClient = client.getStackClient();
33
+ _context.next = 4;
34
+ return stackClient.fetchJSON('POST', "/auth/clients/".concat(stackClient.oauthOptions.clientID, "/challenge"), null, {
35
+ headers: {
36
+ Authorization: stackClient.registrationAccessTokenToAuthHeader()
37
+ }
38
+ });
39
+
40
+ case 4:
41
+ result = _context.sent;
42
+ return _context.abrupt("return", result.nonce);
43
+
44
+ case 8:
45
+ _context.prev = 8;
46
+ _context.t0 = _context["catch"](0);
47
+ throw new Error('[FLAGSHIP_CERTIFICATION] Something went wrong while requesting a challenge from CozyStack:\n' + _context.t0.message);
48
+
49
+ case 11:
50
+ case "end":
51
+ return _context.stop();
52
+ }
53
+ }
54
+ }, _callee, null, [[0, 8]]);
55
+ }));
56
+
57
+ return function getStackChallenge(_x) {
58
+ return _ref.apply(this, arguments);
59
+ };
60
+ }();
61
+ /**
62
+ * Give the app attestation to the Stack
63
+ *
64
+ * @param {AttestationResult} appAttestation - the app attestation that was returned by the app store
65
+ * @param {string} nonce - the Nonce string retrieved from the stack
66
+ * @param {CozyClient} client - the CozyClient instance
67
+ */
68
+
69
+
70
+ var giveAppAttestationToStack = /*#__PURE__*/function () {
71
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(appAttestation, nonce, client) {
72
+ var platform, attestation, keyId, stackClient;
73
+ return _regenerator.default.wrap(function _callee2$(_context2) {
74
+ while (1) {
75
+ switch (_context2.prev = _context2.next) {
76
+ case 0:
77
+ _context2.prev = 0;
78
+ platform = appAttestation.platform, attestation = appAttestation.attestation, keyId = appAttestation.keyId;
79
+ stackClient = client.getStackClient();
80
+ _context2.next = 5;
81
+ return stackClient.fetchJSON('POST', "/auth/clients/".concat(stackClient.oauthOptions.clientID, "/attestation"), {
82
+ platform: platform,
83
+ attestation: attestation,
84
+ challenge: nonce,
85
+ keyId: keyId
86
+ }, {
87
+ headers: {
88
+ Authorization: stackClient.registrationAccessTokenToAuthHeader()
89
+ }
90
+ });
91
+
92
+ case 5:
93
+ _context2.next = 10;
94
+ break;
95
+
96
+ case 7:
97
+ _context2.prev = 7;
98
+ _context2.t0 = _context2["catch"](0);
99
+ throw new Error('[FLAGSHIP_CERTIFICATION] Something went wrong while giving attestation to CozyStack:\n' + _context2.t0.message);
100
+
101
+ case 10:
102
+ case "end":
103
+ return _context2.stop();
104
+ }
105
+ }
106
+ }, _callee2, null, [[0, 7]]);
107
+ }));
108
+
109
+ return function giveAppAttestationToStack(_x2, _x3, _x4) {
110
+ return _ref2.apply(this, arguments);
111
+ };
112
+ }();
113
+ /**
114
+ * Verify app's identity and integrity so the Stack can trust it
115
+ * Verification is done on Stack side by using information from the app's store (Google Play or Apple AppStore)
116
+ *
117
+ * @param {CertificationConfig} certificationConfig - the required configuration to access the stores API
118
+ * @param {CozyClient} client - the CozyClient instance
119
+ */
120
+
121
+
122
+ var certifyFlagship = /*#__PURE__*/function () {
123
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(certificationConfig, client) {
124
+ var stackChallengeNonce, appAttestation;
125
+ return _regenerator.default.wrap(function _callee3$(_context3) {
126
+ while (1) {
127
+ switch (_context3.prev = _context3.next) {
128
+ case 0:
129
+ if (certificationConfig) {
130
+ _context3.next = 2;
131
+ break;
132
+ }
133
+
134
+ throw new Error('[FLAGSHIP_CERTIFICATION] Certification configuration is not set');
135
+
136
+ case 2:
137
+ _context3.next = 4;
138
+ return getStackChallenge(client);
139
+
140
+ case 4:
141
+ stackChallengeNonce = _context3.sent;
142
+ _context3.next = 7;
143
+ return (0, _storeAttestation.getAppAttestationFromStore)(stackChallengeNonce, certificationConfig);
144
+
145
+ case 7:
146
+ appAttestation = _context3.sent;
147
+ _context3.next = 10;
148
+ return giveAppAttestationToStack(appAttestation, stackChallengeNonce, client);
149
+
150
+ case 10:
151
+ case "end":
152
+ return _context3.stop();
153
+ }
154
+ }
155
+ }, _callee3);
156
+ }));
157
+
158
+ return function certifyFlagship(_x5, _x6) {
159
+ return _ref3.apply(this, arguments);
160
+ };
161
+ }();
162
+
163
+ exports.certifyFlagship = certifyFlagship;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.getAppAttestationFromStore = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ var _reactNativeGoogleSafetynet = _interopRequireDefault(require("react-native-google-safetynet"));
15
+
16
+ //@ts-ignore
17
+
18
+ /**
19
+ * Retrieve the app's attestation from the Google Play store
20
+ *
21
+ * @param {string} nonce - the Nonce string retrieved from the stack
22
+ * @param {CertificationConfig} certificationConfig - Configuration to access the stores certification API
23
+ * @returns {Promise<AttestationResult>} the app's attestation
24
+ */
25
+ var getAppAttestationFromStore = /*#__PURE__*/function () {
26
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(nonce, certificationConfig) {
27
+ var attestationResult;
28
+ return _regenerator.default.wrap(function _callee$(_context) {
29
+ while (1) {
30
+ switch (_context.prev = _context.next) {
31
+ case 0:
32
+ _context.prev = 0;
33
+ _context.next = 3;
34
+ return _reactNativeGoogleSafetynet.default.sendAttestationRequestJWT(nonce, certificationConfig.androidSafetyNetApiKey);
35
+
36
+ case 3:
37
+ attestationResult = _context.sent;
38
+ return _context.abrupt("return", {
39
+ platform: 'android',
40
+ attestation: attestationResult
41
+ });
42
+
43
+ case 7:
44
+ _context.prev = 7;
45
+ _context.t0 = _context["catch"](0);
46
+ throw new Error('[FLAGSHIP_CERTIFICATION] Something went wrong while requesting an attestation from Google Safetynet:\n' + _context.t0.message);
47
+
48
+ case 10:
49
+ case "end":
50
+ return _context.stop();
51
+ }
52
+ }
53
+ }, _callee, null, [[0, 7]]);
54
+ }));
55
+
56
+ return function getAppAttestationFromStore(_x, _x2) {
57
+ return _ref.apply(this, arguments);
58
+ };
59
+ }();
60
+
61
+ exports.getAppAttestationFromStore = getAppAttestationFromStore;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.getAppAttestationFromStore = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ var _reactNativeIos11Devicecheck = _interopRequireDefault(require("react-native-ios11-devicecheck"));
15
+
16
+ //@ts-ignore
17
+
18
+ /**
19
+ * Retrieve the app's attestation from the Apple AppStore
20
+ *
21
+ * @param {string} nonce - the Nonce string retrieved from the stack
22
+ * @param {CertificationConfig} certificationConfig - Configuration to access the stores certification API
23
+ * @returns {Promise<AttestationResult>} the app's attestation
24
+ */
25
+ var getAppAttestationFromStore = /*#__PURE__*/function () {
26
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(nonce, certificationConfig) {
27
+ var keyId, attestKey;
28
+ return _regenerator.default.wrap(function _callee$(_context) {
29
+ while (1) {
30
+ switch (_context.prev = _context.next) {
31
+ case 0:
32
+ _context.prev = 0;
33
+ _context.next = 3;
34
+ return _reactNativeIos11Devicecheck.default.generateKey();
35
+
36
+ case 3:
37
+ keyId = _context.sent;
38
+ _context.next = 6;
39
+ return _reactNativeIos11Devicecheck.default.attestKey(keyId, nonce);
40
+
41
+ case 6:
42
+ attestKey = _context.sent;
43
+ return _context.abrupt("return", {
44
+ platform: 'ios',
45
+ attestation: attestKey,
46
+ keyId: keyId
47
+ });
48
+
49
+ case 10:
50
+ _context.prev = 10;
51
+ _context.t0 = _context["catch"](0);
52
+ throw new Error('[FLAGSHIP_CERTIFICATION] Something went wrong while requesting an attestation from Apple DeviceCheck:\n' + _context.t0.message);
53
+
54
+ case 13:
55
+ case "end":
56
+ return _context.stop();
57
+ }
58
+ }
59
+ }, _callee, null, [[0, 10]]);
60
+ }));
61
+
62
+ return function getAppAttestationFromStore(_x, _x2) {
63
+ return _ref.apply(this, arguments);
64
+ };
65
+ }();
66
+
67
+ exports.getAppAttestationFromStore = getAppAttestationFromStore;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.getAppAttestationFromStore = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ /**
15
+ * Retrieve the app's attestation from the app's store
16
+ * /!\ This is a mock implementation that should never be called
17
+ *
18
+ * @param {string} nonce - the Nonce string retrieved from the stack
19
+ * @param {CertificationConfig} certificationConfig - Configuration to access the stores certification API
20
+ * @returns {Promise<AttestationResult>} the app's attestation
21
+ */
22
+ var validateAppMock = /*#__PURE__*/function () {
23
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(nonce, certificationConfig) {
24
+ return _regenerator.default.wrap(function _callee$(_context) {
25
+ while (1) {
26
+ switch (_context.prev = _context.next) {
27
+ case 0:
28
+ throw new Error("validateApp can only be called from a React Native container");
29
+
30
+ case 1:
31
+ case "end":
32
+ return _context.stop();
33
+ }
34
+ }
35
+ }, _callee);
36
+ }));
37
+
38
+ return function validateAppMock(_x, _x2) {
39
+ return _ref.apply(this, arguments);
40
+ };
41
+ }();
42
+
43
+ var getAppAttestationFromStore = validateAppMock;
44
+ exports.getAppAttestationFromStore = getAppAttestationFromStore;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A JSON Web Signature
3
+ * @typedef {string} jws
4
+ */
5
+
6
+ /**
7
+ * A JSON Web Signature
8
+ * @typedef {string} base64string
9
+ */
10
+
11
+ /**
12
+ * An app attestation from the app store
13
+ * @typedef {object} AttestationResult
14
+ * @property {string} platform
15
+ * @property {jws|base64string} attestation
16
+ * @property {string} [keyId]
17
+ */
18
+
19
+ /**
20
+ * Configuration to access the stores certification API
21
+ * @typedef {object} CertificationConfig
22
+ * @property {string} androidSafetyNetApiKey
23
+ */
24
+ "use strict";
@@ -103,8 +103,12 @@ var useQuery = function useQuery(queryDefinition, options) {
103
103
  as: as
104
104
  });
105
105
  }, [as, client]);
106
+ var fetch = (0, _react.useCallback)(function () {
107
+ return client.query(definition, options);
108
+ }, [client, definition, options]);
106
109
  return _objectSpread(_objectSpread({}, queryState), {}, {
107
- fetchMore: fetchMore
110
+ fetchMore: fetchMore,
111
+ fetch: fetch
108
112
  });
109
113
  };
110
114
 
@@ -52,6 +52,46 @@ describe('use query', () => {
52
52
  })
53
53
  })
54
54
 
55
+ it('should share the same API than ObservableQuery', () => {
56
+ const {
57
+ hookResult: {
58
+ result: { current }
59
+ }
60
+ } = setupQuery({
61
+ queryOptions: {
62
+ as: 'simpsons'
63
+ },
64
+ queryDefinition: () => Q('io.cozy.simpsons')
65
+ })
66
+ expect(current).toMatchObject({
67
+ data: [
68
+ expect.objectContaining({ name: 'Homer' }),
69
+ expect.objectContaining({ name: 'Marge' })
70
+ ],
71
+ definition: expect.objectContaining({
72
+ doctype: 'io.cozy.simpsons'
73
+ })
74
+ })
75
+
76
+ expect(Object.keys(current)).toEqual(
77
+ expect.objectContaining([
78
+ 'id',
79
+ 'definition',
80
+ 'fetchStatus',
81
+ 'lastFetch',
82
+ 'lastUpdate',
83
+ 'lastErrorUpdate',
84
+ 'lastError',
85
+ 'hasMore',
86
+ 'count',
87
+ 'data',
88
+ 'bookmark',
89
+ 'options',
90
+ 'fetchMore',
91
+ 'fetch'
92
+ ])
93
+ )
94
+ })
55
95
  it('should query through the client in context', () => {
56
96
  const { client } = setupQuery({
57
97
  queryOptions: {
@@ -32,27 +32,27 @@ var buildItemsByLabel = function buildItemsByLabel(labels) {
32
32
  */
33
33
 
34
34
 
35
- var identityLabels = ['identity_photo', 'national_id_card', 'passport', 'residence_permit', 'family_record_book', 'birth_certificate', 'driver_license', 'other_identity_document'];
35
+ var identityLabels = ['identity_photo', 'national_id_card', 'passport', 'residence_permit', 'family_record_book', 'birth_certificate', 'driver_license', 'citizen_registration_certificate', 'personal_sporting_licence', 'other_identity_document'];
36
36
  /**
37
37
  * @type {Array<FamilyLabel>}
38
38
  */
39
39
 
40
- var familyLabels = ['family_record_book', 'birth_certificate', 'wedding', 'pacs', 'divorce', 'large_family_card', 'caf', 'other_family_document'];
40
+ var familyLabels = ['family_record_book', 'birth_certificate', 'wedding', 'pacs', 'divorce', 'large_family_card', 'caf', 'payment_proof_family_allowance', 'other_family_document'];
41
41
  /**
42
42
  * @type {Array<WorkStudyLabels>}
43
43
  */
44
44
 
45
- var workStudyLabels = ['diploma', 'work_contract', 'pay_sheet', 'unemployment_benefit', 'pension', 'other_revenue', 'gradebook', 'student_card', 'resume', 'motivation_letter', 'other_work_document'];
45
+ var workStudyLabels = ['diploma', 'work_contract', 'pay_sheet', 'unemployment_benefit', 'pension', 'work_disability_recognition', 'other_revenue', 'gradebook', 'student_card', 'school_attendance_certificate', 'resume', 'motivation_letter', 'other_work_document'];
46
46
  /**
47
47
  * @type {Array<HealthLabels>}
48
48
  */
49
49
 
50
- var healthLabels = ['health_certificate', 'health_book', 'national_health_insurance_card', 'health_insurance_card', 'prescription', 'health_invoice'];
50
+ var healthLabels = ['health_certificate', 'health_book', 'national_health_insurance_card', 'national_health_insurance_right_certificate', 'health_insurance_card', 'prescription', 'health_invoice', 'work_disability_recognition', 'pregnancy_medical_certificate', 'other_health_document'];
51
51
  /**
52
52
  * @type {Array<HomeLabels>}
53
53
  */
54
54
 
55
- var homeLabels = ['phone_invoice', 'isp_invoice', 'telecom_invoice', 'energy_invoice', 'water_invoice', 'house_sale_agreeement', 'building_permit', 'technical_diagnostic_record', 'lease', 'rent_receipt', 'house_insurance', 'work_quote', 'work_invoice', 'other_house_document'];
55
+ var homeLabels = ['phone_invoice', 'isp_invoice', 'telecom_invoice', 'energy_invoice', 'water_invoice', 'house_sale_agreeement', 'building_permit', 'technical_diagnostic_record', 'unfit_for_habitation_declaration', 'lease', 'rent_receipt', 'accommodation_proof', 'house_insurance', 'work_quote', 'work_invoice', 'other_house_document'];
56
56
  /**
57
57
  * @type {Array<TransportLabels>}
58
58
  */
@@ -62,7 +62,7 @@ var transportLabels = ['driver_license', 'vehicle_registration', 'car_insurance'
62
62
  * @type {Array<FinanceLabels>}
63
63
  */
64
64
 
65
- var financeLabels = ['tax_return', 'tax_notice', 'tax_timetable', 'receipt', 'other_tax_document', 'bank_details', 'bank_statement', 'loan_agreement', 'other_bank_document'];
65
+ var financeLabels = ['tax_return', 'tax_notice', 'tax_timetable', 'receipt', 'other_tax_document', 'bank_details', 'bank_statement', 'loan_agreement', 'payment_proof_family_allowance', 'other_bank_document'];
66
66
  /**
67
67
  * @type {Array<InvoiceLabels>}
68
68
  */
@@ -19,7 +19,7 @@
19
19
  "items": {
20
20
  "identity": "Identity",
21
21
  "family": "Family",
22
- "work_study": "Work",
22
+ "work_study": "Work & Study",
23
23
  "health": "Health",
24
24
  "home": "Home",
25
25
  "transport": "Transport",
@@ -31,13 +31,15 @@
31
31
  "residence_permit": "Residence permit",
32
32
  "family_record_book": "Family record book",
33
33
  "birth_certificate": "Birth certificate",
34
+ "citizen_registration_certificate": "Certificate of citizen registration",
34
35
  "driver_license": "Driving license",
35
36
  "other_identity_document": "Other identity",
36
37
  "wedding": "Wedding contract",
37
38
  "pacs": "Civil union",
38
39
  "divorce": "Divorce",
39
40
  "large_family_card": " Large Family Card",
40
- "caf": "Social benefit",
41
+ "caf": "Social benefit rate",
42
+ "payment_proof_family_allowance": "family allowance payment proof",
41
43
  "other_family_document": "Other family document",
42
44
  "diploma": "Diploma",
43
45
  "work_contract": "Work contract",
@@ -47,12 +49,16 @@
47
49
  "other_revenue": "Other revenues",
48
50
  "gradebook": "Gradebook",
49
51
  "student_card": "Student card",
52
+ "school_attendance_certificate": "Certificate of school attendance",
50
53
  "resume": "Resume",
51
54
  "motivation_letter": "Motivation letter",
52
55
  "other_work_document": "Other work document",
53
56
  "health_book": "Health book",
54
57
  "health_certificate": "Health/Vaccination certificate",
55
- "national_health_insurance_card": "National insurance card",
58
+ "disability_recognition": "Recognition of disability",
59
+ "pregnancy_medical_certificate": "Certificate of pregnancy",
60
+ "national_health_insurance_card": "National health insurance card",
61
+ "national_health_insurance_right_certificate": "National health insurance right certificate",
56
62
  "health_insurance_card": "Insurance card",
57
63
  "prescription": "Prescription",
58
64
  "health_invoice": "Health invoice",
@@ -75,7 +81,9 @@
75
81
  "technical_diagnostic_record": "Technical diagnostic record",
76
82
  "lease": "Lease",
77
83
  "house_insurance": "Home insurance",
84
+ "unfit_for_habitation_declaration": "Declaration of unfit for habitation",
78
85
  "rent_receipt": "Rent receipt",
86
+ "accommodation_proof": "Proof of accommodation",
79
87
  "work_quote": "Work quote",
80
88
  "work_invoice": "Work invoice",
81
89
  "other_house_document": "Other house document",
@@ -89,12 +97,13 @@
89
97
  "loan_agreement": "Loan agreement",
90
98
  "other_bank_document": "Other banking document",
91
99
  "invoices": "Invoices",
100
+ "personal_sporting_licence": "Sporting licence",
92
101
  "other_invoice": "Other invoice"
93
102
  },
94
103
  "themes": {
95
104
  "identity": "Identity",
96
105
  "family": "Family",
97
- "work_study": "Work",
106
+ "work_study": "Work & Study",
98
107
  "health": "Health",
99
108
  "home": "Home",
100
109
  "transport": "Transport",
@@ -19,7 +19,7 @@
19
19
  "items": {
20
20
  "identity": "Identité",
21
21
  "family": "Famille",
22
- "work_study": "Travail",
22
+ "work_study": "Travail & Études",
23
23
  "health": "Santé",
24
24
  "home": "Logement",
25
25
  "transport": "Transport",
@@ -31,13 +31,15 @@
31
31
  "residence_permit": "Titre de séjour",
32
32
  "family_record_book": "Livret de famille",
33
33
  "birth_certificate": "Certificat de naissance",
34
+ "citizen_registration_certificate": "Attestation de recensement citoyen",
34
35
  "driver_license": "Permis",
35
36
  "other_identity_document": "Autre identité",
36
37
  "wedding": "Contrat de mariage",
37
38
  "pacs": "Attestation de PACS",
38
39
  "divorce": "Attestation de divorce",
39
40
  "large_family_card": "Carte famille nombreuse",
40
- "caf": "CAF",
41
+ "caf": "Attestation de quotient familial (CAF)",
42
+ "payment_proof_family_allowance": "Attestation de paiement CAF",
41
43
  "other_family_document": "Autre document de famille",
42
44
  "diploma": "Diplôme",
43
45
  "work_contract": "Contrat de travail",
@@ -47,12 +49,16 @@
47
49
  "other_revenue": "Autres revenues",
48
50
  "gradebook": "Bulletin de notes",
49
51
  "student_card": "Carte d'étudiant",
52
+ "school_attendance_certificate": "Certificat de scolarité",
50
53
  "resume": "CV",
51
54
  "motivation_letter": "Lettre de motivation",
52
55
  "other_work_document": "Autre document de travail",
53
56
  "health_book": "Carnet de santé",
54
57
  "health_certificate": "Certificat de santé/vaccination",
58
+ "work_disability_recognition": "Reconnaissance de handicap - RQTH",
59
+ "pregnancy_medical_certificate": "Certificat de grossesse",
55
60
  "national_health_insurance_card": "Carte vitale",
61
+ "national_health_insurance_right_certificate": "Attestation de droits de l'Assurance Maladie (vitale)",
56
62
  "health_insurance_card": "Carte de mutuelle",
57
63
  "prescription": "Ordonnance",
58
64
  "health_invoice": "Facture médicale",
@@ -74,27 +80,30 @@
74
80
  "building_permit": "Permis de construire",
75
81
  "technical_diagnostic_record": "Dossier de diagnostic technique",
76
82
  "lease": "Bail",
83
+ "unfit_for_habitation_declaration": "Arrêté d'insalubrité",
77
84
  "house_insurance": "Assurance logement",
78
85
  "rent_receipt": "Quittance de loyer",
86
+ "accommodation_proof": "Attestation d'hébergement",
79
87
  "work_quote": "Devis de travaux",
80
88
  "work_invoice": "Facture de travaux",
81
89
  "other_house_document": "Autre document de logement",
82
- "tax_return": "Déclaration d'impôt",
83
- "tax_notice": "Avis d'imposition",
84
- "tax_timetable": "Echéancier d'imposition",
90
+ "tax_return": "Impôts - Déclaration de revenus",
91
+ "tax_notice": "Impôts - Avis d'imposition",
92
+ "tax_timetable": "Impôts - Echéancier",
85
93
  "receipt": "Accusé de réception",
86
- "other_tax_document": "Autre document d'impôt",
94
+ "other_tax_document": "Impôts - Autre document",
87
95
  "bank_details": "IBAN",
88
96
  "bank_statement": "Relevé de compte",
89
97
  "loan_agreement": "Contrat de prêt",
90
98
  "other_bank_document": "Autre document bancaire",
91
99
  "invoices": "Factures",
100
+ "personal_sporting_licence": "Licences sportives",
92
101
  "other_invoice": "Autre facture"
93
102
  },
94
103
  "themes": {
95
104
  "identity": "Identité",
96
105
  "family": "Famille",
97
- "work_study": "Travail",
106
+ "work_study": "Travail & Études",
98
107
  "health": "Santé",
99
108
  "home": "Logement",
100
109
  "transport": "Transport",
@@ -100,7 +100,7 @@ function _fetchOwn() {
100
100
  case 0:
101
101
  collection = client.collection('io.cozy.permissions');
102
102
  _context.next = 3;
103
- return collection.getOwnPermissions();
103
+ return collection.fetchOwnPermissions();
104
104
 
105
105
  case 3:
106
106
  data = _context.sent;
@@ -42,7 +42,7 @@ function setupClient(verbs = [], ids = ['first', 'other']) {
42
42
  return {
43
43
  query: async data => data,
44
44
  collection: () => ({
45
- getOwnPermissions: async () => ({
45
+ fetchOwnPermissions: async () => ({
46
46
  data: {
47
47
  id: '9385e37389cb9f71a230168f245df2f8',
48
48
  _id: '9385e37389cb9f71a230168f245df2f8',
package/dist/types.js CHANGED
@@ -276,19 +276,19 @@ var _dsl = require("./queries/dsl");
276
276
  */
277
277
 
278
278
  /**
279
- * @typedef {'identity_photo'|'national_id_card'|'passport'|'residence_permit'|'family_record_book'|'birth_certificate'|'driver_license'|'other_identity_document'} IdentityLabel
279
+ * @typedef {'identity_photo'|'national_id_card'|'passport'|'residence_permit'|'family_record_book'|'birth_certificate'|'driver_license'|'other_identity_document'|'citizen_registration_certificate'|'personal_sporting_licence'} IdentityLabel
280
280
  *
281
- * @typedef {'family_record_book'|'birth_certificate'|'wedding'|'pacs'|'divorce'|'large_family_card'|'caf'|'other_family_document'} FamilyLabel
281
+ * @typedef {'family_record_book'|'birth_certificate'|'wedding'|'pacs'|'divorce'|'large_family_card'|'caf'|'other_family_document'|'payment_proof_family_allowance'} FamilyLabel
282
282
  *
283
- * @typedef {'diploma'|'work_contract'|'pay_sheet'|'unemployment_benefit'|'pension'|'other_revenue'|'gradebook'|'student_card'|'resume'|'motivation_letter'|'other_work_document'} WorkStudyLabels
283
+ * @typedef {'diploma'|'work_contract'|'pay_sheet'|'unemployment_benefit'|'pension'|'other_revenue'|'gradebook'|'student_card'|'resume'|'motivation_letter'|'other_work_document'|'work_disability_recognition'|'school_attendance_certificate'} WorkStudyLabels
284
284
  *
285
- * @typedef {'health_certificate'|'health_book'|'national_health_insurance_card'|'health_insurance_card'|'prescription'|'health_invoice'} HealthLabels
285
+ * @typedef {'health_certificate'|'health_book'|'national_health_insurance_card'|'health_insurance_card'|'prescription'|'health_invoice'|'national_health_insurance_right_certificate'|'work_disability_recognition'|'pregnancy_medical_certificate'|'other_health_document'} HealthLabels
286
286
  *
287
- * @typedef {'phone_invoice'|'isp_invoice'|'telecom_invoice'|'energy_invoice'|'water_invoice'|'house_sale_agreeement'|'building_permit'|'technical_diagnostic_record'|'lease'|'rent_receipt'|'house_insurance'|'work_quote'|'work_invoice'|'other_house_document'} HomeLabels
287
+ * @typedef {'phone_invoice'|'isp_invoice'|'telecom_invoice'|'energy_invoice'|'water_invoice'|'house_sale_agreeement'|'building_permit'|'technical_diagnostic_record'|'lease'|'rent_receipt'|'house_insurance'|'work_quote'|'work_invoice'|'other_house_document'|'unfit_for_habitation_declaration'|'accommodation_proof'|'house_insurance'} HomeLabels
288
288
  *
289
289
  * @typedef {'driver_license'|'vehicle_registration'|'car_insurance'|'mechanic_invoice'|'transport_invoice'|'other_transport_document'} TransportLabels
290
290
  *
291
- * @typedef {'tax_return'|'tax_notice'|'tax_timetable'|'receipt'|'other_tax_document'|'bank_details'|'bank_statement'|'loan_agreement'|'other_bank_document'} FinanceLabels
291
+ * @typedef {'tax_return'|'tax_notice'|'tax_timetable'|'receipt'|'other_tax_document'|'bank_details'|'bank_statement'|'loan_agreement'|'other_bank_document'|'payment_proof_family_allowance'} FinanceLabels
292
292
  *
293
293
  * @typedef {'phone_invoice'|'isp_invoice'|'telecom_invoice'|'energy_invoice'|'water_invoice'|'appliance_invoice'|'web_service_invoice'|'restaurant_invoice'|'work_invoice'|'transport_invoice'|'health_invoice'|'other_invoice'} InvoiceLabels
294
294
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "27.6.4",
3
+ "version": "27.9.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "cozy-device-helper": "^1.12.0",
22
22
  "cozy-flags": "2.7.1",
23
23
  "cozy-logger": "^1.6.0",
24
- "cozy-stack-client": "^27.6.4",
24
+ "cozy-stack-client": "^27.9.0",
25
25
  "json-stable-stringify": "^1.0.1",
26
26
  "lodash": "^4.17.13",
27
27
  "microee": "^0.0.6",
@@ -66,8 +66,10 @@
66
66
  "cozy-ui": ">34.0.0",
67
67
  "react": "^16.7.0",
68
68
  "react-native": "^0.65.0",
69
- "react-native-inappbrowser-reborn": "^3.5.1"
69
+ "react-native-google-safetynet": "0.0.4",
70
+ "react-native-inappbrowser-reborn": "^3.5.1",
71
+ "react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
70
72
  },
71
73
  "sideEffects": false,
72
- "gitHead": "3d824e698c423ad080bf5e252c7b95d628716418"
74
+ "gitHead": "59b2993b0605869136048323d05c5d5e3bbd3268"
73
75
  }
@@ -0,0 +1,2 @@
1
+ export function certifyFlagship(certificationConfig: CertificationConfig, client: CozyClient): Promise<void>;
2
+ import CozyClient from "../CozyClient";
@@ -0,0 +1 @@
1
+ export function getAppAttestationFromStore(nonce: string, certificationConfig: CertificationConfig): Promise<AttestationResult>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Retrieve the app's attestation from the app's store
3
+ * /!\ This is a mock implementation that should never be called
4
+ *
5
+ * @param {string} nonce - the Nonce string retrieved from the stack
6
+ * @param {CertificationConfig} certificationConfig - Configuration to access the stores certification API
7
+ * @returns {Promise<AttestationResult>} the app's attestation
8
+ */
9
+ export function getAppAttestationFromStore(nonce: string, certificationConfig: CertificationConfig): Promise<AttestationResult>;
@@ -0,0 +1 @@
1
+ export function getAppAttestationFromStore(nonce: string, certificationConfig: CertificationConfig): Promise<AttestationResult>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A JSON Web Signature
3
+ */
4
+ type jws = string;
5
+ /**
6
+ * A JSON Web Signature
7
+ */
8
+ type base64string = string;
9
+ /**
10
+ * An app attestation from the app store
11
+ */
12
+ type AttestationResult = {
13
+ platform: string;
14
+ attestation: jws | base64string;
15
+ keyId?: string;
16
+ };
17
+ /**
18
+ * Configuration to access the stores certification API
19
+ */
20
+ type CertificationConfig = {
21
+ androidSafetyNetApiKey: string;
22
+ };
@@ -52,7 +52,7 @@ export type Document = {
52
52
  _type: string;
53
53
  type: string;
54
54
  };
55
- export type PermissionVerb = "DELETE" | "PUT" | "POST" | "GET" | "ALL" | "PATCH";
55
+ export type PermissionVerb = "POST" | "DELETE" | "PUT" | "GET" | "ALL" | "PATCH";
56
56
  export type PermissionItem = {
57
57
  /**
58
58
  * - ALL, GET, PUT, PATCH, DELETE, POST…
package/types/types.d.ts CHANGED
@@ -315,13 +315,13 @@ export type QualificationAttributes = {
315
315
  sourceSubCategory?: string;
316
316
  subjects?: Array<string>;
317
317
  };
318
- export type IdentityLabel = "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document";
319
- export type FamilyLabel = "family_record_book" | "birth_certificate" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document";
320
- export type WorkStudyLabels = "resume" | "diploma" | "work_contract" | "pay_sheet" | "unemployment_benefit" | "pension" | "other_revenue" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document";
321
- export type HealthLabels = "health_certificate" | "health_book" | "national_health_insurance_card" | "health_insurance_card" | "prescription" | "health_invoice";
322
- export type HomeLabels = "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document";
318
+ export type IdentityLabel = "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "citizen_registration_certificate" | "personal_sporting_licence";
319
+ export type FamilyLabel = "family_record_book" | "birth_certificate" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "payment_proof_family_allowance";
320
+ export type WorkStudyLabels = "resume" | "diploma" | "work_contract" | "pay_sheet" | "unemployment_benefit" | "pension" | "other_revenue" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document" | "work_disability_recognition" | "school_attendance_certificate";
321
+ export type HealthLabels = "work_disability_recognition" | "health_certificate" | "health_book" | "national_health_insurance_card" | "health_insurance_card" | "prescription" | "health_invoice" | "national_health_insurance_right_certificate" | "pregnancy_medical_certificate" | "other_health_document";
322
+ export type HomeLabels = "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "unfit_for_habitation_declaration" | "accommodation_proof";
323
323
  export type TransportLabels = "driver_license" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document";
324
- export type FinanceLabels = "tax_return" | "tax_notice" | "tax_timetable" | "receipt" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document";
324
+ export type FinanceLabels = "payment_proof_family_allowance" | "tax_return" | "tax_notice" | "tax_timetable" | "receipt" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document";
325
325
  export type InvoiceLabels = "health_invoice" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "work_invoice" | "transport_invoice" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "other_invoice";
326
- export type ItemsLabels = "resume" | "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "diploma" | "work_contract" | "pay_sheet" | "unemployment_benefit" | "pension" | "other_revenue" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document" | "health_certificate" | "health_book" | "national_health_insurance_card" | "health_insurance_card" | "prescription" | "health_invoice" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document" | "tax_return" | "tax_notice" | "tax_timetable" | "receipt" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "other_invoice";
326
+ export type ItemsLabels = "resume" | "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "citizen_registration_certificate" | "personal_sporting_licence" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "payment_proof_family_allowance" | "diploma" | "work_contract" | "pay_sheet" | "unemployment_benefit" | "pension" | "other_revenue" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document" | "work_disability_recognition" | "school_attendance_certificate" | "health_certificate" | "health_book" | "national_health_insurance_card" | "health_insurance_card" | "prescription" | "health_invoice" | "national_health_insurance_right_certificate" | "pregnancy_medical_certificate" | "other_health_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "unfit_for_habitation_declaration" | "accommodation_proof" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document" | "tax_return" | "tax_notice" | "tax_timetable" | "receipt" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "other_invoice";
327
327
  import { QueryDefinition } from "./queries/dsl";