import { type Keyring } from './keyring.js';
/** Every value the kit writes starts with this; the rest is Adonis' own ciphertext. */
export declare const SEALED_PREFIX = "agora:v1:";
export interface SealOptions {
    /**
     * Context bound into the value with the lib's purpose (e.g. `auth_mfa.totp_secret:<account id>`):
     * not stored, and the same string must be passed to `open`, so a value can't move to another row.
     */
    aad?: string;
}
export type SealedValueErrorCode = 'format' | 'unreadable' | 'kms' | 'legacy';
/** A value that can't be opened. The message never contains the value or a key. */
export declare class SealedValueError extends Error {
    readonly code: SealedValueErrorCode;
    constructor(code: SealedValueErrorCode, message: string);
}
/**
 * - `active`: opens with the encrypting key (or, with an opaque `encryption`, opens at all).
 * - `retired`: opens only with an older key, or is not in the KMS envelope the keyring now uses.
 * - `legacy`: a lib's pre-kit format that one of its legacy readers opens.
 * - `unreadable`: nothing configured opens it (key gone, tampered, wrong aad).
 */
export type SealedStatus = 'active' | 'retired' | 'legacy' | 'unreadable';
/** Seals `value` with the keyring's encrypting key (or a fresh KMS-wrapped data key). */
export declare function seal(keyring: Keyring, value: string, options?: SealOptions): Promise<string>;
/** Opens a value from {@link seal} (or, through the keyring's legacy readers, an older format). */
export declare function open(keyring: Keyring, sealed: string, options?: SealOptions): Promise<string>;
/** Where a sealed value stands against the keyring (tries to open it; never returns the value). */
export declare function sealedStatus(keyring: Keyring, sealed: string, options?: SealOptions): Promise<SealedStatus>;
/** True when the value opens but not with the encrypting key (an older key, a legacy format). */
export declare function needsReseal(keyring: Keyring, sealed: string, options?: SealOptions): Promise<boolean>;
/**
 * Opens and seals again with the encrypting key. Returns `sealed` unchanged when nothing is to do,
 * unless `force` (rewrite anyway: rotating keys the kit can't tell apart, e.g. the app's own).
 */
export declare function reseal(keyring: Keyring, sealed: string, options?: SealOptions & {
    force?: boolean;
}): Promise<string>;
//# sourceMappingURL=seal.d.ts.map