返回 CodeWhale
facts-publish.d.mts
根目录 / web / scripts / facts-publish.d.mts
1 import type { KeyObject } from "node:crypto";
2 import type { CloudFactsEnvelope } from "../lib/cloud-facts";
3 import type { TrustedKey } from "../lib/cloud-facts/keys";
4 export const MAX_ENVELOPE_BYTES: number;
5 export const REGISTRY_CHANNEL: string;
6 export const REGISTRY_SCHEMA: string;
7 export const MAX_REGISTRY_PAYLOAD_BYTES: number;
8 export const MAX_REGISTRY_ENVELOPE_BYTES: number;
9 export function maxPayloadBytesFor(channel: string): number;
10 export function maxEnvelopeBytesFor(channel: string): number;
11 export function verifyEnvelope(envelope: unknown, publicKeyB64: string): { ok: boolean; errors: string[]; payload?: Record<string, unknown>; sha256?: string };
12 export function validateSource(source: unknown): string[];
13 export function validateRegistrySource(source: unknown): string[];
14 export function buildRegistryPayload(source: unknown, options?: { factsVersion?: number; publishedAt?: string; notAfter?: string | null; appliesTo?: string }): Record<string, unknown>;
15 export function deriveBundledRegistryTrust(descriptors: Record<string, unknown>): { providers: Record<string, Record<string, unknown>>; providerDescriptorsCompat: Record<string, unknown> };
16 export function parseTsKeys(text: string): TrustedKey[];
17 export function validateTrustedKeys(keys: readonly TrustedKey[]): readonly TrustedKey[];
18 export function activePublishingKey(envelope: CloudFactsEnvelope, keys: readonly TrustedKey[], now?: number): { key: TrustedKey; check: ReturnType<typeof verifyEnvelope> };
19 export function emitSql(envelope: unknown, options: { publishedBy?: string; publicKeyB64: string; notes?: string }): string;
20 export function readBoundedFile(path: string, maxBytes?: number): Buffer;
21 export function readBoundedResponse(response: Response, maxBytes?: number): Promise<string>;
22 export function buildEnvelope(options: { privateKey: KeyObject; keyId: string; payload: Record<string, unknown> }): CloudFactsEnvelope;
23 export type PostgrestRequest = (path: string, init?: { method?: string; body?: Record<string, unknown>; prefer?: string }) => Promise<unknown>;
24 export function publishRelease(request: PostgrestRequest, envelope: CloudFactsEnvelope, row: Record<string, unknown>, publicKey: string): Promise<Record<string, unknown>>;
25 export function revokeRelease(request: PostgrestRequest, options: { channel: string; version: number; reason: string; at: string }): Promise<Record<string, unknown>>;
26
26 lines Plain Text