Files
orca/native/windows-security/index.js
T
Brennan Benson 4217095c06 Support Windows native Antigravity account switching (#34637)
* Support Windows native Antigravity account credentials

* Preserve Antigravity prompt arguments and sanitize Windows file failures

* Preserve Windows credential bytes and distinguish native read failures

* Import Buffer type in Windows security declarations

* Expose native credential bytes without a Node type dependency

* Let Windows agy launches keep shell ownership

* fix: declare Windows account messages and cover owner scope

* fix: resolve Windows account authority before snapshot projection

* fix: share Windows credential parsing with saved account reader

* test: type saved account identity lookup mock

* test: isolate native account fixture host detection

* test: reuse filesystem mock for container marker control

* test: preserve native credential contract failure diagnostics

* test: normalize private read expectation and cover Windows boundary
2026-10-29 14:31:23 -07:00

32 lines
1.5 KiB
JavaScript

'use strict'
// Load lazily because non-Windows installs have no addon, including during test collection.
let addon = null
function getAddon() {
if (!addon) {
addon = require('./build/Release/orca_windows_security.node')
}
return addon
}
module.exports = {
currentUserSid: () => getAddon().currentUserSid(),
getDaclAces: (path) => getAddon().getDaclAces(path),
setDaclSddl: (path, sddl) => getAddon().setDaclSddl(path, sddl),
setDaclSddlAsync: (path, sddl) => getAddon().setDaclSddlAsync(path, sddl),
createFileWithDacl: (path, sddl, data, strict) =>
getAddon().createFileWithDacl(path, sddl, data, strict),
readFileWithDacl: (path, maxBytes) => getAddon().readFileWithDacl(path, maxBytes),
readGenericCredential: (target) => getAddon().readGenericCredential(target),
writeGenericCredential: (target, user, data) =>
getAddon().writeGenericCredential(target, user, data),
grantAccess: (path, sid, mask, options) => getAddon().grantAccess(path, sid, mask, options),
grantAccessAsync: (path, sid, mask, options) =>
getAddon().grantAccessAsync(path, sid, mask, options),
clearStdHandleInheritance: () => getAddon().clearStdHandleInheritance(),
spawnDetachedIsolated: (file, commandLine, cwd, environmentBlock, onExit) =>
getAddon().spawnDetachedIsolated(file, commandLine, cwd, environmentBlock, onExit),
// Reads the binding this package resolved, so a build probe tests the binary the app loads.
hasNativeExport: (name) => typeof getAddon()[name] === 'function'
}