@zukhruf/tcc 0.0.0-stage → 0.8.129
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/LICENSE +21 -0
- package/README.md +298 -2
- package/dist/authorization-statuses.d.ts +7 -0
- package/dist/authorization-statuses.d.ts.map +1 -0
- package/dist/authorization-statuses.js +28 -0
- package/dist/authorization-statuses.js.map +1 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +45 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/native/jxa-request.d.ts +7 -0
- package/dist/native/jxa-request.d.ts.map +1 -0
- package/dist/native/jxa-request.js +34 -0
- package/dist/native/jxa-request.js.map +1 -0
- package/dist/native/node-ffi.d.ts +2 -0
- package/dist/native/node-ffi.d.ts.map +1 -0
- package/dist/native/node-ffi.js +6 -0
- package/dist/native/node-ffi.js.map +1 -0
- package/dist/native/objective-c-class.d.ts +7 -0
- package/dist/native/objective-c-class.d.ts.map +1 -0
- package/dist/native/objective-c-class.js +56 -0
- package/dist/native/objective-c-class.js.map +1 -0
- package/dist/preflight.d.ts +7 -0
- package/dist/preflight.d.ts.map +1 -0
- package/dist/preflight.js +13 -0
- package/dist/preflight.js.map +1 -0
- package/dist/prompted-service.d.ts +10 -0
- package/dist/prompted-service.d.ts.map +1 -0
- package/dist/prompted-service.js +31 -0
- package/dist/prompted-service.js.map +1 -0
- package/dist/request.prompt.spec.d.ts +2 -0
- package/dist/request.prompt.spec.d.ts.map +1 -0
- package/dist/request.prompt.spec.js +59 -0
- package/dist/request.prompt.spec.js.map +1 -0
- package/dist/service.d.ts +11 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +25 -0
- package/dist/service.js.map +1 -0
- package/dist/services/accessibility.d.ts +11 -0
- package/dist/services/accessibility.d.ts.map +1 -0
- package/dist/services/accessibility.js +20 -0
- package/dist/services/accessibility.js.map +1 -0
- package/dist/services/automation.d.ts +13 -0
- package/dist/services/automation.d.ts.map +1 -0
- package/dist/services/automation.js +58 -0
- package/dist/services/automation.js.map +1 -0
- package/dist/services/bluetooth.d.ts +12 -0
- package/dist/services/bluetooth.d.ts.map +1 -0
- package/dist/services/bluetooth.js +21 -0
- package/dist/services/bluetooth.js.map +1 -0
- package/dist/services/calendars.d.ts +10 -0
- package/dist/services/calendars.d.ts.map +1 -0
- package/dist/services/calendars.js +15 -0
- package/dist/services/calendars.js.map +1 -0
- package/dist/services/camera.d.ts +10 -0
- package/dist/services/camera.d.ts.map +1 -0
- package/dist/services/camera.js +14 -0
- package/dist/services/camera.js.map +1 -0
- package/dist/services/contacts.d.ts +10 -0
- package/dist/services/contacts.d.ts.map +1 -0
- package/dist/services/contacts.js +15 -0
- package/dist/services/contacts.js.map +1 -0
- package/dist/services/full-disk-access.d.ts +11 -0
- package/dist/services/full-disk-access.d.ts.map +1 -0
- package/dist/services/full-disk-access.js +40 -0
- package/dist/services/full-disk-access.js.map +1 -0
- package/dist/services/input-monitoring.d.ts +12 -0
- package/dist/services/input-monitoring.d.ts.map +1 -0
- package/dist/services/input-monitoring.js +22 -0
- package/dist/services/input-monitoring.js.map +1 -0
- package/dist/services/microphone.d.ts +10 -0
- package/dist/services/microphone.d.ts.map +1 -0
- package/dist/services/microphone.js +14 -0
- package/dist/services/microphone.js.map +1 -0
- package/dist/services/photos-add.d.ts +10 -0
- package/dist/services/photos-add.d.ts.map +1 -0
- package/dist/services/photos-add.js +15 -0
- package/dist/services/photos-add.js.map +1 -0
- package/dist/services/photos.d.ts +10 -0
- package/dist/services/photos.d.ts.map +1 -0
- package/dist/services/photos.js +15 -0
- package/dist/services/photos.js.map +1 -0
- package/dist/services/reminders.d.ts +10 -0
- package/dist/services/reminders.d.ts.map +1 -0
- package/dist/services/reminders.js +15 -0
- package/dist/services/reminders.js.map +1 -0
- package/dist/services/screen-recording.d.ts +11 -0
- package/dist/services/screen-recording.d.ts.map +1 -0
- package/dist/services/screen-recording.js +18 -0
- package/dist/services/screen-recording.js.map +1 -0
- package/dist/services/speech-recognition.d.ts +12 -0
- package/dist/services/speech-recognition.d.ts.map +1 -0
- package/dist/services/speech-recognition.js +16 -0
- package/dist/services/speech-recognition.js.map +1 -0
- package/package.json +45 -4
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { nodeFfi } from './node-ffi.js';
|
|
2
|
+
const runtime = '/usr/lib/libobjc.A.dylib';
|
|
3
|
+
// A class of an Objective-C framework of macOS. node:ffi binds one signature
|
|
4
|
+
// for each symbol of a library handle, so each message opens the runtime for
|
|
5
|
+
// its own signature of objc_msgSend, and closes it after.
|
|
6
|
+
export class ObjectiveCClass {
|
|
7
|
+
#framework;
|
|
8
|
+
#name;
|
|
9
|
+
constructor(framework, name) {
|
|
10
|
+
this.#framework = framework;
|
|
11
|
+
this.#name = name;
|
|
12
|
+
}
|
|
13
|
+
// +[Class selector] or +[Class selector:integer], which returns an NSInteger.
|
|
14
|
+
integer(selector, argument) {
|
|
15
|
+
const { DynamicLibrary } = nodeFfi();
|
|
16
|
+
using framework = new DynamicLibrary(this.#framework);
|
|
17
|
+
using objc = new DynamicLibrary(runtime);
|
|
18
|
+
const [receiver, message] = this.#target(objc, selector, framework.path);
|
|
19
|
+
if (argument === undefined)
|
|
20
|
+
return Number(objc.getFunction('objc_msgSend', {
|
|
21
|
+
arguments: ['pointer', 'pointer'],
|
|
22
|
+
return: 'int64',
|
|
23
|
+
})(receiver, message));
|
|
24
|
+
return Number(objc.getFunction('objc_msgSend', {
|
|
25
|
+
arguments: ['pointer', 'pointer', 'int64'],
|
|
26
|
+
return: 'int64',
|
|
27
|
+
})(receiver, message, BigInt(argument)));
|
|
28
|
+
}
|
|
29
|
+
// +[Class selector:constant], with an NSString constant of the framework,
|
|
30
|
+
// which returns an NSInteger.
|
|
31
|
+
integerFor(selector, constant) {
|
|
32
|
+
const ffi = nodeFfi();
|
|
33
|
+
using framework = new ffi.DynamicLibrary(this.#framework);
|
|
34
|
+
using objc = new ffi.DynamicLibrary(runtime);
|
|
35
|
+
const [receiver, message] = this.#target(objc, selector, framework.path);
|
|
36
|
+
const object = ffi.getUint64(framework.getSymbol(constant), 0);
|
|
37
|
+
return Number(objc.getFunction('objc_msgSend', {
|
|
38
|
+
arguments: ['pointer', 'pointer', 'pointer'],
|
|
39
|
+
return: 'int64',
|
|
40
|
+
})(receiver, message, object));
|
|
41
|
+
}
|
|
42
|
+
#target(objc, selector, framework) {
|
|
43
|
+
const receiver = objc.getFunction('objc_getClass', {
|
|
44
|
+
arguments: ['string'],
|
|
45
|
+
return: 'pointer',
|
|
46
|
+
})(this.#name);
|
|
47
|
+
if (receiver === 0n)
|
|
48
|
+
throw new Error(`${framework} has no class ${this.#name}`);
|
|
49
|
+
const message = objc.getFunction('sel_registerName', {
|
|
50
|
+
arguments: ['string'],
|
|
51
|
+
return: 'pointer',
|
|
52
|
+
})(selector);
|
|
53
|
+
return [receiver, message];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=objective-c-class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objective-c-class.js","sourceRoot":"","sources":["../../src/native/objective-c-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAE3C,6EAA6E;AAC7E,6EAA6E;AAC7E,0DAA0D;AAC1D,MAAM,OAAO,eAAe;IACjB,UAAU,CAAS;IACnB,KAAK,CAAS;IAEvB,YAAY,SAAiB,EAAE,IAAY;QACzC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,8EAA8E;IAC9E,OAAO,CAAC,QAAgB,EAAE,QAAiB;QACzC,MAAM,EAAE,cAAc,EAAE,GAA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EAAE,CAAC,CAAC,CAAC;QAC/D,OAAO,MAAM,CACX,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE;YAC/B,SAAS,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;YAC5C,MAAM,EAAE,OAAO;SAChB,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAC9B,CAAC;IACJ,CAAC;IAED,OAAO,CACL,IAAgE,EAChE,QAAgB,EAChB,SAAiB;QAEjB,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE;YACjD,SAAS,EAAE,CAAC,QAAQ,CAAC;YACrB,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACf,IAAI,QAAQ,KAAK,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,iBAAiB,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE;YACnD,SAAS,EAAE,CAAC,QAAQ,CAAC;YACrB,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC,QAAQ,CAAC,CAAC;QACb,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class Preflight {
|
|
2
|
+
readonly readable: readonly string[];
|
|
3
|
+
readonly denied: readonly string[];
|
|
4
|
+
readonly missing: readonly string[];
|
|
5
|
+
constructor(readable: readonly string[], denied: readonly string[], missing: readonly string[]);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AACA,qBAAa,SAAS;IACpB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAErC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAEpC,YACE,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,OAAO,EAAE,SAAS,MAAM,EAAE,EAK3B;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The paths of one preflight, sorted by what an open of each gave.
|
|
2
|
+
export class Preflight {
|
|
3
|
+
readable;
|
|
4
|
+
// macOS or the file mode keeps them from the process.
|
|
5
|
+
denied;
|
|
6
|
+
missing;
|
|
7
|
+
constructor(readable, denied, missing) {
|
|
8
|
+
this.readable = readable;
|
|
9
|
+
this.denied = denied;
|
|
10
|
+
this.missing = missing;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,MAAM,OAAO,SAAS;IACX,QAAQ,CAAoB;IACrC,sDAAsD;IAC7C,MAAM,CAAoB;IAC1B,OAAO,CAAoB;IAEpC,YACE,QAA2B,EAC3B,MAAyB,EACzB,OAA0B;QAE1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Service } from './service.ts';
|
|
2
|
+
export declare abstract class PromptedService<Status extends string> extends Service {
|
|
3
|
+
abstract status(): Status;
|
|
4
|
+
protected abstract readonly requestScript: string;
|
|
5
|
+
request({ signal }: {
|
|
6
|
+
readonly signal: AbortSignal;
|
|
7
|
+
}): Promise<Status>;
|
|
8
|
+
protected named(names: readonly Status[], raw: number): Status;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=prompted-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompted-service.d.ts","sourceRoot":"","sources":["../src/prompted-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAKvC,8BAAsB,eAAe,CAAC,MAAM,SAAS,MAAM,CAAE,SAAQ,OAAO;IAC1E,QAAQ,CAAC,MAAM,IAAI,MAAM,CAAC;IAG1B,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAK5C,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAe3E;IAGD,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAK7D;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
import { Service } from './service.js';
|
|
4
|
+
const run = promisify(execFile);
|
|
5
|
+
// A service whose status a framework of macOS gives.
|
|
6
|
+
export class PromptedService extends Service {
|
|
7
|
+
// Asks macOS to show its prompt, and resolves with the status after the
|
|
8
|
+
// user answered. macOS asks only while the status is not decided. The
|
|
9
|
+
// signal ends osascript, and the promise rejects with its reason.
|
|
10
|
+
async request({ signal }) {
|
|
11
|
+
signal.throwIfAborted();
|
|
12
|
+
try {
|
|
13
|
+
await run('/usr/bin/osascript', ['-l', 'JavaScript', '-e', this.requestScript], {
|
|
14
|
+
signal,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
signal.throwIfAborted();
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
return this.status();
|
|
22
|
+
}
|
|
23
|
+
// Apple's raw value as its name, in the order of the SDK header.
|
|
24
|
+
named(names, raw) {
|
|
25
|
+
const name = names[raw];
|
|
26
|
+
if (name === undefined)
|
|
27
|
+
throw new RangeError(`${this.name} gave the unknown status ${raw}`);
|
|
28
|
+
return name;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=prompted-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompted-service.js","sourceRoot":"","sources":["../src/prompted-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEhC,qDAAqD;AACrD,MAAM,OAAgB,eAAuC,SAAQ,OAAO;IAM1E,wEAAwE;IACxE,sEAAsE;IACtE,kEAAkE;IAClE,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAoC;QACxD,MAAM,CAAC,cAAc,EAAE,CAAC;QACxB,IAAI,CAAC;YACH,MAAM,GAAG,CACP,oBAAoB,EACpB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,EAC9C;gBACE,MAAM;aACP,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,cAAc,EAAE,CAAC;YACxB,MAAM,KAAK,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;IAED,iEAAiE;IACvD,KAAK,CAAC,KAAwB,EAAE,GAAW;QACnD,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,IAAI,KAAK,SAAS;YACpB,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,CAAC,IAAI,4BAA4B,GAAG,EAAE,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.prompt.spec.d.ts","sourceRoot":"","sources":["../src/request.prompt.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { execFile } from 'node:child_process';
|
|
3
|
+
import { describe } from 'node:test';
|
|
4
|
+
import { promisify } from 'node:util';
|
|
5
|
+
import { waitFor } from '@zukhruf/testing/async';
|
|
6
|
+
import { test } from '@zukhruf/testing/node';
|
|
7
|
+
import { Accessibility, Automation, Bluetooth, Calendars, Camera, Contacts, FullDiskAccess, InputMonitoring, Microphone, Photos, PhotosAdd, Reminders, ScreenRecording, SpeechRecognition, } from './index.js';
|
|
8
|
+
const run = promisify(execFile);
|
|
9
|
+
// These tests need a person at the Mac. Each one says the status that it
|
|
10
|
+
// needs; `tccutil reset <service> <bundle id of the terminal app>` makes a
|
|
11
|
+
// service not determined again.
|
|
12
|
+
describe('a request that a person answers', { concurrency: false }, () => {
|
|
13
|
+
void test.each([new SpeechRecognition(), new Bluetooth()], (service) => test(`of ${service.constructor.name} shows the prompt, and the answer decides the status`, async (t) => {
|
|
14
|
+
// Arrange
|
|
15
|
+
assert.equal(service.status(), 'notDetermined', service.name);
|
|
16
|
+
// Act
|
|
17
|
+
const answered = await service.request({ signal: t.signal });
|
|
18
|
+
// Assert
|
|
19
|
+
assert.notEqual(answered, 'notDetermined');
|
|
20
|
+
assert.equal(answered, service.status());
|
|
21
|
+
}));
|
|
22
|
+
void test.each([
|
|
23
|
+
new Contacts(),
|
|
24
|
+
new Calendars(),
|
|
25
|
+
new Reminders(),
|
|
26
|
+
new Camera(),
|
|
27
|
+
new Microphone(),
|
|
28
|
+
new Photos(),
|
|
29
|
+
new PhotosAdd(),
|
|
30
|
+
new Accessibility(),
|
|
31
|
+
new ScreenRecording(),
|
|
32
|
+
new InputMonitoring(),
|
|
33
|
+
new Automation('com.apple.finder'),
|
|
34
|
+
], (service) => test(`of ${service.constructor.name} that is decided shows nothing and keeps its status`, async (t) => {
|
|
35
|
+
// Arrange
|
|
36
|
+
const before = service.status();
|
|
37
|
+
assert.notEqual(before, 'notDetermined', service.name);
|
|
38
|
+
// Act
|
|
39
|
+
const answered = await service.request({ signal: t.signal });
|
|
40
|
+
// Assert
|
|
41
|
+
assert.equal(answered, before);
|
|
42
|
+
}));
|
|
43
|
+
});
|
|
44
|
+
describe('the pane of a service', () => {
|
|
45
|
+
test('opens System Settings', async (t) => {
|
|
46
|
+
// Arrange
|
|
47
|
+
await run('/usr/bin/osascript', ['-e', 'quit app "System Settings"']);
|
|
48
|
+
await waitFor(async () => {
|
|
49
|
+
await assert.rejects(run('/usr/bin/pgrep', ['-x', 'System Settings']));
|
|
50
|
+
}, { signal: t.signal, interval: 100 });
|
|
51
|
+
// Act
|
|
52
|
+
await new FullDiskAccess().openSettings();
|
|
53
|
+
// Assert
|
|
54
|
+
await waitFor(async () => {
|
|
55
|
+
await run('/usr/bin/pgrep', ['-x', 'System Settings']);
|
|
56
|
+
}, { signal: t.signal, interval: 100 });
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=request.prompt.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.prompt.spec.js","sourceRoot":"","sources":["../src/request.prompt.spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,M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CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC;QACzD,CAAC,EACD,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CACpC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Client } from './client.ts';
|
|
2
|
+
export declare abstract class Service {
|
|
3
|
+
abstract readonly name: string;
|
|
4
|
+
protected abstract readonly paneKey: string;
|
|
5
|
+
protected abstract readonly anchor: string;
|
|
6
|
+
get pane(): string;
|
|
7
|
+
get url(): URL;
|
|
8
|
+
remedy(client: Client): string;
|
|
9
|
+
openSettings(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAU1C,8BAAsB,OAAO;IAC3B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAE/B,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAC5C,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAK3C,IAAI,IAAI,IAAI,MAAM,CAMjB;IAED,IAAI,GAAG,IAAI,GAAG,CAIb;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7B;IAEK,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAElC;CACF"}
|
package/dist/service.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { execFile, execFileSync } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
const run = promisify(execFile);
|
|
4
|
+
// The strings of the Privacy & Security pane of System Settings, by key.
|
|
5
|
+
const strings = '/System/Library/ExtensionKit/Extensions/SecurityPrivacyExtension.appex/Contents/Resources/Localizable.loctable';
|
|
6
|
+
// A kind of grant that TCC keeps, with the pane of System Settings where the
|
|
7
|
+
// user turns a client on (TCCServiceList.plist of SecurityPrivacyExtension).
|
|
8
|
+
export class Service {
|
|
9
|
+
// The title of the pane as System Settings of this Mac shows it. macOS
|
|
10
|
+
// renames panes: Accessibility on macOS 26 is "Device Control and Data
|
|
11
|
+
// Access" on macOS 27 (ADR 0005).
|
|
12
|
+
get pane() {
|
|
13
|
+
return execFileSync('/usr/bin/plutil', ['-extract', `en.${this.paneKey}`, 'raw', '-o', '-', strings], { encoding: 'utf8' }).trimEnd();
|
|
14
|
+
}
|
|
15
|
+
get url() {
|
|
16
|
+
return new URL(`x-apple.systempreferences:com.apple.preference.security?${this.anchor}`);
|
|
17
|
+
}
|
|
18
|
+
remedy(client) {
|
|
19
|
+
return `Turn on ${client.name} in System Settings › Privacy & Security › ${this.pane}.`;
|
|
20
|
+
}
|
|
21
|
+
async openSettings() {
|
|
22
|
+
await run('/usr/bin/open', [this.url.href]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEhC,yEAAyE;AACzE,MAAM,OAAO,GACX,gHAAgH,CAAC;AAEnH,6EAA6E;AAC7E,6EAA6E;AAC7E,MAAM,OAAgB,OAAO;IAM3B,uEAAuE;IACvE,uEAAuE;IACvE,kCAAkC;IAClC,IAAI,IAAI;QACN,OAAO,YAAY,CACjB,iBAAiB,EACjB,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAC7D,EAAE,QAAQ,EAAE,MAAM,EAAE,CACrB,CAAC,OAAO,EAAE,CAAC;IACd,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,GAAG,CACZ,2DAA2D,IAAI,CAAC,MAAM,EAAE,CACzE,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,OAAO,WAAW,MAAM,CAAC,IAAI,8CAA8C,IAAI,CAAC,IAAI,GAAG,CAAC;IAC1F,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,GAAG,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PromptedService } from '../prompted-service.ts';
|
|
2
|
+
type AccessibilityStatus = 'trusted' | 'notTrusted';
|
|
3
|
+
export declare class Accessibility extends PromptedService<AccessibilityStatus> {
|
|
4
|
+
readonly name = "kTCCServiceAccessibility";
|
|
5
|
+
protected readonly paneKey = "ACCESSIBILITY";
|
|
6
|
+
protected readonly anchor = "Privacy_Accessibility";
|
|
7
|
+
protected readonly requestScript: string;
|
|
8
|
+
status(): AccessibilityStatus;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=accessibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../src/services/accessibility.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,KAAK,mBAAmB,GAAG,SAAS,GAAG,YAAY,CAAC;AAEpD,qBAAa,aAAc,SAAQ,eAAe,CAAC,mBAAmB,CAAC;IACrE,QAAQ,CAAC,IAAI,8BAA8B;IAC3C,SAAS,CAAC,QAAQ,CAAC,OAAO,mBAAmB;IAC7C,SAAS,CAAC,QAAQ,CAAC,MAAM,2BAA2B;IAEpD,SAAS,CAAC,QAAQ,CAAC,aAAa,SAKvB;IAET,MAAM,IAAI,mBAAmB,CAS5B;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { JxaRequest } from '../native/jxa-request.js';
|
|
2
|
+
import { nodeFfi } from '../native/node-ffi.js';
|
|
3
|
+
import { PromptedService } from '../prompted-service.js';
|
|
4
|
+
export class Accessibility extends PromptedService {
|
|
5
|
+
name = 'kTCCServiceAccessibility';
|
|
6
|
+
paneKey = 'ACCESSIBILITY';
|
|
7
|
+
anchor = 'Privacy_Accessibility';
|
|
8
|
+
requestScript = JxaRequest.direct(['ApplicationServices'], "'AXIsProcessTrustedWithOptions', ['bool', ['id']]",
|
|
9
|
+
// kAXTrustedCheckOptionPrompt (HIServices/AXUIElement.h:64)
|
|
10
|
+
'$.AXIsProcessTrustedWithOptions($({ AXTrustedCheckOptionPrompt: true }))').source;
|
|
11
|
+
status() {
|
|
12
|
+
using services = new (nodeFfi().DynamicLibrary)('/System/Library/Frameworks/ApplicationServices.framework/ApplicationServices');
|
|
13
|
+
const trusted = services.getFunction('AXIsProcessTrusted', {
|
|
14
|
+
arguments: [],
|
|
15
|
+
return: 'uint8',
|
|
16
|
+
})();
|
|
17
|
+
return trusted === 0 ? 'notTrusted' : 'trusted';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=accessibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessibility.js","sourceRoot":"","sources":["../../src/services/accessibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAMzD,MAAM,OAAO,aAAc,SAAQ,eAAoC;IAC5D,IAAI,GAAG,0BAA0B,CAAC;IACxB,OAAO,GAAG,eAAe,CAAC;IAC1B,MAAM,GAAG,uBAAuB,CAAC;IAEjC,aAAa,GAAG,UAAU,CAAC,MAAM,CAClD,CAAC,qBAAqB,CAAC,EACvB,mDAAmD;IACnD,4DAA4D;IAC5D,0EAA0E,CAC3E,CAAC,MAAM,CAAC;IAET,MAAM;QACJ,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC,CAC7C,8EAA8E,CAC/E,CAAC;QACF,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,oBAAoB,EAAE;YACzD,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,OAAO;SAChB,CAAC,EAAE,CAAC;QACL,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;IAClD,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PromptedService } from '../prompted-service.ts';
|
|
2
|
+
type AutomationStatus = 'permitted' | 'notPermitted' | 'wouldRequireUserConsent' | 'notRunning';
|
|
3
|
+
export declare class Automation extends PromptedService<AutomationStatus> {
|
|
4
|
+
readonly name = "kTCCServiceAppleEvents";
|
|
5
|
+
protected readonly paneKey = "AUTOMATION";
|
|
6
|
+
protected readonly anchor = "Privacy_Automation";
|
|
7
|
+
readonly target: string;
|
|
8
|
+
constructor(target: string);
|
|
9
|
+
protected get requestScript(): string;
|
|
10
|
+
status(): AutomationStatus;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=automation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automation.d.ts","sourceRoot":"","sources":["../../src/services/automation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,KAAK,gBAAgB,GACnB,WAAW,GAAG,cAAc,GAAG,yBAAyB,GAAG,YAAY,CAAC;AAiB1E,qBAAa,UAAW,SAAQ,eAAe,CAAC,gBAAgB,CAAC;IAC/D,QAAQ,CAAC,IAAI,4BAA4B;IACzC,SAAS,CAAC,QAAQ,CAAC,OAAO,gBAAgB;IAC1C,SAAS,CAAC,QAAQ,CAAC,MAAM,wBAAwB;IAEjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,YAAY,MAAM,EAAE,MAAM,EAGzB;IAID,SAAS,KAAK,aAAa,IAAI,MAAM,CAMpC;IAED,MAAM,IAAI,gBAAgB,CA8BzB;CACF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { JxaRequest } from '../native/jxa-request.js';
|
|
2
|
+
import { nodeFfi } from '../native/node-ffi.js';
|
|
3
|
+
import { PromptedService } from '../prompted-service.js';
|
|
4
|
+
// The results of AEDeterminePermissionToAutomateTarget (AE/AppleEvents.h:346-363).
|
|
5
|
+
const results = new Map([
|
|
6
|
+
[0, 'permitted'],
|
|
7
|
+
[-1743, 'notPermitted'],
|
|
8
|
+
[-1744, 'wouldRequireUserConsent'],
|
|
9
|
+
[-600, 'notRunning'],
|
|
10
|
+
]);
|
|
11
|
+
// The four-character codes of the Apple event that the check names: the open
|
|
12
|
+
// documents event of the core suite, and the type of a bundle identifier.
|
|
13
|
+
const coreSuite = 0x61657674; // 'aevt'
|
|
14
|
+
const openDocuments = 0x6f646f63; // 'odoc'
|
|
15
|
+
const bundleIdentifier = 0x62756e64; // 'bund'
|
|
16
|
+
// The grant to send Apple events to one target app.
|
|
17
|
+
export class Automation extends PromptedService {
|
|
18
|
+
name = 'kTCCServiceAppleEvents';
|
|
19
|
+
paneKey = 'AUTOMATION';
|
|
20
|
+
anchor = 'Privacy_Automation';
|
|
21
|
+
// The bundle identifier of the target app.
|
|
22
|
+
target;
|
|
23
|
+
constructor(target) {
|
|
24
|
+
super();
|
|
25
|
+
this.target = target;
|
|
26
|
+
}
|
|
27
|
+
// AEDeterminePermissionToAutomateTarget with askUserIfNeeded, which waits
|
|
28
|
+
// for the answer (AE/AppleEvents.h:363).
|
|
29
|
+
get requestScript() {
|
|
30
|
+
return JxaRequest.direct(['CoreServices'], "'AEDeterminePermissionToAutomateTarget', ['int', ['void *', 'unsigned int', 'unsigned int', 'bool']]", `$.AEDeterminePermissionToAutomateTarget($.NSAppleEventDescriptor.descriptorWithBundleIdentifier(${JSON.stringify(this.target)}).aeDesc, ${coreSuite}, ${openDocuments}, true)`).source;
|
|
31
|
+
}
|
|
32
|
+
status() {
|
|
33
|
+
using services = new (nodeFfi().DynamicLibrary)('/System/Library/Frameworks/CoreServices.framework/CoreServices');
|
|
34
|
+
const identifier = Buffer.from(this.target);
|
|
35
|
+
// An AEDesc: its 4-byte type, then its 8-byte data handle, aligned to 16.
|
|
36
|
+
const descriptor = Buffer.alloc(16);
|
|
37
|
+
const created = services.getFunction('AECreateDesc', {
|
|
38
|
+
arguments: ['uint32', 'buffer', 'int64', 'buffer'],
|
|
39
|
+
return: 'int16',
|
|
40
|
+
})(bundleIdentifier, identifier, BigInt(identifier.byteLength), descriptor);
|
|
41
|
+
if (created !== 0)
|
|
42
|
+
throw new Error(`AECreateDesc failed with ${created} for ${this.target}`);
|
|
43
|
+
try {
|
|
44
|
+
const result = services.getFunction('AEDeterminePermissionToAutomateTarget', { arguments: ['buffer', 'uint32', 'uint32', 'uint8'], return: 'int32' })(descriptor, coreSuite, openDocuments, 0);
|
|
45
|
+
const status = results.get(result);
|
|
46
|
+
if (status === undefined)
|
|
47
|
+
throw new Error(`AEDeterminePermissionToAutomateTarget gave ${result} for ${this.target}`);
|
|
48
|
+
return status;
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
services.getFunction('AEDisposeDesc', {
|
|
52
|
+
arguments: ['buffer'],
|
|
53
|
+
return: 'int16',
|
|
54
|
+
})(descriptor);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=automation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automation.js","sourceRoot":"","sources":["../../src/services/automation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAKzD,mFAAmF;AACnF,MAAM,OAAO,GAAG,IAAI,GAAG,CAA2B;IAChD,CAAC,CAAC,EAAE,WAAW,CAAC;IAChB,CAAC,CAAC,IAAI,EAAE,cAAc,CAAC;IACvB,CAAC,CAAC,IAAI,EAAE,yBAAyB,CAAC;IAClC,CAAC,CAAC,GAAG,EAAE,YAAY,CAAC;CACrB,CAAC,CAAC;AAEH,6EAA6E;AAC7E,0EAA0E;AAC1E,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,SAAS;AACvC,MAAM,aAAa,GAAG,UAAU,CAAC,CAAC,SAAS;AAC3C,MAAM,gBAAgB,GAAG,UAAU,CAAC,CAAC,SAAS;AAE9C,oDAAoD;AACpD,MAAM,OAAO,UAAW,SAAQ,eAAiC;IACtD,IAAI,GAAG,wBAAwB,CAAC;IACtB,OAAO,GAAG,YAAY,CAAC;IACvB,MAAM,GAAG,oBAAoB,CAAC;IACjD,2CAA2C;IAClC,MAAM,CAAS;IAExB,YAAY,MAAc;QACxB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,0EAA0E;IAC1E,yCAAyC;IACzC,IAAc,aAAa;QACzB,OAAO,UAAU,CAAC,MAAM,CACtB,CAAC,cAAc,CAAC,EAChB,sGAAsG,EACtG,mGAAmG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,SAAS,KAAK,aAAa,SAAS,CAChL,CAAC,MAAM,CAAC;IACX,CAAC;IAED,MAAM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AO;aAChB,CAAC,CAAC,UAAU,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PromptedService } from '../prompted-service.ts';
|
|
2
|
+
declare const values: readonly ['notDetermined', 'restricted', 'denied', 'allowedAlways'];
|
|
3
|
+
type BluetoothStatus = (typeof values)[number];
|
|
4
|
+
export declare class Bluetooth extends PromptedService<BluetoothStatus> {
|
|
5
|
+
readonly name = "kTCCServiceBluetoothAlways";
|
|
6
|
+
protected readonly paneKey = "BLUETOOTH";
|
|
7
|
+
protected readonly anchor = "Privacy_Bluetooth";
|
|
8
|
+
protected readonly requestScript: string;
|
|
9
|
+
status(): BluetoothStatus;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=bluetooth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bluetooth.d.ts","sourceRoot":"","sources":["../../src/services/bluetooth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,QAAA,MAAM,MAAM,YACV,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,eAAe,CACP,CAAC;AACX,KAAK,eAAe,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/C,qBAAa,SAAU,SAAQ,eAAe,CAAC,eAAe,CAAC;IAC7D,QAAQ,CAAC,IAAI,gCAAgC;IAC7C,SAAS,CAAC,QAAQ,CAAC,OAAO,eAAe;IACzC,SAAS,CAAC,QAAQ,CAAC,MAAM,uBAAuB;IAEhD,SAAS,CAAC,QAAQ,CAAC,aAAa,SAIvB;IAET,MAAM,IAAI,eAAe,CASxB;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { JxaRequest } from '../native/jxa-request.js';
|
|
2
|
+
import { ObjectiveCClass } from '../native/objective-c-class.js';
|
|
3
|
+
import { PromptedService } from '../prompted-service.js';
|
|
4
|
+
// CBManagerAuthorization (CoreBluetooth/CBManager.h:62-67).
|
|
5
|
+
const values = [
|
|
6
|
+
'notDetermined',
|
|
7
|
+
'restricted',
|
|
8
|
+
'denied',
|
|
9
|
+
'allowedAlways',
|
|
10
|
+
];
|
|
11
|
+
export class Bluetooth extends PromptedService {
|
|
12
|
+
name = 'kTCCServiceBluetoothAlways';
|
|
13
|
+
paneKey = 'BLUETOOTH';
|
|
14
|
+
anchor = 'Privacy_Bluetooth';
|
|
15
|
+
requestScript = JxaRequest.decided(['CoreBluetooth'], "// macOS asks for Bluetooth when a central manager is created. A queue\n// argument from JXA crashes osascript (libdispatch: 'Cannot target object to\n// cooperative root queue'), so init takes the main queue.\nconst manager = C('CBCentralManager').alloc.init;", "Number(C('CBManager').authorization) === 0").source;
|
|
16
|
+
status() {
|
|
17
|
+
// The class property CBManager.authorization (CoreBluetooth/CBManager.h:86)
|
|
18
|
+
return this.named(values, new ObjectiveCClass('/System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth', 'CBManager').integer('authorization'));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=bluetooth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bluetooth.js","sourceRoot":"","sources":["../../src/services/bluetooth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,4DAA4D;AAC5D,MAAM,MAAM,GAAG;IACb,eAAe;IACf,YAAY;IACZ,QAAQ;IACR,eAAe;CACP,CAAC;AAGX,MAAM,OAAO,SAAU,SAAQ,eAAgC;IACpD,IAAI,GAAG,4BAA4B,CAAC;IAC1B,OAAO,GAAG,WAAW,CAAC;IACtB,MAAM,GAAG,mBAAmB,CAAC;IAE7B,aAAa,GAAG,UAAU,CAAC,OAAO,CACnD,CAAC,eAAe,CAAC,EACjB,sQAAsQ,EACtQ,4CAA4C,CAC7C,CAAC,MAAM,CAAC;IAET,MAAM;QACJ,4EAA4E;QAC5E,OAAO,IAAI,CAAC,KAAK,CACf,MAAM,EACN,IAAI,eAAe,CACjB,kEAAkE,EAClE,WAAW,CACZ,CAAC,OAAO,CAAC,eAAe,CAAC,CAC3B,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type FullAccess } from '../authorization-statuses.ts';
|
|
2
|
+
import { PromptedService } from '../prompted-service.ts';
|
|
3
|
+
export declare class Calendars extends PromptedService<FullAccess> {
|
|
4
|
+
readonly name = "kTCCServiceCalendar";
|
|
5
|
+
protected readonly paneKey = "CALENDARS";
|
|
6
|
+
protected readonly anchor = "Privacy_Calendars";
|
|
7
|
+
protected readonly requestScript: string;
|
|
8
|
+
status(): FullAccess;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=calendars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendars.d.ts","sourceRoot":"","sources":["../../src/services/calendars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAc,MAAM,8BAA8B,CAAC;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,SAAU,SAAQ,eAAe,CAAC,UAAU,CAAC;IACxD,QAAQ,CAAC,IAAI,yBAAyB;IACtC,SAAS,CAAC,QAAQ,CAAC,OAAO,eAAe;IACzC,SAAS,CAAC,QAAQ,CAAC,MAAM,uBAAuB;IAEhD,SAAS,CAAC,QAAQ,CAAC,aAAa,SAIvB;IAET,MAAM,IAAI,UAAU,CASnB;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { fullAccess } from '../authorization-statuses.js';
|
|
2
|
+
import { JxaRequest } from '../native/jxa-request.js';
|
|
3
|
+
import { ObjectiveCClass } from '../native/objective-c-class.js';
|
|
4
|
+
import { PromptedService } from '../prompted-service.js';
|
|
5
|
+
export class Calendars extends PromptedService {
|
|
6
|
+
name = 'kTCCServiceCalendar';
|
|
7
|
+
paneKey = 'CALENDARS';
|
|
8
|
+
anchor = 'Privacy_Calendars';
|
|
9
|
+
requestScript = JxaRequest.decided(['EventKit'], "const store = C('EKEventStore').alloc.init;\nstore.requestFullAccessToEventsWithCompletion(() => {});", "[0, 4].includes(Number(C('EKEventStore').authorizationStatusForEntityType(0)))").source;
|
|
10
|
+
status() {
|
|
11
|
+
// EKEntityTypeEvent (EventKit/EKTypes.h:189)
|
|
12
|
+
return this.named(fullAccess, new ObjectiveCClass('/System/Library/Frameworks/EventKit.framework/EventKit', 'EKEventStore').integer('authorizationStatusForEntityType:', 0));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=calendars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendars.js","sourceRoot":"","sources":["../../src/services/calendars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,OAAO,SAAU,SAAQ,eAA2B;IAC/C,IAAI,GAAG,qBAAqB,CAAC;IACnB,OAAO,GAAG,WAAW,CAAC;IACtB,MAAM,GAAG,mBAAmB,CAAC;IAE7B,aAAa,GAAG,UAAU,CAAC,OAAO,CACnD,CAAC,UAAU,CAAC,EACZ,uGAAuG,EACvG,gFAAgF,CACjF,CAAC,MAAM,CAAC;IAET,MAAM;QACJ,6CAA6C;QAC7C,OAAO,IAAI,CAAC,KAAK,CACf,UAAU,EACV,IAAI,eAAe,CACjB,wDAAwD,EACxD,cAAc,CACf,CAAC,OAAO,CAAC,mCAAmC,EAAE,CAAC,CAAC,CAClD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Authorized } from '../authorization-statuses.ts';
|
|
2
|
+
import { PromptedService } from '../prompted-service.ts';
|
|
3
|
+
export declare class Camera extends PromptedService<Authorized> {
|
|
4
|
+
readonly name = "kTCCServiceCamera";
|
|
5
|
+
protected readonly paneKey = "CAMERA";
|
|
6
|
+
protected readonly anchor = "Privacy_Camera";
|
|
7
|
+
protected readonly requestScript: string;
|
|
8
|
+
status(): Authorized;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=camera.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../src/services/camera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAc,MAAM,8BAA8B,CAAC;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,MAAO,SAAQ,eAAe,CAAC,UAAU,CAAC;IACrD,QAAQ,CAAC,IAAI,uBAAuB;IACpC,SAAS,CAAC,QAAQ,CAAC,OAAO,YAAY;IACtC,SAAS,CAAC,QAAQ,CAAC,MAAM,oBAAoB;IAE7C,SAAS,CAAC,QAAQ,CAAC,aAAa,SAIvB;IAET,MAAM,IAAI,UAAU,CAQnB;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { authorized } from '../authorization-statuses.js';
|
|
2
|
+
import { JxaRequest } from '../native/jxa-request.js';
|
|
3
|
+
import { ObjectiveCClass } from '../native/objective-c-class.js';
|
|
4
|
+
import { PromptedService } from '../prompted-service.js';
|
|
5
|
+
export class Camera extends PromptedService {
|
|
6
|
+
name = 'kTCCServiceCamera';
|
|
7
|
+
paneKey = 'CAMERA';
|
|
8
|
+
anchor = 'Privacy_Camera';
|
|
9
|
+
requestScript = JxaRequest.decided(['AVFoundation'], "C('AVCaptureDevice').requestAccessForMediaTypeCompletionHandler($.AVMediaTypeVideo, () => {});", "Number(C('AVCaptureDevice').authorizationStatusForMediaType($.AVMediaTypeVideo)) === 0").source;
|
|
10
|
+
status() {
|
|
11
|
+
return this.named(authorized, new ObjectiveCClass('/System/Library/Frameworks/AVFoundation.framework/AVFoundation', 'AVCaptureDevice').integerFor('authorizationStatusForMediaType:', 'AVMediaTypeVideo'));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=camera.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera.js","sourceRoot":"","sources":["../../src/services/camera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,OAAO,MAAO,SAAQ,eAA2B;IAC5C,IAAI,GAAG,mBAAmB,CAAC;IACjB,OAAO,GAAG,QAAQ,CAAC;IACnB,MAAM,GAAG,gBAAgB,CAAC;IAE1B,aAAa,GAAG,UAAU,CAAC,OAAO,CACnD,CAAC,cAAc,CAAC,EAChB,gGAAgG,EAChG,wFAAwF,CACzF,CAAC,MAAM,CAAC;IAET,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,CACf,UAAU,EACV,IAAI,eAAe,CACjB,gEAAgE,EAChE,iBAAiB,CAClB,CAAC,UAAU,CAAC,kCAAkC,EAAE,kBAAkB,CAAC,CACrE,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Authorized } from '../authorization-statuses.ts';
|
|
2
|
+
import { PromptedService } from '../prompted-service.ts';
|
|
3
|
+
export declare class Contacts extends PromptedService<Authorized> {
|
|
4
|
+
readonly name = "kTCCServiceAddressBook";
|
|
5
|
+
protected readonly paneKey = "CONTACTS";
|
|
6
|
+
protected readonly anchor = "Privacy_Contacts";
|
|
7
|
+
protected readonly requestScript: string;
|
|
8
|
+
status(): Authorized;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=contacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../src/services/contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAc,MAAM,8BAA8B,CAAC;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,QAAS,SAAQ,eAAe,CAAC,UAAU,CAAC;IACvD,QAAQ,CAAC,IAAI,4BAA4B;IACzC,SAAS,CAAC,QAAQ,CAAC,OAAO,cAAc;IACxC,SAAS,CAAC,QAAQ,CAAC,MAAM,sBAAsB;IAE/C,SAAS,CAAC,QAAQ,CAAC,aAAa,SAIvB;IAET,MAAM,IAAI,UAAU,CASnB;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { authorized } from '../authorization-statuses.js';
|
|
2
|
+
import { JxaRequest } from '../native/jxa-request.js';
|
|
3
|
+
import { ObjectiveCClass } from '../native/objective-c-class.js';
|
|
4
|
+
import { PromptedService } from '../prompted-service.js';
|
|
5
|
+
export class Contacts extends PromptedService {
|
|
6
|
+
name = 'kTCCServiceAddressBook';
|
|
7
|
+
paneKey = 'CONTACTS';
|
|
8
|
+
anchor = 'Privacy_Contacts';
|
|
9
|
+
requestScript = JxaRequest.decided(['Contacts'], "const store = C('CNContactStore').alloc.init;\nstore.requestAccessForEntityTypeCompletionHandler(0, () => {});", "Number(C('CNContactStore').authorizationStatusForEntityType(0)) === 0").source;
|
|
10
|
+
status() {
|
|
11
|
+
// CNEntityTypeContacts (Contacts/CNContactStore.h:74)
|
|
12
|
+
return this.named(authorized, new ObjectiveCClass('/System/Library/Frameworks/Contacts.framework/Contacts', 'CNContactStore').integer('authorizationStatusForEntityType:', 0));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=contacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/services/contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,OAAO,QAAS,SAAQ,eAA2B;IAC9C,IAAI,GAAG,wBAAwB,CAAC;IACtB,OAAO,GAAG,UAAU,CAAC;IACrB,MAAM,GAAG,kBAAkB,CAAC;IAE5B,aAAa,GAAG,UAAU,CAAC,OAAO,CACnD,CAAC,UAAU,CAAC,EACZ,gHAAgH,EAChH,uEAAuE,CACxE,CAAC,MAAM,CAAC;IAET,MAAM;QACJ,sDAAsD;QACtD,OAAO,IAAI,CAAC,KAAK,CACf,UAAU,EACV,IAAI,eAAe,CACjB,wDAAwD,EACxD,gBAAgB,CACjB,CAAC,OAAO,CAAC,mCAAmC,EAAE,CAAC,CAAC,CAClD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Client } from '../client.ts';
|
|
2
|
+
import { Preflight } from '../preflight.ts';
|
|
3
|
+
import { Service } from '../service.ts';
|
|
4
|
+
export declare class FullDiskAccess extends Service {
|
|
5
|
+
readonly name = "kTCCServiceSystemPolicyAllFiles";
|
|
6
|
+
protected readonly paneKey = "ALL_FILES";
|
|
7
|
+
protected readonly anchor = "Privacy_AllFiles";
|
|
8
|
+
remedy(client: Client): string;
|
|
9
|
+
preflight(paths: readonly string[]): Promise<Preflight>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=full-disk-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"full-disk-access.d.ts","sourceRoot":"","sources":["../../src/services/full-disk-access.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AASxC,qBAAa,cAAe,SAAQ,OAAO;IACzC,QAAQ,CAAC,IAAI,qCAAqC;IAClD,SAAS,CAAC,QAAQ,CAAC,OAAO,eAAe;IACzC,SAAS,CAAC,QAAQ,CAAC,MAAM,sBAAsB;IAGtC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMtC;IAEK,SAAS,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAK5D;CACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { open } from 'node:fs/promises';
|
|
2
|
+
import { Preflight } from '../preflight.js';
|
|
3
|
+
import { Service } from '../service.js';
|
|
4
|
+
const denials = new Set(['EPERM', 'EACCES']);
|
|
5
|
+
const absences = new Set(['ENOENT', 'ENOTDIR']);
|
|
6
|
+
// Full Disk Access has no status: Apple gives no API for it and no path that
|
|
7
|
+
// proves the grant (ADR 0003). The caller preflights the paths of its work.
|
|
8
|
+
export class FullDiskAccess extends Service {
|
|
9
|
+
name = 'kTCCServiceSystemPolicyAllFiles';
|
|
10
|
+
paneKey = 'ALL_FILES';
|
|
11
|
+
anchor = 'Privacy_AllFiles';
|
|
12
|
+
// A grant of Full Disk Access applies to the processes that start after it.
|
|
13
|
+
remedy(client) {
|
|
14
|
+
const again = client.type === 'bundle'
|
|
15
|
+
? `quit and reopen ${client.name}`
|
|
16
|
+
: 'start it again';
|
|
17
|
+
return `Turn on ${client.name} in System Settings › Privacy & Security › ${this.pane}, then ${again}. macOS does not ask for this access.`;
|
|
18
|
+
}
|
|
19
|
+
async preflight(paths) {
|
|
20
|
+
const outcomes = await Promise.all(paths.map((path) => outcome(path)));
|
|
21
|
+
const of = (kind) => paths.filter((_, index) => outcomes[index] === kind);
|
|
22
|
+
return new Preflight(of('readable'), of('denied'), of('missing'));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function outcome(path) {
|
|
26
|
+
try {
|
|
27
|
+
const handle = await open(path, 'r');
|
|
28
|
+
await handle.close();
|
|
29
|
+
return 'readable';
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
const code = Error.isError(error) && 'code' in error ? error.code : '';
|
|
33
|
+
if (typeof code === 'string' && denials.has(code))
|
|
34
|
+
return 'denied';
|
|
35
|
+
if (typeof code === 'string' && absences.has(code))
|
|
36
|
+
return 'missing';
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=full-disk-access.js.map
|