初次提交

This commit is contained in:
foxhui
2025-11-23 22:43:43 +08:00
Unverified
commit da94db9181
10 changed files with 2873 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import crypto from 'crypto';
/**
* 生成随机 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');