ZDCCloudRcrd

@interface ZDCCloudRcrd : NSObject

This class represents the decrypted information within a RCRD file.

Every node that gets stored in the cloud gets split into 2 files:

  • the RCRD file contains the treesystem metadata (name of file, permissions, etc)
  • the DATA file contains the actual content of the node

ZeroDark.cloud downloads RCRD files automatically (which are small), in order to keep the local treesystem up-to-date with the cloud. Note, however, that it does NOT automatically download DATA files. Your application gets to decide which DATA files to download & when.

  • Every RCRD has a version number. This relates to the version of the RCRD structure itself (so it’s NOT related to syncing).

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSUInteger version;

    Swift

    var version: UInt { get set }
  • Every RCRD has a cloudID, which is assigned by the server (it’s a UUID). The cloudID is immutable — it cannot be changed. In other words:

    Say a RCRD exists on the server with cloudPath P. Attempting to overwrite the RCRD at P with a new RCRD is only allowed if the newRcrd.cloudID matches oldRcrd.cloudID. If the cloudID’s don’t match, the server requires the oldRCRD to either be deleted or moved first.

    CloudID’s are used to uniquely track a particular item in the cloud. This allows the object to be moved or renamed on the server, while still maintaining a reference to previous versions that may exists on various clients.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *cloudID;

    Swift

    var cloudID: String? { get set }
  • If the RCRD was written by a different user (i.e. not the owner of the bucket), the server will automatically set the sender property to the userID of the user who PUT the item into the bucket.

    This is primarily used in messaging, where the sender of the file is important, and we need to be able to protect against spoofing.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *sender;

    Swift

    var sender: String? { get set }
  • The symmetric key that is used for:

    • the metadata and/or data section of the RCRD
    • the DATA fork (if there is one)

    This value was decrypted using the localUser’s private key.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSData *encryptionKey;

    Swift

    var encryptionKey: Data? { get set }
  • The RAW children dictionary.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSDictionary *children;

    Swift

    var children: [AnyHashable : Any]? { get set }
  • The RAW share dictionary. Use ZDCShareList to parse it.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSDictionary *share;

    Swift

    var share: [AnyHashable : Any]? { get set }
  • Optional burn date. If set, the server will automatically delete the item at approximately this time.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSDate *burnDate;

    Swift

    var burnDate: Date? { get set }
  • Every RCRD must have either a metadata || data section. If it has a data section, the RCRD is not allowed to have an accompanying DATA fork.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSDictionary *metadata;

    Swift

    var metadata: [AnyHashable : Any]? { get set }
  • Every RCRD must have either a metadata || data section. If it has a data section, the RCRD is not allowed to have an accompanying DATA fork.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSDictionary *data;

    Swift

    var data: [AnyHashable : Any]? { get set }
  • If there are any errors parsing the RCRD, or decrypting the content, the errors will be appended to this array.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSArray<NSError *> *_Nonnull errors;

    Swift

    var errors: [Error] { get }
  • Used to append an error to the errors array.

    Declaration

    Objective-C

    - (void)appendError:(nonnull NSError *)error;

    Swift

    func appendError(_ error: Error)
  • Standard nodes just have a single container.

    However, advanced configurations are possible. For example, when using group conversations.

    Declaration

    Objective-C

    - (BOOL)usingAdvancedChildrenContainer;

    Swift

    func usingAdvancedChildrenContainer() -> Bool
  • Enumerates the children containers.

    Declaration

    Objective-C

    - (void)enumerateChildrenWithBlock:(nonnull void (^)(NSString *_Nonnull,
                                                         NSString *_Nonnull,
                                                         BOOL *_Nonnull))block;

    Swift

    func enumerateChildren(_ block: @escaping (String, String, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Extracts the standard dirPrefix from the children dictionary.

    Declaration

    Objective-C

    - (nullable NSString *)dirPrefix;

    Swift

    func dirPrefix() -> String?
  • Returns YES if the data component contains valid pointer info.

    Declaration

    Objective-C

    - (BOOL)isPointer;

    Swift

    func isPointer() -> Bool
  • Extracts pointer information from the data component.

    Declaration

    Objective-C

    - (BOOL)getPointerCloudPath:(ZDCCloudPath *_Nullable *_Nullable)outPath
                        cloudID:(NSString *_Nullable *_Nullable)outCloudID
                        ownerID:(NSString *_Nullable *_Nullable)outOwnerID;

    Swift

    func getPointerCloudPath(_ outPath: AutoreleasingUnsafeMutablePointer<ZDCCloudPath?>?, cloudID outCloudID: AutoreleasingUnsafeMutablePointer<NSString?>?, ownerID outOwnerID: AutoreleasingUnsafeMutablePointer<NSString?>?) -> Bool