Changed the key name for the ActivityPub signing key

This commit is contained in:
Nathan Byrd 2023-01-13 13:07:06 -06:00
parent af1f8890f6
commit 1068abca80
4 changed files with 11 additions and 11 deletions

View File

@ -93,7 +93,7 @@ module.exports = class Actor {
// ], // ],
}; };
const publicKeyPem = user.getProperty(UserProps.PublicKeyMain); const publicKeyPem = user.getProperty(UserProps.PublicActivityPubSigningKey);
if (!_.isEmpty(publicKeyPem)) { if (!_.isEmpty(publicKeyPem)) {
obj.publicKey = { obj.publicKey = {
id: userSelfUrl + '#main-key', id: userSelfUrl + '#main-key',
@ -102,13 +102,13 @@ module.exports = class Actor {
}; };
EnigAssert( EnigAssert(
!_.isEmpty(user.getProperty(UserProps.PrivateKeyMain)), !_.isEmpty(user.getProperty(UserProps.PrivateActivityPubSigningKey)),
'User has public key but no private key!' 'User has public key but no private key!'
); );
} else { } else {
Log.warn( Log.warn(
{ username: user.username }, { 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.Summary,
// ActorProps.IconUrl, // ActorProps.IconUrl,
// ActorProps.BannerUrl, // ActorProps.BannerUrl,
// ActorProps.PublicKeyMain, // ActorProps.PublicActivityPubSigningKey,
// ]; // ];
// } // }

View File

@ -14,7 +14,7 @@ exports.ActorProps = {
Summary: 'summary', Summary: 'summary',
IconUrl: 'icon_url', IconUrl: 'icon_url',
BannerUrl: 'banner_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); exports.AllActorProperties = Object.values(exports.ActorProps);

View File

@ -504,7 +504,7 @@ module.exports = class User {
); );
}, },
function setKeyPair(trans, callback) { function setKeyPair(trans, callback) {
self.updateMainKeyPairProperties(err => { self.updateActivityPubKeyPairProperties(err => {
return callback(err, trans); return callback(err, trans);
}); });
}, },
@ -643,7 +643,7 @@ module.exports = class User {
); );
} }
updateMainKeyPairProperties(cb) { updateActivityPubKeyPairProperties(cb) {
crypto.generateKeyPair( crypto.generateKeyPair(
'rsa', 'rsa',
{ {
@ -659,8 +659,8 @@ module.exports = class User {
}, },
(err, publicKey, privateKey) => { (err, publicKey, privateKey) => {
if (!err) { if (!err) {
this.setProperty(UserProps.PrivateKeyMain, privateKey); this.setProperty(UserProps.PrivateActivityPubSigningKey, privateKey);
this.setProperty(UserProps.PublicKeyMain, publicKey); this.setProperty(UserProps.PublicActivityPubSigningKey, publicKey);
} }
return cb(err); return cb(err);
} }

View File

@ -67,8 +67,8 @@ module.exports = {
AuthFactor2OTPSecret: 'auth_factor2_otp_secret', // Secret used in conjunction with OTP 2FA AuthFactor2OTPSecret: 'auth_factor2_otp_secret', // Secret used in conjunction with OTP 2FA
AuthFactor2OTPBackupCodes: 'auth_factor2_otp_backup', // JSON array of backup codes AuthFactor2OTPBackupCodes: 'auth_factor2_otp_backup', // JSON array of backup codes
PublicKeyMain: 'public_key_main_rsa_pem', // RSA public key for user PublicActivityPubSigningKey: 'public_key_activitypub_sign_rsa_pem', // RSA public key for ActivityPub signing
PrivateKeyMain: 'private_key_main_rsa_pem', // RSA private key (corresponding to PublicKeyMain) 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 ActivityPubSettings: 'activity_pub_settings', // JSON object (above); see ActivityPubSettings in activitypub/settings.js
}; };