@appium/coresim 1.1.1 → 1.2.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 +6 -0
- package/lib/src/commands/permissions.d.ts +4 -2
- package/lib/src/commands/permissions.d.ts.map +1 -1
- package/lib/src/commands/permissions.js +9 -2
- package/lib/src/commands/permissions.js.map +1 -1
- package/lib/src/types.d.ts +3 -4
- package/lib/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@appium+coresim.node +0 -0
- package/src/commands/permissions.ts +15 -2
- package/src/coresim.mm +13 -5
- package/src/native/tcc_privacy.h +17 -14
- package/src/native/tcc_privacy.mm +8 -5
- package/src/types.ts +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [1.2.0](https://github.com/appium/coresim/compare/v1.1.1...v1.2.0) (2026-09-17)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* Support more permission types ([#12](https://github.com/appium/coresim/issues/12)) ([164cb7d](https://github.com/appium/coresim/commit/164cb7d4d4bbc9029f18ad137f1215d82fa3ab79))
|
|
6
|
+
|
|
1
7
|
## [1.1.1](https://github.com/appium/coresim/compare/v1.1.0...v1.1.1) (2026-09-16)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
|
@@ -2,7 +2,7 @@ import type { NativeSimctl } from '../native-simctl.js';
|
|
|
2
2
|
import type { SimPermissionService, SimPermissionStatus } from '../types.js';
|
|
3
3
|
declare module '../native-simctl.js' {
|
|
4
4
|
interface NativeSimctl {
|
|
5
|
-
grantPermission(udid: string, service: SimPermissionService, bundleId: string): Promise<void>;
|
|
5
|
+
grantPermission(udid: string, service: SimPermissionService, bundleId: string, status?: 'granted' | 'limited'): Promise<void>;
|
|
6
6
|
revokePermission(udid: string, service: SimPermissionService, bundleId: string): Promise<void>;
|
|
7
7
|
resetPermission(udid: string, service: SimPermissionService, bundleId: string): Promise<void>;
|
|
8
8
|
getPermission(udid: string, service: SimPermissionService, bundleId: string): Promise<SimPermissionStatus>;
|
|
@@ -16,8 +16,10 @@ declare module '../native-simctl.js' {
|
|
|
16
16
|
* @param udid — UDID of the target device
|
|
17
17
|
* @param service — permission to grant, e.g. `"camera"`, `"contacts"`, `"photos"`
|
|
18
18
|
* @param bundleId — bundle identifier of the app the permission applies to
|
|
19
|
+
* @param status — defaults to `'granted'`. `'limited'` ("selected photos" access) is only valid
|
|
20
|
+
* for the `photos` service.
|
|
19
21
|
*/
|
|
20
|
-
export declare function grantPermission(this: NativeSimctl, udid: string, service: SimPermissionService, bundleId: string): Promise<void>;
|
|
22
|
+
export declare function grantPermission(this: NativeSimctl, udid: string, service: SimPermissionService, bundleId: string, status?: 'granted' | 'limited'): Promise<void>;
|
|
21
23
|
/**
|
|
22
24
|
* Revokes a previously granted privacy permission from the given app.
|
|
23
25
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/commands/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAG3E,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,YAAY;QACpB,eAAe,
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/commands/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAG3E,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,YAAY;QACpB,eAAe,CACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,MAAM,EACh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 import { runCatchingAsync } from '../utils/index.js';
|
|
|
7
7
|
* @param udid — UDID of the target device
|
|
8
8
|
* @param service — permission to grant, e.g. `"camera"`, `"contacts"`, `"photos"`
|
|
9
9
|
* @param bundleId — bundle identifier of the app the permission applies to
|
|
10
|
+
* @param status — defaults to `'granted'`. `'limited'` ("selected photos" access) is only valid
|
|
11
|
+
* for the `photos` service.
|
|
10
12
|
*/
|
|
11
|
-
export async function grantPermission(udid, service, bundleId) {
|
|
13
|
+
export async function grantPermission(udid, service, bundleId, status = 'granted') {
|
|
12
14
|
return runCatchingAsync(async () => {
|
|
15
|
+
if (status === 'limited' && service !== 'photos') {
|
|
16
|
+
throw new Error(`'limited' is only a valid status for the 'photos' service, not '${service}'`);
|
|
17
|
+
}
|
|
13
18
|
const tccIdentifier = toTCCIdentifier(service);
|
|
14
|
-
return (await this._findDevice(udid)).grantPermission(tccIdentifier, bundleId);
|
|
19
|
+
return (await this._findDevice(udid)).grantPermission(tccIdentifier, bundleId, status);
|
|
15
20
|
});
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
@@ -64,6 +69,7 @@ const SERVICE_TO_TCC_IDENTIFIER = {
|
|
|
64
69
|
calendar: 'kTCCServiceCalendar',
|
|
65
70
|
camera: 'kTCCServiceCamera',
|
|
66
71
|
contacts: 'kTCCServiceAddressBook',
|
|
72
|
+
faceid: 'kTCCServiceFaceID',
|
|
67
73
|
health: 'kTCCServiceMSO',
|
|
68
74
|
homekit: 'kTCCServiceWillow',
|
|
69
75
|
medialibrary: 'kTCCServiceMediaLibrary',
|
|
@@ -73,6 +79,7 @@ const SERVICE_TO_TCC_IDENTIFIER = {
|
|
|
73
79
|
reminders: 'kTCCServiceReminders',
|
|
74
80
|
siri: 'kTCCServiceSiri',
|
|
75
81
|
speech: 'kTCCServiceSpeechRecognition',
|
|
82
|
+
usertracking: 'kTCCServiceUserTracking',
|
|
76
83
|
};
|
|
77
84
|
function toTCCIdentifier(service) {
|
|
78
85
|
const identifier = SERVICE_TO_TCC_IDENTIFIER[service];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/commands/permissions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/commands/permissions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAgBnD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAEnC,IAAY,EACZ,OAA6B,EAC7B,QAAgB,EAChB,SAAgC,SAAS;IAEzC,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE;QACjC,IAAI,MAAM,KAAK,SAAS,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;YACjD,MAAM,IAAI,KAAK,CAAC,mEAAmE,OAAO,GAAG,CAAC,CAAC;QACjG,CAAC;QACD,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;QAC/C,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAEpC,IAAY,EACZ,OAA6B,EAC7B,QAAgB;IAEhB,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;QAC/C,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe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EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,IAAI,OAAO,+CAA+C,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9G,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/lib/src/types.d.ts
CHANGED
|
@@ -67,8 +67,7 @@ export interface SimBootInfo {
|
|
|
67
67
|
* Result of `NativeSimctl.getPermission` — mirrors the TCC database's own auth states rather than
|
|
68
68
|
* a plain boolean, since `'unset'` (never prompted/decided) and `'denied'` (explicitly refused)
|
|
69
69
|
* are different states with different UI implications. `'limited'` only applies to `photos`
|
|
70
|
-
* ("selected photos" access)
|
|
71
|
-
* present if something else set it.
|
|
70
|
+
* ("selected photos" access).
|
|
72
71
|
*/
|
|
73
72
|
export type SimPermissionStatus = 'unset' | 'denied' | 'granted' | 'limited';
|
|
74
73
|
/**
|
|
@@ -77,7 +76,7 @@ export type SimPermissionStatus = 'unset' | 'denied' | 'granted' | 'limited';
|
|
|
77
76
|
* `location` isn't included since CoreLocation simulation has its own subsystem, not a plain TCC
|
|
78
77
|
* row (see CLAUDE.md).
|
|
79
78
|
*/
|
|
80
|
-
export type SimPermissionService = 'calendar' | 'camera' | 'contacts' | 'health' | 'homekit' | 'medialibrary' | 'microphone' | 'motion' | 'photos' | 'reminders' | 'siri' | 'speech';
|
|
79
|
+
export type SimPermissionService = 'calendar' | 'camera' | 'contacts' | 'faceid' | 'health' | 'homekit' | 'medialibrary' | 'microphone' | 'motion' | 'photos' | 'reminders' | 'siri' | 'speech' | 'usertracking';
|
|
81
80
|
/**
|
|
82
81
|
* A device's renderable display, as returned by `NativeSimctl.getDisplays()`.
|
|
83
82
|
*/
|
|
@@ -235,7 +234,7 @@ export interface NativeDeviceHandle {
|
|
|
235
234
|
setIncreaseContrast(enabled: boolean): Promise<void>;
|
|
236
235
|
getContentSize(): Promise<number>;
|
|
237
236
|
setContentSize(category: number): Promise<void>;
|
|
238
|
-
grantPermission(service: string, bundleId: string): Promise<void>;
|
|
237
|
+
grantPermission(service: string, bundleId: string, status?: 'granted' | 'limited'): Promise<void>;
|
|
239
238
|
revokePermission(service: string, bundleId: string): Promise<void>;
|
|
240
239
|
resetPermission(service: string, bundleId: string): Promise<void>;
|
|
241
240
|
getPermission(service: string, bundleId: string): Promise<SimPermissionStatus>;
|
package/lib/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,oBAAY,cAAc;IACxB,QAAQ,IAAI;IACZ,QAAQ,IAAI;IACZ,OAAO,IAAI;IACX,MAAM,IAAI;IACV,YAAY,IAAI;CACjB;AAED,uGAAuG;AACvG,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,cAAc,CAAC;IACtB,gHAAgH;IAChH,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wGAAwG;IACxG,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,+GAA+G;AAC/G,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wGAAwG;AACxG,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,oBAAY,aAAa;IACvB,OAAO,IAAI;IACX,sBAAsB,IAAI;IAC1B,kBAAkB,IAAI;IACtB,uDAAuD;IACvD,QAAQ,aAAa;CACtB;AAED,uGAAuG;AACvG,MAAM,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Y,GAAG,SAAS,EAAE,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACrH;AAED,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IACpC,OAAO,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACzC,YAAY,CAAC,oBAAoB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjH,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAED,+EAA+E;AAC/E,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnD,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAChE,oBAAoB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACrD,iBAAiB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CAChD;AAED,uHAAuH;AACvH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAChF,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACrC"}
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -4,7 +4,12 @@ import {runCatchingAsync} from '../utils/index.js';
|
|
|
4
4
|
|
|
5
5
|
declare module '../native-simctl.js' {
|
|
6
6
|
interface NativeSimctl {
|
|
7
|
-
grantPermission(
|
|
7
|
+
grantPermission(
|
|
8
|
+
udid: string,
|
|
9
|
+
service: SimPermissionService,
|
|
10
|
+
bundleId: string,
|
|
11
|
+
status?: 'granted' | 'limited',
|
|
12
|
+
): Promise<void>;
|
|
8
13
|
revokePermission(udid: string, service: SimPermissionService, bundleId: string): Promise<void>;
|
|
9
14
|
resetPermission(udid: string, service: SimPermissionService, bundleId: string): Promise<void>;
|
|
10
15
|
getPermission(udid: string, service: SimPermissionService, bundleId: string): Promise<SimPermissionStatus>;
|
|
@@ -19,16 +24,22 @@ declare module '../native-simctl.js' {
|
|
|
19
24
|
* @param udid — UDID of the target device
|
|
20
25
|
* @param service — permission to grant, e.g. `"camera"`, `"contacts"`, `"photos"`
|
|
21
26
|
* @param bundleId — bundle identifier of the app the permission applies to
|
|
27
|
+
* @param status — defaults to `'granted'`. `'limited'` ("selected photos" access) is only valid
|
|
28
|
+
* for the `photos` service.
|
|
22
29
|
*/
|
|
23
30
|
export async function grantPermission(
|
|
24
31
|
this: NativeSimctl,
|
|
25
32
|
udid: string,
|
|
26
33
|
service: SimPermissionService,
|
|
27
34
|
bundleId: string,
|
|
35
|
+
status: 'granted' | 'limited' = 'granted',
|
|
28
36
|
): Promise<void> {
|
|
29
37
|
return runCatchingAsync(async () => {
|
|
38
|
+
if (status === 'limited' && service !== 'photos') {
|
|
39
|
+
throw new Error(`'limited' is only a valid status for the 'photos' service, not '${service}'`);
|
|
40
|
+
}
|
|
30
41
|
const tccIdentifier = toTCCIdentifier(service);
|
|
31
|
-
return (await this._findDevice(udid)).grantPermission(tccIdentifier, bundleId);
|
|
42
|
+
return (await this._findDevice(udid)).grantPermission(tccIdentifier, bundleId, status);
|
|
32
43
|
});
|
|
33
44
|
}
|
|
34
45
|
|
|
@@ -100,6 +111,7 @@ const SERVICE_TO_TCC_IDENTIFIER: Record<SimPermissionService, string> = {
|
|
|
100
111
|
calendar: 'kTCCServiceCalendar',
|
|
101
112
|
camera: 'kTCCServiceCamera',
|
|
102
113
|
contacts: 'kTCCServiceAddressBook',
|
|
114
|
+
faceid: 'kTCCServiceFaceID',
|
|
103
115
|
health: 'kTCCServiceMSO',
|
|
104
116
|
homekit: 'kTCCServiceWillow',
|
|
105
117
|
medialibrary: 'kTCCServiceMediaLibrary',
|
|
@@ -109,6 +121,7 @@ const SERVICE_TO_TCC_IDENTIFIER: Record<SimPermissionService, string> = {
|
|
|
109
121
|
reminders: 'kTCCServiceReminders',
|
|
110
122
|
siri: 'kTCCServiceSiri',
|
|
111
123
|
speech: 'kTCCServiceSpeechRecognition',
|
|
124
|
+
usertracking: 'kTCCServiceUserTracking',
|
|
112
125
|
};
|
|
113
126
|
|
|
114
127
|
function toTCCIdentifier(service: SimPermissionService): string {
|
package/src/coresim.mm
CHANGED
|
@@ -454,20 +454,28 @@ class NativeDevice : public Napi::ObjectWrap<NativeDevice> {
|
|
|
454
454
|
});
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
// `grantPermission`'s optional 3rd JS argument is a status override ("limited"), used only for
|
|
458
|
+
// kTCCServicePhotos's "selected photos" access — see commands/permissions.ts.
|
|
459
|
+
Napi::Value GrantPermission(const Napi::CallbackInfo& info) {
|
|
460
|
+
TCCAuthStatus desiredStatus = kTCCAuthGranted;
|
|
461
|
+
if (info.Length() > 2 && info[2].IsString() && info[2].As<Napi::String>().Utf8Value() == "limited") {
|
|
462
|
+
desiredStatus = kTCCAuthLimited;
|
|
463
|
+
}
|
|
464
|
+
return SetPermission(info, desiredStatus);
|
|
465
|
+
}
|
|
466
|
+
Napi::Value RevokePermission(const Napi::CallbackInfo& info) { return SetPermission(info, kTCCAuthDenied); }
|
|
459
467
|
|
|
460
468
|
// Writes directly to the simulator's own TCC.db instead of calling CoreSimulator's
|
|
461
469
|
// setPrivacyAccessForService:bundleID:granted:error: — that private method requires the calling
|
|
462
470
|
// process to hold an entitlement no ordinary npm package can obtain (see CLAUDE.md).
|
|
463
|
-
Napi::Value SetPermission(const Napi::CallbackInfo& info,
|
|
471
|
+
Napi::Value SetPermission(const Napi::CallbackInfo& info, TCCAuthStatus desiredStatus) {
|
|
464
472
|
id device = device_;
|
|
465
473
|
NSString* service = @(info[0].As<Napi::String>().Utf8Value().c_str());
|
|
466
474
|
NSString* bundleId = @(info[1].As<Napi::String>().Utf8Value().c_str());
|
|
467
|
-
return RunAsyncVoid(info.Env(), [device, service, bundleId,
|
|
475
|
+
return RunAsyncVoid(info.Env(), [device, service, bundleId, desiredStatus]() {
|
|
468
476
|
NSError* error = nil;
|
|
469
477
|
NSString* dataPath = coresim::DeviceDataPath(device);
|
|
470
|
-
ThrowIfFailed(coresim::SetTCCAccess(dataPath, service, bundleId,
|
|
478
|
+
ThrowIfFailed(coresim::SetTCCAccess(dataPath, service, bundleId, desiredStatus, &error), error);
|
|
471
479
|
});
|
|
472
480
|
}
|
|
473
481
|
|
package/src/native/tcc_privacy.h
CHANGED
|
@@ -4,22 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
namespace coresim {
|
|
6
6
|
|
|
7
|
-
// Grants or revokes a privacy permission for `bundleId` in the simulator's own TCC (privacy)
|
|
8
|
-
// database, located under the device's data directory (see DeviceDataPath, sim_device.h) at
|
|
9
|
-
// `Library/TCC/TCC.db`. `service` is the raw TCC service identifier (e.g. "kTCCServiceCamera"),
|
|
10
|
-
// not a friendly name — callers map friendly names to these before calling in (see
|
|
11
|
-
// commands/permissions.ts). Fails with a descriptive NSError if the device has never been booted
|
|
12
|
-
// (TCC.db doesn't exist yet) or the database can't be written to.
|
|
13
|
-
BOOL SetTCCAccess(NSString* dataPath, NSString* service, NSString* bundleId, BOOL granted, NSError** error);
|
|
14
|
-
|
|
15
|
-
// Resets a previously granted/revoked permission back to its default (unprompted, "unset") state
|
|
16
|
-
// by deleting its row from TCC.db, if one exists.
|
|
17
|
-
BOOL ResetTCCAccess(NSString* dataPath, NSString* service, NSString* bundleId, NSError** error);
|
|
18
|
-
|
|
19
7
|
// Own status codes GetTCCAccess reports through `outStatus` — deliberately not TCC's own raw wire
|
|
20
8
|
// values (which reuse 0 for "denied", not "no row"), so a missing row and an explicit denial are
|
|
21
|
-
// never confusable. `kTCCAuthLimited`
|
|
22
|
-
//
|
|
9
|
+
// never confusable. `kTCCAuthLimited` ("selected photos" access) is only meaningful for
|
|
10
|
+
// kTCCServicePhotos — SetTCCAccess itself doesn't enforce that (see commands/permissions.ts).
|
|
23
11
|
enum TCCAuthStatus {
|
|
24
12
|
kTCCAuthNotDetermined = 0,
|
|
25
13
|
kTCCAuthDenied,
|
|
@@ -27,6 +15,21 @@ enum TCCAuthStatus {
|
|
|
27
15
|
kTCCAuthLimited,
|
|
28
16
|
};
|
|
29
17
|
|
|
18
|
+
// Grants, revokes, or limits a privacy permission for `bundleId` in the simulator's own TCC
|
|
19
|
+
// (privacy) database, located under the device's data directory (see DeviceDataPath, sim_device.h)
|
|
20
|
+
// at `Library/TCC/TCC.db`. `service` is the raw TCC service identifier (e.g. "kTCCServiceCamera"),
|
|
21
|
+
// not a friendly name — callers map friendly names to these before calling in (see
|
|
22
|
+
// commands/permissions.ts). `desiredStatus` must be kTCCAuthGranted, kTCCAuthDenied, or
|
|
23
|
+
// kTCCAuthLimited — kTCCAuthNotDetermined isn't a writable state (see ResetTCCAccess). Fails with a
|
|
24
|
+
// descriptive NSError if the device has never been booted (TCC.db doesn't exist yet) or the
|
|
25
|
+
// database can't be written to.
|
|
26
|
+
BOOL SetTCCAccess(NSString* dataPath, NSString* service, NSString* bundleId, TCCAuthStatus desiredStatus,
|
|
27
|
+
NSError** error);
|
|
28
|
+
|
|
29
|
+
// Resets a previously granted/revoked permission back to its default (unprompted, "unset") state
|
|
30
|
+
// by deleting its row from TCC.db, if one exists.
|
|
31
|
+
BOOL ResetTCCAccess(NSString* dataPath, NSString* service, NSString* bundleId, NSError** error);
|
|
32
|
+
|
|
30
33
|
// Reads TCC.db for the current authorization status of (service, bundleId), translating either
|
|
31
34
|
// schema (see HasAuthValueColumn in the .mm) into the TCCAuthStatus values above. Fails with the
|
|
32
35
|
// same descriptive NSError as SetTCCAccess if the device has never been booted (no TCC.db yet).
|
|
@@ -136,7 +136,8 @@ bool CommitOrRollback(sqlite3* db, bool commit, NSError** error) {
|
|
|
136
136
|
|
|
137
137
|
} // namespace
|
|
138
138
|
|
|
139
|
-
BOOL SetTCCAccess(NSString* dataPath, NSString* service, NSString* bundleId,
|
|
139
|
+
BOOL SetTCCAccess(NSString* dataPath, NSString* service, NSString* bundleId, TCCAuthStatus desiredStatus,
|
|
140
|
+
NSError** error) {
|
|
140
141
|
sqlite3* db = OpenDatabase(dataPath, error);
|
|
141
142
|
if (!db) {
|
|
142
143
|
return NO;
|
|
@@ -149,9 +150,9 @@ BOOL SetTCCAccess(NSString* dataPath, NSString* service, NSString* bundleId, BOO
|
|
|
149
150
|
if (success) {
|
|
150
151
|
if (HasAuthValueColumn(db)) {
|
|
151
152
|
// `kTCCServicePhotos` rows use auth_version 2 (supports the "limited" library access
|
|
152
|
-
// introduced alongside it); every other service uses version 1.
|
|
153
|
-
// as a grantable status here — only plain granted/denied, matching grantPermission's BOOL.
|
|
153
|
+
// introduced alongside it); every other service uses version 1.
|
|
154
154
|
BOOL isPhotos = [service isEqualToString:@"kTCCServicePhotos"];
|
|
155
|
+
int authValue = desiredStatus == kTCCAuthGranted ? 2 : desiredStatus == kTCCAuthLimited ? 3 : 0;
|
|
155
156
|
success = ExecuteStatement(
|
|
156
157
|
db,
|
|
157
158
|
"INSERT INTO access (service, client, client_type, auth_value, auth_reason, auth_version, flags) "
|
|
@@ -159,17 +160,19 @@ BOOL SetTCCAccess(NSString* dataPath, NSString* service, NSString* bundleId, BOO
|
|
|
159
160
|
[&](sqlite3_stmt* stmt) {
|
|
160
161
|
BindText(stmt, 1, service);
|
|
161
162
|
BindText(stmt, 2, bundleId);
|
|
162
|
-
sqlite3_bind_int(stmt, 3,
|
|
163
|
+
sqlite3_bind_int(stmt, 3, authValue);
|
|
163
164
|
sqlite3_bind_int(stmt, 4, isPhotos ? 2 : 1);
|
|
164
165
|
},
|
|
165
166
|
error);
|
|
166
167
|
} else {
|
|
168
|
+
// Pre-iOS 14 schema has no auth_value column, so "limited" collapses to a plain grant here.
|
|
169
|
+
BOOL allowed = desiredStatus != kTCCAuthDenied;
|
|
167
170
|
success = ExecuteStatement(
|
|
168
171
|
db, "REPLACE INTO access (service, client, client_type, allowed, prompt_count) VALUES (?, ?, 0, ?, 1)",
|
|
169
172
|
[&](sqlite3_stmt* stmt) {
|
|
170
173
|
BindText(stmt, 1, service);
|
|
171
174
|
BindText(stmt, 2, bundleId);
|
|
172
|
-
sqlite3_bind_int(stmt, 3,
|
|
175
|
+
sqlite3_bind_int(stmt, 3, allowed ? 1 : 0);
|
|
173
176
|
},
|
|
174
177
|
error);
|
|
175
178
|
}
|
package/src/types.ts
CHANGED
|
@@ -73,8 +73,7 @@ export interface SimBootInfo {
|
|
|
73
73
|
* Result of `NativeSimctl.getPermission` — mirrors the TCC database's own auth states rather than
|
|
74
74
|
* a plain boolean, since `'unset'` (never prompted/decided) and `'denied'` (explicitly refused)
|
|
75
75
|
* are different states with different UI implications. `'limited'` only applies to `photos`
|
|
76
|
-
* ("selected photos" access)
|
|
77
|
-
* present if something else set it.
|
|
76
|
+
* ("selected photos" access).
|
|
78
77
|
*/
|
|
79
78
|
export type SimPermissionStatus = 'unset' | 'denied' | 'granted' | 'limited';
|
|
80
79
|
|
|
@@ -88,6 +87,7 @@ export type SimPermissionService =
|
|
|
88
87
|
| 'calendar'
|
|
89
88
|
| 'camera'
|
|
90
89
|
| 'contacts'
|
|
90
|
+
| 'faceid'
|
|
91
91
|
| 'health'
|
|
92
92
|
| 'homekit'
|
|
93
93
|
| 'medialibrary'
|
|
@@ -96,7 +96,8 @@ export type SimPermissionService =
|
|
|
96
96
|
| 'photos'
|
|
97
97
|
| 'reminders'
|
|
98
98
|
| 'siri'
|
|
99
|
-
| 'speech'
|
|
99
|
+
| 'speech'
|
|
100
|
+
| 'usertracking';
|
|
100
101
|
|
|
101
102
|
/**
|
|
102
103
|
* A device's renderable display, as returned by `NativeSimctl.getDisplays()`.
|
|
@@ -270,7 +271,7 @@ export interface NativeDeviceHandle {
|
|
|
270
271
|
setIncreaseContrast(enabled: boolean): Promise<void>;
|
|
271
272
|
getContentSize(): Promise<number>;
|
|
272
273
|
setContentSize(category: number): Promise<void>;
|
|
273
|
-
grantPermission(service: string, bundleId: string): Promise<void>;
|
|
274
|
+
grantPermission(service: string, bundleId: string, status?: 'granted' | 'limited'): Promise<void>;
|
|
274
275
|
revokePermission(service: string, bundleId: string): Promise<void>;
|
|
275
276
|
resetPermission(service: string, bundleId: string): Promise<void>;
|
|
276
277
|
getPermission(service: string, bundleId: string): Promise<SimPermissionStatus>;
|