diff --git a/Gemfile b/Gemfile index de9bc45f320..73caa5279a5 100644 --- a/Gemfile +++ b/Gemfile @@ -47,7 +47,6 @@ gem 'color_diff', '~> 0.1' gem 'csv', '~> 3.2' gem 'discard', '~> 1.2' gem 'doorkeeper', '~> 5.6' -gem 'ed25519', '~> 1.3' gem 'fast_blank', '~> 1.0' gem 'fastimage' gem 'hiredis', '~> 0.6' diff --git a/Gemfile.lock b/Gemfile.lock index ba8673bbf8d..a5afe5a4f9d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -212,7 +212,6 @@ GEM railties (>= 5) dotenv (3.1.2) drb (2.2.1) - ed25519 (1.3.0) elasticsearch (7.17.10) elasticsearch-api (= 7.17.10) elasticsearch-transport (= 7.17.10) @@ -938,7 +937,6 @@ DEPENDENCIES discard (~> 1.2) doorkeeper (~> 5.6) dotenv - ed25519 (~> 1.3) email_spec fabrication (~> 2.30) faker (~> 3.2) diff --git a/app/controllers/activitypub/claims_controller.rb b/app/controllers/activitypub/claims_controller.rb deleted file mode 100644 index 480baaf2bcc..00000000000 --- a/app/controllers/activitypub/claims_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class ActivityPub::ClaimsController < ActivityPub::BaseController - skip_before_action :authenticate_user! - - before_action :require_account_signature! - before_action :set_claim_result - - def create - render json: @claim_result, serializer: ActivityPub::OneTimeKeySerializer - end - - private - - def set_claim_result - @claim_result = ::Keys::ClaimService.new.call(@account.id, params[:id]) - end -end diff --git a/app/controllers/activitypub/collections_controller.rb b/app/controllers/activitypub/collections_controller.rb index c25362c9bc0..ab1b98e646a 100644 --- a/app/controllers/activitypub/collections_controller.rb +++ b/app/controllers/activitypub/collections_controller.rb @@ -22,8 +22,6 @@ class ActivityPub::CollectionsController < ActivityPub::BaseController @items = @items.map { |item| item.distributable? ? item : ActivityPub::TagManager.instance.uri_for(item) } when 'tags' @items = for_signed_account { @account.featured_tags } - when 'devices' - @items = @account.devices else not_found end @@ -31,7 +29,7 @@ class ActivityPub::CollectionsController < ActivityPub::BaseController def set_size case params[:id] - when 'featured', 'devices', 'tags' + when 'featured', 'tags' @size = @items.size else not_found @@ -42,7 +40,7 @@ class ActivityPub::CollectionsController < ActivityPub::BaseController case params[:id] when 'featured' @type = :ordered - when 'devices', 'tags' + when 'tags' @type = :unordered else not_found diff --git a/app/controllers/api/v1/crypto/deliveries_controller.rb b/app/controllers/api/v1/crypto/deliveries_controller.rb deleted file mode 100644 index aa9df6e03b2..00000000000 --- a/app/controllers/api/v1/crypto/deliveries_controller.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class Api::V1::Crypto::DeliveriesController < Api::BaseController - before_action -> { doorkeeper_authorize! :crypto } - before_action :require_user! - before_action :set_current_device - - def create - devices.each do |device_params| - DeliverToDeviceService.new.call(current_account, @current_device, device_params) - end - - render_empty - end - - private - - def set_current_device - @current_device = Device.find_by!(access_token: doorkeeper_token) - end - - def resource_params - params.require(:device) - params.permit(device: [:account_id, :device_id, :type, :body, :hmac]) - end - - def devices - Array(resource_params[:device]) - end -end diff --git a/app/controllers/api/v1/crypto/encrypted_messages_controller.rb b/app/controllers/api/v1/crypto/encrypted_messages_controller.rb deleted file mode 100644 index 93ae0e77713..00000000000 --- a/app/controllers/api/v1/crypto/encrypted_messages_controller.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -class Api::V1::Crypto::EncryptedMessagesController < Api::BaseController - LIMIT = 80 - - before_action -> { doorkeeper_authorize! :crypto } - before_action :require_user! - before_action :set_current_device - - before_action :set_encrypted_messages, only: :index - after_action :insert_pagination_headers, only: :index - - def index - render json: @encrypted_messages, each_serializer: REST::EncryptedMessageSerializer - end - - def clear - @current_device.encrypted_messages.up_to(params[:up_to_id]).delete_all - render_empty - end - - private - - def set_current_device - @current_device = Device.find_by!(access_token: doorkeeper_token) - end - - def set_encrypted_messages - @encrypted_messages = @current_device.encrypted_messages.to_a_paginated_by_id(limit_param(LIMIT), params_slice(:max_id, :since_id, :min_id)) - end - - def next_path - api_v1_crypto_encrypted_messages_url pagination_params(max_id: pagination_max_id) if records_continue? - end - - def prev_path - api_v1_crypto_encrypted_messages_url pagination_params(min_id: pagination_since_id) unless @encrypted_messages.empty? - end - - def pagination_collection - @encrypted_messages - end - - def records_continue? - @encrypted_messages.size == limit_param(LIMIT) - end -end diff --git a/app/controllers/api/v1/crypto/keys/claims_controller.rb b/app/controllers/api/v1/crypto/keys/claims_controller.rb deleted file mode 100644 index f9d202d67b8..00000000000 --- a/app/controllers/api/v1/crypto/keys/claims_controller.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class Api::V1::Crypto::Keys::ClaimsController < Api::BaseController - before_action -> { doorkeeper_authorize! :crypto } - before_action :require_user! - before_action :set_claim_results - - def create - render json: @claim_results, each_serializer: REST::Keys::ClaimResultSerializer - end - - private - - def set_claim_results - @claim_results = devices.filter_map { |device_params| ::Keys::ClaimService.new.call(current_account, device_params[:account_id], device_params[:device_id]) } - end - - def resource_params - params.permit(device: [:account_id, :device_id]) - end - - def devices - Array(resource_params[:device]) - end -end diff --git a/app/controllers/api/v1/crypto/keys/counts_controller.rb b/app/controllers/api/v1/crypto/keys/counts_controller.rb deleted file mode 100644 index ffd7151b782..00000000000 --- a/app/controllers/api/v1/crypto/keys/counts_controller.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class Api::V1::Crypto::Keys::CountsController < Api::BaseController - before_action -> { doorkeeper_authorize! :crypto } - before_action :require_user! - before_action :set_current_device - - def show - render json: { one_time_keys: @current_device.one_time_keys.count } - end - - private - - def set_current_device - @current_device = Device.find_by!(access_token: doorkeeper_token) - end -end diff --git a/app/controllers/api/v1/crypto/keys/queries_controller.rb b/app/controllers/api/v1/crypto/keys/queries_controller.rb deleted file mode 100644 index e6ce9f9192a..00000000000 --- a/app/controllers/api/v1/crypto/keys/queries_controller.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -class Api::V1::Crypto::Keys::QueriesController < Api::BaseController - before_action -> { doorkeeper_authorize! :crypto } - before_action :require_user! - before_action :set_accounts - before_action :set_query_results - - def create - render json: @query_results, each_serializer: REST::Keys::QueryResultSerializer - end - - private - - def set_accounts - @accounts = Account.where(id: account_ids).includes(:devices) - end - - def set_query_results - @query_results = @accounts.filter_map { |account| ::Keys::QueryService.new.call(account) } - end - - def account_ids - Array(params[:id]).map(&:to_i) - end -end diff --git a/app/controllers/api/v1/crypto/keys/uploads_controller.rb b/app/controllers/api/v1/crypto/keys/uploads_controller.rb deleted file mode 100644 index fc4abf63b3a..00000000000 --- a/app/controllers/api/v1/crypto/keys/uploads_controller.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class Api::V1::Crypto::Keys::UploadsController < Api::BaseController - before_action -> { doorkeeper_authorize! :crypto } - before_action :require_user! - - def create - device = Device.find_or_initialize_by(access_token: doorkeeper_token) - - device.transaction do - device.account = current_account - device.update!(resource_params[:device]) - - if resource_params[:one_time_keys].present? && resource_params[:one_time_keys].is_a?(Enumerable) - resource_params[:one_time_keys].each do |one_time_key_params| - device.one_time_keys.create!(one_time_key_params) - end - end - end - - render json: device, serializer: REST::Keys::DeviceSerializer - end - - private - - def resource_params - params.permit(device: [:device_id, :name, :fingerprint_key, :identity_key], one_time_keys: [:key_id, :key, :signature]) - end -end diff --git a/app/helpers/context_helper.rb b/app/helpers/context_helper.rb index cbefe0fe538..3ab071a4595 100644 --- a/app/helpers/context_helper.rb +++ b/app/helpers/context_helper.rb @@ -23,23 +23,6 @@ module ContextHelper indexable: { 'toot' => 'http://joinmastodon.org/ns#', 'indexable' => 'toot:indexable' }, memorial: { 'toot' => 'http://joinmastodon.org/ns#', 'memorial' => 'toot:memorial' }, voters_count: { 'toot' => 'http://joinmastodon.org/ns#', 'votersCount' => 'toot:votersCount' }, - olm: { - 'toot' => 'http://joinmastodon.org/ns#', - 'Device' => 'toot:Device', - 'Ed25519Signature' => 'toot:Ed25519Signature', - 'Ed25519Key' => 'toot:Ed25519Key', - 'Curve25519Key' => 'toot:Curve25519Key', - 'EncryptedMessage' => 'toot:EncryptedMessage', - 'publicKeyBase64' => 'toot:publicKeyBase64', - 'deviceId' => 'toot:deviceId', - 'claim' => { '@type' => '@id', '@id' => 'toot:claim' }, - 'fingerprintKey' => { '@type' => '@id', '@id' => 'toot:fingerprintKey' }, - 'identityKey' => { '@type' => '@id', '@id' => 'toot:identityKey' }, - 'devices' => { '@type' => '@id', '@id' => 'toot:devices' }, - 'messageFranking' => 'toot:messageFranking', - 'messageType' => 'toot:messageType', - 'cipherText' => 'toot:cipherText', - }, suspended: { 'toot' => 'http://joinmastodon.org/ns#', 'suspended' => 'toot:suspended' }, }.freeze diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 5d700b49613..f97323b4789 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -8,44 +8,11 @@ class ActivityPub::Activity::Create < ActivityPub::Activity dereference_object! - case @object['type'] - when 'EncryptedMessage' - create_encrypted_message - else - create_status - end + create_status end private - def create_encrypted_message - return reject_payload! if non_matching_uri_hosts?(@account.uri, object_uri) || @options[:delivered_to_account_id].blank? - - target_account = Account.find(@options[:delivered_to_account_id]) - target_device = target_account.devices.find_by(device_id: @object.dig('to', 'deviceId')) - - return if target_device.nil? - - target_device.encrypted_messages.create!( - from_account: @account, - from_device_id: @object.dig('attributedTo', 'deviceId'), - type: @object['messageType'], - body: @object['cipherText'], - digest: @object.dig('digest', 'digestValue'), - message_franking: message_franking.to_token - ) - end - - def message_franking - MessageFranking.new( - hmac: @object.dig('digest', 'digestValue'), - original_franking: @object['messageFranking'], - source_account_id: @account.id, - target_account_id: @options[:delivered_to_account_id], - timestamp: Time.now.utc - ) - end - def create_status return reject_payload! if unsupported_object_type? || non_matching_uri_hosts?(@account.uri, object_uri) || tombstone_exists? || !related_to_local_activity? diff --git a/app/lib/inline_renderer.rb b/app/lib/inline_renderer.rb index 0aebb13fce4..af967ac215d 100644 --- a/app/lib/inline_renderer.rb +++ b/app/lib/inline_renderer.rb @@ -20,8 +20,6 @@ class InlineRenderer serializer = REST::AnnouncementSerializer when :reaction serializer = REST::ReactionSerializer - when :encrypted_message - serializer = REST::EncryptedMessageSerializer else return end diff --git a/app/lib/vacuum/system_keys_vacuum.rb b/app/lib/vacuum/system_keys_vacuum.rb deleted file mode 100644 index ceee2fd164b..00000000000 --- a/app/lib/vacuum/system_keys_vacuum.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class Vacuum::SystemKeysVacuum - def perform - vacuum_expired_system_keys! - end - - private - - def vacuum_expired_system_keys! - SystemKey.expired.delete_all - end -end diff --git a/app/models/account.rb b/app/models/account.rb index 23ff07c7696..ee37b214aea 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -44,7 +44,6 @@ # hide_collections :boolean # avatar_storage_schema_version :integer # header_storage_schema_version :integer -# devices_url :string # suspension_origin :integer # sensitized_at :datetime # trendable :boolean @@ -55,11 +54,12 @@ class Account < ApplicationRecord self.ignored_columns += %w( - subscription_expires_at - secret + devices_url + hub_url remote_url salmon_url - hub_url + secret + subscription_expires_at trust_level ) diff --git a/app/models/concerns/account/associations.rb b/app/models/concerns/account/associations.rb index 1c67b07e511..637e785953d 100644 --- a/app/models/concerns/account/associations.rb +++ b/app/models/concerns/account/associations.rb @@ -7,9 +7,6 @@ module Account::Associations # Local users has_one :user, inverse_of: :account, dependent: :destroy - # E2EE - has_many :devices, dependent: :destroy, inverse_of: :account - # Timelines has_many :statuses, inverse_of: :account, dependent: :destroy has_many :favourites, inverse_of: :account, dependent: :destroy diff --git a/app/models/device.rb b/app/models/device.rb deleted file mode 100644 index 5dc6cf1e66f..00000000000 --- a/app/models/device.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: devices -# -# id :bigint(8) not null, primary key -# access_token_id :bigint(8) -# account_id :bigint(8) -# device_id :string default(""), not null -# name :string default(""), not null -# fingerprint_key :text default(""), not null -# identity_key :text default(""), not null -# created_at :datetime not null -# updated_at :datetime not null -# - -class Device < ApplicationRecord - belongs_to :access_token, class_name: 'Doorkeeper::AccessToken' - belongs_to :account - - has_many :one_time_keys, dependent: :destroy, inverse_of: :device - has_many :encrypted_messages, dependent: :destroy, inverse_of: :device - - validates :name, :fingerprint_key, :identity_key, presence: true - validates :fingerprint_key, :identity_key, ed25519_key: true - - before_save :invalidate_associations, if: -> { device_id_changed? || fingerprint_key_changed? || identity_key_changed? } - - private - - def invalidate_associations - one_time_keys.destroy_all - encrypted_messages.destroy_all - end -end diff --git a/app/models/encrypted_message.rb b/app/models/encrypted_message.rb deleted file mode 100644 index 3e7e95594ce..00000000000 --- a/app/models/encrypted_message.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: encrypted_messages -# -# id :bigint(8) not null, primary key -# device_id :bigint(8) -# from_account_id :bigint(8) -# from_device_id :string default(""), not null -# type :integer default(0), not null -# body :text default(""), not null -# digest :text default(""), not null -# message_franking :text default(""), not null -# created_at :datetime not null -# updated_at :datetime not null -# - -class EncryptedMessage < ApplicationRecord - self.inheritance_column = nil - - include Paginable - include Redisable - - scope :up_to, ->(id) { where(arel_table[:id].lteq(id)) } - - belongs_to :device - belongs_to :from_account, class_name: 'Account' - - around_create Mastodon::Snowflake::Callbacks - - after_commit :push_to_streaming_api - - private - - def push_to_streaming_api - return if destroyed? || !subscribed_to_timeline? - - PushEncryptedMessageWorker.perform_async(id) - end - - def subscribed_to_timeline? - redis.exists?("subscribed:#{streaming_channel}") - end - - def streaming_channel - "timeline:#{device.account_id}:#{device.device_id}" - end -end diff --git a/app/models/message_franking.rb b/app/models/message_franking.rb deleted file mode 100644 index c72bd1ccaca..00000000000 --- a/app/models/message_franking.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class MessageFranking - attr_reader :hmac, :source_account_id, :target_account_id, - :timestamp, :original_franking - - def initialize(attributes = {}) - @hmac = attributes[:hmac] - @source_account_id = attributes[:source_account_id] - @target_account_id = attributes[:target_account_id] - @timestamp = attributes[:timestamp] - @original_franking = attributes[:original_franking] - end - - def to_token - crypt = ActiveSupport::MessageEncryptor.new(SystemKey.current_key, serializer: Oj) - crypt.encrypt_and_sign(self) - end -end diff --git a/app/models/one_time_key.rb b/app/models/one_time_key.rb deleted file mode 100644 index 23604e2f7d3..00000000000 --- a/app/models/one_time_key.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: one_time_keys -# -# id :bigint(8) not null, primary key -# device_id :bigint(8) -# key_id :string default(""), not null -# key :text default(""), not null -# signature :text default(""), not null -# created_at :datetime not null -# updated_at :datetime not null -# - -class OneTimeKey < ApplicationRecord - belongs_to :device - - validates :key_id, :key, :signature, presence: true - validates :key, ed25519_key: true - validates :signature, ed25519_signature: { message: :key, verify_key: ->(one_time_key) { one_time_key.device.fingerprint_key } } -end diff --git a/app/models/system_key.rb b/app/models/system_key.rb deleted file mode 100644 index 1be399dd689..00000000000 --- a/app/models/system_key.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: system_keys -# -# id :bigint(8) not null, primary key -# key :binary -# created_at :datetime not null -# updated_at :datetime not null -# -class SystemKey < ApplicationRecord - ROTATION_PERIOD = 1.week.freeze - - before_validation :set_key - - scope :expired, ->(now = Time.now.utc) { where(arel_table[:created_at].lt(now - (ROTATION_PERIOD * 3))) } - - class << self - def current_key - previous_key = order(id: :asc).last - - if previous_key && previous_key.created_at >= ROTATION_PERIOD.ago - previous_key.key - else - create.key - end - end - end - - private - - def set_key - return if key.present? - - cipher = OpenSSL::Cipher.new('AES-256-GCM') - cipher.encrypt - - self.key = cipher.random_key - end -end diff --git a/app/serializers/activitypub/activity_serializer.rb b/app/serializers/activitypub/activity_serializer.rb index 5bdf53f032d..23a5b42bc79 100644 --- a/app/serializers/activitypub/activity_serializer.rb +++ b/app/serializers/activitypub/activity_serializer.rb @@ -5,8 +5,6 @@ class ActivityPub::ActivitySerializer < ActivityPub::Serializer case model.class.name when 'Status' ActivityPub::NoteSerializer - when 'DeliverToDeviceService::EncryptedMessage' - ActivityPub::EncryptedMessageSerializer else super end diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index 4ab48ff204b..d5e1f56acea 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -7,7 +7,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer context :security context_extensions :manually_approves_followers, :featured, :also_known_as, - :moved_to, :property_value, :discoverable, :olm, :suspended, + :moved_to, :property_value, :discoverable, :suspended, :memorial, :indexable attributes :id, :type, :following, :followers, @@ -21,7 +21,6 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer has_many :virtual_tags, key: :tag has_many :virtual_attachments, key: :attachment - attribute :devices, unless: :instance_actor? attribute :moved_to, if: :moved? attribute :also_known_as, if: :also_known_as? attribute :suspended, if: :suspended? @@ -71,10 +70,6 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer object.instance_actor? ? instance_actor_inbox_url : account_inbox_url(object) end - def devices - account_collection_url(object, :devices) - end - def outbox object.instance_actor? ? instance_actor_outbox_url : account_outbox_url(object) end diff --git a/app/serializers/activitypub/collection_serializer.rb b/app/serializers/activitypub/collection_serializer.rb index 34026a6b5be..1b410cecaef 100644 --- a/app/serializers/activitypub/collection_serializer.rb +++ b/app/serializers/activitypub/collection_serializer.rb @@ -14,8 +14,6 @@ class ActivityPub::CollectionSerializer < ActivityPub::Serializer case model.class.name when 'Status' ActivityPub::NoteSerializer - when 'Device' - ActivityPub::DeviceSerializer when 'FeaturedTag' ActivityPub::HashtagSerializer when 'ActivityPub::CollectionPresenter' diff --git a/app/serializers/activitypub/device_serializer.rb b/app/serializers/activitypub/device_serializer.rb deleted file mode 100644 index 5f0fdc8af93..00000000000 --- a/app/serializers/activitypub/device_serializer.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -class ActivityPub::DeviceSerializer < ActivityPub::Serializer - context_extensions :olm - - include RoutingHelper - - class FingerprintKeySerializer < ActivityPub::Serializer - attributes :type, :public_key_base64 - - def type - 'Ed25519Key' - end - - def public_key_base64 - object.fingerprint_key - end - end - - class IdentityKeySerializer < ActivityPub::Serializer - attributes :type, :public_key_base64 - - def type - 'Curve25519Key' - end - - def public_key_base64 - object.identity_key - end - end - - attributes :device_id, :type, :name, :claim - - has_one :fingerprint_key, serializer: FingerprintKeySerializer - has_one :identity_key, serializer: IdentityKeySerializer - - def type - 'Device' - end - - def claim - account_claim_url(object.account, id: object.device_id) - end - - def fingerprint_key - object - end - - def identity_key - object - end -end diff --git a/app/serializers/activitypub/encrypted_message_serializer.rb b/app/serializers/activitypub/encrypted_message_serializer.rb deleted file mode 100644 index 3c525d23e5c..00000000000 --- a/app/serializers/activitypub/encrypted_message_serializer.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -class ActivityPub::EncryptedMessageSerializer < ActivityPub::Serializer - context :security - - context_extensions :olm - - class DeviceSerializer < ActivityPub::Serializer - attributes :type, :device_id - - def type - 'Device' - end - - def device_id - object - end - end - - class DigestSerializer < ActivityPub::Serializer - attributes :type, :digest_algorithm, :digest_value - - def type - 'Digest' - end - - def digest_algorithm - 'http://www.w3.org/2000/09/xmldsig#hmac-sha256' - end - - def digest_value - object - end - end - - attributes :type, :message_type, :cipher_text, :message_franking - - has_one :attributed_to, serializer: DeviceSerializer - has_one :to, serializer: DeviceSerializer - has_one :digest, serializer: DigestSerializer - - def type - 'EncryptedMessage' - end - - def attributed_to - object.source_device.device_id - end - - def to - object.target_device_id - end - - def message_type - object.type - end - - def cipher_text - object.body - end -end diff --git a/app/serializers/activitypub/one_time_key_serializer.rb b/app/serializers/activitypub/one_time_key_serializer.rb deleted file mode 100644 index 5932eb5b55a..00000000000 --- a/app/serializers/activitypub/one_time_key_serializer.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -class ActivityPub::OneTimeKeySerializer < ActivityPub::Serializer - context :security - - context_extensions :olm - - class SignatureSerializer < ActivityPub::Serializer - attributes :type, :signature_value - - def type - 'Ed25519Signature' - end - - def signature_value - object.signature - end - end - - attributes :key_id, :type, :public_key_base64 - - has_one :signature, serializer: SignatureSerializer - - def type - 'Curve25519Key' - end - - def public_key_base64 - object.key - end - - def signature - object - end -end diff --git a/app/serializers/rest/encrypted_message_serializer.rb b/app/serializers/rest/encrypted_message_serializer.rb deleted file mode 100644 index 80c26d060ea..00000000000 --- a/app/serializers/rest/encrypted_message_serializer.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class REST::EncryptedMessageSerializer < ActiveModel::Serializer - attributes :id, :account_id, :device_id, - :type, :body, :digest, :message_franking, - :created_at - - def id - object.id.to_s - end - - def account_id - object.from_account_id.to_s - end - - def device_id - object.from_device_id - end -end diff --git a/app/serializers/rest/keys/claim_result_serializer.rb b/app/serializers/rest/keys/claim_result_serializer.rb deleted file mode 100644 index 145044f5572..00000000000 --- a/app/serializers/rest/keys/claim_result_serializer.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class REST::Keys::ClaimResultSerializer < ActiveModel::Serializer - attributes :account_id, :device_id, :key_id, :key, :signature - - def account_id - object.account.id.to_s - end -end diff --git a/app/serializers/rest/keys/device_serializer.rb b/app/serializers/rest/keys/device_serializer.rb deleted file mode 100644 index f9b821b79ca..00000000000 --- a/app/serializers/rest/keys/device_serializer.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -class REST::Keys::DeviceSerializer < ActiveModel::Serializer - attributes :device_id, :name, :identity_key, - :fingerprint_key -end diff --git a/app/serializers/rest/keys/query_result_serializer.rb b/app/serializers/rest/keys/query_result_serializer.rb deleted file mode 100644 index 8f8bdde289f..00000000000 --- a/app/serializers/rest/keys/query_result_serializer.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class REST::Keys::QueryResultSerializer < ActiveModel::Serializer - attributes :account_id - - has_many :devices, serializer: REST::Keys::DeviceSerializer - - def account_id - object.account.id.to_s - end -end diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index b667e97f4d8..922575d2f38 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -108,7 +108,6 @@ class ActivityPub::ProcessAccountService < BaseService def set_immediate_attributes! @account.featured_collection_url = @json['featured'] || '' - @account.devices_url = @json['devices'] || '' @account.display_name = @json['name'] || '' @account.note = @json['summary'] || '' @account.locked = @json['manuallyApprovesFollowers'] || false diff --git a/app/services/delete_account_service.rb b/app/services/delete_account_service.rb index 328d8ae8f83..0c03267d43d 100644 --- a/app/services/delete_account_service.rb +++ b/app/services/delete_account_service.rb @@ -13,7 +13,6 @@ class DeleteAccountService < BaseService conversation_mutes conversations custom_filters - devices domain_blocks featured_tags follow_requests @@ -40,7 +39,6 @@ class DeleteAccountService < BaseService conversation_mutes conversations custom_filters - devices domain_blocks featured_tags follow_requests diff --git a/app/services/deliver_to_device_service.rb b/app/services/deliver_to_device_service.rb deleted file mode 100644 index 71711945c06..00000000000 --- a/app/services/deliver_to_device_service.rb +++ /dev/null @@ -1,78 +0,0 @@ -# frozen_string_literal: true - -class DeliverToDeviceService < BaseService - include Payloadable - - class EncryptedMessage < ActiveModelSerializers::Model - attributes :source_account, :target_account, :source_device, - :target_device_id, :type, :body, :digest, - :message_franking - end - - def call(source_account, source_device, options = {}) - @source_account = source_account - @source_device = source_device - @target_account = Account.find(options[:account_id]) - @target_device_id = options[:device_id] - @body = options[:body] - @type = options[:type] - @hmac = options[:hmac] - - set_message_franking! - - if @target_account.local? - deliver_to_local! - else - deliver_to_remote! - end - end - - private - - def set_message_franking! - @message_franking = message_franking.to_token - end - - def deliver_to_local! - target_device = @target_account.devices.find_by!(device_id: @target_device_id) - - target_device.encrypted_messages.create!( - from_account: @source_account, - from_device_id: @source_device.device_id, - type: @type, - body: @body, - digest: @hmac, - message_franking: @message_franking - ) - end - - def deliver_to_remote! - ActivityPub::DeliveryWorker.perform_async( - Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_encrypted_message(encrypted_message), ActivityPub::ActivitySerializer)), - @source_account.id, - @target_account.inbox_url - ) - end - - def message_franking - MessageFranking.new( - source_account_id: @source_account.id, - target_account_id: @target_account.id, - hmac: @hmac, - timestamp: Time.now.utc - ) - end - - def encrypted_message - EncryptedMessage.new( - source_account: @source_account, - target_account: @target_account, - source_device: @source_device, - target_device_id: @target_device_id, - type: @type, - body: @body, - digest: @hmac, - message_franking: @message_franking - ) - end -end diff --git a/app/services/keys/claim_service.rb b/app/services/keys/claim_service.rb deleted file mode 100644 index ebce9cce7d8..00000000000 --- a/app/services/keys/claim_service.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -class Keys::ClaimService < BaseService - HEADERS = { 'Content-Type' => 'application/activity+json' }.freeze - - class Result < ActiveModelSerializers::Model - attributes :account, :device_id, :key_id, - :key, :signature - - def initialize(account, device_id, key_attributes = {}) - super( - account: account, - device_id: device_id, - key_id: key_attributes[:key_id], - key: key_attributes[:key], - signature: key_attributes[:signature], - ) - end - end - - def call(source_account, target_account_id, device_id) - @source_account = source_account - @target_account = Account.find(target_account_id) - @device_id = device_id - - if @target_account.local? - claim_local_key! - else - claim_remote_key! - end - rescue ActiveRecord::RecordNotFound - nil - end - - private - - def claim_local_key! - device = @target_account.devices.find_by(device_id: @device_id) - key = nil - - ApplicationRecord.transaction do - key = device.one_time_keys.order(Arel.sql('random()')).first! - key.destroy! - end - - @result = Result.new(@target_account, @device_id, key) - end - - def claim_remote_key! - query_result = QueryService.new.call(@target_account) - device = query_result.find(@device_id) - - return unless device.present? && device.valid_claim_url? - - json = fetch_resource_with_post(device.claim_url) - - return unless json.present? && json['publicKeyBase64'].present? - - @result = Result.new(@target_account, @device_id, key_id: json['id'], key: json['publicKeyBase64'], signature: json.dig('signature', 'signatureValue')) - rescue HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::Error => e - Rails.logger.debug { "Claiming one-time key for #{@target_account.acct}:#{@device_id} failed: #{e}" } - nil - end - - def fetch_resource_with_post(uri) - build_post_request(uri).perform do |response| - raise Mastodon::UnexpectedResponseError, response unless response_successful?(response) || response_error_unsalvageable?(response) - - body_to_json(response.body_with_limit) if response.code == 200 - end - end - - def build_post_request(uri) - Request.new(:post, uri).tap do |request| - request.on_behalf_of(@source_account) - request.add_headers(HEADERS) - end - end -end diff --git a/app/services/keys/query_service.rb b/app/services/keys/query_service.rb deleted file mode 100644 index 33e13293f31..00000000000 --- a/app/services/keys/query_service.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -class Keys::QueryService < BaseService - include JsonLdHelper - - class Result < ActiveModelSerializers::Model - attributes :account, :devices - - def initialize(account, devices) - super( - account: account, - devices: devices || [], - ) - end - - def find(device_id) - @devices.find { |device| device.device_id == device_id } - end - end - - class Device < ActiveModelSerializers::Model - attributes :device_id, :name, :identity_key, :fingerprint_key - - def initialize(attributes = {}) - super( - device_id: attributes[:device_id], - name: attributes[:name], - identity_key: attributes[:identity_key], - fingerprint_key: attributes[:fingerprint_key], - ) - @claim_url = attributes[:claim_url] - end - - def valid_claim_url? - return false if @claim_url.blank? - - begin - parsed_url = Addressable::URI.parse(@claim_url).normalize - rescue Addressable::URI::InvalidURIError - return false - end - - %w(http https).include?(parsed_url.scheme) && parsed_url.host.present? - end - end - - def call(account) - @account = account - - if @account.local? - query_local_devices! - else - query_remote_devices! - end - - Result.new(@account, @devices) - end - - private - - def query_local_devices! - @devices = @account.devices.map { |device| Device.new(device) } - end - - def query_remote_devices! - return if @account.devices_url.blank? - - json = fetch_resource(@account.devices_url) - - return if json['items'].blank? - - @devices = as_array(json['items']).map do |device| - Device.new(device_id: device['id'], name: device['name'], identity_key: device.dig('identityKey', 'publicKeyBase64'), fingerprint_key: device.dig('fingerprintKey', 'publicKeyBase64'), claim_url: device['claim']) - end - rescue HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::Error => e - Rails.logger.debug { "Querying devices for #{@account.acct} failed: #{e}" } - nil - end -end diff --git a/app/validators/ed25519_key_validator.rb b/app/validators/ed25519_key_validator.rb deleted file mode 100644 index adf49296b2f..00000000000 --- a/app/validators/ed25519_key_validator.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class Ed25519KeyValidator < ActiveModel::EachValidator - def validate_each(record, attribute, value) - return if value.blank? - - key = Base64.decode64(value) - - record.errors.add(attribute, I18n.t('crypto.errors.invalid_key')) unless verified?(key) - end - - private - - def verified?(key) - Ed25519.validate_key_bytes(key) - rescue ArgumentError - false - end -end diff --git a/app/validators/ed25519_signature_validator.rb b/app/validators/ed25519_signature_validator.rb deleted file mode 100644 index 0e74c231ece..00000000000 --- a/app/validators/ed25519_signature_validator.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class Ed25519SignatureValidator < ActiveModel::EachValidator - def validate_each(record, attribute, value) - return if value.blank? - - verify_key = Ed25519::VerifyKey.new(Base64.decode64(option_to_value(record, :verify_key))) - signature = Base64.decode64(value) - message = option_to_value(record, :message) - - record.errors.add(attribute, I18n.t('crypto.errors.invalid_signature')) unless verified?(verify_key, signature, message) - end - - private - - def verified?(verify_key, signature, message) - verify_key.verify(signature, message) - rescue Ed25519::VerifyError, ArgumentError - false - end - - def option_to_value(record, key) - if options[key].is_a?(Proc) - options[key].call(record) - else - record.public_send(options[key]) - end - end -end diff --git a/app/workers/push_encrypted_message_worker.rb b/app/workers/push_encrypted_message_worker.rb deleted file mode 100644 index 6bee12675b0..00000000000 --- a/app/workers/push_encrypted_message_worker.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class PushEncryptedMessageWorker - include Sidekiq::Worker - include Redisable - - def perform(encrypted_message_id) - encrypted_message = EncryptedMessage.find(encrypted_message_id) - message = InlineRenderer.render(encrypted_message, nil, :encrypted_message) - timeline_id = "timeline:#{encrypted_message.device.account_id}:#{encrypted_message.device.device_id}" - - redis.publish(timeline_id, Oj.dump(event: :encrypted_message, payload: message)) - rescue ActiveRecord::RecordNotFound - true - end -end diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 83100b1cf5f..30bb5289f43 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -118,8 +118,7 @@ Doorkeeper.configure do :'admin:write:domain_blocks', :'admin:write:ip_blocks', :'admin:write:email_domain_blocks', - :'admin:write:canonical_email_blocks', - :crypto + :'admin:write:canonical_email_blocks' # Change the way client credentials are retrieved from the request object. # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ba459e19f22..2b0563f4d32 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -19,7 +19,6 @@ ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.acronym 'CLI' inflect.acronym 'DeepL' inflect.acronym 'DSL' - inflect.acronym 'Ed25519' inflect.acronym 'JsonLd' inflect.acronym 'OEmbed' inflect.acronym 'OStatus' diff --git a/config/locales/an.yml b/config/locales/an.yml index 637aa8c8b37..eb969d4aaa5 100644 --- a/config/locales/an.yml +++ b/config/locales/an.yml @@ -987,7 +987,6 @@ an: crypto: errors: invalid_key: no ye una clau Ed25519 u Curve25519 valida - invalid_signature: no ye una sinyatura Ed25519 valida date: formats: default: "%d %b %Y" diff --git a/config/locales/ar.yml b/config/locales/ar.yml index 4df24c984c0..cbc5e0e519c 100644 --- a/config/locales/ar.yml +++ b/config/locales/ar.yml @@ -1194,7 +1194,6 @@ ar: crypto: errors: invalid_key: ليس بمفتاح Ed25519 أو Curve25519 صالح - invalid_signature: ليس بتوقيع Ed25519 صالح date: formats: default: "%d %b %Y" diff --git a/config/locales/ast.yml b/config/locales/ast.yml index 567e5357ebc..979f33d3ef3 100644 --- a/config/locales/ast.yml +++ b/config/locales/ast.yml @@ -502,7 +502,6 @@ ast: crypto: errors: invalid_key: nun ye una clave ed25519 o curve25519 válida - invalid_signature: nun ye una clave ed25519 válida datetime: distance_in_words: about_x_hours: "%{count} h" diff --git a/config/locales/be.yml b/config/locales/be.yml index a14ba3d2243..acce105624a 100644 --- a/config/locales/be.yml +++ b/config/locales/be.yml @@ -1168,7 +1168,6 @@ be: crypto: errors: invalid_key: гэта не сапраўдны Ed25519 або Curve25519 ключ - invalid_signature: гэта не сапраўдная Ed25519 сігнатура date: formats: default: "%d.%m.%Y" diff --git a/config/locales/bg.yml b/config/locales/bg.yml index c71fab2177e..d4b23ba9add 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -1154,7 +1154,6 @@ bg: crypto: errors: invalid_key: не е валиден ключ Ed25519 или Curve25519 - invalid_signature: не е валиден подпис Ed25519 date: formats: default: "%b %d, %Y" diff --git a/config/locales/ca.yml b/config/locales/ca.yml index f3fd91d11f6..b16e2794c1a 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -1154,7 +1154,6 @@ ca: crypto: errors: invalid_key: no és una clau Ed25519 o Curve25519 vàlida - invalid_signature: no és una signatura Ed25519 vàlida date: formats: default: "%b %d, %Y" diff --git a/config/locales/ckb.yml b/config/locales/ckb.yml index 93eea8273f5..802394b51fe 100644 --- a/config/locales/ckb.yml +++ b/config/locales/ckb.yml @@ -630,7 +630,6 @@ ckb: crypto: errors: invalid_key: کلیلی باوڕپێکراو Ed25519 یان Curve25519 دروست نییە - invalid_signature: واژووی Ed25519 بڕوادار نییە date: formats: default: "%b %d, %Y" diff --git a/config/locales/co.yml b/config/locales/co.yml index 6edbbc95ffb..fbf9b70c80d 100644 --- a/config/locales/co.yml +++ b/config/locales/co.yml @@ -590,7 +590,6 @@ co: crypto: errors: invalid_key: ùn hè micca una chjave Ed25519 o Curve25519 valida - invalid_signature: ùn hè micca una firma Ed25519 valida date: formats: default: "%d %b %Y" diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 7e0aaaeefb6..ec40d48ae87 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -1169,7 +1169,6 @@ cs: crypto: errors: invalid_key: není platný klíč Ed25519 nebo Curve25519 - invalid_signature: není platný podpis typu Ed25519 date: formats: default: "%d. %b %Y" diff --git a/config/locales/cy.yml b/config/locales/cy.yml index 5f1b0b4bcef..22fdd8422b9 100644 --- a/config/locales/cy.yml +++ b/config/locales/cy.yml @@ -1207,7 +1207,6 @@ cy: crypto: errors: invalid_key: ddim yn allwedd Ed25519 na Curve25519 dilys - invalid_signature: ddim yn llofnod Ed25519 dilys date: formats: default: "%b %d %Y" diff --git a/config/locales/da.yml b/config/locales/da.yml index 004aea520ad..afaf729338f 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -1153,7 +1153,6 @@ da: crypto: errors: invalid_key: er ikke en gyldig Ed25519- eller Curve25519-nøgle - invalid_signature: er ikke en gylidig Ed25519-signatur date: formats: default: "%d. %b %Y" diff --git a/config/locales/de.yml b/config/locales/de.yml index b133cf94bcb..36866b981fc 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1154,7 +1154,6 @@ de: crypto: errors: invalid_key: ist kein gültiger Ed25519- oder Curve25519-Schlüssel - invalid_signature: ist keine gültige Ed25519-Signatur date: formats: default: "%d. %b %Y" diff --git a/config/locales/el.yml b/config/locales/el.yml index e177bf342af..9c77a609ebf 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -1061,7 +1061,6 @@ el: crypto: errors: invalid_key: δεν είναι έγκυρο κλειδί Ed25519 ή Curve25519 - invalid_signature: δεν είναι έγκυρη υπογραφή Ed25519 date: formats: default: "%b %d, %Y" diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index a7e6ed7a665..25659efda06 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -1138,7 +1138,6 @@ en-GB: crypto: errors: invalid_key: is not a valid Ed25519 or Curve25519 key - invalid_signature: is not a valid Ed25519 signature date: formats: default: "%b %d, %Y" diff --git a/config/locales/en.yml b/config/locales/en.yml index aab8db18153..fd4ae900821 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1154,7 +1154,6 @@ en: crypto: errors: invalid_key: is not a valid Ed25519 or Curve25519 key - invalid_signature: is not a valid Ed25519 signature date: formats: default: "%b %d, %Y" diff --git a/config/locales/eo.yml b/config/locales/eo.yml index 95e3dd5a8d9..aafdab1d2f7 100644 --- a/config/locales/eo.yml +++ b/config/locales/eo.yml @@ -1080,7 +1080,6 @@ eo: crypto: errors: invalid_key: 올바른 Ed25519 혹은 Curve25519 키가 아닙니다 - invalid_signature: 올바른 Ed25519 시그니처가 아닙니다 date: formats: default: "%Y-%b-%d" diff --git a/config/locales/es-AR.yml b/config/locales/es-AR.yml index 8ebe203560a..3570f3099ac 100644 --- a/config/locales/es-AR.yml +++ b/config/locales/es-AR.yml @@ -1154,7 +1154,6 @@ es-AR: crypto: errors: invalid_key: no es una clave Ed25519 o Curve25519 válida - invalid_signature: no es una firma Ed25519 válida date: formats: default: "%d de %b de %Y" diff --git a/config/locales/es-MX.yml b/config/locales/es-MX.yml index f39de2b27b1..f3091474092 100644 --- a/config/locales/es-MX.yml +++ b/config/locales/es-MX.yml @@ -1138,7 +1138,6 @@ es-MX: crypto: errors: invalid_key: no es una clave Ed25519 o Curve25519 válida - invalid_signature: no es una firma Ed25519 válida date: formats: default: "%d %b %Y" diff --git a/config/locales/es.yml b/config/locales/es.yml index fbee73ed2ac..f92e0923931 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1138,7 +1138,6 @@ es: crypto: errors: invalid_key: no es una clave Ed25519 o Curve25519 válida - invalid_signature: no es una firma Ed25519 válida date: formats: default: "%d %b %Y" diff --git a/config/locales/et.yml b/config/locales/et.yml index 30d75d25ee4..8bef6faef41 100644 --- a/config/locales/et.yml +++ b/config/locales/et.yml @@ -1133,7 +1133,6 @@ et: crypto: errors: invalid_key: ei ole õige Ed25519 ega Curve25519 võti - invalid_signature: ei ole õige Ed25519 allkiri date: formats: default: "%d. %b %Y" diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 67da357e1de..2b08ce95177 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -1132,7 +1132,6 @@ eu: crypto: errors: invalid_key: ez da baliozko Ed25519 edo Curve25519 gakoa - invalid_signature: ez da baliozko Ed25519 sinadura date: formats: default: "%Y(e)ko %b %d" diff --git a/config/locales/fa.yml b/config/locales/fa.yml index 509d69fcba7..4166015c220 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -952,7 +952,6 @@ fa: crypto: errors: invalid_key: یک کلید معتبر Ed25519 یا Curve25519 نیست - invalid_signature: یک امضای معتبر Ed25519 نیست date: formats: default: "%d %b %Y" diff --git a/config/locales/fi.yml b/config/locales/fi.yml index f3cb791e60d..34314d61b07 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1154,7 +1154,6 @@ fi: crypto: errors: invalid_key: ei ole kelvollinen Ed25519- tai Curve25519-avain - invalid_signature: ei ole kelvollinen Ed25519-allekirjoitus date: formats: default: "%b %d, %Y" diff --git a/config/locales/fo.yml b/config/locales/fo.yml index 74b37c759ef..ba62a85ee08 100644 --- a/config/locales/fo.yml +++ b/config/locales/fo.yml @@ -1154,7 +1154,6 @@ fo: crypto: errors: invalid_key: er ikki ein gildur Ed25519 ella Curve25519 lykil - invalid_signature: er ikki ein gildug Ed25519 undirskrift date: formats: default: "%b %d, %Y" diff --git a/config/locales/fr-CA.yml b/config/locales/fr-CA.yml index f297e8bfdea..5a642b6705d 100644 --- a/config/locales/fr-CA.yml +++ b/config/locales/fr-CA.yml @@ -1129,7 +1129,6 @@ fr-CA: crypto: errors: invalid_key: n’est pas une clé Ed25519 ou Curve25519 valide - invalid_signature: n’est pas une signature Ed25519 valide date: formats: default: "%d %b %Y" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 33cdcd44cc5..4e59a799d5f 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1129,7 +1129,6 @@ fr: crypto: errors: invalid_key: n’est pas une clé Ed25519 ou Curve25519 valide - invalid_signature: n’est pas une signature Ed25519 valide date: formats: default: "%d %b %Y" diff --git a/config/locales/fy.yml b/config/locales/fy.yml index 054ae2fab2a..1d6816fb598 100644 --- a/config/locales/fy.yml +++ b/config/locales/fy.yml @@ -1138,7 +1138,6 @@ fy: crypto: errors: invalid_key: is gjin jildige Ed25519- of Curve25519-kaai - invalid_signature: is gjin jildige Ed25519-hantekening date: formats: default: "%d %b %Y" diff --git a/config/locales/ga.yml b/config/locales/ga.yml index 57162e2ed1d..22f56f5e6d6 100644 --- a/config/locales/ga.yml +++ b/config/locales/ga.yml @@ -1192,7 +1192,6 @@ ga: crypto: errors: invalid_key: nach eochair bhailí Ed25519 nó Curve25519 í - invalid_signature: nach síniú bailí Ed25519 é date: formats: default: "%b %d, %Y" diff --git a/config/locales/gd.yml b/config/locales/gd.yml index 52b25e28543..1dd4c228785 100644 --- a/config/locales/gd.yml +++ b/config/locales/gd.yml @@ -1165,7 +1165,6 @@ gd: crypto: errors: invalid_key: "– chan e iuchair Ed25519 no Curve25519 dhligheach a th’ ann" - invalid_signature: "– chan e soidhneadh Ed25519 dligheach a th’ ann" date: formats: default: "%d %b %Y" diff --git a/config/locales/gl.yml b/config/locales/gl.yml index d6c00d205ca..6096e26ee90 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -1154,7 +1154,6 @@ gl: crypto: errors: invalid_key: non é unha chave Ed25519 ou Curve25519 válida - invalid_signature: non é unha sinatura Ed25519 válida date: formats: default: "%d %b, %Y" diff --git a/config/locales/he.yml b/config/locales/he.yml index 5a9571da754..8db761f4d99 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -1174,7 +1174,6 @@ he: crypto: errors: invalid_key: זהו לא מפתח Ed25519 או Curve25519 קביל - invalid_signature: היא לא חתימת Ed25519 קבילה date: formats: default: "%b %d, %Y" diff --git a/config/locales/hu.yml b/config/locales/hu.yml index e4f5c1b847b..89525ffe5fe 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1154,7 +1154,6 @@ hu: crypto: errors: invalid_key: érvénytelen Ed25519 vagy Curve25519 kulcs - invalid_signature: érvénytelen Ed25519 aláírás date: formats: default: "%Y. %b %d." diff --git a/config/locales/hy.yml b/config/locales/hy.yml index 5042e3f7f06..bc6f0762cd0 100644 --- a/config/locales/hy.yml +++ b/config/locales/hy.yml @@ -508,7 +508,6 @@ hy: crypto: errors: invalid_key: անվաւեր Ed25519 կամ Curve25519 բանալի - invalid_signature: անվաւեր Ed25519 բանալի date: formats: default: "%b %d, %Y" diff --git a/config/locales/ia.yml b/config/locales/ia.yml index 964230d5a57..187f96a87d4 100644 --- a/config/locales/ia.yml +++ b/config/locales/ia.yml @@ -1138,7 +1138,6 @@ ia: crypto: errors: invalid_key: non es un clave Ed25519 o Curve25519 valide - invalid_signature: non es un signatura Ed25519 valide date: formats: default: "%d %b %Y" diff --git a/config/locales/id.yml b/config/locales/id.yml index ac42afdb4f7..52754bebf9d 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -970,7 +970,6 @@ id: crypto: errors: invalid_key: bukan kunci Ed25519 atau Curve25519 yang valid - invalid_signature: bukan tanda tangan Ed25519 yang valid date: formats: default: "%d %b %Y" diff --git a/config/locales/ie.yml b/config/locales/ie.yml index 432e7d031b0..4612e1f8da9 100644 --- a/config/locales/ie.yml +++ b/config/locales/ie.yml @@ -1130,7 +1130,6 @@ ie: crypto: errors: invalid_key: ne es un valid clave Ed25519 o Curve25519 - invalid_signature: ne es un valid signatura Ed25519 date: formats: default: "%d.%m.%Y" diff --git a/config/locales/io.yml b/config/locales/io.yml index bccdcb3cc5c..ef394839907 100644 --- a/config/locales/io.yml +++ b/config/locales/io.yml @@ -1105,7 +1105,6 @@ io: crypto: errors: invalid_key: ne esas valida klefo Ed25519 o Curve25519 - invalid_signature: ne esas valida parafo Ed25519 date: formats: default: "%d %b, %Y" diff --git a/config/locales/is.yml b/config/locales/is.yml index 4aa05fb10cd..5d7b6738e65 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -1158,7 +1158,6 @@ is: crypto: errors: invalid_key: er ekki gildur Ed25519 eða Curve25519-lykill - invalid_signature: er ekki gild Ed25519 undirritun date: formats: default: "%d. %b, %Y" diff --git a/config/locales/it.yml b/config/locales/it.yml index d552d08a45c..327c312fd7b 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1156,7 +1156,6 @@ it: crypto: errors: invalid_key: non è una chiave Ed25519 o Curve25519 valida - invalid_signature: non è una firma Ed25519 valida date: formats: default: "%d %b %Y" diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 0eeb055170a..4434200d5ae 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1117,7 +1117,6 @@ ja: crypto: errors: invalid_key: 有効なEd25519またはCurve25519キーではありません - invalid_signature: 有効なEd25519署名ではありません date: formats: default: "%Y年%m月%d日" diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 4a1afee8427..546f9efc233 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1121,7 +1121,6 @@ ko: crypto: errors: invalid_key: 유효하지 않은 Ed25519 또는 Curve25519 키 - invalid_signature: 유효하지 않은 Ed25519 서명 date: formats: default: "%Y-%m-%d" diff --git a/config/locales/ku.yml b/config/locales/ku.yml index c24337dd7c0..f0449879acb 100644 --- a/config/locales/ku.yml +++ b/config/locales/ku.yml @@ -984,7 +984,6 @@ ku: crypto: errors: invalid_key: ed25519 ne derbasdare ne jî Curve25519 kilîta - invalid_signature: Ed25519 ne îmzeyek derbasdar e date: formats: default: "%b%d%Y" diff --git a/config/locales/lad.yml b/config/locales/lad.yml index d0657e73f99..cc362271f79 100644 --- a/config/locales/lad.yml +++ b/config/locales/lad.yml @@ -1130,7 +1130,6 @@ lad: crypto: errors: invalid_key: no es una yave Ed25519 o Curve25519 valida - invalid_signature: no es una firma Ed25519 valida date: formats: default: "%d %b %Y" diff --git a/config/locales/lv.yml b/config/locales/lv.yml index 5a071eba863..0fb9aee132e 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -1139,7 +1139,6 @@ lv: crypto: errors: invalid_key: nav derīga Ed25519 vai Curve25519 atslēga - invalid_signature: nav derīgs Ed25519 paraksts date: formats: default: "%b %d, %Y" diff --git a/config/locales/ms.yml b/config/locales/ms.yml index a778d0c28f1..b21f6abd808 100644 --- a/config/locales/ms.yml +++ b/config/locales/ms.yml @@ -1092,7 +1092,6 @@ ms: crypto: errors: invalid_key: bukan kunci Ed25519 atau Curve25519 yang sah - invalid_signature: bukan tandatangan Ed25519 yang sah date: formats: default: "%b %d, %Y" diff --git a/config/locales/my.yml b/config/locales/my.yml index f28458360b5..659ae8a899e 100644 --- a/config/locales/my.yml +++ b/config/locales/my.yml @@ -1084,7 +1084,6 @@ my: crypto: errors: invalid_key: မှန်ကန်သော Ed25519 သို့မဟုတ် Curve25519 ကီး မဟုတ်ပါ။ - invalid_signature: မှန်ကန်သော Ed25519 လက်မှတ်မဟုတ်ပါ date: formats: default: "%b %d, %Y" diff --git a/config/locales/nl.yml b/config/locales/nl.yml index da1684e8a9b..3a58c65c373 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1154,7 +1154,6 @@ nl: crypto: errors: invalid_key: is geen geldige Ed25519- of Curve25519-sleutel - invalid_signature: is geen geldige Ed25519-handtekening date: formats: default: "%d %b %Y" diff --git a/config/locales/nn.yml b/config/locales/nn.yml index ec77a2edf87..63cca079f92 100644 --- a/config/locales/nn.yml +++ b/config/locales/nn.yml @@ -1135,7 +1135,6 @@ nn: crypto: errors: invalid_key: er ikkje ein gild Ed25519 eller Curve25519 nykel - invalid_signature: er ikkje ein gild Ed25519-signatur date: formats: default: "%d. %b, %Y" diff --git a/config/locales/no.yml b/config/locales/no.yml index 537552ea986..8e002e68580 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -1123,7 +1123,6 @@ crypto: errors: invalid_key: er ikke en gyldig Ed25519- eller Curve25519-nøkkel - invalid_signature: er ikke en gyldig Ed25519-signatur date: formats: default: "%d. %b, %Y" diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 1477396999f..08755328bc1 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1190,7 +1190,6 @@ pl: crypto: errors: invalid_key: nie jest prawidłowym kluczem Ed25519 lub Curve25519 - invalid_signature: nie jest prawidłowym podpisem Ed25519 date: formats: default: "%d. %b %Y" diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 584a9253b81..5ee64a6bf03 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -1133,7 +1133,6 @@ pt-BR: crypto: errors: invalid_key: não é uma chave Ed25519 ou Curve25519 válida - invalid_signature: não é uma assinatura Ed25519 válida date: formats: default: "%d %b, %Y" diff --git a/config/locales/pt-PT.yml b/config/locales/pt-PT.yml index ed6a8a4028c..e21b2684f59 100644 --- a/config/locales/pt-PT.yml +++ b/config/locales/pt-PT.yml @@ -1154,7 +1154,6 @@ pt-PT: crypto: errors: invalid_key: não é uma chave Ed25519 ou Curve25519 válida - invalid_signature: não é uma assinatura Ed25519 válida date: formats: default: "%d %b %Y" diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 5f5b3676fb6..86171edcd9a 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1158,7 +1158,6 @@ ru: crypto: errors: invalid_key: не является допустимым Ed25519 или Curve25519 ключом - invalid_signature: не является допустимой Ed25519 подписью date: formats: default: "%d %b %Y" diff --git a/config/locales/sc.yml b/config/locales/sc.yml index 6f4fd6eb30d..878180bcad5 100644 --- a/config/locales/sc.yml +++ b/config/locales/sc.yml @@ -712,7 +712,6 @@ sc: crypto: errors: invalid_key: no est una crae Ed25519 o Curve25519 vàlida - invalid_signature: no est una firma Ed25519 vàlida date: formats: default: "%d %b, %Y" diff --git a/config/locales/sco.yml b/config/locales/sco.yml index 7c733b71b50..eb803ea3201 100644 --- a/config/locales/sco.yml +++ b/config/locales/sco.yml @@ -974,7 +974,6 @@ sco: crypto: errors: invalid_key: isnae a valid Ed25519 or Curve25519 key - invalid_signature: isnae a valid Ed25519 signature date: formats: default: "%b %d, %Y" diff --git a/config/locales/si.yml b/config/locales/si.yml index 85e242b630f..9541ec84657 100644 --- a/config/locales/si.yml +++ b/config/locales/si.yml @@ -855,7 +855,6 @@ si: crypto: errors: invalid_key: වලංගු Ed25519 හෝ Curve25519 යතුරක් නොවේ - invalid_signature: වලංගු Ed25519 අත්සනක් නොවේ date: formats: default: "%Y %b %d" diff --git a/config/locales/sl.yml b/config/locales/sl.yml index f63aadd6c8f..be7544ef521 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -1171,7 +1171,6 @@ sl: crypto: errors: invalid_key: ni veljaven ključ Ed25519 ali Curve25519 - invalid_signature: ni veljaven podpis Ed25519 date: formats: default: "%d %b %Y" diff --git a/config/locales/sq.yml b/config/locales/sq.yml index 92e182cfda3..7fa68ae5903 100644 --- a/config/locales/sq.yml +++ b/config/locales/sq.yml @@ -1146,7 +1146,6 @@ sq: crypto: errors: invalid_key: s’është kyç Ed25519 ose Curve25519 i vlefshëm - invalid_signature: s’është nënshkrim Ed25519 i vlefshëm date: formats: default: "%d %b, %Y" diff --git a/config/locales/sr-Latn.yml b/config/locales/sr-Latn.yml index f6e6d4d2a68..83430bec1d7 100644 --- a/config/locales/sr-Latn.yml +++ b/config/locales/sr-Latn.yml @@ -1151,7 +1151,6 @@ sr-Latn: crypto: errors: invalid_key: nije validan Ed25519 ili Curve25519 ključ - invalid_signature: nije validan Ed25519 potpis date: formats: default: "%d. %b. %Y." diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 9bfefde83c0..3b60e564e6e 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -1151,7 +1151,6 @@ sr: crypto: errors: invalid_key: није валидан Ed25519 или Curve25519 кључ - invalid_signature: није валидан Ed25519 потпис date: formats: default: "%d. %b. %Y." diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 8054c113558..871f9507bc6 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -1143,7 +1143,6 @@ sv: crypto: errors: invalid_key: är inte en giltig Ed25519 eller Curve25519 nyckel - invalid_signature: är inte en giltig Ed25519 signatur date: formats: default: "%b %d, %Y" diff --git a/config/locales/ta.yml b/config/locales/ta.yml index 3a22b572b11..89a0f84ea5f 100644 --- a/config/locales/ta.yml +++ b/config/locales/ta.yml @@ -194,7 +194,6 @@ ta: crypto: errors: invalid_key: ஒரு முறையான Ed25519 அல்லது Curve25519 key அல்ல - invalid_signature: ஒரு முறையான Ed25519 அடையாளம் அல்ல filters: index: empty: தடுப்புகள் ஏதும் இல்லை. diff --git a/config/locales/th.yml b/config/locales/th.yml index 678b5ab638f..6a3aa693d4a 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -1120,7 +1120,6 @@ th: crypto: errors: invalid_key: ไม่ใช่กุญแจ Ed25519 หรือ Curve25519 ที่ถูกต้อง - invalid_signature: ไม่ใช่ลายเซ็น Ed25519 ที่ถูกต้อง date: formats: default: "%d %b %Y" diff --git a/config/locales/tr.yml b/config/locales/tr.yml index f561781e59e..c3d8a2d887b 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -1138,7 +1138,6 @@ tr: crypto: errors: invalid_key: geçerli bir Ed25519 veya Curve25519 anahtarı değil - invalid_signature: geçerli bir Ed25519 imzası değil date: formats: default: "%d %b %Y" diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 31ce3e6b798..cebc190136b 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -1174,7 +1174,6 @@ uk: crypto: errors: invalid_key: не є припустимим ключем Ed25519 або Curve25519 - invalid_signature: не є дійсним підписом Ed25519 date: formats: default: "%b %d, %Y" diff --git a/config/locales/vi.yml b/config/locales/vi.yml index dacaafd7681..ba222cdea42 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -1136,7 +1136,6 @@ vi: crypto: errors: invalid_key: không phải là mã khóa Ed25519 hoặc Curve25519 đúng - invalid_signature: không phải là chữ ký số Ed25519 đúng date: formats: default: "%-d %B, %Y" diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index f08142719aa..f0dde30dd9f 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -1136,7 +1136,6 @@ zh-CN: crypto: errors: invalid_key: 不是有效的 Ed25519 或者 Curve25519 密钥 - invalid_signature: 不是有效的 Ed25519 签名 date: formats: default: "%Y年%m月%d日" diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index ddc6571e6da..d47dc18a2b3 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -1112,7 +1112,6 @@ zh-HK: crypto: errors: invalid_key: 不是一個有效的 Ed25519 或 Curve25519 密鑰 - invalid_signature: 不是一個有效的 Ed25519 簽名 date: formats: default: "%Y年%b月%d日" diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index ef2da39f30b..05e49ca39a5 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1138,7 +1138,6 @@ zh-TW: crypto: errors: invalid_key: 這不是一把有效的 Ed25519 或 Curve25519 金鑰 - invalid_signature: 這不是有效的 Ed25519 簽章 date: formats: default: "%Y年%b月%d日" diff --git a/config/routes.rb b/config/routes.rb index 3ac619519d4..ad607e537be 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -134,7 +134,6 @@ Rails.application.routes.draw do scope module: :activitypub do resource :outbox, only: [:show] resource :inbox, only: [:create] - resource :claim, only: [:create] resources :collections, only: [:show] resource :followers_synchronization, only: [:show] end diff --git a/config/routes/api.rb b/config/routes/api.rb index e488bb9187e..f66d28e091a 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -68,23 +68,6 @@ namespace :api, format: false do end end - # namespace :crypto do - # resources :deliveries, only: :create - - # namespace :keys do - # resource :upload, only: [:create] - # resource :query, only: [:create] - # resource :claim, only: [:create] - # resource :count, only: [:show] - # end - - # resources :encrypted_messages, only: [:index] do - # collection do - # post :clear - # end - # end - # end - resources :conversations, only: [:index, :destroy] do member do post :read diff --git a/db/migrate/20240720140205_drop_end_to_end_message_tables.rb b/db/migrate/20240720140205_drop_end_to_end_message_tables.rb new file mode 100644 index 00000000000..dd5662885c5 --- /dev/null +++ b/db/migrate/20240720140205_drop_end_to_end_message_tables.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class DropEndToEndMessageTables < ActiveRecord::Migration[7.1] + def up + drop_table :system_keys + drop_table :one_time_keys + drop_table :encrypted_messages + drop_table :devices + safety_assured { remove_column :accounts, :devices_url } + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end diff --git a/db/schema.rb b/db/schema.rb index d4796079cae..d6133c9c92b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -193,7 +193,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_24_181224) do t.boolean "hide_collections" t.integer "avatar_storage_schema_version" t.integer "header_storage_schema_version" - t.string "devices_url" t.datetime "sensitized_at", precision: nil t.integer "suspension_origin" t.boolean "trendable" @@ -411,19 +410,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_24_181224) do t.index ["account_id"], name: "index_custom_filters_on_account_id" end - create_table "devices", force: :cascade do |t| - t.bigint "access_token_id" - t.bigint "account_id" - t.string "device_id", default: "", null: false - t.string "name", default: "", null: false - t.text "fingerprint_key", default: "", null: false - t.text "identity_key", default: "", null: false - t.datetime "created_at", precision: nil, null: false - t.datetime "updated_at", precision: nil, null: false - t.index ["access_token_id"], name: "index_devices_on_access_token_id" - t.index ["account_id"], name: "index_devices_on_account_id" - end - create_table "domain_allows", force: :cascade do |t| t.string "domain", default: "", null: false t.datetime "created_at", precision: nil, null: false @@ -453,20 +439,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_24_181224) do t.index ["domain"], name: "index_email_domain_blocks_on_domain", unique: true end - create_table "encrypted_messages", id: :bigint, default: -> { "timestamp_id('encrypted_messages'::text)" }, force: :cascade do |t| - t.bigint "device_id" - t.bigint "from_account_id" - t.string "from_device_id", default: "", null: false - t.integer "type", default: 0, null: false - t.text "body", default: "", null: false - t.text "digest", default: "", null: false - t.text "message_franking", default: "", null: false - t.datetime "created_at", precision: nil, null: false - t.datetime "updated_at", precision: nil, null: false - t.index ["device_id"], name: "index_encrypted_messages_on_device_id" - t.index ["from_account_id"], name: "index_encrypted_messages_on_from_account_id" - end - create_table "favourites", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false @@ -779,17 +751,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_24_181224) do t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true end - create_table "one_time_keys", force: :cascade do |t| - t.bigint "device_id" - t.string "key_id", default: "", null: false - t.text "key", default: "", null: false - t.text "signature", default: "", null: false - t.datetime "created_at", precision: nil, null: false - t.datetime "updated_at", precision: nil, null: false - t.index ["device_id"], name: "index_one_time_keys_on_device_id" - t.index ["key_id"], name: "index_one_time_keys_on_key_id" - end - create_table "pghero_space_stats", force: :cascade do |t| t.text "database" t.text "schema" @@ -1102,12 +1063,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_24_181224) do t.index ["status_id"], name: "index_statuses_tags_on_status_id" end - create_table "system_keys", force: :cascade do |t| - t.binary "key" - t.datetime "created_at", precision: nil, null: false - t.datetime "updated_at", precision: nil, null: false - end - create_table "tag_follows", force: :cascade do |t| t.bigint "tag_id", null: false t.bigint "account_id", null: false @@ -1304,11 +1259,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_24_181224) do add_foreign_key "custom_filter_statuses", "custom_filters", on_delete: :cascade add_foreign_key "custom_filter_statuses", "statuses", on_delete: :cascade add_foreign_key "custom_filters", "accounts", on_delete: :cascade - add_foreign_key "devices", "accounts", on_delete: :cascade - add_foreign_key "devices", "oauth_access_tokens", column: "access_token_id", on_delete: :cascade add_foreign_key "email_domain_blocks", "email_domain_blocks", column: "parent_id", on_delete: :cascade - add_foreign_key "encrypted_messages", "accounts", column: "from_account_id", on_delete: :cascade - add_foreign_key "encrypted_messages", "devices", on_delete: :cascade add_foreign_key "favourites", "accounts", name: "fk_5eb6c2b873", on_delete: :cascade add_foreign_key "favourites", "statuses", name: "fk_b0e856845e", on_delete: :cascade add_foreign_key "featured_tags", "accounts", on_delete: :cascade @@ -1351,7 +1302,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_24_181224) do add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id", name: "fk_f5fc4c1ee3", on_delete: :cascade add_foreign_key "oauth_access_tokens", "users", column: "resource_owner_id", name: "fk_e84df68546", on_delete: :cascade add_foreign_key "oauth_applications", "users", column: "owner_id", name: "fk_b0988c7c0a", on_delete: :cascade - add_foreign_key "one_time_keys", "devices", on_delete: :cascade add_foreign_key "poll_votes", "accounts", on_delete: :cascade add_foreign_key "poll_votes", "polls", on_delete: :cascade add_foreign_key "polls", "accounts", on_delete: :cascade diff --git a/spec/controllers/activitypub/claims_controller_spec.rb b/spec/controllers/activitypub/claims_controller_spec.rb deleted file mode 100644 index f00eeb732a7..00000000000 --- a/spec/controllers/activitypub/claims_controller_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe ActivityPub::ClaimsController do - let(:account) { Fabricate(:account) } - - describe 'POST #create' do - context 'without signature' do - before do - post :create, params: { account_username: account.username }, body: '{}' - end - - it 'returns http not authorized' do - expect(response).to have_http_status(401) - end - end - end -end diff --git a/spec/fabricators/device_fabricator.rb b/spec/fabricators/device_fabricator.rb deleted file mode 100644 index 37a2e8977d1..00000000000 --- a/spec/fabricators/device_fabricator.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -Fabricator(:device) do - access_token { Fabricate.build(:access_token) } - account { Fabricate.build(:account) } - device_id { Faker::Number.number(digits: 5) } - name { Faker::App.name } - fingerprint_key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) } - identity_key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) } -end diff --git a/spec/fabricators/encrypted_message_fabricator.rb b/spec/fabricators/encrypted_message_fabricator.rb deleted file mode 100644 index 349b659c2f5..00000000000 --- a/spec/fabricators/encrypted_message_fabricator.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -Fabricator(:encrypted_message) do - device { Fabricate.build(:device) } - from_account { Fabricate.build(:account) } - from_device_id { Faker::Number.number(digits: 5) } -end diff --git a/spec/fabricators/one_time_key_fabricator.rb b/spec/fabricators/one_time_key_fabricator.rb deleted file mode 100644 index 505282e05dd..00000000000 --- a/spec/fabricators/one_time_key_fabricator.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -Fabricator(:one_time_key) do - device { Fabricate.build(:device) } - key_id { Faker::Alphanumeric.alphanumeric(number: 10) } - key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) } - - signature do |attrs| - signing_key = Ed25519::SigningKey.generate - attrs[:device].update(fingerprint_key: Base64.strict_encode64(signing_key.verify_key.to_bytes)) - Base64.strict_encode64(signing_key.sign(attrs[:key])) - end -end diff --git a/spec/fabricators/system_key_fabricator.rb b/spec/fabricators/system_key_fabricator.rb deleted file mode 100644 index bcb3bd5577b..00000000000 --- a/spec/fabricators/system_key_fabricator.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -Fabricator(:system_key) diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index dec17b916b8..0986ae17151 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -936,64 +936,6 @@ RSpec.describe ActivityPub::Activity::Create do end end - context 'with an encrypted message' do - subject { described_class.new(json, sender, delivery: true, delivered_to_account_id: recipient.id) } - - let(:recipient) { Fabricate(:account) } - let(:object_json) do - { - id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, - type: 'EncryptedMessage', - attributedTo: { - type: 'Device', - deviceId: '1234', - }, - to: { - type: 'Device', - deviceId: target_device.device_id, - }, - messageType: 1, - cipherText: 'Foo', - messageFranking: 'Baz678', - digest: { - digestAlgorithm: 'Bar456', - digestValue: 'Foo123', - }, - } - end - let(:target_device) { Fabricate(:device, account: recipient) } - - before do - subject.perform - end - - it 'creates an encrypted message' do - encrypted_message = target_device.encrypted_messages.reload.first - - expect(encrypted_message) - .to be_present - .and have_attributes( - from_device_id: eq('1234'), - from_account: eq(sender), - type: eq(1), - body: eq('Foo'), - digest: eq('Foo123') - ) - end - - it 'creates a message franking' do - encrypted_message = target_device.encrypted_messages.reload.first - message_franking = encrypted_message.message_franking - - crypt = ActiveSupport::MessageEncryptor.new(SystemKey.current_key, serializer: Oj) - json = crypt.decrypt_and_verify(message_franking) - - expect(json['source_account_id']).to eq sender.id - expect(json['target_account_id']).to eq recipient.id - expect(json['original_franking']).to eq 'Baz678' - end - end - context 'when sender is followed by local users' do subject { described_class.new(json, sender, delivery: true) } diff --git a/spec/lib/vacuum/system_keys_vacuum_spec.rb b/spec/lib/vacuum/system_keys_vacuum_spec.rb deleted file mode 100644 index 84cae30411e..00000000000 --- a/spec/lib/vacuum/system_keys_vacuum_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe Vacuum::SystemKeysVacuum do - subject { described_class.new } - - describe '#perform' do - let!(:expired_system_key) { Fabricate(:system_key, created_at: (SystemKey::ROTATION_PERIOD * 4).ago) } - let!(:current_system_key) { Fabricate(:system_key) } - - before do - subject.perform - end - - it 'deletes the expired key' do - expect { expired_system_key.reload }.to raise_error ActiveRecord::RecordNotFound - end - - it 'does not delete the current key' do - expect { current_system_key.reload }.to_not raise_error - end - end -end diff --git a/spec/models/one_time_key_spec.rb b/spec/models/one_time_key_spec.rb deleted file mode 100644 index 6ff7ffc5c14..00000000000 --- a/spec/models/one_time_key_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe OneTimeKey do - describe 'validations' do - context 'with an invalid signature' do - let(:one_time_key) { Fabricate.build(:one_time_key, signature: 'wrong!') } - - it 'is invalid' do - expect(one_time_key).to_not be_valid - end - end - - context 'with an invalid key' do - let(:one_time_key) { Fabricate.build(:one_time_key, key: 'wrong!') } - - it 'is invalid' do - expect(one_time_key).to_not be_valid - end - end - end -end diff --git a/spec/serializers/activitypub/device_serializer_spec.rb b/spec/serializers/activitypub/device_serializer_spec.rb deleted file mode 100644 index 23f0b24c4ea..00000000000 --- a/spec/serializers/activitypub/device_serializer_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe ActivityPub::DeviceSerializer do - let(:serialization) { serialized_record_json(record, described_class) } - let(:record) { Fabricate(:device) } - - describe 'type' do - it 'returns correct serialized type' do - expect(serialization['type']).to eq('Device') - end - end -end diff --git a/spec/serializers/activitypub/one_time_key_serializer_spec.rb b/spec/serializers/activitypub/one_time_key_serializer_spec.rb deleted file mode 100644 index 89efe95c8c2..00000000000 --- a/spec/serializers/activitypub/one_time_key_serializer_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe ActivityPub::OneTimeKeySerializer do - let(:serialization) { serialized_record_json(record, described_class) } - let(:record) { Fabricate(:one_time_key) } - - describe 'type' do - it 'returns correct serialized type' do - expect(serialization['type']).to eq('Curve25519Key') - end - end -end diff --git a/spec/serializers/rest/encrypted_message_serializer_spec.rb b/spec/serializers/rest/encrypted_message_serializer_spec.rb deleted file mode 100644 index 01db1149af5..00000000000 --- a/spec/serializers/rest/encrypted_message_serializer_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe REST::EncryptedMessageSerializer do - let(:serialization) { serialized_record_json(record, described_class) } - let(:record) { Fabricate(:encrypted_message) } - - describe 'account' do - it 'returns the associated account' do - expect(serialization['account_id']).to eq(record.from_account.id.to_s) - end - end -end diff --git a/spec/serializers/rest/keys/claim_result_serializer_spec.rb b/spec/serializers/rest/keys/claim_result_serializer_spec.rb deleted file mode 100644 index 7f7fb850cda..00000000000 --- a/spec/serializers/rest/keys/claim_result_serializer_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe REST::Keys::ClaimResultSerializer do - let(:serialization) { serialized_record_json(record, described_class) } - let(:record) { Keys::ClaimService::Result.new(Account.new(id: 123), 456) } - - describe 'account' do - it 'returns the associated account' do - expect(serialization['account_id']).to eq('123') - end - end -end diff --git a/spec/serializers/rest/keys/device_serializer_spec.rb b/spec/serializers/rest/keys/device_serializer_spec.rb deleted file mode 100644 index 28177a3db5a..00000000000 --- a/spec/serializers/rest/keys/device_serializer_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe REST::Keys::DeviceSerializer do - let(:serialization) { serialized_record_json(record, described_class) } - let(:record) { Device.new(name: 'Device name') } - - describe 'name' do - it 'returns the name' do - expect(serialization['name']).to eq('Device name') - end - end -end diff --git a/spec/serializers/rest/keys/query_result_serializer_spec.rb b/spec/serializers/rest/keys/query_result_serializer_spec.rb deleted file mode 100644 index ef67d706750..00000000000 --- a/spec/serializers/rest/keys/query_result_serializer_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe REST::Keys::QueryResultSerializer do - let(:serialization) { serialized_record_json(record, described_class) } - let(:record) { Keys::QueryService::Result.new(Account.new(id: 123), []) } - - describe 'account' do - it 'returns the associated account id' do - expect(serialization['account_id']).to eq('123') - end - end -end diff --git a/spec/workers/push_encrypted_message_worker_spec.rb b/spec/workers/push_encrypted_message_worker_spec.rb deleted file mode 100644 index 3cd04ce7b4c..00000000000 --- a/spec/workers/push_encrypted_message_worker_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe PushEncryptedMessageWorker do - let(:worker) { described_class.new } - - describe 'perform' do - it 'runs without error for missing record' do - expect { worker.perform(nil) }.to_not raise_error - end - end -end diff --git a/streaming/index.js b/streaming/index.js index dd9ea0c7f68..634ce7314a9 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -45,7 +45,6 @@ initializeLogLevel(process.env, environment); * @property {string[]} scopes * @property {string} accountId * @property {string[]} chosenLanguages - * @property {string} deviceId */ /** @@ -525,7 +524,7 @@ const startServer = async () => { * @returns {Promise} */ const accountFromToken = async (token, req) => { - const result = await pgPool.query('SELECT oauth_access_tokens.id, oauth_access_tokens.resource_owner_id, users.account_id, users.chosen_languages, oauth_access_tokens.scopes, devices.device_id FROM oauth_access_tokens INNER JOIN users ON oauth_access_tokens.resource_owner_id = users.id LEFT OUTER JOIN devices ON oauth_access_tokens.id = devices.access_token_id WHERE oauth_access_tokens.token = $1 AND oauth_access_tokens.revoked_at IS NULL LIMIT 1', [token]); + const result = await pgPool.query('SELECT oauth_access_tokens.id, oauth_access_tokens.resource_owner_id, users.account_id, users.chosen_languages, oauth_access_tokens.scopes FROM oauth_access_tokens INNER JOIN users ON oauth_access_tokens.resource_owner_id = users.id WHERE oauth_access_tokens.token = $1 AND oauth_access_tokens.revoked_at IS NULL LIMIT 1', [token]); if (result.rows.length === 0) { throw new AuthenticationError('Invalid access token'); @@ -535,14 +534,12 @@ const startServer = async () => { req.scopes = result.rows[0].scopes.split(' '); req.accountId = result.rows[0].account_id; req.chosenLanguages = result.rows[0].chosen_languages; - req.deviceId = result.rows[0].device_id; return { accessTokenId: result.rows[0].id, scopes: result.rows[0].scopes.split(' '), accountId: result.rows[0].account_id, chosenLanguages: result.rows[0].chosen_languages, - deviceId: result.rows[0].device_id }; }; @@ -1153,10 +1150,6 @@ const startServer = async () => { const channelsForUserStream = req => { const arr = [`timeline:${req.accountId}`]; - if (isInScope(req, ['crypto']) && req.deviceId) { - arr.push(`timeline:${req.accountId}:${req.deviceId}`); - } - if (isInScope(req, ['read', 'read:notifications'])) { arr.push(`timeline:${req.accountId}:notifications`); }