import { KeyId } from "./KeyId.js";
import { Passphrase, PassphraseEntry } from "./PassphraseEntry.js";
import { Address, ExportableAccount, PublicKey, RawPrivateKey, Signature } from "@planetarium/account";
export type Web3KeyObjectKdf = {
    kdf: "pbkdf2";
    kdfparams: {
        c: number;
        dklen: number;
        prf: "hmac-sha256";
        salt: string;
    };
} | {
    kdf: "scrypt";
    kdfparams: {
        dklen: number;
        n: number;
        p: number;
        r: number;
        salt: string;
    };
};
export type Web3KeyObjectCipher = {
    cipher: "aes-128-ctr";
    cipherparams: {
        iv: string;
    };
    ciphertext: string;
    mac: string;
};
export interface Web3KeyObject {
    version: 3;
    id: KeyId;
    address: string;
    crypto: Web3KeyObjectCipher & Web3KeyObjectKdf;
}
export declare class Web3Account implements ExportableAccount {
    #private;
    constructor(keyObject: Web3KeyObject, passphraseEntry: PassphraseEntry, options?: Partial<Web3AccountOptions>);
    exportPrivateKey(): Promise<RawPrivateKey>;
    getAddress(): Promise<Address>;
    getPublicKey(): Promise<PublicKey>;
    sign(message: Uint8Array): Promise<Signature>;
}
export declare function encryptKeyObject(keyId: KeyId, privateKey: RawPrivateKey, passphrase: Passphrase): Promise<Web3KeyObject>;
export declare function isKeyObject(json: unknown): json is Web3KeyObject;
export interface Web3AccountOptions {
    /**
     * Whether to allow weak private keys (i.e. private keys with leading zeros).
     */
    readonly allowWeakPrivateKey: boolean;
}
export declare class WeakPrivateKeyError extends Error {
    readonly name = "WeakPrivateKeyError";
}
export declare function decryptKeyObject(keyObject: Web3KeyObject, passphrase: Passphrase, options?: Partial<Web3AccountOptions>): Promise<{
    keyId: KeyId;
    privateKey: RawPrivateKey;
}>;
export declare class IncorrectPassphraseError extends Error {
    readonly expectedMac: Uint8Array;
    readonly actualMac: Uint8Array;
    readonly name = "IncorrectPassphraseError";
    constructor(expectedMac: Uint8Array, actualMac: Uint8Array);
}
