RLMSyncConfiguration.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 Realm Inc.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. //
  17. ////////////////////////////////////////////////////////////////////////////
  18. #import <Foundation/Foundation.h>
  19. @class RLMRealmConfiguration;
  20. @class RLMSyncUser;
  21. NS_ASSUME_NONNULL_BEGIN
  22. /**
  23. A configuration object representing configuration state for a Realm which is intended to sync with a Realm Object
  24. Server.
  25. */
  26. @interface RLMSyncConfiguration : NSObject
  27. /// The user to which the remote Realm belongs.
  28. @property (nonatomic, readonly) RLMSyncUser *user;
  29. /**
  30. The URL of the remote Realm upon the Realm Object Server.
  31. @warning The URL cannot end with `.realm`, `.realm.lock` or `.realm.management`.
  32. */
  33. @property (nonatomic, readonly) NSURL *realmURL;
  34. /**
  35. A local path to a file containing the trust anchors for SSL connections.
  36. Only the certificates stored in the PEM file (or any certificates signed by it,
  37. if the file contains a CA cert) will be accepted when initiating a connection
  38. to a server. This prevents certain certain kinds of man-in-the-middle (MITM)
  39. attacks, and can also be used to trust a self-signed certificate which would
  40. otherwise be untrusted.
  41. On macOS, the file may be in any of the formats supported by SecItemImport(),
  42. including PEM and .cer (see SecExternalFormat for a complete list of possible
  43. formats). On iOS and other platforms, only DER .cer files are supported.
  44. */
  45. @property (nonatomic, nullable) NSURL *pinnedCertificateURL;
  46. /**
  47. Whether SSL certificate validation is enabled for the connection associated
  48. with this configuration value. SSL certificate validation is ON by default.
  49. @warning NEVER disable certificate validation for clients and servers in production.
  50. */
  51. @property (nonatomic) BOOL enableSSLValidation;
  52. /// :nodoc:
  53. @property (nonatomic) BOOL isPartial __attribute__((unavailable("Use 'fullSynchronization' instead.")));
  54. /**
  55. Whether this Realm should be a fully synchronized Realm.
  56. Synchronized Realms comes in two flavors: Query-based and Fully synchronized.
  57. A fully synchronized Realm will automatically synchronize the entire Realm in
  58. the background while a query-based Realm will only synchronize the data being
  59. subscribed to. Synchronized realms are by default query-based unless this
  60. boolean is set.
  61. */
  62. @property (nonatomic) BOOL fullSynchronization;
  63. /**
  64. The prefix that is prepended to the path in the HTTP request that initiates a
  65. sync connection. The value specified must match with the server's expectation.
  66. Changing the value of `urlPrefix` should be matched with a corresponding
  67. change of the server's configuration.
  68. If no value is specified here then the default `/realm-sync` path is used.
  69. */
  70. @property (nonatomic, nullable, copy) NSString *urlPrefix;
  71. /**
  72. Whether nonfatal connection errors should cancel async opens.
  73. By default, if a nonfatal connection error such as a connection timing out occurs, any currently pending asyncOpen operations will ignore the error and continue to retry until it succeeds. If this is set to true, the open will instead fail and report the error.
  74. FIXME: This should probably be true by default in the next major version.
  75. */
  76. @property (nonatomic) bool cancelAsyncOpenOnNonFatalErrors;
  77. /// :nodoc:
  78. - (instancetype)initWithUser:(RLMSyncUser *)user realmURL:(NSURL *)url __attribute__((unavailable("Use [RLMSyncUser configurationWithURL:] instead")));
  79. /// :nodoc:
  80. + (RLMRealmConfiguration *)automaticConfiguration __attribute__((unavailable("Use [RLMSyncUser configuration] instead")));
  81. /// :nodoc:
  82. + (RLMRealmConfiguration *)automaticConfigurationForUser:(RLMSyncUser *)user __attribute__((unavailable("Use [RLMSyncUser configuration] instead")));
  83. /// :nodoc:
  84. - (instancetype)init __attribute__((unavailable("This type cannot be created directly")));
  85. /// :nodoc:
  86. + (instancetype)new __attribute__((unavailable("This type cannot be created directly")));
  87. @end
  88. NS_ASSUME_NONNULL_END