Commit 251e90e5c9
Verified · cmc
Changed files (15)
- Sources/OrgApp/CryptPassphrases.swift +215 −46
- Sources/OrgApp/CryptSheet.swift +39 −15
- Sources/OrgApp/DecryptSettings.swift added +77
- Sources/OrgApp/DocumentSession.swift +8 −9
- Sources/Orgstar/ContentView.swift +1
- Sources/Orgstar/OrgstarApp.swift +4
- Sources/OrgstarMobile/OrgstarMobileApp.swift +1
- Sources/OrgstarMobile/SettingsScreen.swift +1
- Tests/OrgAppTests/CryptPassphrasesTests.swift added +220
- Tests/OrgAppTests/CryptReviewTests.swift +12 −11
- Tests/OrgAppTests/CryptSaveTests.swift +4 −4
- docs/manual/guide/04-outlines.org +17 −6
- docs/manual/guide/13-configuration.org +12 −1
- docs/manual/guide/14-ios.org +3 −1
- l10n/Localizable.xcstrings +386 −34
Sources/OrgApp/CryptPassphrases.swift +215 −46 · view
| @@ -4,16 +4,59 @@ import LocalAuthentication | |||
| 4 | import OrgDocument | 4 | import OrgDocument |
| 5 | import Security | 5 | import Security |
| 6 | 6 | ||
| 7 | /// Passphrases for encrypted entries and files, kept in the Keychain by file path when asked. | 7 | /// Where passphrases are saved: the Keychain, or a stand-in in tests. |
| 8 | /// Items are readable only on this device while it's unlocked, and only after Touch ID, Face | ||
| 9 | /// ID or the device's password (`.userPresence`), asked once per file while it's open. Items | ||
| 10 | /// earlier versions stored without that move over at their first read. A build without a | ||
| 11 | /// Keychain entitlement (the Developer ID Mac app) can't make such items and keeps the old kind. | ||
| 12 | @MainActor | 8 | @MainActor |
| 13 | public enum CryptPassphrases { | 9 | public protocol PassphraseKeychain: AnyObject { |
| 10 | /// Whether a passphrase is saved for `path`, without asking for authentication. | ||
| 11 | func contains(_ path: String) -> Bool | ||
| 12 | /// The passphrase saved for `path`, once `context` has authenticated the person; nil otherwise. | ||
| 13 | func read(_ path: String, context: LAContext) async -> String? | ||
| 14 | /// Saves `passphrase` for `path`. A message to show when it wasn't kept; nil otherwise. | ||
| 15 | func write(_ passphrase: String, for path: String) -> String? | ||
| 16 | func delete(_ path: String) | ||
| 17 | /// The paths passphrases are saved for, without asking for authentication. | ||
| 18 | func paths() -> [String] | ||
| 19 | } | ||
| 20 | |||
| 21 | /// Passphrases for encrypted entries and files, saved in the Keychain by file path while "Use | ||
| 22 | /// Face ID to Decrypt" is on. Off or undecided, the Keychain isn't read or written: a passphrase | ||
| 23 | /// is typed and kept in memory while its file is open. Items are readable only on this device | ||
| 24 | /// while it's unlocked, and only after Touch ID, Face ID or the device's password | ||
| 25 | /// (`.userPresence`), asked once per file while it's open. | ||
| 26 | @MainActor | ||
| 27 | @Observable | ||
| 28 | public final class CryptPassphrases { | ||
| 29 | public static let shared = CryptPassphrases() | ||
| 30 | |||
| 31 | /// "Use Face ID to Decrypt", kept in user defaults on this device, not in `config.toml`. | ||
| 32 | public enum Setting: String, Sendable { | ||
| 33 | case undecided, on, off | ||
| 34 | } | ||
| 35 | |||
| 36 | nonisolated static let settingKey = "decryptWithBiometrics" | ||
| 14 | nonisolated static let service = "sh.krz.orgstar.crypt.v2" | 37 | nonisolated static let service = "sh.krz.orgstar.crypt.v2" |
| 15 | /// Where earlier versions kept passphrases, readable without authentication. | 38 | /// Where earlier versions kept passphrases, readable without authentication. |
| 16 | nonisolated static let legacyService = "sh.krz.orgstar.crypt" | 39 | nonisolated static let legacyService = "sh.krz.orgstar.crypt" |
| 40 | |||
| 41 | @ObservationIgnored private let keychain: PassphraseKeychain | ||
| 42 | @ObservationIgnored private let defaults: UserDefaults | ||
| 43 | public private(set) var setting: Setting | ||
| 44 | /// The question waits to be asked at launch: passphrases saved by an earlier version. | ||
| 45 | public var asking = false | ||
| 46 | /// The files with a saved passphrase, as Settings lists them. | ||
| 47 | public private(set) var savedPaths: [String] = [] | ||
| 48 | |||
| 49 | public init(keychain: PassphraseKeychain = SystemKeychain(), defaults: UserDefaults = .standard) { | ||
| 50 | self.keychain = keychain | ||
| 51 | self.defaults = defaults | ||
| 52 | setting = defaults.string(forKey: Self.settingKey).flatMap(Setting.init) ?? .undecided | ||
| 53 | } | ||
| 54 | |||
| 55 | private func set(_ setting: Setting) { | ||
| 56 | self.setting = setting | ||
| 57 | defaults.set(setting.rawValue, forKey: Self.settingKey) | ||
| 58 | } | ||
| 59 | |||
| 17 | /// Whether this build can keep passphrases limited to this device: the Developer ID Mac app | 60 | /// Whether this build can keep passphrases limited to this device: the Developer ID Mac app |
| 18 | /// has no Keychain entitlement and keeps them in the login keychain. | 61 | /// has no Keychain entitlement and keeps them in the login keychain. |
| 19 | public static var protectsItems: Bool { | 62 | public static var protectsItems: Bool { |
| @@ -24,20 +67,91 @@ public enum CryptPassphrases { | |||
| 24 | #endif | 67 | #endif |
| 25 | } | 68 | } |
| 26 | 69 | ||
| 27 | /// Said beside Remember in the Keychain where `protectsItems` is false. | 70 | /// Said beside the setting where `protectsItems` is false. |
| 28 | public static var caveat: String { | 71 | public static var caveat: String { |
| 29 | String(localized: "This version of orgstar keeps remembered passphrases in your login keychain without limiting them to this Mac; Touch ID or your password is still asked before one is used.") | 72 | String(localized: "This version of orgstar keeps remembered passphrases in your login keychain without limiting them to this Mac; Touch ID or your password is still asked before one is used.") |
| 30 | } | 73 | } |
| 31 | 74 | ||
| 32 | /// A Keychain query handed to the thread that waits on it; nothing else uses it meanwhile. | 75 | /// Face ID, Touch ID or Optic ID, as this device has it; the Mac's is Touch ID. |
| 33 | struct Request: @unchecked Sendable { | 76 | public static var biometryName: String { |
| 34 | let query: [String: Any] | 77 | #if os(macOS) |
| 78 | return "Touch ID" | ||
| 79 | #else | ||
| 80 | let context = LAContext() | ||
| 81 | _ = context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil) | ||
| 82 | return switch context.biometryType { | ||
| 83 | case .touchID: "Touch ID" | ||
| 84 | case .opticID: "Optic ID" | ||
| 85 | default: "Face ID" | ||
| 86 | } | ||
| 87 | #endif | ||
| 88 | } | ||
| 89 | |||
| 90 | /// The setting's name. | ||
| 91 | public static var title: String { String(localized: "Use \(biometryName) to Decrypt") } | ||
| 92 | |||
| 93 | /// The question asked the first time a passphrase is typed, and at launch. | ||
| 94 | public static var question: String { String(localized: "Use \(biometryName) to Decrypt?") } | ||
| 95 | |||
| 96 | /// What the setting does, in the question and in Settings. | ||
| 97 | public static var explanation: String { | ||
| 98 | let name = biometryName | ||
| 99 | #if os(macOS) | ||
| 100 | return String(localized: "Passphrases you type for encrypted files and entries are saved in the Keychain, and \(name) or your password unlocks them. \(name) can then decrypt anything whose passphrase is saved in your Keychain. Otherwise a passphrase is typed when it's needed and kept only while its file is open.") | ||
| 101 | #else | ||
| 102 | return String(localized: "Passphrases you type for encrypted files and entries are saved in the Keychain, and \(name) or your passcode unlocks them. \(name) can then decrypt anything whose passphrase is saved in your Keychain. Otherwise a passphrase is typed when it's needed and kept only while its file is open.") | ||
| 103 | #endif | ||
| 104 | } | ||
| 105 | |||
| 106 | /// What turning the setting off removes, for its confirmation. | ||
| 107 | public static func removal(_ count: Int) -> String { | ||
| 108 | count == 1 | ||
| 109 | ? String(localized: "The passphrase saved for 1 file is removed from the Keychain.") | ||
| 110 | : String(localized: "The passphrases saved for \(count) files are removed from the Keychain.") | ||
| 35 | } | 111 | } |
| 36 | 112 | ||
| 113 | // MARK: - The setting | ||
| 114 | |||
| 115 | /// Whether a typed passphrase waits for the question before it can be saved. | ||
| 116 | public var asksFirst: Bool { setting == .undecided } | ||
| 117 | |||
| 118 | /// The answer to the question: Enable turns the setting on, Not Now off. | ||
| 119 | public func answer(enable: Bool) { | ||
| 120 | set(enable ? .on : .off) | ||
| 121 | asking = false | ||
| 122 | } | ||
| 123 | |||
| 124 | /// Turns the setting on from Settings. | ||
| 125 | public func turnOn() { | ||
| 126 | set(.on) | ||
| 127 | } | ||
| 128 | |||
| 129 | /// Turns the setting off and removes every saved passphrase; Settings confirms first when | ||
| 130 | /// there are any. | ||
| 131 | public func turnOff() { | ||
| 132 | set(.off) | ||
| 133 | for path in keychain.paths() { forget(path) } | ||
| 134 | refresh() | ||
| 135 | } | ||
| 136 | |||
| 137 | /// At launch: passphrases saved by an earlier version, while the setting is undecided, ask | ||
| 138 | /// the question. | ||
| 139 | public func askIfSavedBefore() { | ||
| 140 | guard setting == .undecided, !keychain.paths().isEmpty else { return } | ||
| 141 | asking = true | ||
| 142 | } | ||
| 143 | |||
| 144 | /// Reads the files with a saved passphrase again, for Settings. | ||
| 145 | public func refresh() { | ||
| 146 | savedPaths = keychain.paths().sorted() | ||
| 147 | } | ||
| 148 | |||
| 149 | // MARK: - Passphrases | ||
| 150 | |||
| 37 | /// One authentication per file while it's open; `endSession` ends it. | 151 | /// One authentication per file while it's open; `endSession` ends it. |
| 38 | private static var contexts: [String: LAContext] = [:] | 152 | @ObservationIgnored private var contexts: [String: LAContext] = [:] |
| 39 | 153 | ||
| 40 | static func context(for path: String) -> LAContext { | 154 | func context(for path: String) -> LAContext { |
| 41 | if let context = contexts[path] { return context } | 155 | if let context = contexts[path] { return context } |
| 42 | let context = LAContext() | 156 | let context = LAContext() |
| 43 | contexts[path] = context | 157 | contexts[path] = context |
| @@ -45,13 +159,56 @@ public enum CryptPassphrases { | |||
| 45 | } | 159 | } |
| 46 | 160 | ||
| 47 | /// The file closed: its authentication no longer reads its passphrase. | 161 | /// The file closed: its authentication no longer reads its passphrase. |
| 48 | public static func endSession(for path: String) { | 162 | public func endSession(for path: String) { |
| 49 | contexts.removeValue(forKey: path)?.invalidate() | 163 | contexts.removeValue(forKey: path)?.invalidate() |
| 50 | } | 164 | } |
| 51 | 165 | ||
| 52 | nonisolated static func query(_ path: String, service: String = service) -> [String: Any] { | 166 | /// A passphrase typed for `path` that opened or encrypted it: saved while the setting is on. |
| 53 | var query: [String: Any] = [kSecClass as String: kSecClassGenericPassword, kSecAttrService as String: service, kSecAttrAccount as String: path] | 167 | /// A message to show when it wasn't kept; nil otherwise. |
| 54 | if service == Self.service { query[kSecUseDataProtectionKeychain as String] = true } | 168 | @discardableResult |
| 169 | public func keep(_ passphrase: String, for path: String) -> String? { | ||
| 170 | guard setting == .on else { return nil } | ||
| 171 | let note = keychain.write(passphrase, for: path) | ||
| 172 | refresh() | ||
| 173 | return note | ||
| 174 | } | ||
| 175 | |||
| 176 | /// Forget Encryption Passphrase, or Forget in Settings: the saved passphrase is removed. | ||
| 177 | public func forget(_ path: String) { | ||
| 178 | endSession(for: path) | ||
| 179 | keychain.delete(path) | ||
| 180 | savedPaths.removeAll { $0 == path } | ||
| 181 | } | ||
| 182 | |||
| 183 | /// Whether a passphrase is saved for `path` and may be used, without asking for authentication. | ||
| 184 | public func hasStored(_ path: String) -> Bool { | ||
| 185 | setting == .on && keychain.contains(path) | ||
| 186 | } | ||
| 187 | |||
| 188 | /// The saved passphrase, once the person has proved who they are; nil otherwise, and always | ||
| 189 | /// while the setting isn't on. | ||
| 190 | public func stored(for path: String) async -> String? { | ||
| 191 | guard setting == .on, keychain.contains(path) else { return nil } | ||
| 192 | return await keychain.read(path, context: context(for: path)) | ||
| 193 | } | ||
| 194 | } | ||
| 195 | |||
| 196 | /// The Keychain. New items are this device only, unlocked, after user presence. Items earlier | ||
| 197 | /// versions saved without that move over at their first read. A build without a Keychain | ||
| 198 | /// entitlement (the Developer ID Mac app) can't make such items and keeps the old kind. | ||
| 199 | @MainActor | ||
| 200 | public final class SystemKeychain: PassphraseKeychain { | ||
| 201 | public init() {} | ||
| 202 | |||
| 203 | /// A Keychain query handed to the thread that waits on it; nothing else uses it meanwhile. | ||
| 204 | struct Request: @unchecked Sendable { | ||
| 205 | let query: [String: Any] | ||
| 206 | } | ||
| 207 | |||
| 208 | nonisolated static func query(_ path: String?, service: String = CryptPassphrases.service) -> [String: Any] { | ||
| 209 | var query: [String: Any] = [kSecClass as String: kSecClassGenericPassword, kSecAttrService as String: service] | ||
| 210 | if let path { query[kSecAttrAccount as String] = path } | ||
| 211 | if service == CryptPassphrases.service { query[kSecUseDataProtectionKeychain as String] = true } | ||
| 55 | return query | 212 | return query |
| 56 | } | 213 | } |
| 57 | 214 | ||
| @@ -75,53 +232,64 @@ public enum CryptPassphrases { | |||
| 75 | return status | 232 | return status |
| 76 | } | 233 | } |
| 77 | 234 | ||
| 78 | /// Remembers `passphrase` for `path`. A message to show when it wasn't kept; nil otherwise. | 235 | public func write(_ passphrase: String, for path: String) -> String? { |
| 79 | @discardableResult | 236 | let refused = String(localized: "The passphrase wasn't remembered: the Keychain refused it.") |
| 80 | public static func store(_ passphrase: String, for path: String) -> String? { | 237 | guard let item = Self.newItem(passphrase, for: path) else { return refused } |
| 81 | guard let item = newItem(passphrase, for: path) else { return String(localized: "The passphrase wasn't remembered: the Keychain refused it.") } | 238 | let status = Self.add(item, replacing: Self.query(path)) |
| 82 | let status = add(item, replacing: query(path)) | ||
| 83 | if status == errSecSuccess { | 239 | if status == errSecSuccess { |
| 84 | SecItemDelete(query(path, service: legacyService) as CFDictionary) | 240 | SecItemDelete(Self.query(path, service: CryptPassphrases.legacyService) as CFDictionary) |
| 85 | return nil | 241 | return nil |
| 86 | } | 242 | } |
| 87 | guard status == errSecMissingEntitlement else { return String(localized: "The passphrase wasn't remembered: the Keychain refused it.") } | 243 | guard status == errSecMissingEntitlement else { return refused } |
| 88 | var legacy = query(path, service: legacyService) | 244 | var legacy = Self.query(path, service: CryptPassphrases.legacyService) |
| 89 | legacy[kSecValueData as String] = Data(passphrase.utf8) | 245 | legacy[kSecValueData as String] = Data(passphrase.utf8) |
| 90 | legacy[kSecAttrLabel as String] = item[kSecAttrLabel as String] | 246 | legacy[kSecAttrLabel as String] = item[kSecAttrLabel as String] |
| 91 | guard add(legacy, replacing: query(path, service: legacyService)) == errSecSuccess else { | 247 | guard Self.add(legacy, replacing: Self.query(path, service: CryptPassphrases.legacyService)) == errSecSuccess else { return refused } |
| 92 | return String(localized: "The passphrase wasn't remembered: the Keychain refused it.") | 248 | SecItemDelete(Self.query(path) as CFDictionary) |
| 93 | } | ||
| 94 | SecItemDelete(query(path) as CFDictionary) | ||
| 95 | return nil | 249 | return nil |
| 96 | } | 250 | } |
| 97 | 251 | ||
| 98 | public static func forget(_ path: String) { | 252 | public func delete(_ path: String) { |
| 99 | endSession(for: path) | 253 | SecItemDelete(Self.query(path) as CFDictionary) |
| 100 | SecItemDelete(query(path) as CFDictionary) | 254 | SecItemDelete(Self.query(path, service: CryptPassphrases.legacyService) as CFDictionary) |
| 101 | SecItemDelete(query(path, service: legacyService) as CFDictionary) | ||
| 102 | } | 255 | } |
| 103 | 256 | ||
| 104 | /// Whether an item exists, without asking for authentication. | 257 | /// `query` for attributes only, without asking for authentication. |
| 105 | nonisolated static func exists(_ query: [String: Any]) -> Bool { | 258 | nonisolated static func quiet(_ query: [String: Any]) -> [String: Any] { |
| 106 | var q = query | 259 | var q = query |
| 107 | let quiet = LAContext() | 260 | let quiet = LAContext() |
| 108 | quiet.interactionNotAllowed = true | 261 | quiet.interactionNotAllowed = true |
| 109 | q[kSecUseAuthenticationContext as String] = quiet | 262 | q[kSecUseAuthenticationContext as String] = quiet |
| 110 | q[kSecReturnAttributes as String] = true | 263 | q[kSecReturnAttributes as String] = true |
| 111 | let status = SecItemCopyMatching(q as CFDictionary, nil) | 264 | return q |
| 265 | } | ||
| 266 | |||
| 267 | /// Whether an item exists, without asking for authentication. | ||
| 268 | nonisolated static func exists(_ query: [String: Any]) -> Bool { | ||
| 269 | let status = SecItemCopyMatching(quiet(query) as CFDictionary, nil) | ||
| 112 | return status == errSecSuccess || status == errSecInteractionNotAllowed | 270 | return status == errSecSuccess || status == errSecInteractionNotAllowed |
| 113 | } | 271 | } |
| 114 | 272 | ||
| 115 | public static func hasStored(_ path: String) -> Bool { | 273 | public func contains(_ path: String) -> Bool { |
| 116 | exists(query(path)) || exists(query(path, service: legacyService)) | 274 | Self.exists(Self.query(path)) || Self.exists(Self.query(path, service: CryptPassphrases.legacyService)) |
| 275 | } | ||
| 276 | |||
| 277 | public func paths() -> [String] { | ||
| 278 | var paths: Set<String> = [] | ||
| 279 | for service in [CryptPassphrases.service, CryptPassphrases.legacyService] { | ||
| 280 | var q = Self.quiet(Self.query(nil, service: service)) | ||
| 281 | q[kSecMatchLimit as String] = kSecMatchLimitAll | ||
| 282 | var result: AnyObject? | ||
| 283 | guard SecItemCopyMatching(q as CFDictionary, &result) == errSecSuccess, let items = result as? [[String: Any]] else { continue } | ||
| 284 | for item in items { if let account = item[kSecAttrAccount as String] as? String { paths.insert(account) } } | ||
| 285 | } | ||
| 286 | return Array(paths) | ||
| 117 | } | 287 | } |
| 118 | 288 | ||
| 119 | /// The stored passphrase, once the person has proved who they are; nil otherwise. | 289 | public func read(_ path: String, context: LAContext) async -> String? { |
| 120 | public static func stored(for path: String) async -> String? { | ||
| 121 | let reason = "unlock the passphrase for " + (path as NSString).lastPathComponent | 290 | let reason = "unlock the passphrase for " + (path as NSString).lastPathComponent |
| 122 | let context = context(for: path) | 291 | if Self.exists(Self.query(path)) { |
| 123 | if exists(query(path)) { | 292 | var q = Self.query(path) |
| 124 | var q = query(path) | ||
| 125 | q[kSecReturnData as String] = true | 293 | q[kSecReturnData as String] = true |
| 126 | context.localizedReason = reason | 294 | context.localizedReason = reason |
| 127 | q[kSecUseAuthenticationContext as String] = context | 295 | q[kSecUseAuthenticationContext as String] = context |
| @@ -133,16 +301,17 @@ public enum CryptPassphrases { | |||
| 133 | return String(decoding: data, as: UTF8.self) | 301 | return String(decoding: data, as: UTF8.self) |
| 134 | }.value | 302 | }.value |
| 135 | } | 303 | } |
| 136 | guard exists(query(path, service: legacyService)) else { return nil } | 304 | let legacyQuery = Self.query(path, service: CryptPassphrases.legacyService) |
| 305 | guard Self.exists(legacyQuery) else { return nil } | ||
| 137 | guard (try? await context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason)) == true else { return nil } | 306 | guard (try? await context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason)) == true else { return nil } |
| 138 | var q = query(path, service: legacyService) | 307 | var q = legacyQuery |
| 139 | q[kSecReturnData as String] = true | 308 | q[kSecReturnData as String] = true |
| 140 | var result: AnyObject? | 309 | var result: AnyObject? |
| 141 | guard SecItemCopyMatching(q as CFDictionary, &result) == errSecSuccess, let data = result as? Data else { return nil } | 310 | guard SecItemCopyMatching(q as CFDictionary, &result) == errSecSuccess, let data = result as? Data else { return nil } |
| 142 | let passphrase = String(decoding: data, as: UTF8.self) | 311 | let passphrase = String(decoding: data, as: UTF8.self) |
| 143 | // Moved to the protected kind of item; kept as it was where that can't be made. | 312 | // Moved to the protected kind of item; kept as it was where that can't be made. |
| 144 | if let item = newItem(passphrase, for: path), add(item, replacing: query(path)) == errSecSuccess { | 313 | if let item = Self.newItem(passphrase, for: path), Self.add(item, replacing: Self.query(path)) == errSecSuccess { |
| 145 | SecItemDelete(query(path, service: legacyService) as CFDictionary) | 314 | SecItemDelete(legacyQuery as CFDictionary) |
| 146 | } | 315 | } |
| 147 | return passphrase | 316 | return passphrase |
| 148 | } | 317 | } |
Sources/OrgApp/CryptSheet.swift +39 −15 · view
| @@ -54,10 +54,10 @@ public struct CryptRequest: Identifiable, Sendable { | |||
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | /// The passphrase for an org-crypt command, from the Keychain when it was remembered, then for | 57 | /// The passphrase for an org-crypt command, from the Keychain when one is saved and "Use Face ID |
| 58 | /// `open` the decrypted entry to edit. `text` is the file's text now; `apply` puts a new text | 58 | /// to Decrypt" is on, then for `open` the decrypted entry to edit. `text` is the file's text |
| 59 | /// in its place; `done` closes the sheet with a message. `session` learns the passphrase, so | 59 | /// now; `apply` puts a new text in its place; `done` closes the sheet with a message. `session` |
| 60 | /// saves encrypt with it without asking again. | 60 | /// learns the passphrase, so saves encrypt with it without asking again. |
| 61 | public struct CryptSheet: View { | 61 | public struct CryptSheet: View { |
| 62 | let request: CryptRequest | 62 | let request: CryptRequest |
| 63 | let session: DocumentSession? | 63 | let session: DocumentSession? |
| @@ -66,9 +66,11 @@ public struct CryptSheet: View { | |||
| 66 | let done: (String?) -> Void | 66 | let done: (String?) -> Void |
| 67 | @State private var passphrase = "" | 67 | @State private var passphrase = "" |
| 68 | @State private var repeated = "" | 68 | @State private var repeated = "" |
| 69 | @State private var remember = false | 69 | /// What the Keychain said when the passphrase was saved, shown with the result. |
| 70 | /// What the Keychain said when the passphrase was remembered, shown with the result. | ||
| 71 | @State private var keychainNote: String? | 70 | @State private var keychainNote: String? |
| 71 | /// A typed passphrase that worked, waiting for the answer to whether to use Face ID, and | ||
| 72 | /// what follows. | ||
| 73 | @State private var question: (passphrase: String, then: () -> Void)? | ||
| 72 | @State private var problem: String? | 74 | @State private var problem: String? |
| 73 | /// The decrypted entry being edited, and the passphrase it came with. | 75 | /// The decrypted entry being edited, and the passphrase it came with. |
| 74 | @State private var editing: (original: String, passphrase: String)? | 76 | @State private var editing: (original: String, passphrase: String)? |
| @@ -101,10 +103,6 @@ public struct CryptSheet: View { | |||
| 101 | if let explanation { Text(explanation).font(.callout).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true) } | 103 | if let explanation { Text(explanation).font(.callout).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true) } |
| 102 | SecureField("Passphrase", text: $passphrase).onSubmit(submit) | 104 | SecureField("Passphrase", text: $passphrase).onSubmit(submit) |
| 103 | if asksTwice { SecureField("Repeat passphrase", text: $repeated).onSubmit(submit) } | 105 | if asksTwice { SecureField("Repeat passphrase", text: $repeated).onSubmit(submit) } |
| 104 | Toggle("Remember in the Keychain", isOn: $remember) | ||
| 105 | if !CryptPassphrases.protectsItems { | ||
| 106 | Text(CryptPassphrases.caveat).font(.caption).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true) | ||
| 107 | } | ||
| 108 | if let problem { Text(problem).foregroundStyle(.red).font(.callout) } | 106 | if let problem { Text(problem).foregroundStyle(.red).font(.callout) } |
| 109 | HStack { | 107 | HStack { |
| 110 | Spacer() | 108 | Spacer() |
| @@ -122,10 +120,35 @@ public struct CryptSheet: View { | |||
| 122 | .frame(maxHeight: .infinity, alignment: .top) | 120 | .frame(maxHeight: .infinity, alignment: .top) |
| 123 | #endif | 121 | #endif |
| 124 | .task { | 122 | .task { |
| 125 | if let stored = await CryptPassphrases.stored(for: request.path) { run(stored, remembered: true) } | 123 | if let stored = await passphrases.stored(for: request.path) { run(stored, remembered: true) } |
| 124 | } | ||
| 125 | .alert(CryptPassphrases.question, isPresented: Binding(get: { question != nil }, set: { _ in })) { | ||
| 126 | Button("Not Now", role: .cancel) { answer(enable: false) } | ||
| 127 | Button("Enable") { answer(enable: true) } | ||
| 128 | } message: { | ||
| 129 | Text(CryptPassphrases.explanation) | ||
| 126 | } | 130 | } |
| 127 | } | 131 | } |
| 128 | 132 | ||
| 133 | private var passphrases: CryptPassphrases { session?.passphrases ?? .shared } | ||
| 134 | |||
| 135 | /// A typed passphrase worked: saved while the setting is on, after the question while it's | ||
| 136 | /// undecided, then `then`. | ||
| 137 | private func keep(_ passphrase: String, remembered: Bool, then: @escaping () -> Void) { | ||
| 138 | guard !remembered else { return then() } | ||
| 139 | if passphrases.asksFirst { return question = (passphrase, then) } | ||
| 140 | keychainNote = passphrases.keep(passphrase, for: request.path) | ||
| 141 | then() | ||
| 142 | } | ||
| 143 | |||
| 144 | private func answer(enable: Bool) { | ||
| 145 | guard let question else { return } | ||
| 146 | self.question = nil | ||
| 147 | passphrases.answer(enable: enable) | ||
| 148 | keychainNote = passphrases.keep(question.passphrase, for: request.path) | ||
| 149 | question.then() | ||
| 150 | } | ||
| 151 | |||
| 129 | private var title: String { | 152 | private var title: String { |
| 130 | switch request.mode { | 153 | switch request.mode { |
| 131 | case .encrypt: "Encrypt Entry" | 154 | case .encrypt: "Encrypt Entry" |
| @@ -192,11 +215,11 @@ public struct CryptSheet: View { | |||
| 192 | finish("Encrypted \(count) \(count == 1 ? "entry" : "entries")", passphrase: passphrase, remembered: remembered) | 215 | finish("Encrypted \(count) \(count == 1 ? "entry" : "entries")", passphrase: passphrase, remembered: remembered) |
| 193 | case .open: | 216 | case .open: |
| 194 | let plain = try OrgCrypt.decrypt(current, at: request.offset, passphrase: passphrase).plaintext | 217 | let plain = try OrgCrypt.decrypt(current, at: request.offset, passphrase: passphrase).plaintext |
| 195 | if remember, !remembered { keychainNote = CryptPassphrases.store(passphrase, for: request.path) } | ||
| 196 | session?.cryptUsed(passphrase, for: request.path) | 218 | session?.cryptUsed(passphrase, for: request.path) |
| 197 | plaintext = plain | 219 | plaintext = plain |
| 198 | editing = (plain, passphrase) | 220 | editing = (plain, passphrase) |
| 199 | problem = nil | 221 | problem = nil |
| 222 | keep(passphrase, remembered: remembered) {} | ||
| 200 | case .decryptInPlace: | 223 | case .decryptInPlace: |
| 201 | let message = OrgCrypt.encryptedRange(current, at: request.offset).map { (current as NSString).substring(with: NSRange($0)) } | 224 | let message = OrgCrypt.encryptedRange(current, at: request.offset).map { (current as NSString).substring(with: NSRange($0)) } |
| 202 | let decrypted = try OrgCrypt.decryptInPlace(current, at: request.offset, passphrase: passphrase) | 225 | let decrypted = try OrgCrypt.decryptInPlace(current, at: request.offset, passphrase: passphrase) |
| @@ -215,10 +238,11 @@ public struct CryptSheet: View { | |||
| 215 | } | 238 | } |
| 216 | 239 | ||
| 217 | private func finish(_ message: String?, passphrase: String, remembered: Bool) { | 240 | private func finish(_ message: String?, passphrase: String, remembered: Bool) { |
| 218 | if remember, !remembered { keychainNote = CryptPassphrases.store(passphrase, for: request.path) } | ||
| 219 | if !request.unlocks { session?.cryptUsed(passphrase, for: request.path) } | 241 | if !request.unlocks { session?.cryptUsed(passphrase, for: request.path) } |
| 220 | let text = [message, keychainNote].compactMap { $0 }.joined(separator: " ") | 242 | keep(passphrase, remembered: remembered) { |
| 221 | done(text.isEmpty ? nil : text) | 243 | let text = [message, keychainNote].compactMap { $0 }.joined(separator: " ") |
| 244 | done(text.isEmpty ? nil : text) | ||
| 245 | } | ||
| 222 | } | 246 | } |
| 223 | 247 | ||
| 224 | /// The edited text encrypted again in the message's place; nothing changes if it wasn't edited. | 248 | /// The edited text encrypted again in the message's place; nothing changes if it wasn't edited. |
Sources/OrgApp/DecryptSettings.swift added +77 · view
| @@ -0,0 +1,77 @@ | |||
| 1 | import SwiftUI | ||
| 2 | |||
| 3 | /// "Use Face ID to Decrypt" and the files with a saved passphrase, for a settings form. | ||
| 4 | public struct DecryptSettings: View { | ||
| 5 | @Bindable var passphrases: CryptPassphrases | ||
| 6 | @State private var confirmingOff = false | ||
| 7 | |||
| 8 | public init(passphrases: CryptPassphrases = .shared) { | ||
| 9 | self.passphrases = passphrases | ||
| 10 | } | ||
| 11 | |||
| 12 | public var body: some View { | ||
| 13 | Section { | ||
| 14 | Toggle(CryptPassphrases.title, isOn: Binding { | ||
| 15 | passphrases.setting == .on | ||
| 16 | } set: { on in | ||
| 17 | if on { | ||
| 18 | passphrases.turnOn() | ||
| 19 | } else if passphrases.savedPaths.isEmpty { | ||
| 20 | passphrases.turnOff() | ||
| 21 | } else { | ||
| 22 | confirmingOff = true | ||
| 23 | } | ||
| 24 | }) | ||
| 25 | } footer: { | ||
| 26 | VStack(alignment: .leading, spacing: 6) { | ||
| 27 | Text(CryptPassphrases.explanation) | ||
| 28 | if !CryptPassphrases.protectsItems { Text(CryptPassphrases.caveat) } | ||
| 29 | } | ||
| 30 | .font(.caption) | ||
| 31 | .foregroundStyle(.secondary) | ||
| 32 | .fixedSize(horizontal: false, vertical: true) | ||
| 33 | } | ||
| 34 | .onAppear { passphrases.refresh() } | ||
| 35 | .alert(String(localized: "Remove Saved Passphrases?"), isPresented: $confirmingOff) { | ||
| 36 | Button("Cancel", role: .cancel) {} | ||
| 37 | Button("Turn Off", role: .destructive) { passphrases.turnOff() } | ||
| 38 | } message: { | ||
| 39 | Text(CryptPassphrases.removal(passphrases.savedPaths.count)) | ||
| 40 | } | ||
| 41 | if !passphrases.savedPaths.isEmpty { | ||
| 42 | Section("Saved Passphrases") { | ||
| 43 | ForEach(passphrases.savedPaths, id: \.self) { path in | ||
| 44 | HStack { | ||
| 45 | VStack(alignment: .leading, spacing: 2) { | ||
| 46 | Text((path as NSString).lastPathComponent) | ||
| 47 | Text((path as NSString).deletingLastPathComponent).font(.caption).foregroundStyle(.secondary).lineLimit(1).truncationMode(.middle) | ||
| 48 | } | ||
| 49 | Spacer() | ||
| 50 | Button("Forget") { passphrases.forget(path) }.buttonStyle(.borderless) | ||
| 51 | } | ||
| 52 | } | ||
| 53 | } | ||
| 54 | } | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | /// Asks whether to use Face ID to decrypt, once, at launch, when an earlier version saved | ||
| 59 | /// passphrases and the setting is undecided. | ||
| 60 | public struct DecryptQuestion: ViewModifier { | ||
| 61 | @Bindable var passphrases: CryptPassphrases | ||
| 62 | |||
| 63 | public init(passphrases: CryptPassphrases = .shared) { | ||
| 64 | self.passphrases = passphrases | ||
| 65 | } | ||
| 66 | |||
| 67 | public func body(content: Content) -> some View { | ||
| 68 | content | ||
| 69 | .task { passphrases.askIfSavedBefore() } | ||
| 70 | .alert(CryptPassphrases.question, isPresented: Binding(get: { passphrases.asking }, set: { _ in })) { | ||
| 71 | Button("Not Now", role: .cancel) { passphrases.answer(enable: false) } | ||
| 72 | Button("Enable") { passphrases.answer(enable: true) } | ||
| 73 | } message: { | ||
| 74 | Text(CryptPassphrases.explanation) | ||
| 75 | } | ||
| 76 | } | ||
| 77 | } | ||
Sources/OrgApp/DocumentSession.swift +8 −9 · view
| @@ -190,10 +190,9 @@ public final class DocumentSession { | |||
| 190 | public private(set) var unlockRequest: String? | 190 | public private(set) var unlockRequest: String? |
| 191 | @ObservationIgnored private var unlockPane: EditorPane? | 191 | @ObservationIgnored private var unlockPane: EditorPane? |
| 192 | 192 | ||
| 193 | /// The passphrase remembered in the Keychain, after Touch ID, Face ID or the device's | 193 | /// Passphrases saved in the Keychain, used after Touch ID, Face ID or the device's password |
| 194 | /// password; nil when there's none or it wasn't given. | 194 | /// while the setting is on. |
| 195 | @ObservationIgnored public var storedPassphrase: (String) async -> String? = { await CryptPassphrases.stored(for: $0) } | 195 | @ObservationIgnored public var passphrases = CryptPassphrases.shared |
| 196 | @ObservationIgnored public var hasStoredPassphrase: (String) -> Bool = { CryptPassphrases.hasStored($0) } | ||
| 197 | /// Files whose remembered passphrase is being asked for, and those where it was refused: | 196 | /// Files whose remembered passphrase is being asked for, and those where it was refused: |
| 198 | /// the Keychain is asked once per file until the file closes or Encrypt is chosen. | 197 | /// the Keychain is asked once per file until the file closes or Encrypt is chosen. |
| 199 | @ObservationIgnored private var askingKeychain: Set<String> = [] | 198 | @ObservationIgnored private var askingKeychain: Set<String> = [] |
| @@ -242,7 +241,7 @@ public final class DocumentSession { | |||
| 242 | 241 | ||
| 243 | /// The encrypted file waiting for its passphrase stays closed. | 242 | /// The encrypted file waiting for its passphrase stays closed. |
| 244 | public func cancelUnlock() { | 243 | public func cancelUnlock() { |
| 245 | if let unlockRequest { CryptPassphrases.endSession(for: unlockRequest) } | 244 | if let unlockRequest { passphrases.endSession(for: unlockRequest) } |
| 246 | unlockRequest = nil | 245 | unlockRequest = nil |
| 247 | unlockPane = nil | 246 | unlockPane = nil |
| 248 | } | 247 | } |
| @@ -260,7 +259,7 @@ public final class DocumentSession { | |||
| 260 | 259 | ||
| 261 | /// Forget Encryption Passphrase: the passphrase leaves the Keychain and the session. | 260 | /// Forget Encryption Passphrase: the passphrase leaves the Keychain and the session. |
| 262 | public func forgetPassphrase(for path: String) { | 261 | public func forgetPassphrase(for path: String) { |
| 263 | CryptPassphrases.forget(path) | 262 | passphrases.forget(path) |
| 264 | crypt.forgetPassphrase(for: path) | 263 | crypt.forgetPassphrase(for: path) |
| 265 | } | 264 | } |
| 266 | 265 | ||
| @@ -290,11 +289,11 @@ public final class DocumentSession { | |||
| 290 | /// Asks the Keychain for `entry`'s passphrase, once, and saves with it. | 289 | /// Asks the Keychain for `entry`'s passphrase, once, and saves with it. |
| 291 | private func askKeychain(_ entry: Entry) { | 290 | private func askKeychain(_ entry: Entry) { |
| 292 | let path = entry.path | 291 | let path = entry.path |
| 293 | guard !askingKeychain.contains(path), !refusedKeychain.contains(path), hasStoredPassphrase(path) else { return } | 292 | guard !askingKeychain.contains(path), !refusedKeychain.contains(path), passphrases.hasStored(path) else { return } |
| 294 | askingKeychain.insert(path) | 293 | askingKeychain.insert(path) |
| 295 | Task { [weak self, weak entry] in | 294 | Task { [weak self, weak entry] in |
| 296 | guard let self else { return } | 295 | guard let self else { return } |
| 297 | let passphrase = await self.storedPassphrase(path) | 296 | let passphrase = await self.passphrases.stored(for: path) |
| 298 | self.askingKeychain.remove(path) | 297 | self.askingKeychain.remove(path) |
| 299 | guard let entry, self.entries.contains(where: { $0 === entry }) else { return } | 298 | guard let entry, self.entries.contains(where: { $0 === entry }) else { return } |
| 300 | if let passphrase, self.unlock(passphrase, for: path) == nil { return } | 299 | if let passphrase, self.unlock(passphrase, for: path) == nil { return } |
| @@ -495,7 +494,7 @@ public final class DocumentSession { | |||
| 495 | entry.autosave?.cancel() | 494 | entry.autosave?.cancel() |
| 496 | entries.removeAll { $0 === entry } | 495 | entries.removeAll { $0 === entry } |
| 497 | crypt.close(entry.path) | 496 | crypt.close(entry.path) |
| 498 | CryptPassphrases.endSession(for: entry.path) | 497 | passphrases.endSession(for: entry.path) |
| 499 | held[entry.path] = nil | 498 | held[entry.path] = nil |
| 500 | failedHolds[entry.path] = nil | 499 | failedHolds[entry.path] = nil |
| 501 | refusedKeychain.remove(entry.path) | 500 | refusedKeychain.remove(entry.path) |
Sources/Orgstar/ContentView.swift +1 · view
| @@ -410,6 +410,7 @@ struct ContentView: View { | |||
| 410 | .modifier(CryptSettings(session: session, cryptBeforeSave: cryptBeforeSave, cryptTagMatcher: cryptTagMatcher) { path in | 410 | .modifier(CryptSettings(session: session, cryptBeforeSave: cryptBeforeSave, cryptTagMatcher: cryptTagMatcher) { path in |
| 411 | panel = .crypt(UUID(), CryptRequest(mode: .openFile, path: path, offset: 0)) | 411 | panel = .crypt(UUID(), CryptRequest(mode: .openFile, path: path, offset: 0)) |
| 412 | }) | 412 | }) |
| 413 | .modifier(DecryptQuestion()) | ||
| 413 | .onChange(of: options, initial: true) { _, options in session.options = options } | 414 | .onChange(of: options, initial: true) { _, options in session.options = options } |
| 414 | .onAppear { TimerModel.shared.onDone = { [commands] in commands.show($0) } } | 415 | .onAppear { TimerModel.shared.onDone = { [commands] in commands.show($0) } } |
| 415 | .onReceive(NotificationCenter.default.publisher(for: UserDefaults.didChangeNotification)) { _ in defaultsChanges += 1 } | 416 | .onReceive(NotificationCenter.default.publisher(for: UserDefaults.didChangeNotification)) { _ in defaultsChanges += 1 } |
Sources/Orgstar/OrgstarApp.swift +4 · view
| @@ -408,6 +408,7 @@ enum UnsavedChanges { | |||
| 408 | } else if let failure = session.unlock(passphrase, for: path) { | 408 | } else if let failure = session.unlock(passphrase, for: path) { |
| 409 | problem = failure | 409 | problem = failure |
| 410 | } else { | 410 | } else { |
| 411 | session.passphrases.keep(passphrase, for: path) | ||
| 411 | return !session.dirtyPaths.contains(path) | 412 | return !session.dirtyPaths.contains(path) |
| 412 | } | 413 | } |
| 413 | case .alertSecondButtonReturn: return true | 414 | case .alertSecondButtonReturn: return true |
| @@ -977,6 +978,9 @@ struct SettingsView: View { | |||
| 977 | Tab("Appearance", systemImage: "paintpalette", value: "appearance") { appearance } | 978 | Tab("Appearance", systemImage: "paintpalette", value: "appearance") { appearance } |
| 978 | Tab("Agenda", systemImage: "calendar", value: "agenda") { agenda } | 979 | Tab("Agenda", systemImage: "calendar", value: "agenda") { agenda } |
| 979 | Tab("Capture", systemImage: "tray.and.arrow.down", value: "capture") { capture } | 980 | Tab("Capture", systemImage: "tray.and.arrow.down", value: "capture") { capture } |
| 981 | Tab("Encryption", systemImage: "lock", value: "encryption") { | ||
| 982 | Form { DecryptSettings() }.formStyle(.grouped).frame(height: 330) | ||
| 983 | } | ||
| 980 | #if !APPSTORE | 984 | #if !APPSTORE |
| 981 | Tab(value: "git") { GitSettingsForm(workspace: workspace) } label: { | 985 | Tab(value: "git") { GitSettingsForm(workspace: workspace) } label: { |
| 982 | Label { Text("Git", tableName: "DeveloperID") } icon: { Image(systemName: "arrow.triangle.branch") } | 986 | Label { Text("Git", tableName: "DeveloperID") } icon: { Image(systemName: "arrow.triangle.branch") } |
Sources/OrgstarMobile/OrgstarMobileApp.swift +1 · view
| @@ -335,6 +335,7 @@ struct RootView: View { | |||
| 335 | .interactiveDismissDisabled() | 335 | .interactiveDismissDisabled() |
| 336 | } | 336 | } |
| 337 | .sheet(item: $whatsNew) { WhatsNewView(notes: $0) } | 337 | .sheet(item: $whatsNew) { WhatsNewView(notes: $0) } |
| 338 | .modifier(DecryptQuestion()) | ||
| 338 | .sheet(item: Bindable(ProAccess.shared).paywall) { ProSheet(feature: $0) } | 339 | .sheet(item: Bindable(ProAccess.shared).paywall) { ProSheet(feature: $0) } |
| 339 | .onChange(of: ProAccess.shared.isUnlocked) { | 340 | .onChange(of: ProAccess.shared.isUnlocked) { |
| 340 | // Calendar and Reminders in the agenda, the widgets and the watch follow Pro. | 341 | // Calendar and Reminders in the agenda, the widgets and the watch follow Pro. |
Sources/OrgstarMobile/SettingsScreen.swift +1 · view
| @@ -85,6 +85,7 @@ struct SettingsScreen: View { | |||
| 85 | Text("Sync folders that are git repositories in Working Copy.") | 85 | Text("Sync folders that are git repositories in Working Copy.") |
| 86 | } | 86 | } |
| 87 | } | 87 | } |
| 88 | DecryptSettings() | ||
| 88 | Section { | 89 | Section { |
| 89 | let _ = model.settingsVersion | 90 | let _ = model.settingsVersion |
| 90 | Toggle("Show days without entries", isOn: Binding { | 91 | Toggle("Show days without entries", isOn: Binding { |
Tests/OrgAppTests/CryptPassphrasesTests.swift added +220 · view
| @@ -0,0 +1,220 @@ | |||
| 1 | import Foundation | ||
| 2 | import LocalAuthentication | ||
| 3 | import OrgCore | ||
| 4 | import OrgDocument | ||
| 5 | import Testing | ||
| 6 | @testable import OrgApp | ||
| 7 | |||
| 8 | /// The Keychain's stand-in: saved passphrases by path, and every call made. | ||
| 9 | @MainActor | ||
| 10 | final class FakeKeychain: PassphraseKeychain { | ||
| 11 | var saved: [String: String] | ||
| 12 | var calls: [String] = [] | ||
| 13 | var contexts: [LAContext] = [] | ||
| 14 | |||
| 15 | init(_ saved: [String: String] = [:]) { | ||
| 16 | self.saved = saved | ||
| 17 | } | ||
| 18 | |||
| 19 | /// Passphrases with `setting`, over a new stand-in holding `saved`. | ||
| 20 | static func passphrases(_ setting: CryptPassphrases.Setting, saved: [String: String] = [:], defaults: UserDefaults = TestDefaults("crypt")) -> (keychain: FakeKeychain, passphrases: CryptPassphrases) { | ||
| 21 | if setting != .undecided { defaults.set(setting.rawValue, forKey: CryptPassphrases.settingKey) } | ||
| 22 | let keychain = FakeKeychain(saved) | ||
| 23 | return (keychain, CryptPassphrases(keychain: keychain, defaults: defaults)) | ||
| 24 | } | ||
| 25 | |||
| 26 | func contains(_ path: String) -> Bool { | ||
| 27 | calls.append("contains \(path)") | ||
| 28 | return saved[path] != nil | ||
| 29 | } | ||
| 30 | |||
| 31 | func read(_ path: String, context: LAContext) async -> String? { | ||
| 32 | calls.append("read \(path)") | ||
| 33 | contexts.append(context) | ||
| 34 | return saved[path] | ||
| 35 | } | ||
| 36 | |||
| 37 | func write(_ passphrase: String, for path: String) -> String? { | ||
| 38 | calls.append("write \(path)") | ||
| 39 | saved[path] = passphrase | ||
| 40 | return nil | ||
| 41 | } | ||
| 42 | |||
| 43 | func delete(_ path: String) { | ||
| 44 | calls.append("delete \(path)") | ||
| 45 | saved[path] = nil | ||
| 46 | } | ||
| 47 | |||
| 48 | func paths() -> [String] { | ||
| 49 | calls.append("paths") | ||
| 50 | return Array(saved.keys) | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | /// "Use Face ID to Decrypt": the Keychain is used only while it's on. | ||
| 55 | @MainActor | ||
| 56 | struct CryptPassphrasesTests { | ||
| 57 | static let secret = "Account 12345" | ||
| 58 | let notes: Folder | ||
| 59 | |||
| 60 | init() throws { | ||
| 61 | notes = try Folder() | ||
| 62 | } | ||
| 63 | |||
| 64 | func wait(_ condition: () -> Bool) async throws { | ||
| 65 | for _ in 0..<200 where !condition() { try await Task.sleep(for: .milliseconds(10)) } | ||
| 66 | } | ||
| 67 | |||
| 68 | /// Every way a saved passphrase was read: commands, opening a `.org.gpg`, Encrypt… on a held | ||
| 69 | /// file and encrypt-on-save. Off or undecided, none of them reaches the Keychain, though it | ||
| 70 | /// holds the files' passphrases (as saved by an earlier version). | ||
| 71 | @Test(arguments: [CryptPassphrases.Setting.undecided, .off]) | ||
| 72 | func notOnTouchesNoKeychain(_ setting: CryptPassphrases.Setting) async throws { | ||
| 73 | let file = try notes.write("a.org", "* Plain\n") | ||
| 74 | let gpg = notes.url.appendingPathComponent("b.org.gpg") | ||
| 75 | try OpenPGP.encryptedMessage(Data("* B\n".utf8), passphrase: "pw").write(to: gpg) | ||
| 76 | let (keychain, passphrases) = FakeKeychain.passphrases(setting, saved: [file.path: "pw", gpg.path: "pw"]) | ||
| 77 | let session = DocumentSession(recovery: FileRecoveryStore(directory: notes.url.appendingPathComponent(".recovery"))) | ||
| 78 | session.saveMode = .explicit | ||
| 79 | session.encryptsTaggedEntries = true | ||
| 80 | session.passphrases = passphrases | ||
| 81 | |||
| 82 | // Encrypt-on-save holds the file: no passphrase in memory, none read. | ||
| 83 | session.open(file.path) | ||
| 84 | let buffer = StateBuffer(session.document!) | ||
| 85 | session.attach(buffer) | ||
| 86 | try buffer.update { try $0.apply([TextEdit(range: 8..<8, replacement: "* Bank :crypt:\n\(Self.secret)\n")], baseRevision: $0.revision) } | ||
| 87 | session.bufferChanged() | ||
| 88 | #expect(!session.save()) | ||
| 89 | try await Task.sleep(for: .milliseconds(100)) | ||
| 90 | #expect(session.held[file.path] == .entries(1)) | ||
| 91 | #expect(!(try String(contentsOf: file, encoding: .utf8)).contains(Self.secret)) | ||
| 92 | |||
| 93 | // An encrypted file waits for its typed passphrase. | ||
| 94 | session.open(gpg.path) | ||
| 95 | #expect(session.unlockRequest == gpg.path && !session.isOpen(gpg.path)) | ||
| 96 | |||
| 97 | // The sheet's read (the org-crypt commands, Decrypt File, Encrypt… on a held file), and | ||
| 98 | // a typed passphrase that worked. | ||
| 99 | #expect(await passphrases.stored(for: file.path) == nil) | ||
| 100 | #expect(await passphrases.stored(for: gpg.path) == nil) | ||
| 101 | #expect(!passphrases.hasStored(file.path)) | ||
| 102 | #expect(passphrases.keep("typed", for: file.path) == nil) | ||
| 103 | #expect(session.unlock("pw", for: gpg.path) == nil) | ||
| 104 | #expect(session.isOpen(gpg.path)) | ||
| 105 | |||
| 106 | #expect(keychain.calls.isEmpty) | ||
| 107 | #expect(keychain.saved == [file.path: "pw", gpg.path: "pw"]) | ||
| 108 | } | ||
| 109 | |||
| 110 | @Test func onSavesATypedPassphraseAndReadsItThroughTheFilesAuthentication() async throws { | ||
| 111 | let (keychain, passphrases) = FakeKeychain.passphrases(.on) | ||
| 112 | #expect(!passphrases.asksFirst) | ||
| 113 | #expect(passphrases.keep("pw", for: "/x/a.org") == nil) | ||
| 114 | #expect(keychain.saved == ["/x/a.org": "pw"]) | ||
| 115 | #expect(passphrases.savedPaths == ["/x/a.org"]) | ||
| 116 | #expect(passphrases.hasStored("/x/a.org")) | ||
| 117 | #expect(await passphrases.stored(for: "/x/a.org") == "pw") | ||
| 118 | #expect(await passphrases.stored(for: "/x/a.org") == "pw") | ||
| 119 | let context = passphrases.context(for: "/x/a.org") | ||
| 120 | #expect(keychain.contexts.count == 2 && keychain.contexts.allSatisfy { $0 === context }) | ||
| 121 | // Closing the file ends its authentication; the next read asks again. | ||
| 122 | passphrases.endSession(for: "/x/a.org") | ||
| 123 | #expect(await passphrases.stored(for: "/x/a.org") == "pw") | ||
| 124 | #expect(keychain.contexts.last !== context) | ||
| 125 | #expect(await passphrases.stored(for: "/x/b.org") == nil) | ||
| 126 | } | ||
| 127 | |||
| 128 | @Test func onEncryptOnSaveUsesTheSavedPassphrase() async throws { | ||
| 129 | let file = try notes.write("a.org", "* Bank :crypt:\nold\n") | ||
| 130 | let (keychain, passphrases) = FakeKeychain.passphrases(.on, saved: [file.path: "pw"]) | ||
| 131 | let session = DocumentSession(recovery: FileRecoveryStore(directory: notes.url.appendingPathComponent(".recovery"))) | ||
| 132 | session.saveMode = .explicit | ||
| 133 | session.encryptsTaggedEntries = true | ||
| 134 | session.passphrases = passphrases | ||
| 135 | session.open(file.path) | ||
| 136 | let buffer = StateBuffer(session.document!) | ||
| 137 | session.attach(buffer) | ||
| 138 | try buffer.update { try $0.apply([TextEdit(range: 15..<18, replacement: Self.secret)], baseRevision: $0.revision) } | ||
| 139 | session.bufferChanged() | ||
| 140 | #expect(!session.save()) | ||
| 141 | try await wait { !session.isDirty } | ||
| 142 | #expect(session.held.isEmpty) | ||
| 143 | #expect(keychain.calls.filter { $0.hasPrefix("read ") } == ["read \(file.path)"]) | ||
| 144 | let disk = try String(contentsOf: file, encoding: .utf8) | ||
| 145 | #expect(!disk.contains(Self.secret)) | ||
| 146 | #expect(try OrgCrypt.decrypt(disk, at: 0, passphrase: "pw").plaintext == Self.secret + "\n") | ||
| 147 | } | ||
| 148 | |||
| 149 | @Test func theQuestionIsAskedOnce() { | ||
| 150 | let defaults = TestDefaults("crypt") | ||
| 151 | // Undecided: the first typed passphrase asks, and isn't saved before the answer. | ||
| 152 | let (keychain, passphrases) = FakeKeychain.passphrases(.undecided, defaults: defaults) | ||
| 153 | #expect(passphrases.setting == .undecided && passphrases.asksFirst) | ||
| 154 | #expect(passphrases.keep("pw", for: "/x/a.org") == nil && keychain.saved.isEmpty) | ||
| 155 | // Not Now turns it off, for good. | ||
| 156 | passphrases.answer(enable: false) | ||
| 157 | #expect(passphrases.setting == .off && !passphrases.asksFirst) | ||
| 158 | #expect(passphrases.keep("pw", for: "/x/a.org") == nil && keychain.saved.isEmpty) | ||
| 159 | let later = CryptPassphrases(keychain: FakeKeychain(["/x/old.org": "pw"]), defaults: defaults) | ||
| 160 | #expect(later.setting == .off && !later.asksFirst) | ||
| 161 | later.askIfSavedBefore() | ||
| 162 | #expect(!later.asking) | ||
| 163 | // Enable turns it on and saves the passphrase. | ||
| 164 | let (enabled, enabling) = FakeKeychain.passphrases(.undecided) | ||
| 165 | enabling.answer(enable: true) | ||
| 166 | #expect(enabling.setting == .on && !enabling.asksFirst) | ||
| 167 | enabling.keep("pw", for: "/x/a.org") | ||
| 168 | #expect(enabled.saved == ["/x/a.org": "pw"]) | ||
| 169 | } | ||
| 170 | |||
| 171 | /// Passphrases an earlier version saved: the first launch asks, and they aren't read before | ||
| 172 | /// the answer. | ||
| 173 | @Test func savedPassphrasesFromBeforeAskAtLaunch() async { | ||
| 174 | let defaults = TestDefaults("crypt") | ||
| 175 | let (keychain, passphrases) = FakeKeychain.passphrases(.undecided, saved: ["/x/old.org": "pw"], defaults: defaults) | ||
| 176 | passphrases.askIfSavedBefore() | ||
| 177 | #expect(passphrases.asking) | ||
| 178 | #expect(await passphrases.stored(for: "/x/old.org") == nil) | ||
| 179 | #expect(keychain.calls == ["paths"]) | ||
| 180 | passphrases.answer(enable: true) | ||
| 181 | #expect(!passphrases.asking) | ||
| 182 | #expect(await passphrases.stored(for: "/x/old.org") == "pw") | ||
| 183 | let next = CryptPassphrases(keychain: keychain, defaults: defaults) | ||
| 184 | next.askIfSavedBefore() | ||
| 185 | #expect(!next.asking && next.setting == .on) | ||
| 186 | // None saved: nothing to ask until a passphrase is typed. | ||
| 187 | let (_, empty) = FakeKeychain.passphrases(.undecided) | ||
| 188 | empty.askIfSavedBefore() | ||
| 189 | #expect(!empty.asking && empty.setting == .undecided) | ||
| 190 | } | ||
| 191 | |||
| 192 | @Test func turningOffRemovesEverySavedPassphrase() async { | ||
| 193 | let (keychain, passphrases) = FakeKeychain.passphrases(.on, saved: ["/x/a.org": "a", "/x/b.org.gpg": "b"]) | ||
| 194 | passphrases.refresh() | ||
| 195 | #expect(passphrases.savedPaths == ["/x/a.org", "/x/b.org.gpg"]) | ||
| 196 | #expect(CryptPassphrases.removal(passphrases.savedPaths.count).contains("2 files")) | ||
| 197 | #expect(CryptPassphrases.removal(1).contains("1 file")) | ||
| 198 | _ = await passphrases.stored(for: "/x/a.org") | ||
| 199 | let context = passphrases.context(for: "/x/a.org") | ||
| 200 | passphrases.turnOff() | ||
| 201 | #expect(passphrases.setting == .off) | ||
| 202 | #expect(keychain.saved.isEmpty && passphrases.savedPaths.isEmpty) | ||
| 203 | #expect(Set(keychain.calls.filter { $0.hasPrefix("delete ") }) == ["delete /x/a.org", "delete /x/b.org.gpg"]) | ||
| 204 | #expect(passphrases.context(for: "/x/a.org") !== context) | ||
| 205 | // Forget in Settings removes one. | ||
| 206 | let (one, forgetting) = FakeKeychain.passphrases(.on, saved: ["/x/a.org": "a", "/x/b.org": "b"]) | ||
| 207 | forgetting.refresh() | ||
| 208 | forgetting.forget("/x/a.org") | ||
| 209 | #expect(one.saved == ["/x/b.org": "b"] && forgetting.savedPaths == ["/x/b.org"]) | ||
| 210 | } | ||
| 211 | |||
| 212 | @Test func theSettingIsKeptInUserDefaults() { | ||
| 213 | let defaults = TestDefaults("crypt") | ||
| 214 | let (_, passphrases) = FakeKeychain.passphrases(.undecided, defaults: defaults) | ||
| 215 | passphrases.turnOn() | ||
| 216 | #expect(defaults.string(forKey: "decryptWithBiometrics") == "on") | ||
| 217 | passphrases.turnOff() | ||
| 218 | #expect(defaults.string(forKey: "decryptWithBiometrics") == "off") | ||
| 219 | } | ||
| 220 | } | ||
Tests/OrgAppTests/CryptReviewTests.swift +12 −11 · view
| @@ -23,7 +23,7 @@ struct CryptReviewTests { | |||
| 23 | session = DocumentSession(recovery: FileRecoveryStore(directory: recoveryFolder)) | 23 | session = DocumentSession(recovery: FileRecoveryStore(directory: recoveryFolder)) |
| 24 | session.saveMode = .explicit | 24 | session.saveMode = .explicit |
| 25 | session.encryptsTaggedEntries = true | 25 | session.encryptsTaggedEntries = true |
| 26 | session.hasStoredPassphrase = { _ in false } | 26 | session.passphrases = FakeKeychain.passphrases(.undecided).passphrases |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | func replace(with text: String) throws { | 29 | func replace(with text: String) throws { |
| @@ -142,7 +142,7 @@ struct CryptReviewTests { | |||
| 142 | let files = InjectingFileSystem() | 142 | let files = InjectingFileSystem() |
| 143 | let session = DocumentSession(fileSystem: files, recovery: FileRecoveryStore(directory: recoveryFolder)) | 143 | let session = DocumentSession(fileSystem: files, recovery: FileRecoveryStore(directory: recoveryFolder)) |
| 144 | session.encryptsTaggedEntries = true | 144 | session.encryptsTaggedEntries = true |
| 145 | session.hasStoredPassphrase = { _ in false } | 145 | session.passphrases = FakeKeychain.passphrases(.undecided).passphrases |
| 146 | let theirs = "* B\nb\n* Emacs :crypt:\nemacs secret\n* Work\nEMACSWORK\n" | 146 | let theirs = "* B\nb\n* Emacs :crypt:\nemacs secret\n* Work\nEMACSWORK\n" |
| 147 | let b = try notes.write("b.org", "* B\nb\n") | 147 | let b = try notes.write("b.org", "* B\nb\n") |
| 148 | func check(_ message: String?, _ what: String) { | 148 | func check(_ message: String?, _ what: String) { |
| @@ -191,7 +191,7 @@ struct CryptReviewTests { | |||
| 191 | let files = InjectingFileSystem() | 191 | let files = InjectingFileSystem() |
| 192 | let session = DocumentSession(fileSystem: files, recovery: FileRecoveryStore(directory: recoveryFolder)) | 192 | let session = DocumentSession(fileSystem: files, recovery: FileRecoveryStore(directory: recoveryFolder)) |
| 193 | session.encryptsTaggedEntries = true | 193 | session.encryptsTaggedEntries = true |
| 194 | session.hasStoredPassphrase = { _ in false } | 194 | session.passphrases = FakeKeychain.passphrases(.undecided).passphrases |
| 195 | let b = try notes.write("b.org", "* B\nb\n") | 195 | let b = try notes.write("b.org", "* B\nb\n") |
| 196 | files.inject[b.path] = "* B\nb\n* Emacs :crypt:\nemacs secret\n" | 196 | files.inject[b.path] = "* B\nb\n* Emacs :crypt:\nemacs secret\n" |
| 197 | files.injectAfter[b.path] = "* B\nthird\n" | 197 | files.injectAfter[b.path] = "* B\nthird\n" |
| @@ -290,10 +290,10 @@ struct CryptReviewTests { | |||
| 290 | let path = notes.url.appendingPathComponent("d.org.gpg") | 290 | let path = notes.url.appendingPathComponent("d.org.gpg") |
| 291 | try OpenPGP.encryptedMessage(Data("* D\n".utf8), passphrase: "pw").write(to: path) | 291 | try OpenPGP.encryptedMessage(Data("* D\n".utf8), passphrase: "pw").write(to: path) |
| 292 | session.open(path.path) | 292 | session.open(path.path) |
| 293 | let context = CryptPassphrases.context(for: path.path) | 293 | let context = session.passphrases.context(for: path.path) |
| 294 | session.cancelUnlock() | 294 | session.cancelUnlock() |
| 295 | #expect(CryptPassphrases.context(for: path.path) !== context) | 295 | #expect(session.passphrases.context(for: path.path) !== context) |
| 296 | CryptPassphrases.endSession(for: path.path) | 296 | session.passphrases.endSession(for: path.path) |
| 297 | #expect(!CryptPassphrases.protectsItems) | 297 | #expect(!CryptPassphrases.protectsItems) |
| 298 | } | 298 | } |
| 299 | 299 | ||
| @@ -390,11 +390,12 @@ struct CryptReviewTests { | |||
| 390 | 390 | ||
| 391 | // Second review, 3 | 391 | // Second review, 3 |
| 392 | @Test func eachFileHasItsOwnAuthentication() throws { | 392 | @Test func eachFileHasItsOwnAuthentication() throws { |
| 393 | let a = CryptPassphrases.context(for: "/x/a.org"), b = CryptPassphrases.context(for: "/x/b.org") | 393 | let passphrases = session.passphrases |
| 394 | #expect(a !== b && CryptPassphrases.context(for: "/x/a.org") === a) | 394 | let a = passphrases.context(for: "/x/a.org"), b = passphrases.context(for: "/x/b.org") |
| 395 | #expect(a !== b && passphrases.context(for: "/x/a.org") === a) | ||
| 395 | #expect(a.touchIDAuthenticationAllowableReuseDuration == 0) | 396 | #expect(a.touchIDAuthenticationAllowableReuseDuration == 0) |
| 396 | CryptPassphrases.endSession(for: "/x/a.org") | 397 | passphrases.endSession(for: "/x/a.org") |
| 397 | #expect(CryptPassphrases.context(for: "/x/a.org") !== a) | 398 | #expect(passphrases.context(for: "/x/a.org") !== a) |
| 398 | } | 399 | } |
| 399 | 400 | ||
| 400 | // Second review, 4a | 401 | // Second review, 4a |
| @@ -502,7 +503,7 @@ struct CryptReviewTests { | |||
| 502 | 503 | ||
| 503 | // 6 | 504 | // 6 |
| 504 | @Test func keychainItemsAreThisDeviceOnlyAfterUserPresence() throws { | 505 | @Test func keychainItemsAreThisDeviceOnlyAfterUserPresence() throws { |
| 505 | let item = try #require(CryptPassphrases.newItem("pw", for: "/x/a.org")) | 506 | let item = try #require(SystemKeychain.newItem("pw", for: "/x/a.org")) |
| 506 | #expect(item[kSecAttrAccessControl as String] != nil) | 507 | #expect(item[kSecAttrAccessControl as String] != nil) |
| 507 | #expect(item[kSecUseDataProtectionKeychain as String] as? Bool == true) | 508 | #expect(item[kSecUseDataProtectionKeychain as String] as? Bool == true) |
| 508 | #expect(item[kSecAttrService as String] as? String == "sh.krz.orgstar.crypt.v2") | 509 | #expect(item[kSecAttrService as String] as? String == "sh.krz.orgstar.crypt.v2") |
Tests/OrgAppTests/CryptSaveTests.swift +4 −4 · view
| @@ -22,7 +22,7 @@ struct CryptSaveTests { | |||
| 22 | session = DocumentSession(recovery: FileRecoveryStore(directory: recoveryFolder)) | 22 | session = DocumentSession(recovery: FileRecoveryStore(directory: recoveryFolder)) |
| 23 | session.saveMode = .explicit | 23 | session.saveMode = .explicit |
| 24 | session.encryptsTaggedEntries = true | 24 | session.encryptsTaggedEntries = true |
| 25 | session.hasStoredPassphrase = { _ in false } | 25 | session.passphrases = FakeKeychain.passphrases(.undecided).passphrases |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | /// Types `text` at `offset` in the open file, as the editor would. | 28 | /// Types `text` at `offset` in the open file, as the editor would. |
| @@ -60,9 +60,9 @@ struct CryptSaveTests { | |||
| 60 | 60 | ||
| 61 | @Test func savesTaggedEntriesEncryptedWithTheRememberedPassphrase() async throws { | 61 | @Test func savesTaggedEntriesEncryptedWithTheRememberedPassphrase() async throws { |
| 62 | try notes.write("a.org", "* Bank :crypt:\nold\n* Last\n") | 62 | try notes.write("a.org", "* Bank :crypt:\nold\n* Last\n") |
| 63 | session.hasStoredPassphrase = { _ in true } | 63 | let (keychain, passphrases) = FakeKeychain.passphrases(.on, saved: [file.path: "pw"]) |
| 64 | var asked = 0 | 64 | session.passphrases = passphrases |
| 65 | session.storedPassphrase = { _ in asked += 1; return "pw" } | 65 | var asked: Int { keychain.calls.filter { $0.hasPrefix("read ") }.count } |
| 66 | var written: [String] = [] | 66 | var written: [String] = [] |
| 67 | session.fileWritten = { written.append($0) } | 67 | session.fileWritten = { written.append($0) } |
| 68 | session.open(file.path) | 68 | session.open(file.path) |
docs/manual/guide/04-outlines.org +17 −6 · view
| @@ -947,14 +947,25 @@ ww0ECQMI… | |||
| 947 | | Decrypt Entry… (=app.crypt.open-entry=) | Asks for the passphrase and shows the decrypted text in a sheet. Save encrypts the edited text again in the message's place; the file never holds the plaintext. Decrypt in File puts the text in the file instead. | | 947 | | Decrypt Entry… (=app.crypt.open-entry=) | Asks for the passphrase and shows the decrypted text in a sheet. Save encrypts the edited text again in the message's place; the file never holds the plaintext. Decrypt in File puts the text in the file instead. | |
| 948 | | Decrypt Entry in File… (=app.crypt.decrypt-entry=) | Replaces the message with the decrypted text (=org-decrypt-entry=). Headings in it are moved below the entry's level when they aren't. | | 948 | | Decrypt Entry in File… (=app.crypt.decrypt-entry=) | Replaces the message with the decrypted text (=org-decrypt-entry=). Headings in it are moved below the entry's level when they aren't. | |
| 949 | | Encrypt Tagged Entries… (=app.crypt.encrypt-entries=) | Encrypts every entry with the =crypt= tag, its own or inherited, that isn't encrypted yet (=org-encrypt-entries=). A tagged entry's tagged children go inside its message. | | 949 | | Encrypt Tagged Entries… (=app.crypt.encrypt-entries=) | Encrypts every entry with the =crypt= tag, its own or inherited, that isn't encrypted yet (=org-encrypt-entries=). A tagged entry's tagged children go inside its message. | |
| 950 | | Forget Encryption Passphrase (=app.crypt.forget-passphrase=) | Removes the current file's passphrase from the Keychain. | | 950 | | Forget Encryption Passphrase (=app.crypt.forget-passphrase=) | Removes the current file's passphrase from the Keychain and from memory. | |
| 951 | 951 | ||
| 952 | The commands have no keys, as in Org; run them from the command palette, or bind them in =keymap.toml=. On iOS they are in the editor's Commands. | 952 | The commands have no keys, as in Org; run them from the command palette, or bind them in =keymap.toml=. On iOS they are in the editor's Commands. |
| 953 | 953 | ||
| 954 | Remember in the Keychain stores the passphrase for the file. The next command on that file uses it after Touch ID, Face ID or the device password, without asking. =org-crypt-tag-matcher= in =config.toml= sets the tag; it must be a single tag, not a match expression. | 954 | =org-crypt-tag-matcher= in =config.toml= sets the tag; it must be a single tag, not a match expression. |
| 955 | 955 | ||
| 956 | Messages are written with AES-256 and an iterated and salted SHA-256 key, which GnuPG and Emacs read. Messages using AES-128, AES-192 or AES-256 are read, compressed or not. Messages encrypted to a public key, other ciphers, and AEAD (OpenPGP version 5 and 6) packets are not supported. | 956 | Messages are written with AES-256 and an iterated and salted SHA-256 key, which GnuPG and Emacs read. Messages using AES-128, AES-192 or AES-256 are read, compressed or not. Messages encrypted to a public key, other ciphers, and AEAD (OpenPGP version 5 and 6) packets are not supported. |
| 957 | 957 | ||
| 958 | ** Face ID and Touch ID | ||
| 959 | |||
| 960 | One setting decides whether passphrases are saved in the Keychain: Use Face ID to Decrypt on iPhone and iPad (Use Touch ID to Decrypt on the Mac and on an iPad with Touch ID). It is in Settings ▸ Encryption on the Mac and in the Settings tab on iOS. It is kept in the app's settings on the device, not in =config.toml=, so it isn't synced to other devices and can't be changed by editing a file. | ||
| 961 | |||
| 962 | - Off :: No passphrase is saved in the Keychain or read from it. A passphrase is typed when it's needed: by the org-crypt commands, to open a =.org.gpg= file, and by Encrypt… for a held file. Once typed, it is kept in memory for that file until the file is closed. | ||
| 963 | - On :: A passphrase typed for a file, once it has opened or encrypted the file, is saved in the Keychain for that file. From then on the commands, opening the file, Encrypt… and encrypting on save use it after Face ID, Touch ID or the device's passcode or password, without asking for the passphrase. | ||
| 964 | |||
| 965 | Until you choose, the setting is undecided and works as Off. The first time you type a passphrase that works, orgstar explains that Face ID can then decrypt anything whose passphrase is saved in your Keychain, and asks whether to use it: Enable turns the setting on and saves that passphrase; Not Now turns it off. Either answer is kept, so the question isn't asked again; change it in Settings. If passphrases saved by an earlier version of orgstar are in the Keychain, the question is asked once at the first launch instead, and they aren't used unless you choose Enable. | ||
| 966 | |||
| 967 | Turning the setting off in Settings asks first, saying how many saved passphrases will be removed, then removes them from the Keychain. Settings lists the files with a saved passphrase, by name and folder, each with Forget, which removes that file's passphrase. Forget Encryption Passphrase does the same for the current file. | ||
| 968 | |||
| 958 | ** Encrypting on save | 969 | ** Encrypting on save |
| 959 | 970 | ||
| 960 | With =org-crypt-use-before-save-magic = true= in =config.toml=, every save, the automatic one included, encrypts the tagged entries that aren't encrypted, as =org-crypt-use-before-save-magic= does in Emacs. It is off by default. | 971 | With =org-crypt-use-before-save-magic = true= in =config.toml=, every save, the automatic one included, encrypts the tagged entries that aren't encrypted, as =org-crypt-use-before-save-magic= does in Emacs. It is off by default. |
| @@ -963,8 +974,8 @@ With =org-crypt-use-before-save-magic = true= in =config.toml=, every save, the | |||
| 963 | - An entry decrypted with Decrypt Entry in File… and saved unchanged gets its old message back, byte for byte, as org-crypt does, and so does an entry left unchanged between saves. Only entries that changed get a new message, so syncing and git see no other change. A new message takes GnuPG's key iterations (about 65 MB of hashing); each changed entry adds a few hundredths of a second to its save. | 974 | - An entry decrypted with Decrypt Entry in File… and saved unchanged gets its old message back, byte for byte, as org-crypt does, and so does an entry left unchanged between saves. Only entries that changed get a new message, so syncing and git see no other change. A new message takes GnuPG's key iterations (about 65 MB of hashing); each changed entry adds a few hundredths of a second to its save. |
| 964 | - Text typed below an entry's message isn't encrypted until it goes into the message: the save opens the old message with the passphrase and encrypts it with the new text as one. | 975 | - Text typed below an entry's message isn't encrypted until it goes into the message: the save opens the old message with the passphrase and encrypts it with the new text as one. |
| 965 | - Turning the setting off while a file is open doesn't write what it encrypted in plaintext: the file keeps encrypting its tagged entries until it's closed. Files opened afterwards are saved as they are. | 976 | - Turning the setting off while a file is open doesn't write what it encrypted in plaintext: the file keeps encrypting its tagged entries until it's closed. Files opened afterwards are saved as they are. |
| 966 | - The passphrase comes from the Keychain when it was remembered for the file, after Touch ID, Face ID or the device password. That is asked once for each file while it's open, at the first save that needs it; another file asks again, and so does the same file after it was closed. A passphrase typed for an org-crypt command on the file is used too. Closing the file or Forget Encryption Passphrase forgets it. | 977 | - A passphrase typed for an org-crypt command on the file is used. With Use Face ID to Decrypt on, so is one saved in the Keychain for the file, after Face ID, Touch ID or the device password; that is asked once for each file while it's open, at the first save that needs it; another file asks again, and so does the same file after it was closed. With the setting off or undecided, the Keychain isn't asked. Closing the file or Forget Encryption Passphrase forgets the passphrase. |
| 967 | - Without the passphrase, or when Touch ID is declined, the file isn't saved at all, and no recovery version or snapshot of it is kept, until the entries can be encrypted. A notice above the mode line (on iOS, at the top of the editor) says how many tagged entries aren't encrypted, and stays while that's so; its Encrypt… button asks for the passphrase and saves. Other edits to the file wait meanwhile. An entry with no text doesn't keep the file from being saved. | 978 | - Without the passphrase, or when Face ID or Touch ID is declined, the file isn't saved at all, and no recovery version or snapshot of it is kept, until the entries can be encrypted. A notice above the mode line (on iOS, at the top of the editor) says how many tagged entries aren't encrypted, and stays while that's so; its Encrypt… button asks for the passphrase and saves. Other edits to the file wait meanwhile. An entry with no text doesn't keep the file from being saved. |
| 968 | - When the file has encrypted entries already, the passphrase must open them. A first passphrase is asked twice. Entries encrypted to a public key (=org-crypt-key=) are left as they are and aren't checked; text typed below one can't be encrypted, and saving says so. | 979 | - When the file has encrypted entries already, the passphrase must open them. A first passphrase is asked twice. Entries encrypted to a public key (=org-crypt-key=) are left as they are and aren't checked; text typed below one can't be encrypted, and saving says so. |
| 969 | - Use Disk Version, Merge with Markers, restoring an earlier version and resolving a sync conflict keep a copy of the editor's text first; while the file is held that copy can't be kept encrypted, so they stop and ask for the passphrase first. Replace in Files on a held file that has no editor open replaces without keeping a copy; the replacement can be undone in the file. | 980 | - Use Disk Version, Merge with Markers, restoring an earlier version and resolving a sync conflict keep a copy of the editor's text first; while the file is held that copy can't be kept encrypted, so they stop and ask for the passphrase first. Replace in Files on a held file that has no editor open replaces without keeping a copy; the replacement can be undone in the file. |
| 970 | - Archiving, refiling or copying an entry with the tag to another file encrypts it in place first; without the passphrase it isn't moved. A heading inside an encrypted entry (in its message on disk) isn't archived, refiled or copied on its own, to another file or within its own; move the encrypted entry. | 981 | - Archiving, refiling or copying an entry with the tag to another file encrypts it in place first; without the passphrase it isn't moved. A heading inside an encrypted entry (in its message on disk) isn't archived, refiled or copied on its own, to another file or within its own; move the encrypted entry. |
| @@ -977,14 +988,14 @@ With =org-crypt-use-before-save-magic = true= in =config.toml=, every save, the | |||
| 977 | 988 | ||
| 978 | orgstar opens and saves files encrypted with a passphrase as GnuPG (=gpg --symmetric=) and Emacs's EasyPG (=epa-file=) write them, named =NAME.org.gpg=. They show in the sidebar and the file list by name. | 989 | orgstar opens and saves files encrypted with a passphrase as GnuPG (=gpg --symmetric=) and Emacs's EasyPG (=epa-file=) write them, named =NAME.org.gpg=. They show in the sidebar and the file list by name. |
| 979 | 990 | ||
| 980 | Opening one asks for its passphrase, or takes it from the Keychain after Touch ID, Face ID or the device password; Remember in the Keychain keeps it for the file. A wrong passphrase leaves the file closed and as it was. While the file is open, saves encrypt it with that passphrase; closing it forgets the passphrase. A new file named =NAME.org.gpg= is empty: it isn't saved until Set Passphrase… in its notice gives it a passphrase, typed twice. | 991 | Opening one asks for its passphrase, or, with Use Face ID to Decrypt on, takes it from the Keychain after Face ID, Touch ID or the device password (see Face ID and Touch ID above). A wrong passphrase leaves the file closed and as it was. While the file is open, saves encrypt it with that passphrase; closing it forgets the passphrase. A new file named =NAME.org.gpg= is empty: it isn't saved until Set Passphrase… in its notice gives it a passphrase, typed twice. |
| 981 | 992 | ||
| 982 | The decrypted text is kept in memory only: | 993 | The decrypted text is kept in memory only: |
| 983 | - Files are written with AES-256 and an iterated and salted SHA-256 key, binary, or armored when the file was armored. | 994 | - Files are written with AES-256 and an iterated and salted SHA-256 key, binary, or armored when the file was armored. |
| 984 | - Recovery versions and hourly snapshots are kept encrypted with the file's passphrase, and Recovery Versions… shows them decrypted. Changes made to the file elsewhere are merged in memory, and a conflict is compared in memory. | 995 | - Recovery versions and hourly snapshots are kept encrypted with the file's passphrase, and Recovery Versions… shows them decrypted. Changes made to the file elsewhere are merged in memory, and a conflict is compared in memory. |
| 985 | - The index, search, Spotlight, Quick Look, the agenda, widgets and the watch don't read the file's text. iCalendar export and publishing leave it out, and Emacs isn't given a copy of it. A clocked heading shows as "Encrypted entry" outside the editor. Handoff doesn't offer the file, and Share Subtree… refuses its entries. | 996 | - The index, search, Spotlight, Quick Look, the agenda, widgets and the watch don't read the file's text. iCalendar export and publishing leave it out, and Emacs isn't given a copy of it. A clocked heading shows as "Encrypted entry" outside the editor. Handoff doesn't offer the file, and Share Subtree… refuses its entries. |
| 986 | - Archiving from =NAME.org.gpg= goes to =NAME_archive.org.gpg=, encrypted with the same passphrase (Org would write =NAME.org.gpg_archive=, unencrypted). Entries aren't refiled or copied from it to a file that isn't encrypted. | 997 | - Archiving from =NAME.org.gpg= goes to =NAME_archive.org.gpg=, encrypted with the same passphrase (Org would write =NAME.org.gpg_archive=, unencrypted). Entries aren't refiled or copied from it to a file that isn't encrypted. |
| 987 | - Remembered passphrases are kept by the file's path, on this device only, readable while it's unlocked and after Touch ID, Face ID or the device password; renaming the file forgets it. Passphrases remembered by earlier versions move to this kind of item the first time they're used. The version of orgstar downloaded from the website can't make such items (it has no Keychain entitlement): it keeps remembered passphrases in the login keychain, not limited to this Mac, still asking for Touch ID or the password before one is used, and says so beside Remember in the Keychain. | 998 | - Saved passphrases are kept by the file's path, on this device only, readable while it's unlocked and after Face ID, Touch ID or the device password; renaming the file forgets it. Passphrases saved by earlier versions move to this kind of item the first time they're used with the setting on. The version of orgstar downloaded from the website can't make such items (it has no Keychain entitlement): it keeps saved passphrases in the login keychain, not limited to this Mac, still asking for Touch ID or the password before one is used, and says so under Use Touch ID to Decrypt. |
| 988 | 999 | ||
| 989 | =age= files (=.age=) aren't supported. | 1000 | =age= files (=.age=) aren't supported. |
| 990 | 1001 | ||
docs/manual/guide/13-configuration.org +12 −1 · view
| @@ -49,7 +49,7 @@ A file that isn't valid TOML is reported with its parse error, and none of it ap | |||
| 49 | 49 | ||
| 50 | * The Settings window | 50 | * The Settings window |
| 51 | 51 | ||
| 52 | Open it with orgstar ▸ Settings (=⌘,=). It has six panes, and a seventh, Git, in the download version. The last, orgstar+, has the plans and Restore Purchases in the Mac App Store version and the license key in the download version. Each control in the others, except Git, writes the =config.toml= key named in the tables below; the config.toml reference below gives the type and the Emacs variable. | 52 | Open it with orgstar ▸ Settings (=⌘,=). It has seven panes, and an eighth, Git, in the download version. The last, orgstar+, has the plans and Restore Purchases in the Mac App Store version and the license key in the download version. Each control in the others, except Encryption and Git, writes the =config.toml= key named in the tables below; the config.toml reference below gives the type and the Emacs variable. |
| 53 | 53 | ||
| 54 | ** General | 54 | ** General |
| 55 | 55 | ||
| @@ -166,6 +166,17 @@ Turning on the idle question sets =org-clock-idle-time= to 15 minutes; turning i | |||
| 166 | 166 | ||
| 167 | The footer shows the path of =capture.toml=. Templates are covered in [[file:08-capture.org][Capture]]. | 167 | The footer shows the path of =capture.toml=. Templates are covered in [[file:08-capture.org][Capture]]. |
| 168 | 168 | ||
| 169 | ** Encryption | ||
| 170 | |||
| 171 | | Control | Choices | Default | | ||
| 172 | |-------------------------+-----------------------+----------------------------------------------| | ||
| 173 | | Use Touch ID to Decrypt | On or off | Off, asked the first time a passphrase works | | ||
| 174 | | Saved Passphrases | Forget, for each file | | | ||
| 175 | |||
| 176 | With it on, a passphrase typed for an encrypted entry or file is saved in the Keychain, and Touch ID or your password unlocks it from then on. With it off, nothing is saved in the Keychain or read from it. Turning it off asks first, saying how many saved passphrases it removes. Saved Passphrases lists the files with a saved passphrase. In the download version, a note under the switch says passphrases are kept in the login keychain, not limited to this Mac. | ||
| 177 | |||
| 178 | The choice is kept on this Mac, not in =config.toml=, so it isn't synced and can't be changed by editing a file. On iPhone and iPad the same switch, Use Face ID to Decrypt, is in the Settings tab. See [[file:04-outlines.org::*Face ID and Touch ID][Face ID and Touch ID]]. | ||
| 179 | |||
| 169 | ** Git | 180 | ** Git |
| 170 | 181 | ||
| 171 | Download version only. One row for each folder in the sidebar; a folder that isn't in a git repository says so. | 182 | Download version only. One row for each folder in the sidebar; a folder that isn't in a git repository says so. |
docs/manual/guide/14-ios.org +3 −1 · view
| @@ -204,7 +204,7 @@ Sync with Working Copy, under File in Commands, syncs the folder of the open fil | |||
| 204 | 204 | ||
| 205 | Archive Subtree in Commands (or =C-c C-x C-s= with a hardware keyboard) archives the entry at the caret where =org-archive-location= says, as on the Mac. | 205 | Archive Subtree in Commands (or =C-c C-x C-s= with a hardware keyboard) archives the entry at the caret where =org-archive-location= says, as on the Mac. |
| 206 | 206 | ||
| 207 | Commands has the org-crypt commands; see [[file:04-outlines.org][Outlines]]. A remembered passphrase is used after Face ID, Touch ID or the device passcode. | 207 | Commands has the org-crypt commands; see [[file:04-outlines.org][Outlines]]. With Use Face ID to Decrypt on in Settings, a typed passphrase is saved in the Keychain and used after Face ID, Touch ID or the device passcode; with it off, a passphrase is typed each time the file is opened. The first passphrase you type asks which you want. |
| 208 | 208 | ||
| 209 | Rename Tag… and Rename TODO Keyword… in the editor's Commands, under TODO and Tags, rename a tag or a keyword in every org file of one folder or all folders, as on the Mac: a sheet asks for the old and new name (the menu beside the first field lists the tags of your folders, or the keywords), the folder, and whether to change =config.toml= too; Find lists each line that changes, with a switch to leave it out, and Rename applies them. A change to =config.toml= goes into the synced folder's file. See [[file:05-todos-and-tags.org][TODOs and tags]]. | 209 | Rename Tag… and Rename TODO Keyword… in the editor's Commands, under TODO and Tags, rename a tag or a keyword in every org file of one folder or all folders, as on the Mac: a sheet asks for the old and new name (the menu beside the first field lists the tags of your folders, or the keywords), the folder, and whether to change =config.toml= too; Find lists each line that changes, with a switch to leave it out, and Rename applies them. A change to =config.toml= goes into the synced folder's file. See [[file:05-todos-and-tags.org][TODOs and tags]]. |
| 210 | 210 | ||
| @@ -512,6 +512,8 @@ The Agenda, TODO Dependencies, Calendar and Reminders sections are the only plac | |||
| 512 | 512 | ||
| 513 | These write =config.toml= in the configuration folder, as the Mac's Settings window does, so the Mac sees the change too. Without a configuration folder they are kept on the device. | 513 | These write =config.toml= in the configuration folder, as the Mac's Settings window does, so the Mac sees the change too. Without a configuration folder they are kept on the device. |
| 514 | 514 | ||
| 515 | Use Face ID to Decrypt (Use Touch ID to Decrypt on an iPad with Touch ID), below Working Copy, is kept on the device only, never in =config.toml=. With it on, a passphrase typed for an encrypted entry or file is saved in the Keychain, and Face ID or the device passcode unlocks it from then on; with it off, nothing is saved in the Keychain or read from it. It starts undecided, which works as off, and the first passphrase that works asks whether to turn it on (Enable or Not Now). Turning it off asks first, saying how many saved passphrases it removes. Saved Passphrases, under the switch, lists the files with a saved passphrase, each with Forget. See [[file:04-outlines.org::*Face ID and Touch ID][Face ID and Touch ID]]. | ||
| 516 | |||
| 515 | The In Use section shows the TODO keywords, the agenda span and start (for example =10 days, starting today=), Notifications (how long before a timed entry it notifies you, or Off), the capture template keys, the light and dark themes, and the theme file's name when there is one, and the font with its size. When =font= names a family that isn't installed on the device, Font shows the system's font with a note, as =System monospaced, 13 pt (JetBrains Mono isn't installed)=. | 517 | The In Use section shows the TODO keywords, the agenda span and start (for example =10 days, starting today=), Notifications (how long before a timed entry it notifies you, or Off), the capture template keys, the light and dark themes, and the theme file's name when there is one, and the font with its size. When =font= names a family that isn't installed on the device, Font shows the system's font with a note, as =System monospaced, 13 pt (JetBrains Mono isn't installed)=. |
| 516 | 518 | ||
| 517 | About orgstar, at the bottom, shows the version, What's New (the sheet that opens once after an update with what changed) and links to the manual, the release notes, the website, the issue tracker (which needs a gitbay account), support by email at =help@krz.sh= with the version and device filled in, the App Store review page, the source code, the license, third-party notices and the privacy policy. | 519 | About orgstar, at the bottom, shows the version, What's New (the sheet that opens once after an update with what changed) and links to the manual, the release notes, the website, the issue tracker (which needs a gitbay account), support by email at =help@krz.sh= with the version and device filled in, the App Store review page, the source code, the license, third-party notices and the privacy policy. |
l10n/Localizable.xcstrings +386 −34 · view
| @@ -16115,6 +16115,40 @@ | |||
| 16115 | } | 16115 | } |
| 16116 | } | 16116 | } |
| 16117 | }, | 16117 | }, |
| 16118 | "Enable": { | ||
| 16119 | "localizations": { | ||
| 16120 | "de": { | ||
| 16121 | "stringUnit": { | ||
| 16122 | "state": "translated", | ||
| 16123 | "value": "Aktivieren" | ||
| 16124 | } | ||
| 16125 | }, | ||
| 16126 | "es": { | ||
| 16127 | "stringUnit": { | ||
| 16128 | "state": "translated", | ||
| 16129 | "value": "Activar" | ||
| 16130 | } | ||
| 16131 | }, | ||
| 16132 | "fr": { | ||
| 16133 | "stringUnit": { | ||
| 16134 | "state": "translated", | ||
| 16135 | "value": "Activer" | ||
| 16136 | } | ||
| 16137 | }, | ||
| 16138 | "ja": { | ||
| 16139 | "stringUnit": { | ||
| 16140 | "state": "translated", | ||
| 16141 | "value": "オンにする" | ||
| 16142 | } | ||
| 16143 | }, | ||
| 16144 | "pt-BR": { | ||
| 16145 | "stringUnit": { | ||
| 16146 | "state": "translated", | ||
| 16147 | "value": "Ativar" | ||
| 16148 | } | ||
| 16149 | } | ||
| 16150 | } | ||
| 16151 | }, | ||
| 16118 | "Encrypt": { | 16152 | "Encrypt": { |
| 16119 | "localizations": { | 16153 | "localizations": { |
| 16120 | "de": { | 16154 | "de": { |
| @@ -19519,6 +19553,40 @@ | |||
| 19519 | } | 19553 | } |
| 19520 | } | 19554 | } |
| 19521 | }, | 19555 | }, |
| 19556 | "Forget": { | ||
| 19557 | "localizations": { | ||
| 19558 | "de": { | ||
| 19559 | "stringUnit": { | ||
| 19560 | "state": "translated", | ||
| 19561 | "value": "Vergessen" | ||
| 19562 | } | ||
| 19563 | }, | ||
| 19564 | "es": { | ||
| 19565 | "stringUnit": { | ||
| 19566 | "state": "translated", | ||
| 19567 | "value": "Olvidar" | ||
| 19568 | } | ||
| 19569 | }, | ||
| 19570 | "fr": { | ||
| 19571 | "stringUnit": { | ||
| 19572 | "state": "translated", | ||
| 19573 | "value": "Oublier" | ||
| 19574 | } | ||
| 19575 | }, | ||
| 19576 | "ja": { | ||
| 19577 | "stringUnit": { | ||
| 19578 | "state": "translated", | ||
| 19579 | "value": "削除" | ||
| 19580 | } | ||
| 19581 | }, | ||
| 19582 | "pt-BR": { | ||
| 19583 | "stringUnit": { | ||
| 19584 | "state": "translated", | ||
| 19585 | "value": "Esquecer" | ||
| 19586 | } | ||
| 19587 | } | ||
| 19588 | } | ||
| 19589 | }, | ||
| 19522 | "Forget Encryption Passphrase": { | 19590 | "Forget Encryption Passphrase": { |
| 19523 | "comment": "Command title", | 19591 | "comment": "Command title", |
| 19524 | "localizations": { | 19592 | "localizations": { |
| @@ -32368,6 +32436,86 @@ | |||
| 32368 | } | 32436 | } |
| 32369 | } | 32437 | } |
| 32370 | }, | 32438 | }, |
| 32439 | "Passphrases you type for encrypted files and entries are saved in the Keychain, and %@ or your passcode unlocks them. %@ can then decrypt anything whose passphrase is saved in your Keychain. Otherwise a passphrase is typed when it's needed and kept only while its file is open.": { | ||
| 32440 | "localizations": { | ||
| 32441 | "de": { | ||
| 32442 | "stringUnit": { | ||
| 32443 | "state": "translated", | ||
| 32444 | "value": "Passwörter, die du für verschlüsselte Dateien und Einträge eingibst, werden im Schlüsselbund gesichert, und %1$@ oder dein Code gibt sie frei. %2$@ kann dann alles entschlüsseln, dessen Passwort in deinem Schlüsselbund gesichert ist. Sonst wird ein Passwort eingegeben, wenn es gebraucht wird, und nur behalten, solange seine Datei geöffnet ist." | ||
| 32445 | } | ||
| 32446 | }, | ||
| 32447 | "en": { | ||
| 32448 | "stringUnit": { | ||
| 32449 | "state": "new", | ||
| 32450 | "value": "Passphrases you type for encrypted files and entries are saved in the Keychain, and %1$@ or your passcode unlocks them. %2$@ can then decrypt anything whose passphrase is saved in your Keychain. Otherwise a passphrase is typed when it's needed and kept only while its file is open." | ||
| 32451 | } | ||
| 32452 | }, | ||
| 32453 | "es": { | ||
| 32454 | "stringUnit": { | ||
| 32455 | "state": "translated", | ||
| 32456 | "value": "Las frases de contraseña que escribes para archivos y entradas cifrados se guardan en el llavero, y %1$@ o tu código las desbloquea. %2$@ podrá entonces descifrar todo aquello cuya frase de contraseña esté guardada en tu llavero. Si no, la frase de contraseña se escribe cuando hace falta y se conserva solo mientras su archivo está abierto." | ||
| 32457 | } | ||
| 32458 | }, | ||
| 32459 | "fr": { | ||
| 32460 | "stringUnit": { | ||
| 32461 | "state": "translated", | ||
| 32462 | "value": "Les phrases secrètes que vous saisissez pour les fichiers et entrées chiffrés sont enregistrées dans le trousseau, et %1$@ ou votre code les déverrouille. %2$@ peut alors déchiffrer tout ce dont la phrase secrète est enregistrée dans votre trousseau. Sinon, une phrase secrète est saisie quand elle est nécessaire et n'est gardée que tant que son fichier est ouvert." | ||
| 32463 | } | ||
| 32464 | }, | ||
| 32465 | "ja": { | ||
| 32466 | "stringUnit": { | ||
| 32467 | "state": "translated", | ||
| 32468 | "value": "暗号化されたファイルやエントリに入力したパスフレーズはキーチェーンに保存され、%1$@またはパスコードで解除されます。これにより、キーチェーンにパスフレーズが保存されているものはすべて%2$@で復号できます。オフの場合、パスフレーズは必要なときに入力し、そのファイルを開いている間だけ保持されます。" | ||
| 32469 | } | ||
| 32470 | }, | ||
| 32471 | "pt-BR": { | ||
| 32472 | "stringUnit": { | ||
| 32473 | "state": "translated", | ||
| 32474 | "value": "As senhas que você digita para arquivos e entradas criptografados são salvas nas Chaves, e o %1$@ ou seu código as desbloqueia. O %2$@ poderá então descriptografar tudo cuja senha esteja salva nas suas Chaves. Caso contrário, a senha é digitada quando necessária e mantida apenas enquanto o arquivo estiver aberto." | ||
| 32475 | } | ||
| 32476 | } | ||
| 32477 | } | ||
| 32478 | }, | ||
| 32479 | "Passphrases you type for encrypted files and entries are saved in the Keychain, and %@ or your password unlocks them. %@ can then decrypt anything whose passphrase is saved in your Keychain. Otherwise a passphrase is typed when it's needed and kept only while its file is open.": { | ||
| 32480 | "localizations": { | ||
| 32481 | "de": { | ||
| 32482 | "stringUnit": { | ||
| 32483 | "state": "translated", | ||
| 32484 | "value": "Passwörter, die du für verschlüsselte Dateien und Einträge eingibst, werden im Schlüsselbund gesichert, und %1$@ oder dein Passwort gibt sie frei. %2$@ kann dann alles entschlüsseln, dessen Passwort in deinem Schlüsselbund gesichert ist. Sonst wird ein Passwort eingegeben, wenn es gebraucht wird, und nur behalten, solange seine Datei geöffnet ist." | ||
| 32485 | } | ||
| 32486 | }, | ||
| 32487 | "en": { | ||
| 32488 | "stringUnit": { | ||
| 32489 | "state": "new", | ||
| 32490 | "value": "Passphrases you type for encrypted files and entries are saved in the Keychain, and %1$@ or your password unlocks them. %2$@ can then decrypt anything whose passphrase is saved in your Keychain. Otherwise a passphrase is typed when it's needed and kept only while its file is open." | ||
| 32491 | } | ||
| 32492 | }, | ||
| 32493 | "es": { | ||
| 32494 | "stringUnit": { | ||
| 32495 | "state": "translated", | ||
| 32496 | "value": "Las frases de contraseña que escribes para archivos y entradas cifrados se guardan en el llavero, y %1$@ o tu contraseña las desbloquea. %2$@ podrá entonces descifrar todo aquello cuya frase de contraseña esté guardada en tu llavero. Si no, la frase de contraseña se escribe cuando hace falta y se conserva solo mientras su archivo está abierto." | ||
| 32497 | } | ||
| 32498 | }, | ||
| 32499 | "fr": { | ||
| 32500 | "stringUnit": { | ||
| 32501 | "state": "translated", | ||
| 32502 | "value": "Les phrases secrètes que vous saisissez pour les fichiers et entrées chiffrés sont enregistrées dans le trousseau, et %1$@ ou votre mot de passe les déverrouille. %2$@ peut alors déchiffrer tout ce dont la phrase secrète est enregistrée dans votre trousseau. Sinon, une phrase secrète est saisie quand elle est nécessaire et n'est gardée que tant que son fichier est ouvert." | ||
| 32503 | } | ||
| 32504 | }, | ||
| 32505 | "ja": { | ||
| 32506 | "stringUnit": { | ||
| 32507 | "state": "translated", | ||
| 32508 | "value": "暗号化されたファイルやエントリに入力したパスフレーズはキーチェーンに保存され、%1$@またはパスワードで解除されます。これにより、キーチェーンにパスフレーズが保存されているものはすべて%2$@で復号できます。オフの場合、パスフレーズは必要なときに入力し、そのファイルを開いている間だけ保持されます。" | ||
| 32509 | } | ||
| 32510 | }, | ||
| 32511 | "pt-BR": { | ||
| 32512 | "stringUnit": { | ||
| 32513 | "state": "translated", | ||
| 32514 | "value": "As senhas que você digita para arquivos e entradas criptografados são salvas nas Chaves, e o %1$@ ou sua senha as desbloqueia. O %2$@ poderá então descriptografar tudo cuja senha esteja salva nas suas Chaves. Caso contrário, a senha é digitada quando necessária e mantida apenas enquanto o arquivo estiver aberto." | ||
| 32515 | } | ||
| 32516 | } | ||
| 32517 | } | ||
| 32518 | }, | ||
| 32371 | "Paste Subtree": { | 32519 | "Paste Subtree": { |
| 32372 | "comment": "Command title", | 32520 | "comment": "Command title", |
| 32373 | "localizations": { | 32521 | "localizations": { |
| @@ -35329,40 +35477,6 @@ | |||
| 35329 | } | 35477 | } |
| 35330 | } | 35478 | } |
| 35331 | }, | 35479 | }, |
| 35332 | "Remember in the Keychain": { | ||
| 35333 | "localizations": { | ||
| 35334 | "de": { | ||
| 35335 | "stringUnit": { | ||
| 35336 | "state": "translated", | ||
| 35337 | "value": "Im Schlüsselbund merken" | ||
| 35338 | } | ||
| 35339 | }, | ||
| 35340 | "es": { | ||
| 35341 | "stringUnit": { | ||
| 35342 | "state": "translated", | ||
| 35343 | "value": "Recordar en el llavero" | ||
| 35344 | } | ||
| 35345 | }, | ||
| 35346 | "fr": { | ||
| 35347 | "stringUnit": { | ||
| 35348 | "state": "translated", | ||
| 35349 | "value": "Mémoriser dans le trousseau" | ||
| 35350 | } | ||
| 35351 | }, | ||
| 35352 | "ja": { | ||
| 35353 | "stringUnit": { | ||
| 35354 | "state": "translated", | ||
| 35355 | "value": "キーチェーンに保存" | ||
| 35356 | } | ||
| 35357 | }, | ||
| 35358 | "pt-BR": { | ||
| 35359 | "stringUnit": { | ||
| 35360 | "state": "translated", | ||
| 35361 | "value": "Lembrar nas Chaves" | ||
| 35362 | } | ||
| 35363 | } | ||
| 35364 | } | ||
| 35365 | }, | ||
| 35366 | "Reminder": { | 35480 | "Reminder": { |
| 35367 | "localizations": { | 35481 | "localizations": { |
| 35368 | "de": { | 35482 | "de": { |
| @@ -35637,6 +35751,40 @@ | |||
| 35637 | } | 35751 | } |
| 35638 | } | 35752 | } |
| 35639 | }, | 35753 | }, |
| 35754 | "Remove Saved Passphrases?": { | ||
| 35755 | "localizations": { | ||
| 35756 | "de": { | ||
| 35757 | "stringUnit": { | ||
| 35758 | "state": "translated", | ||
| 35759 | "value": "Gesicherte Passwörter entfernen?" | ||
| 35760 | } | ||
| 35761 | }, | ||
| 35762 | "es": { | ||
| 35763 | "stringUnit": { | ||
| 35764 | "state": "translated", | ||
| 35765 | "value": "¿Eliminar las frases de contraseña guardadas?" | ||
| 35766 | } | ||
| 35767 | }, | ||
| 35768 | "fr": { | ||
| 35769 | "stringUnit": { | ||
| 35770 | "state": "translated", | ||
| 35771 | "value": "Supprimer les phrases secrètes enregistrées ?" | ||
| 35772 | } | ||
| 35773 | }, | ||
| 35774 | "ja": { | ||
| 35775 | "stringUnit": { | ||
| 35776 | "state": "translated", | ||
| 35777 | "value": "保存されたパスフレーズを削除しますか?" | ||
| 35778 | } | ||
| 35779 | }, | ||
| 35780 | "pt-BR": { | ||
| 35781 | "stringUnit": { | ||
| 35782 | "state": "translated", | ||
| 35783 | "value": "Remover Senhas Salvas?" | ||
| 35784 | } | ||
| 35785 | } | ||
| 35786 | } | ||
| 35787 | }, | ||
| 35640 | "Remove Schedule": { | 35788 | "Remove Schedule": { |
| 35641 | "comment": "Command title", | 35789 | "comment": "Command title", |
| 35642 | "localizations": { | 35790 | "localizations": { |
| @@ -37805,6 +37953,40 @@ | |||
| 37805 | } | 37953 | } |
| 37806 | } | 37954 | } |
| 37807 | }, | 37955 | }, |
| 37956 | "Saved Passphrases": { | ||
| 37957 | "localizations": { | ||
| 37958 | "de": { | ||
| 37959 | "stringUnit": { | ||
| 37960 | "state": "translated", | ||
| 37961 | "value": "Gesicherte Passwörter" | ||
| 37962 | } | ||
| 37963 | }, | ||
| 37964 | "es": { | ||
| 37965 | "stringUnit": { | ||
| 37966 | "state": "translated", | ||
| 37967 | "value": "Frases de contraseña guardadas" | ||
| 37968 | } | ||
| 37969 | }, | ||
| 37970 | "fr": { | ||
| 37971 | "stringUnit": { | ||
| 37972 | "state": "translated", | ||
| 37973 | "value": "Phrases secrètes enregistrées" | ||
| 37974 | } | ||
| 37975 | }, | ||
| 37976 | "ja": { | ||
| 37977 | "stringUnit": { | ||
| 37978 | "state": "translated", | ||
| 37979 | "value": "保存されたパスフレーズ" | ||
| 37980 | } | ||
| 37981 | }, | ||
| 37982 | "pt-BR": { | ||
| 37983 | "stringUnit": { | ||
| 37984 | "state": "translated", | ||
| 37985 | "value": "Senhas Salvas" | ||
| 37986 | } | ||
| 37987 | } | ||
| 37988 | } | ||
| 37989 | }, | ||
| 37808 | "Saved encrypted": { | 37990 | "Saved encrypted": { |
| 37809 | "localizations": { | 37991 | "localizations": { |
| 37810 | "de": { | 37992 | "de": { |
| @@ -45164,6 +45346,40 @@ | |||
| 45164 | } | 45346 | } |
| 45165 | } | 45347 | } |
| 45166 | }, | 45348 | }, |
| 45349 | "The passphrase saved for 1 file is removed from the Keychain.": { | ||
| 45350 | "localizations": { | ||
| 45351 | "de": { | ||
| 45352 | "stringUnit": { | ||
| 45353 | "state": "translated", | ||
| 45354 | "value": "Das für 1 Datei gesicherte Passwort wird aus dem Schlüsselbund entfernt." | ||
| 45355 | } | ||
| 45356 | }, | ||
| 45357 | "es": { | ||
| 45358 | "stringUnit": { | ||
| 45359 | "state": "translated", | ||
| 45360 | "value": "Se elimina del llavero la frase de contraseña guardada para 1 archivo." | ||
| 45361 | } | ||
| 45362 | }, | ||
| 45363 | "fr": { | ||
| 45364 | "stringUnit": { | ||
| 45365 | "state": "translated", | ||
| 45366 | "value": "La phrase secrète enregistrée pour 1 fichier est supprimée du trousseau." | ||
| 45367 | } | ||
| 45368 | }, | ||
| 45369 | "ja": { | ||
| 45370 | "stringUnit": { | ||
| 45371 | "state": "translated", | ||
| 45372 | "value": "1件のファイルに保存されたパスフレーズがキーチェーンから削除されます。" | ||
| 45373 | } | ||
| 45374 | }, | ||
| 45375 | "pt-BR": { | ||
| 45376 | "stringUnit": { | ||
| 45377 | "state": "translated", | ||
| 45378 | "value": "A senha salva para 1 arquivo é removida das Chaves." | ||
| 45379 | } | ||
| 45380 | } | ||
| 45381 | } | ||
| 45382 | }, | ||
| 45167 | "The passphrase wasn't remembered: the Keychain refused it.": { | 45383 | "The passphrase wasn't remembered: the Keychain refused it.": { |
| 45168 | "localizations": { | 45384 | "localizations": { |
| 45169 | "de": { | 45385 | "de": { |
| @@ -45232,6 +45448,40 @@ | |||
| 45232 | } | 45448 | } |
| 45233 | } | 45449 | } |
| 45234 | }, | 45450 | }, |
| 45451 | "The passphrases saved for %lld files are removed from the Keychain.": { | ||
| 45452 | "localizations": { | ||
| 45453 | "de": { | ||
| 45454 | "stringUnit": { | ||
| 45455 | "state": "translated", | ||
| 45456 | "value": "Die für %lld Dateien gesicherten Passwörter werden aus dem Schlüsselbund entfernt." | ||
| 45457 | } | ||
| 45458 | }, | ||
| 45459 | "es": { | ||
| 45460 | "stringUnit": { | ||
| 45461 | "state": "translated", | ||
| 45462 | "value": "Se eliminan del llavero las frases de contraseña guardadas para %lld archivos." | ||
| 45463 | } | ||
| 45464 | }, | ||
| 45465 | "fr": { | ||
| 45466 | "stringUnit": { | ||
| 45467 | "state": "translated", | ||
| 45468 | "value": "Les phrases secrètes enregistrées pour %lld fichiers sont supprimées du trousseau." | ||
| 45469 | } | ||
| 45470 | }, | ||
| 45471 | "ja": { | ||
| 45472 | "stringUnit": { | ||
| 45473 | "state": "translated", | ||
| 45474 | "value": "%lld件のファイルに保存されたパスフレーズがキーチェーンから削除されます。" | ||
| 45475 | } | ||
| 45476 | }, | ||
| 45477 | "pt-BR": { | ||
| 45478 | "stringUnit": { | ||
| 45479 | "state": "translated", | ||
| 45480 | "value": "As senhas salvas para %lld arquivos são removidas das Chaves." | ||
| 45481 | } | ||
| 45482 | } | ||
| 45483 | } | ||
| 45484 | }, | ||
| 45235 | "The purchase didn't go through. %@": { | 45485 | "The purchase didn't go through. %@": { |
| 45236 | "localizations": { | 45486 | "localizations": { |
| 45237 | "de": { | 45487 | "de": { |
| @@ -46926,6 +47176,40 @@ | |||
| 46926 | } | 47176 | } |
| 46927 | } | 47177 | } |
| 46928 | }, | 47178 | }, |
| 47179 | "Turn Off": { | ||
| 47180 | "localizations": { | ||
| 47181 | "de": { | ||
| 47182 | "stringUnit": { | ||
| 47183 | "state": "translated", | ||
| 47184 | "value": "Ausschalten" | ||
| 47185 | } | ||
| 47186 | }, | ||
| 47187 | "es": { | ||
| 47188 | "stringUnit": { | ||
| 47189 | "state": "translated", | ||
| 47190 | "value": "Desactivar" | ||
| 47191 | } | ||
| 47192 | }, | ||
| 47193 | "fr": { | ||
| 47194 | "stringUnit": { | ||
| 47195 | "state": "translated", | ||
| 47196 | "value": "Désactiver" | ||
| 47197 | } | ||
| 47198 | }, | ||
| 47199 | "ja": { | ||
| 47200 | "stringUnit": { | ||
| 47201 | "state": "translated", | ||
| 47202 | "value": "オフにする" | ||
| 47203 | } | ||
| 47204 | }, | ||
| 47205 | "pt-BR": { | ||
| 47206 | "stringUnit": { | ||
| 47207 | "state": "translated", | ||
| 47208 | "value": "Desativar" | ||
| 47209 | } | ||
| 47210 | } | ||
| 47211 | } | ||
| 47212 | }, | ||
| 46929 | "Turn Subtree Export On or Off": { | 47213 | "Turn Subtree Export On or Off": { |
| 46930 | "comment": "Command title", | 47214 | "comment": "Command title", |
| 46931 | "localizations": { | 47215 | "localizations": { |
| @@ -47616,6 +47900,74 @@ | |||
| 47616 | } | 47900 | } |
| 47617 | } | 47901 | } |
| 47618 | }, | 47902 | }, |
| 47903 | "Use %@ to Decrypt": { | ||
| 47904 | "localizations": { | ||
| 47905 | "de": { | ||
| 47906 | "stringUnit": { | ||
| 47907 | "state": "translated", | ||
| 47908 | "value": "%@ zum Entschlüsseln verwenden" | ||
| 47909 | } | ||
| 47910 | }, | ||
| 47911 | "es": { | ||
| 47912 | "stringUnit": { | ||
| 47913 | "state": "translated", | ||
| 47914 | "value": "Usar %@ para descifrar" | ||
| 47915 | } | ||
| 47916 | }, | ||
| 47917 | "fr": { | ||
| 47918 | "stringUnit": { | ||
| 47919 | "state": "translated", | ||
| 47920 | "value": "Utiliser %@ pour déchiffrer" | ||
| 47921 | } | ||
| 47922 | }, | ||
| 47923 | "ja": { | ||
| 47924 | "stringUnit": { | ||
| 47925 | "state": "translated", | ||
| 47926 | "value": "%@で復号" | ||
| 47927 | } | ||
| 47928 | }, | ||
| 47929 | "pt-BR": { | ||
| 47930 | "stringUnit": { | ||
| 47931 | "state": "translated", | ||
| 47932 | "value": "Usar %@ para Descriptografar" | ||
| 47933 | } | ||
| 47934 | } | ||
| 47935 | } | ||
| 47936 | }, | ||
| 47937 | "Use %@ to Decrypt?": { | ||
| 47938 | "localizations": { | ||
| 47939 | "de": { | ||
| 47940 | "stringUnit": { | ||
| 47941 | "state": "translated", | ||
| 47942 | "value": "%@ zum Entschlüsseln verwenden?" | ||
| 47943 | } | ||
| 47944 | }, | ||
| 47945 | "es": { | ||
| 47946 | "stringUnit": { | ||
| 47947 | "state": "translated", | ||
| 47948 | "value": "¿Usar %@ para descifrar?" | ||
| 47949 | } | ||
| 47950 | }, | ||
| 47951 | "fr": { | ||
| 47952 | "stringUnit": { | ||
| 47953 | "state": "translated", | ||
| 47954 | "value": "Utiliser %@ pour déchiffrer ?" | ||
| 47955 | } | ||
| 47956 | }, | ||
| 47957 | "ja": { | ||
| 47958 | "stringUnit": { | ||
| 47959 | "state": "translated", | ||
| 47960 | "value": "%@で復号しますか?" | ||
| 47961 | } | ||
| 47962 | }, | ||
| 47963 | "pt-BR": { | ||
| 47964 | "stringUnit": { | ||
| 47965 | "state": "translated", | ||
| 47966 | "value": "Usar %@ para Descriptografar?" | ||
| 47967 | } | ||
| 47968 | } | ||
| 47969 | } | ||
| 47970 | }, | ||
| 47619 | "Use Copy": { | 47971 | "Use Copy": { |
| 47620 | "localizations": { | 47972 | "localizations": { |
| 47621 | "de": { | 47973 | "de": { |