@enc-protocol/plugin-client-base
v0.9.0
Published
Default reference impls for the protocol-level client slots (IngestStrategy, EventResolver, EnvelopeCrypto, RegistryStrategy, PeerRouting, Provisioner, ProfileResolver). Extracts the behavior that previously lived inline inside impl-cli/lib/client/* and i
Readme
@enc-protocol/plugin-client-base
An infrastructure plugin that fills 10 client-side protocol slots with pass-through / sensible-default implementations. Suitable for dev / tests / single-tenant deployments where the protocol behaviors aren't customized.
Slots filled
| Slot | Default behavior |
|-----------------------|-----------------------------------------------------------|
| IngestStrategyFn | Append every event to the local store |
| EventResolverFn | Identity transform (no event rewriting) |
| EnvelopeEncryptFn | Pass-through — payload appears as-is |
| EnvelopeDecryptFn | Pass-through — envelope.payload is the plaintext |
| RegistryStrategyFn | Local-only registry lookup |
| PeerRoutingFn | Single-adapter routing |
| ProvisionerFn | Manifest passthrough |
| ProfileResolverFn | Lookup by pubkey in the local profiles table |
| ManifestNormalizerFn| Identity (manifest unchanged) |
| TransportFn | Single adapter / map-of-adapters passthrough |
Usage
import { PluginRegistry } from '@enc-protocol/plugin-runtime';
import * as defaults from '@enc-protocol/plugin-client-base';
const registry = new PluginRegistry({
pluginSlots: defaults.slots,
bindings: defaults.bindings,
});The SDK can also auto-discover these via npm metadata
(encPlugin.slotIds).
When to swap
- EnvelopeEncryptFn / EnvelopeDecryptFn: swap in
plugin-envelope-dm(ECDH+AEAD) orplugin-mls-dm-envelope(MLS) for any non-toy DM use. - TransportFn: replace with a real adapter for production multi-server deployments.
- RegistryStrategyFn: swap when the registry lives off-host.
- Everything else is usually fine as default unless the app's spec declares a custom behavior.
CF compatibility
- Pure JS, no deps
- O(1) on every slot
- Worker primitive only
cf_compatible: true
