/** * Schema Registry * Fail-closed validation: reject any unknown version/type/algorithm * CVF-US-009: Schema registry allowlist for deterministic validation */ import { type EnvelopeVersion, type EnvelopeType, type Algorithm, type HashAlgorithm } from './types.js'; /** * Schema allowlist entry - defines an allowed schema ID with its version */ export interface SchemaAllowlistEntry { /** Schema identifier (e.g., 'artifact_signature') */ schema_id: string; /** Current active version */ version: string; /** All supported versions for this schema */ supported_versions: string[]; /** Schema status */ status: 'active' | 'deprecated'; /** When this schema was added to the allowlist */ added_at: string; /** Optional deprecation date for deprecated schemas */ deprecated_at?: string; } /** * Allowlisted schema IDs and their versions * This is the authoritative list - any schema not in this list is rejected */ export declare const SCHEMA_ALLOWLIST: readonly SchemaAllowlistEntry[]; /** * Check if a schema ID is in the allowlist * @param schemaId - The schema ID to check * @returns true if the schema ID is allowlisted, false otherwise */ export declare function isAllowlistedSchemaId(schemaId: unknown): schemaId is string; /** * Check if a schema ID + version combination is allowlisted * @param schemaId - The schema ID to check * @param version - The version to check * @returns true if the combination is allowlisted, false otherwise */ export declare function isAllowlistedSchemaVersion(schemaId: string, version: string): boolean; /** * Get the allowlist entry for a schema ID * @param schemaId - The schema ID to look up * @returns The allowlist entry or undefined if not found */ export declare function getSchemaAllowlistEntry(schemaId: string): SchemaAllowlistEntry | undefined; /** * Get all allowlisted schema IDs * @returns Array of all allowlisted schema IDs */ export declare function getAllowlistedSchemaIds(): string[]; /** * Validate schema ID and version against the allowlist * Returns detailed error information for fail-closed behavior */ export interface SchemaValidationResult { valid: boolean; schema_id?: string; version?: string; error_code?: 'UNKNOWN_SCHEMA_ID' | 'UNKNOWN_SCHEMA_VERSION' | 'DEPRECATED_SCHEMA'; error_message?: string; } /** * Validate a schema ID and version against the allowlist * @param schemaId - The schema ID to validate * @param version - The version to validate (optional, defaults to checking if ID exists) * @returns Validation result with error details if invalid */ export declare function validateSchemaAllowlist(schemaId: string, version?: string): SchemaValidationResult; /** * Check if an envelope version is allowlisted */ export declare function isAllowedVersion(version: unknown): version is EnvelopeVersion; /** * Check if an envelope type is allowlisted */ export declare function isAllowedType(type: unknown): type is EnvelopeType; /** * Check if a signature algorithm is allowlisted */ export declare function isAllowedAlgorithm(algorithm: unknown): algorithm is Algorithm; /** * Check if a hash algorithm is allowlisted */ export declare function isAllowedHashAlgorithm(hashAlgorithm: unknown): hashAlgorithm is HashAlgorithm; /** * Validate DID format (did:key:... or did:web:...) */ export declare function isValidDidFormat(did: unknown): did is string; /** * Validate ISO 8601 date format */ export declare function isValidIsoDate(date: unknown): date is string; /** * Validate base64url string format */ export declare function isValidBase64Url(str: unknown): str is string; //# sourceMappingURL=schema-registry.d.ts.map