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,
|
scope: request.scope,
|
||||||
updatedAt: now,
|
updatedAt: now,
|
||||||
};
|
};
|
||||||
// Remove legacy field
|
|
||||||
delete keys[idx].encrypted;
|
delete keys[idx].encrypted;
|
||||||
} else {
|
} else {
|
||||||
keys.push({
|
keys.push({
|
||||||
|
|
@ -232,7 +231,6 @@ export class ApiKeyService {
|
||||||
/** Resolve encryption method, handling legacy entries without encryptionMethod field */
|
/** Resolve encryption method, handling legacy entries without encryptionMethod field */
|
||||||
private resolveMethod(stored: StoredApiKey): EncryptionMethod {
|
private resolveMethod(stored: StoredApiKey): EncryptionMethod {
|
||||||
if (stored.encryptionMethod) return stored.encryptionMethod;
|
if (stored.encryptionMethod) return stored.encryptionMethod;
|
||||||
// Legacy migration: encrypted boolean → method
|
|
||||||
return stored.encrypted ? 'safeStorage' : 'base64';
|
return stored.encrypted ? 'safeStorage' : 'base64';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -266,7 +264,6 @@ export class ApiKeyService {
|
||||||
const candidates = ['/etc/machine-id', '/var/lib/dbus/machine-id'];
|
const candidates = ['/etc/machine-id', '/var/lib/dbus/machine-id'];
|
||||||
for (const p of candidates) {
|
for (const p of candidates) {
|
||||||
try {
|
try {
|
||||||
// Synchronous read is OK — called once, result cached in aesKey
|
|
||||||
const { readFileSync } = require('node:fs') as typeof import('node:fs');
|
const { readFileSync } = require('node:fs') as typeof import('node:fs');
|
||||||
const id = readFileSync(p, 'utf-8').trim();
|
const id = readFileSync(p, 'utf-8').trim();
|
||||||
if (id) return id;
|
if (id) return id;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import { getCachedShellEnv } from '@main/utils/shellEnv';
|
||||||
import { getErrorMessage } from '@shared/utils/errorHandling';
|
import { getErrorMessage } from '@shared/utils/errorHandling';
|
||||||
import { createLogger } from '@shared/utils/logger';
|
import { createLogger } from '@shared/utils/logger';
|
||||||
import { createHash } from 'crypto';
|
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 http from 'http';
|
||||||
import https from 'https';
|
import https from 'https';
|
||||||
import { tmpdir } from 'os';
|
import { tmpdir } from 'os';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue