Generate application keys too

pull/128/head
Chocobozzz 2017-11-17 09:12:03 +01:00
parent 47e0652b4a
commit 1b3989b096
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import { createLocalAccountWithoutKeys } from '../lib/user'
import { applicationExist, clientsExist, usersExist } from './checker'
import { CACHE, CONFIG, LAST_MIGRATION_VERSION, SERVER_ACCOUNT_NAME } from './constants'
import { database as db } from './database'
import { createPrivateAndPublicKeys } from '../helpers/peertube-crypto'
async function installApplication () {
try {
@ -136,5 +137,11 @@ async function createApplicationIfNotExist () {
logger.info('Creating application account.')
return createLocalAccountWithoutKeys(SERVER_ACCOUNT_NAME, null, applicationInstance.id, undefined)
const accountCreated = await createLocalAccountWithoutKeys(SERVER_ACCOUNT_NAME, null, applicationInstance.id, undefined)
const { publicKey, privateKey } = await createPrivateAndPublicKeys()
accountCreated.set('publicKey', publicKey)
accountCreated.set('privateKey', privateKey)
return accountCreated.save()
}