From: Chocobozzz Date: Fri, 17 Nov 2017 08:12:03 +0000 (+0100) Subject: Generate application keys too X-Git-Tag: v0.0.1-alpha~206 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=1b3989b0961d22a5a45ad16239e3c3f58f66180c;p=github%2FChocobozzz%2FPeerTube.git Generate application keys too --- 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() }