Couchbase Lite
Objective-C API for iOS and Mac OS
Class Methods | Properties | List of all members
CBLDatabaseOptions Class Reference

Detailed Description

Options for opening a database.

All properties default to NO or nil.

Inheritance diagram for CBLDatabaseOptions:

Class Methods

(instancetype) + defaultOptions
 Creates a new instance with a default set of options for a CBLDatabase. More...
 

Properties

NSString * directory
 Path to the directory to store the database in. More...
 
NSDataWritingOptions fileProtection
 File protection/encryption options (iOS only.) Defaults to whatever file protection settings you've specified in your app's entitlements. More...
 
id encryptionKey
 A key to encrypt the database with. More...
 
BOOL readOnly
 If YES, the database will be opened read-only. More...
 

Method Documentation

+ (instancetype) defaultOptions

Creates a new instance with a default set of options for a CBLDatabase.

Property Documentation

- (NSString*) directory
readwritenonatomiccopy

Path to the directory to store the database in.

If the directory doesn't already exist it will be created when the database is opened. A nil value (the default) means to use the default directory, in Application Support. You won't usually need to change this.

- (NSDataWritingOptions) fileProtection
readwritenonatomicassign

File protection/encryption options (iOS only.) Defaults to whatever file protection settings you've specified in your app's entitlements.

Specifying a nonzero value here overrides those settings for the database files. If file protection is at the highest level, NSDataWritingFileProtectionCompleteUnlessOpen or NSDataWritingFileProtectionComplete, it will not be possible to read or write the database when the device is locked. This can make it impossible to run replications in the background or respond to push notifications.

- (id) encryptionKey
readwritenonatomicstrong

A key to encrypt the database with.

If the database does not exist and is being created, it will use this key, and the same key must be given every time it's opened.

The primary form of key is an NSData object 32 bytes in length: this is interpreted as a raw AES-256 key. To create a key, generate random data using a secure cryptographic randomizer like SecRandomCopyBytes or CCRandomGenerateBytes. Alternatively, the value may be an NSString containing a passphrase. This will be run through 64,000 rounds of the PBKDF algorithm to securely convert it into an AES-256 key. A default nil value, of course, means the database is unencrypted.

- (BOOL) readOnly
readwritenonatomicassign

If YES, the database will be opened read-only.


The documentation for this class was generated from the following file: