mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-08 22:48:14 -05:00
* 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
23 lines
885 B
TypeScript
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)
|
|
}
|