import { Effect } from "effect";
declare const BytesError_base: new = {}>(args: import("effect/Types").Equals extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
readonly _tag: "BytesError";
} & Readonly;
export declare class BytesError extends BytesError_base<{
message: string;
cause?: unknown;
}> {
}
/**
* Asserts that the input is a Uint8Array and, if a length constraint is provided, that its length matches.
* The length constraint can be:
* - a single number (exact length)
* - an array [min, max] (inclusive range)
* - an object { min?: number; max?: number }
* Throws an Error if the assertion fails.
*
* @example
* import { assert_bytes_unsafe } from "@lucid-evolution/experimental/Bytes";
* assert_bytes_unsafe(new Uint8Array([1,2,3]), 3); // passes
* assert_bytes_unsafe(new Uint8Array([1,2,3]), [2,4]); // passes
* assert_bytes_unsafe(new Uint8Array([1,2,3]), { min: 2, max: 3 }); // passes
* assert_bytes_unsafe(new Uint8Array([1,2,3]), { min: 4 }); // throws
*
* @since 1.0.0
* @category predicates
*/
export declare const assert_bytes_or_throw: (b: Uint8Array | undefined, length?: number | [number, number] | {
min?: number;
max?: number;
}) => void;
/**
* Asserts that the input is a Uint8Array and, if a length constraint is provided, that its length matches.
* The length constraint can be:
* - a single number (exact length)
* - an array [min, max] (inclusive range)
* - an object { min?: number; max?: number }
* Fails with BytesError if the assertion fails.
*
* @example
* import { assert_bytes } from "@lucid-evolution/experimental/Bytes";
* yield* assert_bytes(new Uint8Array([1,2,3]), 3); // passes
* yield* assert_bytes(new Uint8Array([1,2,3]), [2,4]); // passes
* yield* assert_bytes(new Uint8Array([1,2,3]), { min: 2, max: 3 }); // passes
* yield* assert_bytes(new Uint8Array([1,2,3]), { min: 4 }); // fails
*
* @since 1.0.0
* @category predicates
*/
export declare const assert_bytes: (b: Uint8Array | undefined, length?: number | [number, number] | {
min?: number;
max?: number;
} | undefined) => Effect.Effect;
export declare function isBytes(a: unknown): a is Uint8Array;
/**
* @example fromHex('cafe0123') -> Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
*/
export declare function fromHexOrThrow(hex: string): Uint8Array;
export declare const fromHex: (hex: string) => Effect.Effect, BytesError, never>;
/**
* @example toHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) -> 'cafe0123'
*/
export declare function toHexOrThrow(bytes: Uint8Array, ...length: number[]): string;
export declare const toHex: (bytes: Uint8Array, ...lengths: number[]) => Effect.Effect;
/** Convert a Hex encoded string to a Utf-8 encoded string.
* @example toText("6d79746f6b656e") -> 'mytoken'
*/
export declare function unsafeToText(hex: string): string;
/** Convert a Utf-8 encoded string to a Hex encoded string.
* @example fromText("mytoken") -> 6d79746f6b656e
*/
export declare function fromTextUnsafe(text: string): string;
/**
* Checks if a string is a valid hexadecimal string (lowercase, even length).
*
* @example
* import { isHex } from "@lucid-evolution/experimental/Bytes";
* isHex("deadbeef"); // true
* isHex("DEADBEEF"); // false
* isHex("abc"); // false
*
* @since 1.0.0
* @category predicates
*/
export declare const isHex: (input: string) => boolean;
export {};
//# sourceMappingURL=Bytes.d.ts.map