aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0605-actor-missing-keys.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-12 10:54:21 +0200
committerChocobozzz <me@florianbigard.com>2022-07-12 12:08:12 +0200
commit5d7cb63ede7c4bba93954c0586f589ad9748d5ea (patch)
tree12856de40417d16ebe86c16a9febe7cc9f36091b /server/initializers/migrations/0605-actor-missing-keys.ts
parent0667dbaf268e05b5c9d22f662532e86a1233741c (diff)
downloadPeerTube-5d7cb63ede7c4bba93954c0586f589ad9748d5ea.tar.gz
PeerTube-5d7cb63ede7c4bba93954c0586f589ad9748d5ea.tar.zst
PeerTube-5d7cb63ede7c4bba93954c0586f589ad9748d5ea.zip
Add compat with openssl 3
Diffstat (limited to 'server/initializers/migrations/0605-actor-missing-keys.ts')
-rw-r--r--server/initializers/migrations/0605-actor-missing-keys.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/server/initializers/migrations/0605-actor-missing-keys.ts b/server/initializers/migrations/0605-actor-missing-keys.ts
index 72d9b359d..aa89a500c 100644
--- a/server/initializers/migrations/0605-actor-missing-keys.ts
+++ b/server/initializers/migrations/0605-actor-missing-keys.ts
@@ -1,5 +1,5 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { createPrivateKey, getPublicKey } from '../../helpers/core-utils' 2import { generateRSAKeyPairPromise } from '../../helpers/core-utils'
3import { PRIVATE_RSA_KEY_SIZE } from '../constants' 3import { PRIVATE_RSA_KEY_SIZE } from '../constants'
4 4
5async function up (utils: { 5async function up (utils: {
@@ -15,10 +15,9 @@ async function up (utils: {
15 const actors = await utils.sequelize.query<any>(query, options) 15 const actors = await utils.sequelize.query<any>(query, options)
16 16
17 for (const actor of actors) { 17 for (const actor of actors) {
18 const { key } = await createPrivateKey(PRIVATE_RSA_KEY_SIZE) 18 const { privateKey, publicKey } = await generateRSAKeyPairPromise(PRIVATE_RSA_KEY_SIZE)
19 const { publicKey } = await getPublicKey(key)
20 19
21 const queryUpdate = `UPDATE "actor" SET "publicKey" = '${publicKey}', "privateKey" = '${key}' WHERE id = ${actor.id}` 20 const queryUpdate = `UPDATE "actor" SET "publicKey" = '${publicKey}', "privateKey" = '${privateKey}' WHERE id = ${actor.id}`
22 await utils.sequelize.query(queryUpdate) 21 await utils.sequelize.query(queryUpdate)
23 } 22 }
24 } 23 }