import type { AssetsClient } from "../assets.js";
export interface UseAithosAssetState {
/** A `blob:` URL pointing at the decrypted plaintext. Use in
etc. */
readonly url: string | null;
/** Raw decrypted bytes. Use when you need the binary itself (e.g. PDF viewer). */
readonly bytes: Uint8Array | null;
/** IANA media type — useful for routing rendering. */
readonly mediaType: string | null;
/** Plaintext size in bytes. */
readonly sizeBytes: number | null;
/** True while the fetch+decrypt is in flight. */
readonly loading: boolean;
/** Non-null when the fetch/decrypt failed. */
readonly error: Error | null;
}
export interface UseAithosAssetOptions {
/** Override the client from context. Useful for tests. */
readonly client?: AssetsClient | null;
/**
* If `true`, the hook keeps the previous blob URL visible while a
* new URN is being fetched, instead of flashing `null`. Default
* `false` (more predictable, less visual stutter avoidance).
*/
readonly keepPreviousOnUrnChange?: boolean;
}
/**
* Fetch + decrypt an Aithos asset and return a stable `blob:` URL.
*
* Lifecycle:
* - On mount or when `urn` changes, runs `client.fetch(urn)`.
* - On success, creates an object URL from the plaintext bytes.
* - On unmount or before refetching, revokes the URL to free memory.
* - Cancels in-flight fetches if the URN changes mid-flight.
*
* Throws (via `error`) when no client is available — supply one via
* `` or the `client` option.
*/
export declare function useAithosAsset(urn: string | null | undefined, options?: UseAithosAssetOptions): UseAithosAssetState;
//# sourceMappingURL=use-aithos-asset.d.ts.map