identity-sync/github-identity-admin-attestation
@sarj-ai/workspace-sync/identity-sync/github-identity-admin-attestation ยท Source
import { z } from "zod";import { GitHubLoginSchema } from "../catalog/identity-authority.ts";import { type GoogleWorkspaceIdentityUserGateway, type SarjIdentitySchemaService } from "../org-sync/google-identity-schema.ts";import { type GoogleIdentityMaintenanceFence } from "./google-identity-maintenance-fence-error.ts";type ApplyResult = Promise<{ applied: number; planHash: string; verified: true;}>;export declare const GitHubIdentityAdminAttestationSchema: z.ZodReadonly<z.ZodObject<{ githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">; subject: z.ZodDiscriminatedUnion<[z.ZodObject<{ googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">; kind: z.ZodLiteral<"google-user-id">; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"primary-email">; primaryEmail: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodEmail>, "PrimaryEmail", "out">; }, z.core.$strict>], "kind">; attestedAt: z.ZodISODateTime; attestedBy: z.core.$ZodBranded<z.ZodString, "AdminActorId", "out">;}, z.core.$strict>>;export declare const GitHubIdentityAdminAttestationRequestSchema: z.ZodReadonly<z.ZodObject<{ attestations: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{ githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">; subject: z.ZodDiscriminatedUnion<[z.ZodObject<{ googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">; kind: z.ZodLiteral<"google-user-id">; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"primary-email">; primaryEmail: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodEmail>, "PrimaryEmail", "out">; }, z.core.$strict>], "kind">; }, z.core.$strict>>>>; schemaVersion: z.ZodLiteral<"github-identity-admin-attestation/v1">;}, z.core.$strict>>;export declare const GitHubIdentityAdminAttestationPlanSchema: z.ZodReadonly<z.ZodObject<{ entries: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{ attestation: z.ZodReadonly<z.ZodObject<{ githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">; subject: z.ZodDiscriminatedUnion<[z.ZodObject<{ googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">; kind: z.ZodLiteral<"google-user-id">; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"primary-email">; primaryEmail: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodEmail>, "PrimaryEmail", "out">; }, z.core.$strict>], "kind">; attestedAt: z.ZodISODateTime; attestedBy: z.core.$ZodBranded<z.ZodString, "AdminActorId", "out">; }, z.core.$strict>>; googlePlan: z.ZodUnion<readonly [z.ZodObject<{ current: z.ZodNullable<z.ZodObject<{ githubLogin: z.ZodOptional<z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">>; githubUserId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">>; }, z.core.$strict>>; desired: z.ZodObject<{ githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">; githubUserId: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">; }, z.core.$strict>; kind: z.ZodLiteral<"update">; user: z.ZodObject<{ etag: z.ZodString; id: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">; primaryEmail: z.ZodEmail; }, z.core.$strict>; }, z.core.$strict>, z.ZodObject<{ identity: z.ZodObject<{ githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">; githubUserId: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">; }, z.core.$strict>; kind: z.ZodLiteral<"unchanged">; user: z.ZodObject<{ etag: z.ZodString; id: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">; primaryEmail: z.ZodEmail; }, z.core.$strict>; }, z.core.$strict>]>; target: z.ZodObject<{ githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">; githubUserId: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">; }, z.core.$strict>; }, z.core.$strict>>>>; planHash: z.ZodString; schemaVersion: z.ZodLiteral<"github-identity-admin-attestation-plan/v1">;}, z.core.$strict>>;export type GitHubIdentityAdminAttestationPlan = z.output<typeof GitHubIdentityAdminAttestationPlanSchema>;declare const GitHubIdentityAdminAttestationContextSchema: z.ZodReadonly<z.ZodObject<{ actorId: z.core.$ZodBranded<z.ZodString, "AdminActorId", "out">; attestedAt: z.ZodISODateTime;}, z.core.$strict>>;export type GitHubIdentityAdminAttestationContext = z.input<typeof GitHubIdentityAdminAttestationContextSchema>;export interface GitHubIdentityResolver { resolveUser(login: z.output<typeof GitHubLoginSchema>): Promise<unknown>;}export interface GoogleIdentityAttestationDirectory extends GoogleWorkspaceIdentityUserGateway { listIdentityUsers(): Promise<readonly unknown[]>;}export interface IGitHubIdentityAdminAttestationService { apply(planInput: unknown, confirmPlanHash: string): ApplyResult; plan(requestInput: unknown, contextInput: GitHubIdentityAdminAttestationContext): Promise<GitHubIdentityAdminAttestationPlan>;}export declare class GitHubIdentityAdminAttestationError extends Error { readonly issues: readonly string[]; constructor(issues: readonly string[], options?: ErrorOptions);}type GitHubIdentityLookupFailure = "authentication" | "forbidden" | "invalid-response" | "network" | "not-found" | "rate-limited" | "request-construction" | "runtime" | "timeout" | "unexpected-status" | "upstream";export type GitHubIdentityAdminAttestationSource = "github-user-lookup" | "google-directory-list" | "google-directory-schema" | "google-directory-user" | `github-user-lookup.${GitHubIdentityLookupFailure}`;/** Identifies the failed provider boundary without exposing provider payloads or employee data. */export declare class GitHubIdentityAdminAttestationSourceError extends Error { readonly source: GitHubIdentityAdminAttestationSource; constructor(source: GitHubIdentityAdminAttestationSource, options?: ErrorOptions);}/** Read-only lookup used to bind a reviewed login to GitHub's immutable numeric user ID. */export declare class GitHubIdentityLookupClient implements GitHubIdentityResolver { #private; constructor(input: { fetchImpl?: typeof fetch; token: string; }); resolveUser(loginInput: string): Promise<unknown>;}/** * Converts explicit administrator attestations into exact, replay-safe Google identity updates. * It never guesses from names, emails, commit metadata, or public GitHub profile fields. */export declare class GitHubIdentityAdminAttestationService implements IGitHubIdentityAdminAttestationService { #private; constructor(input: { github: GitHubIdentityResolver; google: GoogleIdentityAttestationDirectory; schema: Pick<SarjIdentitySchemaService, "plan">; maintenanceFence?: GoogleIdentityMaintenanceFence<GitHubIdentityAdminAttestationPlan>; }); plan(requestInput: unknown, contextInput: GitHubIdentityAdminAttestationContext): Promise<GitHubIdentityAdminAttestationPlan>; apply(planInput: unknown, confirmPlanHash: string): ApplyResult;}export {};