createOAuthFlowRegistry (source-control/oauth-flow-registry.js)

openchamber · packages/web/server/lib/source-control/oauth-flow-registry.js · javascript · MIT
auth, Auth / Identity

Creates an in‑memory registry for OAuth flows, handling registration, acquisition, and cleanup.

// Source: https://github.com/openchamber/openchamber | License: MIT | Copyright 2025 Bohdan Triapitsyn
// Provided via justclaw.it.com; keep this notice with the code.
import crypto from 'node:crypto';

const DEFAULT_TTL_MS = 10 * 60 * 1000;
const MAX_TTL_MS = 15 * 60 * 1000;
const MAX_ENTRIES = 256;

const invalidFlow = () => {
  const error = new Error('OAuth flow is invalid');
  error.code = 'INVALID_SOURCE_CONTROL_OAUTH_FLOW';
  return error;
};

const unavailableFlow = () => {
  const error = new Error('OAuth flow is unavailable');
  error.code = 'SOURCE_CONTROL_OAUTH_FLOW_UNAVAILABLE';
  return error;
};

const busyFlow = () => {
  const error = new Error('OAuth flow is busy');
  error.code = 'SOURCE_CONTROL_OAUTH_FLOW_BUSY';
  return error;
};

const isNonEmptyString = (value) => O

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key