@devseccode/core-launcher
v0.1.1
Published
Dependency-free Node integration helpers for DevSecCode local services.
Readme
DevSecCode Core Launcher
Dependency-free Node helpers for DevSecCode integrations.
This package helps JavaScript clients prepare packaged DevSecCode resources, connect to a local authenticated service, check required runtime capabilities, and send requests.
Features
The package provides Node 18 helpers for:
- Checking packaged resource integrity with manifest hashes and sizes.
- Safely extracting verified archives while rejecting unsafe paths.
- Reading local service endpoint descriptors.
- Starting a caller-provided local service binary when needed.
- Waiting for service readiness.
- Checking caller-specified runtime capabilities.
- Sending authenticated JSON requests.
Example
const {
ensureCore,
extractArtifactArchive,
request,
} = require("@devseccode/core-launcher");
const artifact = extractArtifactArchive({
artifactRoot: "/path/to/devseccode/resources",
target: "darwin-arm64",
verifyArchive: true,
});
const { endpoint, meta } = await ensureCore({
binaryPath: artifact.binaryPath,
requiredCapabilities: ["example.capability"],
});
const result = await request(endpoint, "/example/route", {
method: "POST",
body: JSON.stringify({
ok: true,
}),
});
console.log(meta.engineVersion, result);