MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / summaryFromOrgApiKey

Function summaryFromOrgApiKey

apps/cloud/src/auth/api-keys.ts:226–239  ·  view source on GitHub ↗
(
  apiKey: typeof OrgApiKey.Type,
  organizationId: string,
)

Source from the content-addressed store, hash-verified

224// workspace-wide, so a response naming a different org than the one requested
225// must not be surfaced as that org's key.
226const summaryFromOrgApiKey = (
227 apiKey: typeof OrgApiKey.Type,
228 organizationId: string,
229): ApiKeySummary | null => {
230 if (apiKey.owner.id !== organizationId) return null;
231 return {
232 id: apiKey.id,
233 name: apiKey.name ?? "API key",
234 obfuscatedValue: apiKey.obfuscatedValue ?? apiKey.obfuscated_value ?? "",
235 createdAt: apiKey.createdAt ?? apiKey.created_at ?? "",
236 updatedAt: apiKey.updatedAt ?? apiKey.updated_at ?? "",
237 lastUsedAt: apiKey.lastUsedAt ?? apiKey.last_used_at ?? null,
238 };
239};
240
241const orgListFromResponse = (value: unknown, organizationId: string): readonly ApiKeySummary[] =>
242 Option.match(decodeListOrgApiKeysResponse(value), {

Callers 2

orgListFromResponseFunction · 0.85
orgCreatedFromResponseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected