From 1b3989b0961d22a5a45ad16239e3c3f58f66180c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 17 Nov 2017 09:12:03 +0100 Subject: Generate application keys too --- server/initializers/installer.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'server/initializers') diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 865495722..954516057 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts @@ -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() } -- cgit v1.2.3