fix: generated keys should be 64 chars not 58

This commit is contained in:
Alexis Tyler
2021-07-01 07:56:08 +09:30
parent a985b1b624
commit 492cc7755c
2 changed files with 2 additions and 6 deletions

View File

@@ -97,8 +97,8 @@ export class ApiManager extends EventEmitter {
this.replace('notifier', notifierApiKey, { userId: '-1' });
} else {
// Generate API keys
const UPCFinalKey = upcApiKey ?? `unupc_${crypto.randomBytes(58).toString('hex')}`.substring(0, 58);
const notifierFinalKey = notifierApiKey ?? `unnotify_${crypto.randomBytes(58).toString('hex')}`.substring(0, 58);
const UPCFinalKey = upcApiKey ?? `unupc_${crypto.randomBytes(58).toString('hex')}`.substring(0, 64);
const notifierFinalKey = notifierApiKey ?? `unnotify_${crypto.randomBytes(58).toString('hex')}`.substring(0, 64);
// Rebuild config file
const data = {

View File

@@ -80,10 +80,6 @@ const getAllowedOrigins = (): string[] => {
// Get local tld
const localTld = varState.data.localTld;
// Get dynamix config file
const filePath = paths.get('myservers-config')!;
const dynamix = loadState<{ remote: { wanport: number } }>(filePath);
// Get server's hostname
const serverName = varState.data.name;