kokorobox-native 0.8.4 → 0.10.1
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/README.md +6 -0
- package/index.d.ts +48 -0
- package/index.js +5 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ The full TypeScript declarations are shipped in
|
|
|
43
43
|
| Rules | `fileToStr` |
|
|
44
44
|
| Platform | `getLaunchAtLogin`, `setLaunchAtLogin`, `getNetworkContext` |
|
|
45
45
|
| macOS service | `getMacosManagedServiceStatus`, `registerMacosManagedService`, `unregisterMacosManagedService`, `reloadMacosManagedService`, `openMacosLoginItemsSettings` |
|
|
46
|
+
| macOS application routing | `invokeMacosApplicationRouting` |
|
|
46
47
|
| Core permissions | `getCorePrivilegeStatus`, `setCorePrivileges` |
|
|
47
48
|
| Windows | `getCurrentUserSid`, `isRunningAsAdmin`, `runElevated`, `launchElevated`, `launchUnelevated`, `setupFirewallRules` |
|
|
48
49
|
|
|
@@ -77,6 +78,11 @@ LaunchDaemon plist and use `SMAppService` directly. They return an explicit
|
|
|
77
78
|
`requires-approval` state when an administrator must approve the daemon in
|
|
78
79
|
System Settings.
|
|
79
80
|
|
|
81
|
+
`invokeMacosApplicationRouting(request)` runs the bounded, versioned macOS
|
|
82
|
+
application-routing control-plane protocol off the Node.js main thread. It
|
|
83
|
+
controls the bundled System Extension and Network Extension; packet forwarding
|
|
84
|
+
continues to run in the separate extension process.
|
|
85
|
+
|
|
80
86
|
Core-file privilege APIs are supported on macOS and Linux. They accept only
|
|
81
87
|
canonical, existing executables named `mihomo` or `mihomo-alpha`; callers cannot
|
|
82
88
|
use them as a general privileged-command interface. See the repository's
|
package/index.d.ts
CHANGED
|
@@ -12,8 +12,11 @@ export interface NativeCapabilities {
|
|
|
12
12
|
windowsFirewall: boolean;
|
|
13
13
|
launchAtLogin: boolean;
|
|
14
14
|
networkContext: boolean;
|
|
15
|
+
networkMonitor: boolean;
|
|
15
16
|
macosServiceManagement: boolean;
|
|
17
|
+
macosApplicationRouting: boolean;
|
|
16
18
|
coreFilePrivileges: boolean;
|
|
19
|
+
serviceIdentity: boolean;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
export interface ExecutableSearchOptions {
|
|
@@ -57,6 +60,8 @@ export interface LaunchAtLoginStatus {
|
|
|
57
60
|
|
|
58
61
|
/** Best-effort active-network state. Unavailable fields are omitted instead of guessed. */
|
|
59
62
|
export interface NetworkContext {
|
|
63
|
+
/** Whether the operating system currently has a usable default route. */
|
|
64
|
+
online: boolean;
|
|
60
65
|
defaultInterface?: string;
|
|
61
66
|
/** Active network-service name. Currently populated on macOS and Linux. */
|
|
62
67
|
defaultService?: string;
|
|
@@ -71,6 +76,42 @@ export interface CorePrivilegeStatus {
|
|
|
71
76
|
granted: boolean;
|
|
72
77
|
}
|
|
73
78
|
|
|
79
|
+
export interface ServiceIdentityOptions {
|
|
80
|
+
/** OS credential namespace, for example `com.amamiyakokoro.KokoroBox`. */
|
|
81
|
+
service: string;
|
|
82
|
+
account: string;
|
|
83
|
+
/** Mode-0600 fallback used only when Linux Secret Service is unavailable. */
|
|
84
|
+
linuxFallbackPath?: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface LegacyServiceIdentity {
|
|
88
|
+
keyId?: string;
|
|
89
|
+
publicKey: string;
|
|
90
|
+
privateKey: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface ServiceIdentityInfo {
|
|
94
|
+
keyId: string;
|
|
95
|
+
publicKey: string;
|
|
96
|
+
backend:
|
|
97
|
+
| "windows-credential-manager"
|
|
98
|
+
| "macos-keychain"
|
|
99
|
+
| "linux-secret-service"
|
|
100
|
+
| "linux-protected-file";
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Opaque native signer. Private key material is never exposed by this object. */
|
|
104
|
+
export class ServiceIdentity {
|
|
105
|
+
getInfo(): ServiceIdentityInfo;
|
|
106
|
+
sign(data: string): string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function openServiceIdentity(
|
|
110
|
+
options: ServiceIdentityOptions,
|
|
111
|
+
legacy?: LegacyServiceIdentity,
|
|
112
|
+
): Promise<ServiceIdentity>;
|
|
113
|
+
export function deleteServiceIdentity(options: ServiceIdentityOptions): Promise<void>;
|
|
114
|
+
|
|
74
115
|
export interface ApplicationInfo {
|
|
75
116
|
executablePath: string;
|
|
76
117
|
executableName: string;
|
|
@@ -144,12 +185,19 @@ export function setLaunchAtLogin(
|
|
|
144
185
|
enabled: boolean,
|
|
145
186
|
): Promise<LaunchAtLoginStatus>;
|
|
146
187
|
export function getNetworkContext(): Promise<NetworkContext>;
|
|
188
|
+
/** Resolve when the native network snapshot changes, or `undefined` on timeout. */
|
|
189
|
+
export function waitForNetworkContextChange(
|
|
190
|
+
previous: NetworkContext,
|
|
191
|
+
timeoutMs?: number,
|
|
192
|
+
): Promise<NetworkContext | null>;
|
|
147
193
|
/** Query a LaunchDaemon plist embedded in the calling macOS application. */
|
|
148
194
|
export function getMacosManagedServiceStatus(plistName: string): MacOSManagedServiceStatus;
|
|
149
195
|
export function registerMacosManagedService(plistName: string): MacOSManagedServiceStatus;
|
|
150
196
|
export function unregisterMacosManagedService(plistName: string): MacOSManagedServiceStatus;
|
|
151
197
|
export function reloadMacosManagedService(plistName: string): MacOSManagedServiceStatus;
|
|
152
198
|
export function openMacosLoginItemsSettings(): void;
|
|
199
|
+
/** Invoke the versioned macOS Network/System Extension control-plane protocol. */
|
|
200
|
+
export function invokeMacosApplicationRouting(request: string): Promise<string>;
|
|
153
201
|
/** Inspect only validated `mihomo` and `mihomo-alpha` executable paths. */
|
|
154
202
|
export function getCorePrivilegeStatus(paths: string[]): CorePrivilegeStatus[];
|
|
155
203
|
/** Grant or revoke the constrained Unix core-file privilege. */
|
package/index.js
CHANGED
|
@@ -104,11 +104,13 @@ export const findExecutables = nativeBinding.findExecutables;
|
|
|
104
104
|
export const getLaunchAtLogin = nativeBinding.getLaunchAtLogin;
|
|
105
105
|
export const setLaunchAtLogin = nativeBinding.setLaunchAtLogin;
|
|
106
106
|
export const getNetworkContext = nativeBinding.getNetworkContext;
|
|
107
|
+
export const waitForNetworkContextChange = nativeBinding.waitForNetworkContextChange;
|
|
107
108
|
export const getMacosManagedServiceStatus = nativeBinding.getMacosManagedServiceStatus;
|
|
108
109
|
export const registerMacosManagedService = nativeBinding.registerMacosManagedService;
|
|
109
110
|
export const unregisterMacosManagedService = nativeBinding.unregisterMacosManagedService;
|
|
110
111
|
export const reloadMacosManagedService = nativeBinding.reloadMacosManagedService;
|
|
111
112
|
export const openMacosLoginItemsSettings = nativeBinding.openMacosLoginItemsSettings;
|
|
113
|
+
export const invokeMacosApplicationRouting = nativeBinding.invokeMacosApplicationRouting;
|
|
112
114
|
export const getCorePrivilegeStatus = nativeBinding.getCorePrivilegeStatus;
|
|
113
115
|
export const setCorePrivileges = nativeBinding.setCorePrivileges;
|
|
114
116
|
export const inspectApplication = nativeBinding.inspectApplication;
|
|
@@ -119,3 +121,6 @@ export const runElevated = nativeBinding.runElevated;
|
|
|
119
121
|
export const launchElevated = nativeBinding.launchElevated;
|
|
120
122
|
export const launchUnelevated = nativeBinding.launchUnelevated;
|
|
121
123
|
export const setupFirewallRules = nativeBinding.setupFirewallRules;
|
|
124
|
+
export const ServiceIdentity = nativeBinding.ServiceIdentity;
|
|
125
|
+
export const openServiceIdentity = nativeBinding.openServiceIdentity;
|
|
126
|
+
export const deleteServiceIdentity = nativeBinding.deleteServiceIdentity;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kokorobox-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "KokoroBox native bridge",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"optionalDependencies": {
|
|
51
|
-
"kokorobox-native-win32-x64-msvc": "0.
|
|
52
|
-
"kokorobox-native-win32-arm64-msvc": "0.
|
|
53
|
-
"kokorobox-native-darwin-x64": "0.
|
|
54
|
-
"kokorobox-native-darwin-arm64": "0.
|
|
55
|
-
"kokorobox-native-linux-x64-gnu": "0.
|
|
56
|
-
"kokorobox-native-linux-arm64-gnu": "0.
|
|
51
|
+
"kokorobox-native-win32-x64-msvc": "0.10.1",
|
|
52
|
+
"kokorobox-native-win32-arm64-msvc": "0.10.1",
|
|
53
|
+
"kokorobox-native-darwin-x64": "0.10.1",
|
|
54
|
+
"kokorobox-native-darwin-arm64": "0.10.1",
|
|
55
|
+
"kokorobox-native-linux-x64-gnu": "0.10.1",
|
|
56
|
+
"kokorobox-native-linux-arm64-gnu": "0.10.1"
|
|
57
57
|
}
|
|
58
58
|
}
|