logicsrc/plugins/credential-sharing/src/index.ts
sh1pt-actions-fleet[bot] 87bbc50423
Rotation on every surface: desktop rotator, Rotation page + run queue, MCP tools (CLI 0.15.0) (#269)
- method "desktop": dashboard-only keys (OpenAI, ElevenLabs, Brave Search,
  Civitai, Cloudflare Global API Key roll, Anthropic/Claude OAuth report-only)
  rotated by an agent on a W3BS Agentic Desktop Layer host (--desktop /
  LOGICSRC_DESKTOP_HOST). Agent browser only, old key by its last 4 chars,
  DOM-to-file capture (wl-paste fallback), two-phase revoke after health,
  rollback deletes the new key, remote file shredded. needs-login and busy
  are waits, not failures. Roll needs --allow-roll plus a capture self-test.
- app.logicsrc.com: /teams/:slug/rotation plan page + rotation run queue
  (migration 010), API routes; runner: rotate-keys --from-queue.
- MCP: rotation_plan, rotation_set, rotate_keys (dry run default), rotation_runs.
- docs/rotation.md: desktop rotators and every surface.

Co-authored-by: Anthony Ettinger <anthony@profullstack.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 04:30:18 +00:00

153 lines
4.2 KiB
TypeScript

import type { PluginDefinition } from "@logicsrc/plugin-core";
import { credentialSharingManifest } from "./manifest.js";
import { CredentialEngine, type CredentialEngineOptions } from "./engine.js";
import { listCredentialProviderManifests } from "./providers/index.js";
export const credentialSharingPlugin: PluginDefinition = {
manifest: credentialSharingManifest,
configDefaults: {
enabled: true,
default_policy: "approval_required_for_destructive",
credential_home: "${LOGICSRC_CREDENTIAL_HOME}"
},
routes: [
{ method: "GET", path: "/api/credentials/providers", capability: "credentials.providers.list" },
{ method: "GET", path: "/api/credentials/inspect", capability: "credentials.inspect" },
{ method: "POST", path: "/api/credentials/diff", capability: "credentials.diff" },
{ method: "POST", path: "/api/credentials/plans", capability: "credentials.plan" },
{ method: "POST", path: "/api/credentials/plans/:id/approve", capability: "credentials.approve" },
{ method: "POST", path: "/api/credentials/plans/:id/sync", capability: "credentials.sync" },
{ method: "POST", path: "/api/credentials/runs/:id/rollback", capability: "credentials.rollback" },
{ method: "GET", path: "/api/credentials/runs/:id/audit", capability: "credentials.audit.read" }
],
permissions: [
"credentials:inspect",
"credentials:diff",
"credentials:plan",
"credentials:approve",
"credentials:sync",
"credentials:rollback",
"credentials:audit:read"
],
tuiPanels: [{ id: "credential-sharing", title: "Credential Sharing" }]
};
/** Factory mirroring the LogicSRC Credential Sharing SDK spec. */
export function createCredentialEngine(options: CredentialEngineOptions = {}): CredentialEngine {
return new CredentialEngine(options);
}
/** Provider listing without constructing an engine (used by the CLI `providers` command). */
export function listCredentialProviders() {
return listCredentialProviderManifests();
}
export { credentialSharingManifest };
export { CredentialEngine, DEFAULT_CREDENTIAL_POLICY, endpointLabel } from "./engine.js";
export type { CredentialEngineOptions } from "./engine.js";
export {
credentialProviders,
credentialProviderRegistry,
listCredentialProviderManifests,
envProvider,
dopplerProvider,
railwayProvider,
githubSecretsProvider,
sshProvider,
teamProvider,
ROTATION_ENTRY_PREFIX,
parseEnv,
applyEnv,
classifySshFile,
decodeSshFile,
defaultSshDirectory,
encodeSshFile,
isPassphraseless,
readSshDirectory,
secretNameForPath,
sshDirectory,
SSH_ENVELOPE_VERSION,
type SshFile,
type SshFileKind
} from "./providers/index.js";
export {
TeamClient,
TeamApiError,
type TeamClientOptions,
type RemoteUser,
type RemoteTeam,
type RemoteMember,
type RemoteVault,
type RemoteSecret,
type RemoteGrantRow,
type RemoteKeyInfo,
type RemoteApiKey,
type RemoteKeyGrant,
type RemoteAuditRow,
type CreateApiKeyInput,
type RemoteRotationPlanItem,
type RemoteRotationRun
} from "./client.js";
export {
ensureApiKeyIdentity,
ApiKeyAuthError,
type EnsureApiKeyOptions,
type EnsuredApiKey
} from "./machine-key.js";
export {
generateIdentityKeyPair,
generateVaultKey,
wrapVaultKey,
unwrapVaultKey,
encryptValue,
decryptValue,
publicKeyForSecret,
type IdentityKeyPair,
type SealedValue
} from "./crypto.js";
export {
loadOrCreateIdentity,
readIdentity,
saveIdentity,
updateIdentity,
requireAuth,
verifyIdentityIntegrity,
identityPath,
logicsrcHome,
defaultApiUrl,
envApiUrl,
resolveApiUrl,
envApiKey,
apiKeyPrefix,
keyIdentityPath,
activeKeyPath,
readActiveKeyIdentity,
setActiveKey,
DEFAULT_API_URL,
type LocalIdentity
} from "./identity.js";
export {
createFileCredentialStore,
createMemoryCredentialStore,
defaultCredentialHome,
type CredentialStore
} from "./store.js";
export { fingerprintValue, fingerprintsEqual } from "./fingerprint.js";
export {
keyFingerprint,
knownKeysPath,
pinStatus,
checkAndPinKey,
repinKey,
KeyChangedError,
type KnownKey,
type PinStatus
} from "./known-keys.js";
export {
planVaultRekey,
type RekeyPlan,
type RekeyPlanInput,
type RekeyMember,
type SealedSecret
} from "./rekey.js";
export * from "./types.js";