(staged as /lib/init/init-main.js); point bundle-kernel-init and verify scripts at the new path. Wire curl, wget, openssl, ssh-keygen, and tar through coreutils and booter host delegates with booter-side CLI helpers; refresh related bins, bare manifest, shell completion, and man DB (kernel + seeder). Add booter support modules for ACL evaluation, audit chain, secret handles, peer admission, replication priority, process table, swarm lifecycle, boot-graph proc, metrics, monotonic time, protomux alias registry, and swarm peer policy; extend extension resolver, VFS, swarm connection managers, IPC, identity-account, and initd. Harden bare-os-bare-libs build on esbuild failure; add verify scripts for extension manifest schema and runtime incomplete markers; extend ctx API typings, gen-ctx-client-stub, and verify-ctx-dts. Update boot hook fragment, bundled init.js, handbook and reference docs (incl. kernel security and VFS path classes).
34 lines
900 B
JavaScript
34 lines
900 B
JavaScript
/**
|
|
* Optional peer admission gate from **`BARE_OS_PEER_ALLOWLIST_HEX`**
|
|
* (comma-separated hex public keys; empty = allow all).
|
|
* @param {Record<string, unknown> | null | undefined} env
|
|
* @param {string} peerKeyHex
|
|
*/
|
|
export function evaluateBareOsPeerAdmission(env, peerKeyHex) {
|
|
const raw = String(env?.BARE_OS_PEER_ALLOWLIST_HEX || '').trim()
|
|
if (!raw) {
|
|
return {
|
|
schema: 1,
|
|
verdict: 'allow',
|
|
note: 'No allowlist; all peers admitted (subject to Hyperswarm topic).'
|
|
}
|
|
}
|
|
const want = String(peerKeyHex || '')
|
|
.trim()
|
|
.toLowerCase()
|
|
.replace(/^0x/, '')
|
|
const set = new Set(
|
|
raw
|
|
.split(/[\s,]+/)
|
|
.map((s) => s.trim().toLowerCase().replace(/^0x/, ''))
|
|
.filter(Boolean)
|
|
)
|
|
const ok = want && set.has(want)
|
|
return {
|
|
schema: 1,
|
|
verdict: ok ? 'allow' : 'deny',
|
|
allowlistSize: set.size,
|
|
atMs: Date.now()
|
|
}
|
|
}
|