From 5d7cb63ede7c4bba93954c0586f589ad9748d5ea Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 12 Jul 2022 10:54:21 +0200 Subject: Add compat with openssl 3 --- server/initializers/migrations/0605-actor-missing-keys.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'server/initializers/migrations/0605-actor-missing-keys.ts') 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 @@ import * as Sequelize from 'sequelize' -import { createPrivateKey, getPublicKey } from '../../helpers/core-utils' +import { generateRSAKeyPairPromise } from '../../helpers/core-utils' import { PRIVATE_RSA_KEY_SIZE } from '../constants' async function up (utils: { @@ -15,10 +15,9 @@ async function up (utils: { const actors = await utils.sequelize.query(query, options) for (const actor of actors) { - const { key } = await createPrivateKey(PRIVATE_RSA_KEY_SIZE) - const { publicKey } = await getPublicKey(key) + const { privateKey, publicKey } = await generateRSAKeyPairPromise(PRIVATE_RSA_KEY_SIZE) - const queryUpdate = `UPDATE "actor" SET "publicKey" = '${publicKey}', "privateKey" = '${key}' WHERE id = ${actor.id}` + const queryUpdate = `UPDATE "actor" SET "publicKey" = '${publicKey}', "privateKey" = '${privateKey}' WHERE id = ${actor.id}` await utils.sequelize.query(queryUpdate) } } -- cgit v1.2.3