encrypted logs, more customization for admins.
This commit is contained in:
@@ -208,6 +208,10 @@ type SaveSecrets = {
|
||||
privateKey?: string;
|
||||
publicKey?: string;
|
||||
};
|
||||
clientLogs?: {
|
||||
privateKey?: string;
|
||||
publicKey?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type BuildSigningSecrets = {
|
||||
@@ -215,6 +219,11 @@ export type BuildSigningSecrets = {
|
||||
publicKey: string;
|
||||
};
|
||||
|
||||
export type ClientLogSecrets = {
|
||||
privateKey: string;
|
||||
publicKey: string;
|
||||
};
|
||||
|
||||
function generateRandomSecret(length = 48): string {
|
||||
const chars =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";
|
||||
@@ -1025,6 +1034,26 @@ export function setBuildSigningSecrets(secrets: BuildSigningSecrets): void {
|
||||
persistSaveSecrets(savePath, saved);
|
||||
}
|
||||
|
||||
export function getClientLogSecrets(): ClientLogSecrets | null {
|
||||
const dataDir = ensureDataDir();
|
||||
const savePath = resolve(dataDir, "save.json");
|
||||
const saved = loadSaveSecrets(savePath);
|
||||
const priv = saved.clientLogs?.privateKey;
|
||||
const pub = saved.clientLogs?.publicKey;
|
||||
if (typeof priv === "string" && priv && typeof pub === "string" && pub) {
|
||||
return { privateKey: priv, publicKey: pub };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function setClientLogSecrets(secrets: ClientLogSecrets): void {
|
||||
const dataDir = ensureDataDir();
|
||||
const savePath = resolve(dataDir, "save.json");
|
||||
const saved = loadSaveSecrets(savePath);
|
||||
saved.clientLogs = { privateKey: secrets.privateKey, publicKey: secrets.publicKey };
|
||||
persistSaveSecrets(savePath, saved);
|
||||
}
|
||||
|
||||
export function getBuildBanlist(): string[] {
|
||||
return getConfig().buildSigning.banlist;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user