/** * MTKruto - Cross-runtime JavaScript library for building Telegram clients * Copyright (C) 2023-2026 Roj * * This file is part of MTKruto. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ export type ByteOrder = "little" | "big"; export declare function modExp(a: bigint, b: bigint, n: bigint): bigint; export declare function mod(n: bigint, m: bigint): bigint; export declare function mod(n: number, m: number): number; /** Additional parameters for {@link intFromBytes}. */ export interface IntFromBytesParams { /** The byte order of the representation. Defaults to `little`. */ byteOrder?: ByteOrder; /** Whether the integer is a signed one. Defaults to `true`. */ isSigned?: boolean; } /** * Creates an integer from its byte representation. * * @param bytes The byte representation of the integer. * @param params Additional parameters. */ export declare function intFromBytes(bytes: Uint8Array, { byteOrder, isSigned }?: IntFromBytesParams): bigint; /** * Generates a random integer of an arbitrary size. * * @param isSigned Whether to allow signed integers. Defaults to `true`. */ export declare function getRandomInt(byteLength: number, isSigned?: boolean): bigint; /** * Generates a random ID. Useful when interacting with the Telegram API. * * @param isNumber Whether the ID should be of the type number instead of a bigint. */ export declare function getRandomId(isNumber: true): number; export declare function getRandomId(): bigint; export declare function gcd(a: bigint, b: bigint): bigint; /** Additional parameters for {@link intToBuffer}. */ export interface BufferFromBigintParams { /** The byte order to use for the representation. Defaults to `little`. */ byteOrder?: ByteOrder; /** Whether the integer is a signed one. Defaults to `true`. */ isSigned?: boolean; /** The path to the integer in the TL schema. Unspecified by default. */ path?: string[]; } /** * Converts an integer to its byte representation. * * @param int The integer to convert. * @param byteCount The expected size of the integer in bytes. * @param params Additional parameters. */ export declare function intToBytes(int: bigint | number, byteCount: number, { byteOrder, isSigned, path, }?: BufferFromBigintParams): Uint8Array; //# sourceMappingURL=0_int.d.ts.map