diff options
Diffstat (limited to 'server/initializers/migrations/0605-actor-missing-keys.ts')
-rw-r--r-- | server/initializers/migrations/0605-actor-missing-keys.ts | 7 |
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 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { createPrivateKey, getPublicKey } from '../../helpers/core-utils' | 2 | import { generateRSAKeyPairPromise } from '../../helpers/core-utils' |
3 | import { PRIVATE_RSA_KEY_SIZE } from '../constants' | 3 | import { PRIVATE_RSA_KEY_SIZE } from '../constants' |
4 | 4 | ||
5 | async function up (utils: { | 5 | async 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 | } |