@provablehq/sdk
Version:
A Software Development Kit (SDK) for Zero-Knowledge Transactions
25 lines (24 loc) • 1.16 kB
TypeScript
/**
* Reason code for invalid locator validation failures.
* - `"reserved_name"`: A locator component is empty or `"."`.
* - `"path_traversal"`: A locator component contains `..`.
* - `"path_separator"`: A locator component contains a path separator (`/`, `\`) or null byte.
* - `"negative_value"`: A numeric locator field (edition, amendment, recordInputPosition) is not a non-negative integer.
*/
export type InvalidLocatorReason = "reserved_name" | "path_traversal" | "path_separator" | "negative_value";
/**
* Error thrown when a key locator is invalid for filesystem use.
* Used to prevent path traversal and other filesystem injection when deriving paths from locators.
*
* @extends Error
*/
export declare class InvalidLocatorError extends Error {
readonly locator: string;
readonly reason: InvalidLocatorReason;
/**
* @param message - Human-readable description of the validation failure.
* @param locator - The invalid locator string that failed validation.
* @param reason - Machine-readable reason code for the failure.
*/
constructor(message: string, locator: string, reason: InvalidLocatorReason);
}