Vault and Access
The Vault loads local keys and issues access tokens according to pack manifests. Packs use engine.vault.requireAccess and engine.vault.requireKey through a facade. The .keys file stores plain-text key material, with access controlled by the host's filesystem permissions. Environment variables are also supported as a fallback for individual key lookup.
Key Names and Lifetime
The Core uses KEY:ENGINE, KEY:HMAC, and KEY:VAULT for its internal operations. A pack's typology selects its integrity key, such as KEY:LIBRARY for library packs or KEY:TARGETAPI for a targetApi layer. An optional child key uses an additional name segment. The following values are placeholders.
KEY:ENGINE YOUR_ENGINE_KEY
KEY:HMAC YOUR_HMAC_KEY
KEY:VAULT YOUR_VAULT_KEY
KEY:LIBRARY YOUR_LIBRARY_KEY
KEY:TARGETAPI YOUR_TARGET_KEY
KEY:TARGETAPI:API YOUR_PRIVATE_API_KEY
Generate values locally as described in First setup. Each Vault instance loads .keys once. Updating the file does not refresh keys already held by that instance. Provision the intended keys before startup and restart when changing them. Private recovery archives can retain .keys alongside the other application data.
Manifest Permissions
The provider's permits field controls requests from other packs. An array lists allowed caller labels. true allows requests from other packs, while false denies them. A pack can request its own keys. The Core has a separate internal access path.
{
"label": "sometarget",
"typology": "targetApi",
"permits": ["whorequest"]
}
This fragment belongs in the provider's full manifest. A consumer requests a token using its own pack label and the provider's pack label. The current facade accepts those labels as arguments; it does not bind the supplied caller label to an independently authenticated JavaScript caller. Use reviewed packs within this shared-process trust model.
Request a Layer Instance
In this example, whorequest is the caller's pack label, sometarget is the target pack's label, and targetApi is the target's runtime typology. The target manifest grants access to whorequest. Use labels when requesting the Vault token, then the typology when requesting the instance.
The following fragment runs inside whorequest and uses the targetApi layer built in Runtime Layers.
const token = engine.vault.requireAccess(
'whorequest', // Requester's manifest.label
'sometarget' // Provider's manifest.label
)
if (typeof token !== 'string' || token.startsWith('error:')) {
throw new Error('Vault access denied')
}
const targetInstance = layers.require(
'targetApi', // Provider's manifest.typology: runtime slot
token,
false
)
if (!targetInstance || typeof targetInstance.assets?.getValue !== 'function') {
throw new Error('Target layer unavailable')
}
const value = targetInstance.assets.getValue()
Valid tokens are strings. The Vault also returns error strings for denied requests, so distinguish those results explicitly. false requests the published instance with its assets. true requests the lifecycle API, whose attach and detach operations are supervised separately.
Tokens and Key Access
Tokens contain a Base64url-encoded requester/provider profile and expiry time, authenticated with HMAC-SHA256 using KEY:VAULT. They expire after ten minutes. Verification checks the signature, expiry, target, and current manifests. The encoded profile can be read by anyone holding the token. Keep tokens private.
requireKey(token, typology) can return the raw key when the token permits it. Child-key requests also require the token holder to be the provider itself or the Core. Token expiry is checked on subsequent Vault validation. An instance reference already handed to a pack remains a JavaScript reference after the token expires.
Access Under Reduced Security
The checked layer-request path combines Vault key lookup with HMAC verification. If you deliberately disable HMAC or enable its development bypass, the request uses the reduced verification path. The Vault still reports denied or invalid tokens, but layers.require currently accepts a truthy key-lookup result, including an error string. Under those conditions it can return an available instance or lifecycle API.
Keep the token and instance checks shown above, and use reduced verification with trusted code. Those caller checks handle cooperative application errors. A caller that omits them can still reach the reduced path. Choose the active security profile.