mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
Fix failing test for change(passphrase:)
This commit is contained in:
1 parent
aded6d206d
commit
1ba4e8c771
2 files changed
+15
-4
No files matched your search
@@ -214,7 +214,7 @@ extension Database {
|
||||
#if SQLITE_HAS_CODEC
|
||||
try validateSQLCipher()
|
||||
if let passphrase = configuration._passphrase {
|
||||
try usePassphrase(passphrase)
|
||||
try _usePassphrase(passphrase)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -967,6 +967,17 @@ extension Database {
|
||||
/// try db.usePassphrase("secret")
|
||||
/// }
|
||||
public func usePassphrase(_ passphrase: String) throws {
|
||||
// Support for the deprecated method change(passphrase:).
|
||||
// After it has been called, the passphrase used for opening the
|
||||
// database must be ignored.
|
||||
if configuration._passphrase != nil {
|
||||
return
|
||||
}
|
||||
try _usePassphrase(passphrase)
|
||||
}
|
||||
|
||||
/// See usePassphrase(_:)
|
||||
private func _usePassphrase(_ passphrase: String) throws {
|
||||
let data = passphrase.data(using: .utf8)!
|
||||
#if swift(>=5.0)
|
||||
let code = data.withUnsafeBytes {
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
- [X] Introduce DatabaseConfiguration.onConnect { ... } as a replacement for DatabaseConfiguration.prepareDatabase
|
||||
- [ ] Consider introducing DatabaseConfiguration.onDisconnect { ... }
|
||||
- [ ] Deprecate change(passphrase:), and provide a static function instead
|
||||
- [ ] Introduce Database.usePassphrase(_:).
|
||||
- [ ] Make Database.usePassphrase(_:) a no-op if DatabaseConfiguration._passphrase is not nil, as support for the deprecated change(passphrase:).
|
||||
- [ ] Deprecate DatabaseConfiguration.passphrase
|
||||
- [X] Introduce Database.usePassphrase(_:).
|
||||
- [X] Make Database.usePassphrase(_:) a no-op if DatabaseConfiguration._passphrase is not nil, as support for the deprecated change(passphrase:).
|
||||
- [X] Deprecate DatabaseConfiguration.passphrase
|
||||
- [ ] Remove SQLiteConnectionDidOpen and
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user