1
0
Fork 0

Generate application keys too

This commit is contained in:
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

View file

@ -6,6 +6,7 @@ import { createLocalAccountWithoutKeys } from '../lib/user'
import { applicationExist, clientsExist, usersExist } from './checker' import { applicationExist, clientsExist, usersExist } from './checker'
import { CACHE, CONFIG, LAST_MIGRATION_VERSION, SERVER_ACCOUNT_NAME } from './constants' import { CACHE, CONFIG, LAST_MIGRATION_VERSION, SERVER_ACCOUNT_NAME } from './constants'
import { database as db } from './database' import { database as db } from './database'
import { createPrivateAndPublicKeys } from '../helpers/peertube-crypto'
async function installApplication () { async function installApplication () {
try { try {
@ -136,5 +137,11 @@ async function createApplicationIfNotExist () {
logger.info('Creating application account.') 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()
} }