mirror of
https://github.com/foxhui/WebAI2API.git
synced 2026-06-16 21:03:59 +08:00
feat: 初步支持 Gemini Business 并重构和整理
This commit is contained in:
+4
-17
@@ -1,18 +1,5 @@
|
||||
import crypto from 'crypto';
|
||||
import { generateApiKey } from './security/apiKey.js';
|
||||
|
||||
/**
|
||||
* 生成随机 API Key
|
||||
* 格式: sk- + 32位十六进制字符串
|
||||
*/
|
||||
function generateApiKey() {
|
||||
const buffer = crypto.randomBytes(16);
|
||||
const hex = buffer.toString('hex');
|
||||
return `sk-${hex}`;
|
||||
}
|
||||
|
||||
const key = generateApiKey();
|
||||
console.log('\n=== API Key 生成器 ===');
|
||||
console.log('您的新 API Key 是:');
|
||||
console.log('\x1b[32m%s\x1b[0m', key); // 绿色高亮
|
||||
console.log('\n请将其复制到 config.yaml 的 server.auth 字段中。');
|
||||
console.log('======================\n');
|
||||
console.log('>>> [GenAPIKey] 生成新的 API Key:');
|
||||
console.log(generateApiKey());
|
||||
console.log('\n>>> 请将此 Key 复制到 config.yaml 文件的 server.auth 字段中。');
|
||||
|
||||
Reference in New Issue
Block a user