import { MessageHash, type EcdsaPublicKey } from '#internal/web';
import { type KeyShareBackupInfo, type ThresholdSignatureScheme, type WaasWalletProperties } from '@dynamic-labs-wallet/core';
import type { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
import type { ClientKeyShare } from './mpc/types.js';
export declare const isBrowser: () => boolean;
/**
 * Helper function to extract pubkey from potentially nested structure
 * Handles cases where pubkey is stored as {pubkey: {0: 33, 1: 209, ...}} in localStorage
 */
export declare const extractPubkey: (pubkey: any) => Uint8Array | EcdsaPublicKey;
export declare const getClientKeyShareExportFileName: ({ thresholdSignatureScheme, accountAddress, isGoogleDrive, }: {
    thresholdSignatureScheme: ThresholdSignatureScheme;
    accountAddress: string;
    isGoogleDrive?: boolean;
}) => string;
export declare const getClientKeyShareBackupInfo: (params?: {
    walletProperties: WaasWalletProperties;
}) => KeyShareBackupInfo;
/**
 * Helper function to merge keyshares and remove duplicates based on pubkey and secretShare
 * @param existingKeyShares - Array of existing keyshares
 * @param newKeyShares - Array of new keyshares to merge
 * @returns Array of merged unique keyshares
 */
export declare const mergeUniqueKeyShares: (existingKeyShares: ClientKeyShare[], newKeyShares: ClientKeyShare[]) => ClientKeyShare[];
export declare const timeoutPromise: ({ timeInMs, activity }: {
    timeInMs: number;
    activity?: string;
}) => Promise<unknown>;
interface RetryConfig {
    maxAttempts?: number;
    retryInterval?: number;
    operationName?: string;
    logContext?: Record<string, unknown>;
}
/**
 * Generic helper function to retry a promise-based operations
 *
 * @param operation - The async operation to retry
 * @param config - Configuration options for retry behavior
 * @returns Promise with the operation result
 * @throws Last error encountered after all retries are exhausted
 */
export declare function retryPromise<T>(operation: () => Promise<T>, { maxAttempts, retryInterval, operationName, logContext }?: RetryConfig): Promise<T>;
export declare const formatEvmMessage: (message: string | Uint8Array) => MessageHash;
export declare const isHexString: (str: string) => boolean;
export declare const formatMessage: (chainName: string, message: string | Uint8Array) => string | Uint8Array | MessageHash;
export declare const getGoogleOAuthAccountId: (verifiedCredentials: JwtVerifiedCredential[]) => string | undefined;
export declare const createBackupData: ({ encryptedKeyShares, accountAddress, thresholdSignatureScheme, hasPassword, }: {
    encryptedKeyShares: string[];
    accountAddress: string;
    thresholdSignatureScheme: ThresholdSignatureScheme;
    hasPassword?: boolean;
}) => {
    keyShares: string[];
    metadata: {
        createdAt: string;
        accountAddress: string;
        thresholdSignatureScheme: ThresholdSignatureScheme;
        hasPassword: boolean;
        encryption: import("@dynamic-labs-wallet/core").EncryptionMetadata;
        encryptionVersion: import("./backup/encryption/constants.js").EncryptionVersion;
        shareCount: number;
    };
};
export declare const downloadStringAsFile: ({ filename, content, mimeType, }: {
    filename: string;
    content: string;
    mimeType?: string;
}) => void;
/**
 * Checks if a wallet has cached encrypted shares in storage.
 */
export declare const hasEncryptedSharesCached: ({ accountAddress, backupInfo, storage, }: {
    accountAddress: string;
    backupInfo?: KeyShareBackupInfo;
    storage: {
        getItem: (key: string) => Promise<string | null> | string | null;
    };
}) => Promise<boolean>;
/**
 * Checks if an error is a public key mismatch error that can be recovered
 * by re-fetching the client key share from backup.
 *
 * This error occurs when the local client key share doesn't match the server's
 * expected public key, typically due to stale or corrupted local storage.
 */
export declare const isPublicKeyMismatchError: (error: unknown) => boolean;
export {};
//# sourceMappingURL=utils.d.ts.map