import { bytesToBase64UrlSafe, bytesToHex } from '../../util/bytes';
/** Byte/string union used by the material JSON, which stores base64. */
export type BytesLike = Uint8Array | string;
/**
 * The three pieces of APK material the Android registration token is signed
 * with. They cannot be derived — they have to be read out of a WhatsApp APK.
 */
export interface AndroidApkMaterial {
    /** `com.whatsapp` (consumer) or `com.whatsapp.w4b` (business). */
    readonly packageName?: string;
    /** 64-byte PBKDF2 output. base64 when it comes from JSON. */
    readonly secretKey: BytesLike;
    /** Raw 16-byte MD5 of `classes.dex`. base64 when it comes from JSON. */
    readonly classesDexMd5: BytesLike;
    /** DER bytes of every v1 signing certificate, in APK order. base64 in JSON. */
    readonly certificates: readonly BytesLike[];
    /**
     * Version of the APK the material came from. It must be the version sent in
     * the User-Agent, otherwise the server answers `old_version`.
     */
    readonly apkVersion?: string;
}
export interface RegistrationTokenOptions {
    /** Platform that will be announced in the User-Agent. */
    readonly os?: 'android' | 'ios' | string;
    /** Business builds use a different iOS static token and their own APK. */
    readonly business?: boolean;
    /** Override the static iOS token (newer build than this library knows). */
    readonly staticToken?: string;
    /** Required when `os === 'android'`. */
    readonly androidMaterial?: AndroidApkMaterial;
}
/**
 * Generate a request token (UUID-like string)
 */
export declare function generateRequestToken(): Promise<string>;
/**
 * Java's phone number handling: digits only, leading zeros dropped (the native
 * client converts the national number to a `long`). The token is computed over
 * this value, WITHOUT the country code.
 */
export declare function normalizeNationalNumber(phone: string): string;
/**
 * Calculate the registration token for the platform that will be announced.
 *
 * - iOS: `md5_hex(staticToken + md5_hex(appVersion) + nationalNumber)`.
 * - Android: HMAC-SHA1 over the APK signing certificates + `md5(classes.dex)` +
 *   the national number, URL-encoded base64.
 *
 * `phone` must be the national number (no country code). Passing `cc + in`
 * produces a well-formed token the server rejects with `bad_token`.
 */
export declare function calculateRegistrationToken(version: string, phone: string, options?: RegistrationTokenOptions): string;
/**
 * Android token, exactly as the native client signs it:
 *
 *   key   = PBKDF2-HMAC-SHA1(packageName || about_logo.png, ANDROID_SALT, 128, 64)
 *   mac   = HMAC-SHA1(key) over certificates..., MD5(classes.dex), national
 *   token = urlencode(base64(mac))
 */
export declare function calculateAndroidRegistrationToken(phone: string, options: Pick<RegistrationTokenOptions, 'androidMaterial'>): string;
/**
 * Derive the PBKDF2 key from the package name and `about_logo.png`.
 * Exposed for tooling that extracts the material from an APK.
 */
export declare function deriveAndroidSecretKey(packageName: string, aboutLogoPng: Uint8Array): Uint8Array;
/**
 * Parse the JSON produced by the APK material extractor (base64 fields).
 * Pure — read the file yourself and pass the parsed object.
 */
export declare function parseAndroidApkMaterial(json: unknown): AndroidApkMaterial;
/**
 * Legacy helper kept for API compatibility. New code should use
 * {@link calculateRegistrationToken}; iOS wants hex, Android wants the
 * URL-encoded base64 returned above.
 */
export declare function calculateRegistrationTokenBase64(version: string, phone: string): string;
export { bytesToHex, bytesToBase64UrlSafe };
/**
 * requestToken() - supports both old and attempted modern variants
 */
export declare function requestToken(): Promise<string>;
export declare function requestTokenLegacy(): Promise<string>;
export declare function requestTokenModern(): Promise<string>;
