Monorepo for Wisp.place. A static site hosting service built on top of the AT Protocol.
at main 1.4 kB view raw
1// Quick script to create admin user with randomly generated password 2import { adminAuth } from './src/lib/admin-auth' 3import { randomBytes } from 'crypto' 4 5// Generate a secure random password 6function generatePassword(length: number = 20): string { 7 const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*' 8 const bytes = randomBytes(length) 9 let password = '' 10 for (let i = 0; i < length; i++) { 11 password += chars[bytes[i] % chars.length] 12 } 13 return password 14} 15 16const username = 'admin' 17const password = generatePassword(20) 18 19await adminAuth.init() 20await adminAuth.createAdmin(username, password) 21 22console.log('\n╔════════════════════════════════════════════════════════════════╗') 23console.log('║ ADMIN USER CREATED SUCCESSFULLY ║') 24console.log('╚════════════════════════════════════════════════════════════════╝\n') 25console.log(`Username: ${username}`) 26console.log(`Password: ${password}`) 27console.log('\n⚠️ IMPORTANT: Save this password securely!') 28console.log('This password will not be shown again.\n') 29console.log('Change it with: bun run change-admin-password.ts admin NEW_PASSWORD\n') 30 31process.exit(0)