| 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 function verifyEnvelope(envelope: unknown, publicKeyB64: string): { ok: boolean; errors: string[]; payload?: Record<string, unknown>; sha256?: string }; |
| 6 | export function validateSource(source: unknown): string[]; |
| 7 | export function parseTsKeys(text: string): TrustedKey[]; |
| 8 | export function validateTrustedKeys(keys: readonly TrustedKey[]): readonly TrustedKey[]; |
| 9 | export function activePublishingKey(envelope: CloudFactsEnvelope, keys: readonly TrustedKey[], now?: number): { key: TrustedKey; check: ReturnType<typeof verifyEnvelope> }; |
| 10 | export function emitSql(envelope: unknown, options: { publishedBy?: string; publicKeyB64: string; notes?: string }): string; |
| 11 | export function readBoundedFile(path: string, maxBytes?: number): Buffer; |
| 12 | export function readBoundedResponse(response: Response, maxBytes?: number): Promise<string>; |
| 13 | export function buildEnvelope(options: { privateKey: KeyObject; keyId: string; payload: Record<string, unknown> }): CloudFactsEnvelope; |
| 14 | export type PostgrestRequest = (path: string, init?: { method?: string; body?: Record<string, unknown>; prefer?: string }) => Promise<unknown>; |
| 15 | export function publishRelease(request: PostgrestRequest, envelope: CloudFactsEnvelope, row: Record<string, unknown>, publicKey: string): Promise<Record<string, unknown>>; |
| 16 | export function revokeRelease(request: PostgrestRequest, options: { channel: string; version: number; reason: string; at: string }): Promise<Record<string, unknown>>; |
| 17 |