]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Generate application keys too
authorChocobozzz <florian.bigard@gmail.com>
Fri, 17 Nov 2017 08:12:03 +0000 (09:12 +0100)
committerChocobozzz <florian.bigard@gmail.com>
Mon, 27 Nov 2017 18:40:52 +0000 (19:40 +0100)
server/initializers/installer.ts

index 865495722feb71523380ac0ceab31ceb8708dde5..9545160571457f63decf73fb9d55ec3f316407f9 100644 (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()
 }