Problem
@enbox/auth manages identities within a single data directory and vault. Applications that need named profiles with separate data directories (e.g. gitd's work/personal profile separation) must build their own profile management layer.
gitd implements this in src/profiles/config.ts (194 lines):
- Named profiles mapped to
~/.enbox/profiles/<name>/DATA/AGENT/
- Multi-source resolution: CLI flag -> env var -> git config -> global default -> single-profile fallback
- Profile CRUD (create, list, get, set active, remove)
- Per-repo profile overrides via git config
Proposal
Add ProfileManager to @enbox/auth:
import { ProfileManager } from '@enbox/auth';
const profiles = new ProfileManager({ baseDir: '~/.enbox/profiles' });
// Create and use profiles
await profiles.create({ name: 'work', did: '...' });
await profiles.setActive('work');
const active = profiles.resolve(); // respects env, config, default
// Get an AuthManager for the active profile
const auth = await profiles.getAuthManager({ password });
Source reference
gitd/src/profiles/config.ts:1-194
Acceptance criteria
Problem
@enbox/authmanages identities within a single data directory and vault. Applications that need named profiles with separate data directories (e.g. gitd's work/personal profile separation) must build their own profile management layer.gitd implements this in
src/profiles/config.ts(194 lines):~/.enbox/profiles/<name>/DATA/AGENT/Proposal
Add
ProfileManagerto@enbox/auth:Source reference
gitd/src/profiles/config.ts:1-194Acceptance criteria
AuthManagerinstances scoped to a profile's data directory