This commit is contained in:
Gwendal Roué committed 2016-07-05 14:41:39 +02:00
1 parent 16a3b88db5
commit 723c7a97fc
1 file changed
+2 -2
+2 -2
View File
@@ -3016,12 +3016,12 @@ To encrypt an existing clear-text database, you have to create an new, empty, en
```swift
// The clear-text database
let clearDBQueue = DatabaseQueue("/path/to/clear.db")
let clearDBQueue = try DatabaseQueue(path: "/path/to/clear.db")
// The encrypted database, at some distinct location:
var configuration = Configuration("/path/to/encrypted.db")
configuration.passphrase = "secret"
let encryptedDBQueue = DatabaseQueue("/path/to/encrypted.db", configuration: config)
let encryptedDBQueue = try DatabaseQueue(path: "/path/to/encrypted.db", configuration: config)
try clearDBQueue.inDatabase { db in
try db.execute("ATTACH DATABASE ? AS encrypted KEY ?", arguments: [encryptedDBQueue.path, "secret"])