Phase 1: Add ESLint/Prettier config + baseline auto-fixes
This commit is contained in:
@@ -40,10 +40,10 @@ class AuthManager {
|
||||
{
|
||||
...payload,
|
||||
iat: Math.floor(Date.now() / 1000),
|
||||
scope: payload.scope || ['read', 'write']
|
||||
scope: payload.scope || ['read', 'write'],
|
||||
},
|
||||
JWT_SECRET,
|
||||
{ expiresIn }
|
||||
{ expiresIn },
|
||||
);
|
||||
|
||||
// SECURITY: Log event only, never log the actual token
|
||||
@@ -67,7 +67,7 @@ class AuthManager {
|
||||
userId: decoded.sub,
|
||||
scope: decoded.scope || [],
|
||||
iat: decoded.iat,
|
||||
exp: decoded.exp
|
||||
exp: decoded.exp,
|
||||
};
|
||||
} catch (error) {
|
||||
if (error.name === 'TokenExpiredError') {
|
||||
@@ -111,7 +111,7 @@ class AuthManager {
|
||||
name,
|
||||
scopes,
|
||||
createdAt: new Date().toISOString(),
|
||||
lastUsed: null
|
||||
lastUsed: null,
|
||||
};
|
||||
|
||||
const metadataKey = `${API_KEY_METADATA_NAMESPACE}.${keyId}`;
|
||||
@@ -128,7 +128,7 @@ class AuthManager {
|
||||
id: keyId,
|
||||
name,
|
||||
scopes,
|
||||
createdAt: metadata.createdAt
|
||||
createdAt: metadata.createdAt,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('[AuthManager] API key generation failed:', error.message);
|
||||
@@ -179,7 +179,7 @@ class AuthManager {
|
||||
|
||||
// Update last used timestamp (non-blocking)
|
||||
this.updateLastUsed(keyId, metadata).catch(err =>
|
||||
console.error(`[AuthManager] Failed to update lastUsed for ${keyId}:`, err.message)
|
||||
console.error(`[AuthManager] Failed to update lastUsed for ${keyId}:`, err.message),
|
||||
);
|
||||
|
||||
console.log(`[AuthManager] API key verified: ${metadata.name} (${keyId})`);
|
||||
@@ -187,7 +187,7 @@ class AuthManager {
|
||||
return {
|
||||
keyId,
|
||||
scopes: metadata.scopes || [],
|
||||
name: metadata.name
|
||||
name: metadata.name,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('[AuthManager] API key verification failed:', error.message);
|
||||
@@ -282,7 +282,7 @@ class AuthManager {
|
||||
try {
|
||||
const updatedMetadata = {
|
||||
...metadata,
|
||||
lastUsed: new Date().toISOString()
|
||||
lastUsed: new Date().toISOString(),
|
||||
};
|
||||
|
||||
const metadataKey = `${API_KEY_METADATA_NAMESPACE}.${keyId}`;
|
||||
|
||||
Reference in New Issue
Block a user