This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TELEGRAM_BOT_TOKEN = '110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw'; // https://core.telegram.org/bots#creating-a-new-bot | |
export const verifyTelegramWebAppData = async (telegramInitData: string): boolean => { | |
// The data is a query string, which is composed of a series of field-value pairs. | |
const encoded = decodeURIComponent(telegramInitData); | |
// HMAC-SHA-256 signature of the bot's token with the constant string WebAppData used as a key. | |
const secret = crypto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PcmToWavUtil { | |
/** | |
* @param pcmData pcm原始数据 | |
* @param numChannels 声道设置, mono = 1, stereo = 2 | |
* @param sampleRate 采样频率 | |
* @param bitPerSample 单次数据长度, 例如8bits | |
* @return wav数据 | |
*/ | |
public static byte[] pcmToWav(byte[] pcmData, int numChannels, int sampleRate, int bitPerSample) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PcmToWavUtil { | |
/** | |
* @param pcmData pcm原始数据 | |
* @param numChannels 声道设置, mono = 1, stereo = 2 | |
* @param sampleRate 采样频率 | |
* @param bitPerSample 单次数据长度, 例如8bits | |
* @return wav数据 | |
*/ | |
public static byte[] pcmToWav(byte[] pcmData, int numChannels, int sampleRate, int bitPerSample) { |