refactor: clean up legacy code and improve import statements in ApiKeyService and CliInstallerService
- Removed legacy comments and fields in ApiKeyService to streamline code. - Updated import statements in CliInstallerService for better organization.
This commit is contained in:
parent
eb49fe7b61
commit
927c8b5c30
2 changed files with 1 additions and 4 deletions
|
|
@ -100,7 +100,6 @@ export class ApiKeyService {
|
|||
scope: request.scope,
|
||||
updatedAt: now,
|
||||
};
|
||||
// Remove legacy field
|
||||
delete keys[idx].encrypted;
|
||||
} else {
|
||||
keys.push({
|
||||
|
|
@ -232,7 +231,6 @@ export class ApiKeyService {
|
|||
/** Resolve encryption method, handling legacy entries without encryptionMethod field */
|
||||
private resolveMethod(stored: StoredApiKey): EncryptionMethod {
|
||||
if (stored.encryptionMethod) return stored.encryptionMethod;
|
||||
// Legacy migration: encrypted boolean → method
|
||||
return stored.encrypted ? 'safeStorage' : 'base64';
|
||||
}
|
||||
|
||||
|
|
@ -266,7 +264,6 @@ export class ApiKeyService {
|
|||
const candidates = ['/etc/machine-id', '/var/lib/dbus/machine-id'];
|
||||
for (const p of candidates) {
|
||||
try {
|
||||
// Synchronous read is OK — called once, result cached in aesKey
|
||||
const { readFileSync } = require('node:fs') as typeof import('node:fs');
|
||||
const id = readFileSync(p, 'utf-8').trim();
|
||||
if (id) return id;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import { getCachedShellEnv } from '@main/utils/shellEnv';
|
|||
import { getErrorMessage } from '@shared/utils/errorHandling';
|
||||
import { createLogger } from '@shared/utils/logger';
|
||||
import { createHash } from 'crypto';
|
||||
import { createWriteStream, existsSync, realpathSync, promises as fsp } from 'fs';
|
||||
import { createWriteStream, existsSync, promises as fsp, realpathSync } from 'fs';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
import { tmpdir } from 'os';
|
||||
|
|
|
|||
Loading…
Reference in a new issue