module LdapManager
  class UpdateNostrKey < LdapManagerService
    def initialize(dn:, pubkey:)
      @dn = dn
      @pubkey = pubkey
    end

    def call
      if @pubkey.present?
        replace_attribute @dn, :nostrKey, @pubkey
      else
        delete_attribute @dn, :nostrKey
      end
    end
  end
end
