Runtime resolver plus optional runtime-owned policy helpers
ServiceHandler to register via runtime.registerService('resource', handler)
import { createResourceService } from '@kehto/services';
const svc = createResourceService({
fetch: (url, init) => runtimeResources.resolve(url, init),
isOriginGranted: (origin, grants) => grants.includes(origin),
getConnectGrants: (dTag, hash) => myOriginGrantStore.getOrigins(dTag, hash),
resolveIdentity: (windowId) => sessionRegistry.getEntryByWindowId(windowId) ?? null,
});
runtime.registerService('resource', svc);
Create a NAP-RESOURCE reference service.
Implements the NAP-RESOURCE request/response protocol:
resource.info,resource.bytes,resource.bytesMany,resource.cancel, and their result/error envelopes.The runtime resolver is validated at construction. Runtime implementers may additionally install the origin-grant adapter; Kehto provides and enforces the hook contract without selecting the grants or requiring that policy.
Returns a
ServiceHandler(nopublishValues-style surface — resource has no shell-initiated push beyond the response/error path).