feat: initial prototype

This commit is contained in:
2026-02-13 15:52:13 +07:00
parent 134351b326
commit e8dbefde43
140 changed files with 12388 additions and 1367 deletions
@@ -0,0 +1,26 @@
export interface ApiKeyGenerator {
generateServerApiKey(): string;
generateReverseProxyApiKey(): string;
}
export class ApiKeyGeneratorImpl implements ApiKeyGenerator {
private readonly SERVER_PREFIX = "minikura_srv_";
private readonly REVERSE_PROXY_PREFIX = "minikura_proxy_";
private readonly TOKEN_LENGTH = 32;
generateServerApiKey(): string {
const token = Buffer.from(crypto.randomUUID())
.toString("base64")
.replace(/[^a-zA-Z0-9]/g, "")
.substring(0, this.TOKEN_LENGTH);
return `${this.SERVER_PREFIX}${token}`;
}
generateReverseProxyApiKey(): string {
const token = Buffer.from(crypto.randomUUID())
.toString("base64")
.replace(/[^a-zA-Z0-9]/g, "")
.substring(0, this.TOKEN_LENGTH);
return `${this.REVERSE_PROXY_PREFIX}${token}`;
}
}