diff --git a/src/middleware/packages/crypto/keys/migration.js b/src/middleware/packages/crypto/keys/migration.js index ae54f7193..419912cb0 100644 --- a/src/middleware/packages/crypto/keys/migration.js +++ b/src/middleware/packages/crypto/keys/migration.js @@ -111,6 +111,11 @@ module.exports = { /** Returns true, if the server has migrated to the new keys service yet, i.e. keys are stored in the user dataset, not on fs. */ async isMigrated() { + // If the `actorsKeyPairsDir` setting is not set, we assume migration has happened or was never needed. + if (!this.settings.actorsKeyPairsDir) { + return true; + } + // Check actorsKeyPairsDir for existing keys. if (!fs.existsSync(this.settings.actorsKeyPairsDir)) { return true; diff --git a/src/middleware/packages/crypto/signature/keypair.js b/src/middleware/packages/crypto/signature/keypair.js index 79e1dd458..b0f1b31df 100644 --- a/src/middleware/packages/crypto/signature/keypair.js +++ b/src/middleware/packages/crypto/signature/keypair.js @@ -19,10 +19,10 @@ const SignatureService = { actorsKeyPairsDir: null }, async created() { - if (!this.settings.actorsKeyPairsDir) { - throw new Error('You must set the actorsKeyPairsDir setting in the signature service'); - } else if (!fs.existsSync(this.settings.actorsKeyPairsDir)) { - throw new Error(`The actorsKeyPairsDir (${this.settings.actorsKeyPairsDir}) does not exist! Please create it.`); + if (this.settings.actorsKeyPairsDir && !fs.existsSync(this.settings.actorsKeyPairsDir)) { + throw new Error( + `The \`actorsKeyPairsDir\` is configured for the keys legacy service but the directory (${this.settings.actorsKeyPairsDir}) does not exist! Please remove the setting (preferred) or create the directory.` + ); } }, async started() {