vibesweep
Version:
Detects and removes AI-generated code waste, dead code, and duplications
58 lines (51 loc) • 1.28 kB
text/typescript
// Special authentication for founder API key
// This gives unlimited access without billing
const FOUNDER_KEY_PREFIX = 'vsk_founder_';
export interface FounderAuth {
isFounder: boolean;
email?: string;
limits: {
requests: number | 'unlimited';
projects: number | 'unlimited';
teamMembers: number | 'unlimited';
};
}
export function checkFounderAuth(apiKey: string): FounderAuth {
if (!apiKey || !apiKey.startsWith(FOUNDER_KEY_PREFIX)) {
return {
isFounder: false,
limits: {
requests: 1000, // Default limits
projects: 3,
teamMembers: 1
}
};
}
// Founder key detected
return {
isFounder: true,
email: 'founder@vibesweep.com',
limits: {
requests: 'unlimited',
projects: 'unlimited',
teamMembers: 'unlimited'
}
};
}
// Use this in your API middleware
export function validateApiKey(apiKey: string): { valid: boolean; tier: string } {
// Check if it's a founder key first
const founderAuth = checkFounderAuth(apiKey);
if (founderAuth.isFounder) {
return {
valid: true,
tier: 'founder'
};
}
// Otherwise, check normal API keys
// ... your existing API key validation logic
return {
valid: false,
tier: 'free'
};
}