Add projects

This commit is contained in:
Alois 2026-08-24 00:10:41 +02:00
commit 8b607dd700
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24
1802 changed files with 503346 additions and 2 deletions

View file

@ -0,0 +1,17 @@
import { describe, expect, test } from 'vitest';
import { generateSecureApiKey } from '../src/utils/apiKey';
describe('API key generation', () => {
test('generates a 51-character key with the expected prefix and charset', () => {
const apiKey = generateSecureApiKey();
expect(apiKey).toHaveLength(51);
expect(apiKey).toMatch(/^sk-[A-Za-z0-9]{48}$/);
});
test('generates distinct keys', () => {
const apiKeys = Array.from({ length: 100 }, () => generateSecureApiKey());
expect(new Set(apiKeys).size).toBe(apiKeys.length);
});
});