From 1068abca80e63bc4fb8d391b228f9635ea195a0c Mon Sep 17 00:00:00 2001 From: Nathan Byrd Date: Fri, 13 Jan 2023 13:07:06 -0600 Subject: [PATCH] Changed the key name for the ActivityPub signing key --- core/activitypub/actor.js | 8 ++++---- core/activitypub_actor_property.js | 2 +- core/user.js | 8 ++++---- core/user_property.js | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/activitypub/actor.js b/core/activitypub/actor.js index 30af36f5..f098ed0f 100644 --- a/core/activitypub/actor.js +++ b/core/activitypub/actor.js @@ -93,7 +93,7 @@ module.exports = class Actor { // ], }; - const publicKeyPem = user.getProperty(UserProps.PublicKeyMain); + const publicKeyPem = user.getProperty(UserProps.PublicActivityPubSigningKey); if (!_.isEmpty(publicKeyPem)) { obj.publicKey = { id: userSelfUrl + '#main-key', @@ -102,13 +102,13 @@ module.exports = class Actor { }; EnigAssert( - !_.isEmpty(user.getProperty(UserProps.PrivateKeyMain)), + !_.isEmpty(user.getProperty(UserProps.PrivateActivityPubSigningKey)), 'User has public key but no private key!' ); } else { Log.warn( { username: user.username }, - `No public key (${UserProps.PublicKeyMain}) for user "${user.username}"` + `No public key (${UserProps.PublicActivityPubSigningKey}) for user "${user.username}"` ); } @@ -412,7 +412,7 @@ module.exports = class Actor { // ActorProps.Summary, // ActorProps.IconUrl, // ActorProps.BannerUrl, - // ActorProps.PublicKeyMain, + // ActorProps.PublicActivityPubSigningKey, // ]; // } diff --git a/core/activitypub_actor_property.js b/core/activitypub_actor_property.js index 91df8a29..cc866c07 100644 --- a/core/activitypub_actor_property.js +++ b/core/activitypub_actor_property.js @@ -14,7 +14,7 @@ exports.ActorProps = { Summary: 'summary', IconUrl: 'icon_url', BannerUrl: 'banner_url', - PublicKeyMain: 'public_key_main_rsa_pem', // RSA public key for user + PublicActivityPubSigningKey: 'public_key_activitypub_sign_rsa_pem', // RSA public key for user }; exports.AllActorProperties = Object.values(exports.ActorProps); diff --git a/core/user.js b/core/user.js index 6a69eca4..bacc18b7 100644 --- a/core/user.js +++ b/core/user.js @@ -504,7 +504,7 @@ module.exports = class User { ); }, function setKeyPair(trans, callback) { - self.updateMainKeyPairProperties(err => { + self.updateActivityPubKeyPairProperties(err => { return callback(err, trans); }); }, @@ -643,7 +643,7 @@ module.exports = class User { ); } - updateMainKeyPairProperties(cb) { + updateActivityPubKeyPairProperties(cb) { crypto.generateKeyPair( 'rsa', { @@ -659,8 +659,8 @@ module.exports = class User { }, (err, publicKey, privateKey) => { if (!err) { - this.setProperty(UserProps.PrivateKeyMain, privateKey); - this.setProperty(UserProps.PublicKeyMain, publicKey); + this.setProperty(UserProps.PrivateActivityPubSigningKey, privateKey); + this.setProperty(UserProps.PublicActivityPubSigningKey, publicKey); } return cb(err); } diff --git a/core/user_property.js b/core/user_property.js index 82fa6b3b..0cef0fd5 100644 --- a/core/user_property.js +++ b/core/user_property.js @@ -67,8 +67,8 @@ module.exports = { AuthFactor2OTPSecret: 'auth_factor2_otp_secret', // Secret used in conjunction with OTP 2FA AuthFactor2OTPBackupCodes: 'auth_factor2_otp_backup', // JSON array of backup codes - PublicKeyMain: 'public_key_main_rsa_pem', // RSA public key for user - PrivateKeyMain: 'private_key_main_rsa_pem', // RSA private key (corresponding to PublicKeyMain) + PublicActivityPubSigningKey: 'public_key_activitypub_sign_rsa_pem', // RSA public key for ActivityPub signing + PrivateActivityPubSigningKey: 'private_key_activitypub_sign_rsa_pem', // RSA private key (corresponding to PublicActivityPubSigningKey) ActivityPubSettings: 'activity_pub_settings', // JSON object (above); see ActivityPubSettings in activitypub/settings.js };