Files
sim/apps/sim/test-self-hosting.ts
Waleed 065fc5b87b feat(api-keys): add workspace level api keys to share with other workspace members, add encryption for api keys (#1323)
* update infra and remove railway

* feat(api-keys): add workspace-level api keys

* encrypt api keys

* Revert "update infra and remove railway"

This reverts commit b23258a5a1.

* reran migrations

* tested workspace keys

* consolidated code

* more consolidation

* cleanup

* consolidate, remove unused code

* add dummy key for ci

* continue with regular path for self-hosted folks that don't have key set

* fix tests

* fix test

* remove tests

* removed ci additions
2025-09-12 11:46:47 -07:00

23 lines
885 B
TypeScript

import { createApiKey } from './lib/api-key/auth'
console.log('=== Testing self-hosting scenario (no API_ENCRYPTION_KEY) ===')
// Check environment
console.log('ENCRYPTION_KEY:', `${process.env.ENCRYPTION_KEY?.slice(0, 10)}...`)
console.log('API_ENCRYPTION_KEY:', process.env.API_ENCRYPTION_KEY)
// Ensure API_ENCRYPTION_KEY is not set
process.env.API_ENCRYPTION_KEY = undefined
console.log('API_ENCRYPTION_KEY after delete:', process.env.API_ENCRYPTION_KEY)
try {
const result = await createApiKey(true)
console.log('Key generated:', !!result.key)
console.log('Encrypted key generated:', !!result.encryptedKey)
console.log('Encrypted key value:', result.encryptedKey)
console.log('Are they the same?', result.key === result.encryptedKey)
console.log('Would validation pass?', !!result.encryptedKey)
} catch (error) {
console.error('Error in createApiKey:', error)
}