import * as Hex from "./Hex.js"; import { Effect } from "effect"; declare const CBORError_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: "CBORError"; } & Readonly; /** * Error type for CBOR-related operations * * @since 2.0.0 * @category errors */ export declare class CBORError extends CBORError_base<{ message: string; cause?: unknown; }> { } export type CBORHex = Hex.HexString & T; /** * Encodes a value to CBOR bytes * * @example * import { encodeCBORBytes } from "@lucid-evolution/experimental/CBOR"; * import { Either } from "effect"; * * const value = { hello: "world" }; * const result = encodeCBORBytes(value); * if (Either.isRight(result)) { * console.log("Encoded to CBOR bytes successfully"); * } * * @since 2.0.0 * @category encoding/decoding */ export declare const encodeAsBytes: (value: unknown) => Effect.Effect, CBORError, never>; export declare const encodeAsBytesOrThrow: (value: unknown) => Uint8Array; /** * Encodes a value to CBOR hex string * * @example * import { encodeCBOR } from "@lucid-evolution/experimental/CBOR"; * import { Either } from "effect"; * * const value = { hello: "world" }; * const result = encodeCBOR(value); * if (Either.isRight(result)) { * console.log("Encoded to CBOR hex successfully"); * } * * @since 2.0.0 * @category encoding/decoding */ export declare const encodeAsCBORHex: (value: Hex.HexString) => Effect.Effect, CBORError, never>; /** * Encodes a value to CBOR hex string, throws on error * * @example * import { encodeCBOROrThrow } from "@lucid-evolution/experimental/CBOR"; * * const value = { hello: "world" }; * const cborHex = encodeCBOROrThrow(value); * * @since 2.0.0 * @category encoding/decoding */ export declare const encodeAsCBORHexOrThrow: (value: Hex.HexString) => string & import("effect/Brand").Brand<"HexString">; /** * Decodes CBOR bytes to a value * * @example * import { decode } from "@lucid-evolution/experimental/CBOR"; * import { Either } from "effect"; * * const buffer = new Uint8Array([...]); * const result = decode(buffer); * if (Either.isRight(result)) { * console.log("Decoded value:", result.right); * } * * @since 2.0.0 * @category encoding/decoding */ export declare const decodeBytes: (bytes: Uint8Array) => Effect.Effect; /** * Decodes CBOR bytes to a value, throws on error * * @example * import { decodeOrThrow } from "@lucid-evolution/experimental/CBOR"; * * const buffer = new Uint8Array([...]); * const value = decodeOrThrow(buffer); * * @since 2.0.0 * @category encoding/decoding */ export declare const decodeBytesOrThrow: (bytes: Uint8Array) => any; /** * Decodes a CBOR hex string to a value * * @since 2.0.0 * @category encoding/decoding */ export declare const decodeHex: (hex: CBORHex) => Effect.Effect; /** * Decodes a CBOR hex string to a value, throws on error * * @example * import { decodeHexOrThrow } from "@lucid-evolution/experimental/CBOR"; * import { makeOrThrow } from "@lucid-evolution/experimental/Hex"; * * const hex = makeOrThrow("a1656865656c6c6f65776f726c64"); * const value = decodeHexOrThrow(hex); * * @since 2.0.0 * @category encoding/decoding */ export declare const decodeHexOrThrow: (hex: CBORHex) => any; export {}; //# sourceMappingURL=CBOR.d.ts.map