Change code to use first usable keypairs record for local user for signing, if it exists (#39662)
This commit is contained in:
1 parent
68627adff4
commit
7fc19f81aa
14 files changed
+115
-33
No files matched your search
@@ -612,10 +612,22 @@ module Mastodon::CLI
|
||||
def rotate_keys_for_account(account, delay = 0)
|
||||
fail_with_message 'No such account' if account.nil?
|
||||
|
||||
old_key = account.private_key
|
||||
old_key = account.keypair
|
||||
new_key = OpenSSL::PKey::RSA.new(2048)
|
||||
account.update(private_key: new_key.to_pem, public_key: new_key.public_key.to_pem)
|
||||
ActivityPub::UpdateDistributionWorker.perform_in(delay, account.id, { 'sign_with' => old_key })
|
||||
|
||||
account.update(private_key: nil, public_key: '', keypairs: [account.keypairs.build(local_fragment: '#main-key', type: :rsa, public_key: new_key.public_key.to_pem, private_key: new_key.to_pem)])
|
||||
|
||||
ActivityPub::UpdateDistributionWorker.perform_in(
|
||||
delay,
|
||||
account.id,
|
||||
{
|
||||
'sign_with' => {
|
||||
'private_key' => old_key.private_key,
|
||||
'local_fragment' => old_key.local_fragment,
|
||||
'type' => old_key.type,
|
||||
},
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user