Encrypt tagged entries on save; whole-file encryption !489
22 files changed, +2409 −33
Changed files (22)
- Sources/OrgApp/CryptPassphrases.swift +35 −2
- Sources/OrgApp/CryptSheet.swift +78 −8
- Sources/OrgApp/DocumentSession.swift +166 −8
- Sources/OrgApp/OrgPreferences.swift +4
- Sources/OrgApp/UserConfig.swift +2
- Sources/OrgCore/Crypto/OpenPGP.swift +17 −1
- Sources/OrgCore/Crypto/OrgCrypt.swift +66
- Sources/OrgDocument/Crypt.swift added +257
- Sources/Orgstar/ContentView.swift +17 −2
- Sources/Orgstar/CryptHoldBar.swift added +27
- Sources/Orgstar/EditorWindowView.swift +1
- Sources/Orgstar/OrgstarApp.swift +50 −5
- Sources/OrgstarMobile/EditorScreen.swift +30 −2
- Sources/OrgstarMobile/MobileModel.swift +2
- Sources/OrgstarMobile/OrgstarMobileApp.swift +8 −1
- Sources/OrgstarMobile/UnsavedHeldFiles.swift added +23
- Tests/OrgAppTests/CryptSaveTests.swift added +300
- docs/manual/guide/04-outlines.org +26 −1
- docs/manual/guide/13-configuration.org +2 −1
- docs/manual/guide/14-ios.org +3 −1
- docs/manual/guide/15-alongside-emacs.org +2 −1
- l10n/Localizable.xcstrings +1293
Sources/OrgApp/CryptPassphrases.swift +35 −2 · view
| @@ -1,5 +1,6 @@ | |||
| 1 | import Foundation | 1 | import Foundation |
| 2 | import LocalAuthentication | 2 | import LocalAuthentication |
| 3 | import OrgDocument | ||
| 3 | import Security | 4 | import Security |
| 4 | 5 | ||
| 5 | /// Passphrases for encrypted entries, kept in the Keychain by file when asked, and given back | 6 | /// Passphrases for encrypted entries, kept in the Keychain by file when asked, and given back |
| @@ -15,7 +16,7 @@ public enum CryptPassphrases { | |||
| 15 | forget(path) | 16 | forget(path) |
| 16 | var item = query(path) | 17 | var item = query(path) |
| 17 | item[kSecValueData as String] = Data(passphrase.utf8) | 18 | item[kSecValueData as String] = Data(passphrase.utf8) |
| 18 | item[kSecAttrLabel as String] = "orgstar: encrypted entries in " + (path as NSString).lastPathComponent | 19 | item[kSecAttrLabel as String] = "orgstar: passphrase for " + (path as NSString).lastPathComponent |
| 19 | SecItemAdd(item as CFDictionary, nil) | 20 | SecItemAdd(item as CFDictionary, nil) |
| 20 | } | 21 | } |
| 21 | 22 | ||
| @@ -33,7 +34,7 @@ public enum CryptPassphrases { | |||
| 33 | public static func stored(for path: String) async -> String? { | 34 | public static func stored(for path: String) async -> String? { |
| 34 | guard hasStored(path) else { return nil } | 35 | guard hasStored(path) else { return nil } |
| 35 | let context = LAContext() | 36 | let context = LAContext() |
| 36 | let reason = "unlock the passphrase for encrypted entries in " + (path as NSString).lastPathComponent | 37 | let reason = "unlock the passphrase for " + (path as NSString).lastPathComponent |
| 37 | guard (try? await context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason)) == true else { return nil } | 38 | guard (try? await context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason)) == true else { return nil } |
| 38 | var q = query(path) | 39 | var q = query(path) |
| 39 | q[kSecReturnData as String] = true | 40 | q[kSecReturnData as String] = true |
| @@ -42,3 +43,35 @@ public enum CryptPassphrases { | |||
| 42 | return String(decoding: data, as: UTF8.self) | 43 | return String(decoding: data, as: UTF8.self) |
| 43 | } | 44 | } |
| 44 | } | 45 | } |
| 46 | |||
| 47 | extension CryptHold { | ||
| 48 | /// What the held file's notice says. | ||
| 49 | public func notice(for path: String) -> String { | ||
| 50 | let name = (path as NSString).lastPathComponent | ||
| 51 | return switch self { | ||
| 52 | case .entries(1): String(localized: "1 tagged entry isn't encrypted. Changes to \(name) aren't saved until it is.") | ||
| 53 | case .entries(let count): String(localized: "\(count) tagged entries aren't encrypted. Changes to \(name) aren't saved until they are.") | ||
| 54 | case .file: String(localized: "\(name) isn't saved until it has a passphrase.") | ||
| 55 | } | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | extension CryptHold: LocalizedError { | ||
| 60 | public var errorDescription: String? { | ||
| 61 | switch self { | ||
| 62 | case .entries(1): String(localized: "1 tagged entry isn't encrypted") | ||
| 63 | case .entries(let count): String(localized: "\(count) tagged entries aren't encrypted") | ||
| 64 | case .file: String(localized: "The file has no passphrase yet") | ||
| 65 | } | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | extension CryptReadError: LocalizedError { | ||
| 70 | public var errorDescription: String? { | ||
| 71 | switch self { | ||
| 72 | case .locked: String(localized: "The file is encrypted, and its passphrase isn't known") | ||
| 73 | case .wrongPassphrase: String(localized: "Wrong passphrase") | ||
| 74 | case .failed(let reason): reason | ||
| 75 | } | ||
| 76 | } | ||
| 77 | } | ||
Sources/OrgApp/CryptSheet.swift +78 −8 · view
| @@ -1,5 +1,6 @@ | |||
| 1 | import Foundation | 1 | import Foundation |
| 2 | import OrgCore | 2 | import OrgCore |
| 3 | import OrgDocument | ||
| 3 | import SwiftUI | 4 | import SwiftUI |
| 4 | 5 | ||
| 5 | /// What an org-crypt command does with the entry at `offset` in the file at `path`. | 6 | /// What an org-crypt command does with the entry at `offset` in the file at `path`. |
| @@ -13,6 +14,12 @@ public struct CryptRequest: Identifiable, Sendable { | |||
| 13 | case open | 14 | case open |
| 14 | /// `org-decrypt-entry`: the decrypted text in the file. | 15 | /// `org-decrypt-entry`: the decrypted text in the file. |
| 15 | case decryptInPlace | 16 | case decryptInPlace |
| 17 | /// The passphrase a held save needs, to encrypt the tagged entries as the file is saved. | ||
| 18 | case encryptOnSave | ||
| 19 | /// The passphrase of an encrypted file (`.org.gpg`), to open it. | ||
| 20 | case openFile | ||
| 21 | /// The passphrase a new encrypted file is saved with. | ||
| 22 | case newFile | ||
| 16 | } | 23 | } |
| 17 | 24 | ||
| 18 | public let id = UUID() | 25 | public let id = UUID() |
| @@ -28,17 +35,32 @@ public struct CryptRequest: Identifiable, Sendable { | |||
| 28 | 35 | ||
| 29 | var encrypting: Bool { | 36 | var encrypting: Bool { |
| 30 | switch mode { | 37 | switch mode { |
| 31 | case .encrypt, .encryptAll: true | 38 | case .encrypt, .encryptAll, .encryptOnSave, .newFile: true |
| 32 | default: false | 39 | default: false |
| 33 | } | 40 | } |
| 34 | } | 41 | } |
| 42 | |||
| 43 | /// The passphrase goes to the session, which checks it and saves or opens the file. | ||
| 44 | var unlocks: Bool { | ||
| 45 | switch mode { | ||
| 46 | case .encryptOnSave, .openFile, .newFile: true | ||
| 47 | default: false | ||
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 | /// The request for what keeps `path` from being saved. | ||
| 52 | public static func save(_ path: String, hold: CryptHold) -> CryptRequest { | ||
| 53 | CryptRequest(mode: hold == .file ? .newFile : .encryptOnSave, path: path, offset: 0) | ||
| 54 | } | ||
| 35 | } | 55 | } |
| 36 | 56 | ||
| 37 | /// 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 it was remembered, then for |
| 38 | /// `open` the decrypted entry to edit. `text` is the file's text now; `apply` puts a new text | 58 | /// `open` the decrypted entry to edit. `text` is the file's text now; `apply` puts a new text |
| 39 | /// in its place; `done` closes the sheet with a message. | 59 | /// in its place; `done` closes the sheet with a message. `session` learns the passphrase, so |
| 60 | /// saves encrypt with it without asking again. | ||
| 40 | public struct CryptSheet: View { | 61 | public struct CryptSheet: View { |
| 41 | let request: CryptRequest | 62 | let request: CryptRequest |
| 63 | let session: DocumentSession? | ||
| 42 | let text: () -> String | 64 | let text: () -> String |
| 43 | let apply: (String) -> Void | 65 | let apply: (String) -> Void |
| 44 | let done: (String?) -> Void | 66 | let done: (String?) -> Void |
| @@ -50,8 +72,9 @@ public struct CryptSheet: View { | |||
| 50 | @State private var editing: (original: String, passphrase: String)? | 72 | @State private var editing: (original: String, passphrase: String)? |
| 51 | @State private var plaintext = "" | 73 | @State private var plaintext = "" |
| 52 | 74 | ||
| 53 | public init(request: CryptRequest, text: @escaping () -> String, apply: @escaping (String) -> Void, done: @escaping (String?) -> Void) { | 75 | public init(request: CryptRequest, session: DocumentSession? = nil, text: @escaping () -> String, apply: @escaping (String) -> Void, done: @escaping (String?) -> Void) { |
| 54 | self.request = request | 76 | self.request = request |
| 77 | self.session = session | ||
| 55 | self.text = text | 78 | self.text = text |
| 56 | self.apply = apply | 79 | self.apply = apply |
| 57 | self.done = done | 80 | self.done = done |
| @@ -73,13 +96,14 @@ public struct CryptSheet: View { | |||
| 73 | } | 96 | } |
| 74 | } else { | 97 | } else { |
| 75 | Text(title).font(.headline) | 98 | Text(title).font(.headline) |
| 99 | if let explanation { Text(explanation).font(.callout).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true) } | ||
| 76 | SecureField("Passphrase", text: $passphrase).onSubmit(submit) | 100 | SecureField("Passphrase", text: $passphrase).onSubmit(submit) |
| 77 | if request.encrypting { SecureField("Repeat passphrase", text: $repeated).onSubmit(submit) } | 101 | if asksTwice { SecureField("Repeat passphrase", text: $repeated).onSubmit(submit) } |
| 78 | Toggle("Remember in the Keychain", isOn: $remember) | 102 | Toggle("Remember in the Keychain", isOn: $remember) |
| 79 | if let problem { Text(problem).foregroundStyle(.red).font(.callout) } | 103 | if let problem { Text(problem).foregroundStyle(.red).font(.callout) } |
| 80 | HStack { | 104 | HStack { |
| 81 | Spacer() | 105 | Spacer() |
| 82 | Button("Cancel", role: .cancel) { done(nil) }.keyboardShortcut(.cancelAction) | 106 | Button("Cancel", role: .cancel) { cancel() }.keyboardShortcut(.cancelAction) |
| 83 | Button(request.encrypting ? "Encrypt" : "Decrypt") { submit() } | 107 | Button(request.encrypting ? "Encrypt" : "Decrypt") { submit() } |
| 84 | .keyboardShortcut(.defaultAction) | 108 | .keyboardShortcut(.defaultAction) |
| 85 | .disabled(passphrase.isEmpty) | 109 | .disabled(passphrase.isEmpty) |
| @@ -102,16 +126,52 @@ public struct CryptSheet: View { | |||
| 102 | case .encrypt: "Encrypt Entry" | 126 | case .encrypt: "Encrypt Entry" |
| 103 | case .encryptAll: "Encrypt Tagged Entries" | 127 | case .encryptAll: "Encrypt Tagged Entries" |
| 104 | case .open, .decryptInPlace: "Decrypt Entry" | 128 | case .open, .decryptInPlace: "Decrypt Entry" |
| 129 | case .encryptOnSave: String(localized: "Encrypt Tagged Entries") | ||
| 130 | case .openFile: String(localized: "Decrypt File") | ||
| 131 | case .newFile: String(localized: "Set Passphrase") | ||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 135 | private var name: String { (request.path as NSString).lastPathComponent } | ||
| 136 | |||
| 137 | private var explanation: String? { | ||
| 138 | switch request.mode { | ||
| 139 | case .encryptOnSave: String(localized: "\(name) is saved with its tagged entries encrypted.") | ||
| 140 | case .openFile: String(localized: "\(name) is encrypted.") | ||
| 141 | case .newFile: String(localized: "\(name) is saved encrypted with this passphrase.") | ||
| 142 | default: nil | ||
| 143 | } | ||
| 144 | } | ||
| 145 | |||
| 146 | /// A new passphrase is typed twice; one that must open what's encrypted already, once. | ||
| 147 | private var asksTwice: Bool { | ||
| 148 | switch request.mode { | ||
| 149 | case .encryptOnSave: OrgCrypt.firstMessage(text()) == nil | ||
| 150 | case .openFile: false | ||
| 151 | default: request.encrypting | ||
| 105 | } | 152 | } |
| 106 | } | 153 | } |
| 107 | 154 | ||
| 108 | private func submit() { | 155 | private func submit() { |
| 109 | guard !passphrase.isEmpty else { return } | 156 | guard !passphrase.isEmpty else { return } |
| 110 | if request.encrypting, passphrase != repeated { return problem = "The passphrases differ" } | 157 | if asksTwice, passphrase != repeated { return problem = "The passphrases differ" } |
| 111 | run(passphrase, remembered: false) | 158 | run(passphrase, remembered: false) |
| 112 | } | 159 | } |
| 113 | 160 | ||
| 161 | private func cancel() { | ||
| 162 | if case .openFile = request.mode { session?.cancelUnlock() } | ||
| 163 | done(nil) | ||
| 164 | } | ||
| 165 | |||
| 114 | private func run(_ passphrase: String, remembered: Bool) { | 166 | private func run(_ passphrase: String, remembered: Bool) { |
| 167 | if request.unlocks { | ||
| 168 | if let failure = session?.unlock(passphrase, for: request.path) { return problem = failure } | ||
| 169 | switch request.mode { | ||
| 170 | case .encryptOnSave: return finish(String(localized: "Tagged entries encrypted and saved"), passphrase: passphrase, remembered: remembered) | ||
| 171 | case .newFile: return finish(String(localized: "Saved encrypted"), passphrase: passphrase, remembered: remembered) | ||
| 172 | default: return finish(nil, passphrase: passphrase, remembered: remembered) | ||
| 173 | } | ||
| 174 | } | ||
| 115 | let current = text() | 175 | let current = text() |
| 116 | do { | 176 | do { |
| 117 | switch request.mode { | 177 | switch request.mode { |
| @@ -128,20 +188,30 @@ public struct CryptSheet: View { | |||
| 128 | case .open: | 188 | case .open: |
| 129 | let plain = try OrgCrypt.decrypt(current, at: request.offset, passphrase: passphrase).plaintext | 189 | let plain = try OrgCrypt.decrypt(current, at: request.offset, passphrase: passphrase).plaintext |
| 130 | if remember, !remembered { CryptPassphrases.store(passphrase, for: request.path) } | 190 | if remember, !remembered { CryptPassphrases.store(passphrase, for: request.path) } |
| 191 | session?.cryptUsed(passphrase, for: request.path) | ||
| 131 | plaintext = plain | 192 | plaintext = plain |
| 132 | editing = (plain, passphrase) | 193 | editing = (plain, passphrase) |
| 133 | problem = nil | 194 | problem = nil |
| 134 | case .decryptInPlace: | 195 | case .decryptInPlace: |
| 135 | apply(try OrgCrypt.decryptInPlace(current, at: request.offset, passphrase: passphrase)) | 196 | let message = OrgCrypt.encryptedRange(current, at: request.offset).map { (current as NSString).substring(with: NSRange($0)) } |
| 197 | let decrypted = try OrgCrypt.decryptInPlace(current, at: request.offset, passphrase: passphrase) | ||
| 198 | // Saved unchanged with org-crypt-use-before-save-magic, the entry gets its message back. | ||
| 199 | if let message, let body = OrgCrypt.bodyRange(decrypted, at: request.offset) { | ||
| 200 | session?.cryptDecrypted(message: message, plaintext: (decrypted as NSString).substring(with: NSRange(body)), for: request.path) | ||
| 201 | } | ||
| 202 | apply(decrypted) | ||
| 136 | finish("Entry decrypted", passphrase: passphrase, remembered: remembered) | 203 | finish("Entry decrypted", passphrase: passphrase, remembered: remembered) |
| 204 | case .encryptOnSave, .openFile, .newFile: | ||
| 205 | break | ||
| 137 | } | 206 | } |
| 138 | } catch { | 207 | } catch { |
| 139 | problem = "\(error)" | 208 | problem = "\(error)" |
| 140 | } | 209 | } |
| 141 | } | 210 | } |
| 142 | 211 | ||
| 143 | private func finish(_ message: String, passphrase: String, remembered: Bool) { | 212 | private func finish(_ message: String?, passphrase: String, remembered: Bool) { |
| 144 | if remember, !remembered { CryptPassphrases.store(passphrase, for: request.path) } | 213 | if remember, !remembered { CryptPassphrases.store(passphrase, for: request.path) } |
| 214 | if !request.unlocks { session?.cryptUsed(passphrase, for: request.path) } | ||
| 145 | done(message) | 215 | done(message) |
| 146 | } | 216 | } |
| 147 | 217 | ||
Sources/OrgApp/DocumentSession.swift +166 −8 · view
| @@ -137,8 +137,13 @@ public final class DocumentSession { | |||
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | /// Files and recovery through `crypt`, and as they are on disk. | ||
| 140 | private let fileSystem: FileSystem | 141 | private let fileSystem: FileSystem |
| 141 | private let recovery: RecoveryStore | 142 | private let recovery: RecoveryStore |
| 143 | private let diskFileSystem: FileSystem | ||
| 144 | private let diskRecovery: RecoveryStore | ||
| 145 | /// Passphrases and encrypted entries of the open files. | ||
| 146 | @ObservationIgnored public let crypt = CryptVault() | ||
| 142 | @ObservationIgnored private var entries: [Entry] = [] | 147 | @ObservationIgnored private var entries: [Entry] = [] |
| 143 | /// The focused pane's buffer. | 148 | /// The focused pane's buffer. |
| 144 | private var current: Entry? { focused.path.flatMap(entry) } | 149 | private var current: Entry? { focused.path.flatMap(entry) } |
| @@ -151,11 +156,142 @@ public final class DocumentSession { | |||
| 151 | fileSystem: FileSystem = CoordinatedFileSystem(), | 156 | fileSystem: FileSystem = CoordinatedFileSystem(), |
| 152 | recovery: RecoveryStore = FileRecoveryStore(directory: WorkspaceModel.defaultDirectory.appendingPathComponent("Recovery")) | 157 | recovery: RecoveryStore = FileRecoveryStore(directory: WorkspaceModel.defaultDirectory.appendingPathComponent("Recovery")) |
| 153 | ) { | 158 | ) { |
| 154 | self.fileSystem = fileSystem | 159 | diskFileSystem = fileSystem |
| 155 | self.recovery = recovery | 160 | diskRecovery = recovery |
| 161 | self.fileSystem = CryptFileSystem(base: fileSystem, vault: crypt) | ||
| 162 | self.recovery = CryptRecoveryStore(base: recovery, vault: crypt) | ||
| 156 | let pane = EditorPane() | 163 | let pane = EditorPane() |
| 157 | panes = [pane] | 164 | panes = [pane] |
| 158 | focused = pane | 165 | focused = pane |
| 166 | crypt.written = { [weak self] path in | ||
| 167 | if Thread.isMainThread { | ||
| 168 | MainActor.assumeIsolated { self?.fileSaved?(path) } | ||
| 169 | } else { | ||
| 170 | Task { @MainActor in self?.fileSaved?(path) } | ||
| 171 | } | ||
| 172 | } | ||
| 173 | } | ||
| 174 | |||
| 175 | // MARK: - Encryption | ||
| 176 | |||
| 177 | /// Called with a file's path each time the session wrote it to disk: a buffer saved (by | ||
| 178 | /// hand or on its own), Keep Mine, and refile, archive or agenda changes to files that | ||
| 179 | /// aren't open. Not called for a save that was held, failed or conflicted. | ||
| 180 | @ObservationIgnored public var fileSaved: ((String) -> Void)? | ||
| 181 | |||
| 182 | /// `org-crypt-use-before-save-magic`: entries with `cryptTag` are encrypted on every save. | ||
| 183 | public var encryptsTaggedEntries: Bool { | ||
| 184 | get { crypt.encryptsTaggedEntries } | ||
| 185 | set { crypt.encryptsTaggedEntries = newValue } | ||
| 186 | } | ||
| 187 | |||
| 188 | /// `org-crypt-tag-matcher`. | ||
| 189 | public var cryptTag: String { | ||
| 190 | get { crypt.tag } | ||
| 191 | set { crypt.tag = newValue } | ||
| 192 | } | ||
| 193 | |||
| 194 | /// Open files that aren't saved until a passphrase is given: tagged entries that would be | ||
| 195 | /// written unencrypted, or an encrypted file without one. Other edits to them wait too. | ||
| 196 | public private(set) var held: [String: CryptHold] = [:] | ||
| 197 | |||
| 198 | /// An encrypted file waiting for its passphrase to open, and the pane to show it in. | ||
| 199 | public private(set) var unlockRequest: String? | ||
| 200 | @ObservationIgnored private var unlockPane: EditorPane? | ||
| 201 | |||
| 202 | /// The passphrase remembered in the Keychain, after Touch ID, Face ID or the device's | ||
| 203 | /// password; nil when there's none or it wasn't given. | ||
| 204 | @ObservationIgnored public var storedPassphrase: (String) async -> String? = { await CryptPassphrases.stored(for: $0) } | ||
| 205 | @ObservationIgnored public var hasStoredPassphrase: (String) -> Bool = { CryptPassphrases.hasStored($0) } | ||
| 206 | /// Files whose remembered passphrase is being asked for, and those where it was refused: | ||
| 207 | /// the Keychain is asked once per file until the file closes or Encrypt is chosen. | ||
| 208 | @ObservationIgnored private var askingKeychain: Set<String> = [] | ||
| 209 | @ObservationIgnored private var refusedKeychain: Set<String> = [] | ||
| 210 | |||
| 211 | public static func isEncryptedFile(_ path: String) -> Bool { CryptVault.isEncryptedFile(path) } | ||
| 212 | |||
| 213 | /// An encrypted org file, which lists with the org files. | ||
| 214 | public static func isEncryptedOrgFile(_ path: String) -> Bool { path.hasSuffix(".org.gpg") } | ||
| 215 | |||
| 216 | /// Gives `passphrase` for `path`: an encrypted file opens with it, and a held file is saved. | ||
| 217 | /// It must open the file, or the file's encrypted entries if it has any. A message when it | ||
| 218 | /// doesn't. | ||
| 219 | public func unlock(_ passphrase: String, for path: String) -> String? { | ||
| 220 | if let entry = entry(path) { | ||
| 221 | if let message = OrgCrypt.firstMessage(entry.buffer.document.text), !OrgCrypt.opens(message, passphrase: passphrase) { | ||
| 222 | return String(localized: "Wrong passphrase") | ||
| 223 | } | ||
| 224 | // An encrypted file on disk keeps its passphrase: a passphrase given after Forget | ||
| 225 | // must open it. | ||
| 226 | if Self.isEncryptedFile(entry.path), let disk = try? diskFileSystem.read(URL(fileURLWithPath: entry.path)), | ||
| 227 | !CryptVault.opens(disk, passphrase: passphrase) { | ||
| 228 | return String(localized: "Wrong passphrase") | ||
| 229 | } | ||
| 230 | crypt.unlock(passphrase, for: entry.path) | ||
| 231 | refusedKeychain.remove(entry.path) | ||
| 232 | save(entry) | ||
| 233 | return nil | ||
| 234 | } | ||
| 235 | guard Self.isEncryptedFile(path) else { return nil } | ||
| 236 | let bytes: [UInt8] | ||
| 237 | do { | ||
| 238 | guard let read = try diskFileSystem.read(URL(fileURLWithPath: path)) else { return "\((path as NSString).lastPathComponent) no longer exists." } | ||
| 239 | bytes = read | ||
| 240 | } catch { | ||
| 241 | return error.localizedDescription | ||
| 242 | } | ||
| 243 | guard CryptVault.opens(bytes, passphrase: passphrase) else { return String(localized: "Wrong passphrase") } | ||
| 244 | crypt.unlock(passphrase, for: path) | ||
| 245 | let pane = unlockPane.flatMap { pane in panes.contains { $0 === pane } ? pane : nil } ?? focused | ||
| 246 | unlockRequest = nil | ||
| 247 | unlockPane = nil | ||
| 248 | open(path, in: pane) | ||
| 249 | return nil | ||
| 250 | } | ||
| 251 | |||
| 252 | /// The encrypted file waiting for its passphrase stays closed. | ||
| 253 | public func cancelUnlock() { | ||
| 254 | unlockRequest = nil | ||
| 255 | unlockPane = nil | ||
| 256 | } | ||
| 257 | |||
| 258 | /// A crypt command used `passphrase` for `path`: saves use it from now on, without asking. | ||
| 259 | public func cryptUsed(_ passphrase: String, for path: String) { | ||
| 260 | crypt.unlock(passphrase, for: path) | ||
| 261 | refusedKeychain.remove(path) | ||
| 262 | } | ||
| 263 | |||
| 264 | /// The entry holding `plaintext` in `path`'s buffer was decrypted from `message`. | ||
| 265 | public func cryptDecrypted(message: String, plaintext: String, for path: String) { | ||
| 266 | crypt.remember(message: message, plaintext: plaintext, for: path) | ||
| 267 | } | ||
| 268 | |||
| 269 | /// Forget Encryption Passphrase: the passphrase leaves the Keychain and the session. | ||
| 270 | public func forgetPassphrase(for path: String) { | ||
| 271 | CryptPassphrases.forget(path) | ||
| 272 | crypt.forgetPassphrase(for: path) | ||
| 273 | } | ||
| 274 | |||
| 275 | /// Whether `path`'s buffer is held back from disk now. | ||
| 276 | private func updateHold(_ entry: Entry) -> CryptHold? { | ||
| 277 | let hold = entry.buffer.document.isDirty ? crypt.hold(entry.buffer.document.text, for: entry.path) : nil | ||
| 278 | if held[entry.path] != hold { held[entry.path] = hold } | ||
| 279 | return hold | ||
| 280 | } | ||
| 281 | |||
| 282 | /// Asks the Keychain for `entry`'s passphrase, once, and saves with it. | ||
| 283 | private func askKeychain(_ entry: Entry) { | ||
| 284 | let path = entry.path | ||
| 285 | guard !askingKeychain.contains(path), !refusedKeychain.contains(path), hasStoredPassphrase(path) else { return } | ||
| 286 | askingKeychain.insert(path) | ||
| 287 | Task { [weak self, weak entry] in | ||
| 288 | guard let self else { return } | ||
| 289 | let passphrase = await self.storedPassphrase(path) | ||
| 290 | self.askingKeychain.remove(path) | ||
| 291 | guard let entry, self.entries.contains(where: { $0 === entry }) else { return } | ||
| 292 | if let passphrase, self.unlock(passphrase, for: path) == nil { return } | ||
| 293 | self.refusedKeychain.insert(path) | ||
| 294 | } | ||
| 159 | } | 295 | } |
| 160 | 296 | ||
| 161 | // MARK: - Panes | 297 | // MARK: - Panes |
| @@ -187,7 +323,7 @@ public final class DocumentSession { | |||
| 187 | public var isOrg: Bool { path.map(Self.isOrgPath) ?? false } | 323 | public var isOrg: Bool { path.map(Self.isOrgPath) ?? false } |
| 188 | 324 | ||
| 189 | public static func isOrgPath(_ path: String) -> Bool { | 325 | public static func isOrgPath(_ path: String) -> Bool { |
| 190 | path.hasSuffix(".org") || path.hasSuffix(".org_archive") | 326 | path.hasSuffix(".org") || path.hasSuffix(".org_archive") || path.hasSuffix(".org.gpg") |
| 191 | } | 327 | } |
| 192 | 328 | ||
| 193 | /// The caret in the open file. | 329 | /// The caret in the open file. |
| @@ -248,9 +384,12 @@ public final class DocumentSession { | |||
| 248 | entries.map { ($0.path, $0.buffer.document) } | 384 | entries.map { ($0.path, $0.buffer.document) } |
| 249 | } | 385 | } |
| 250 | 386 | ||
| 251 | /// The text of every open file by path, for the agenda. | 387 | /// The text of every open file by path, for the agenda and what it writes (widgets, the |
| 388 | /// watch, reminders). Encrypted files, and files with entries decrypted that saving | ||
| 389 | /// encrypts, are left out: those views read them from disk. | ||
| 252 | public var openTexts: [String: String] { | 390 | public var openTexts: [String: String] { |
| 253 | Dictionary(entries.map { ($0.path, $0.buffer.document.text) }, uniquingKeysWith: { a, _ in a }) | 391 | let shown = entries.filter { !crypt.isPrivate($0.buffer.document.text, for: $0.path) } |
| 392 | return Dictionary(shown.map { ($0.path, $0.buffer.document.text) }, uniquingKeysWith: { a, _ in a }) | ||
| 254 | } | 393 | } |
| 255 | 394 | ||
| 256 | /// Open buffers, most recently shown first. | 395 | /// Open buffers, most recently shown first. |
| @@ -269,6 +408,12 @@ public final class DocumentSession { | |||
| 269 | show(existing, in: pane) | 408 | show(existing, in: pane) |
| 270 | return | 409 | return |
| 271 | } | 410 | } |
| 411 | if Self.isEncryptedFile(path), crypt.passphrase(for: path) == nil, | ||
| 412 | (try? diskFileSystem.read(URL(fileURLWithPath: path)))??.isEmpty == false { | ||
| 413 | unlockRequest = path | ||
| 414 | unlockPane = pane | ||
| 415 | return | ||
| 416 | } | ||
| 272 | do { | 417 | do { |
| 273 | guard let bytes = try fileSystem.read(URL(fileURLWithPath: path)) else { | 418 | guard let bytes = try fileSystem.read(URL(fileURLWithPath: path)) else { |
| 274 | showError(String(localized: "Couldn't Open File", comment: "Error alert title"), "\((path as NSString).lastPathComponent) no longer exists.") | 419 | showError(String(localized: "Couldn't Open File", comment: "Error alert title"), "\((path as NSString).lastPathComponent) no longer exists.") |
| @@ -312,6 +457,9 @@ public final class DocumentSession { | |||
| 312 | guard let entry = entry(path) else { return } | 457 | guard let entry = entry(path) else { return } |
| 313 | entry.autosave?.cancel() | 458 | entry.autosave?.cancel() |
| 314 | entries.removeAll { $0 === entry } | 459 | entries.removeAll { $0 === entry } |
| 460 | crypt.close(entry.path) | ||
| 461 | held[entry.path] = nil | ||
| 462 | refusedKeychain.remove(entry.path) | ||
| 315 | history.removeAll { $0 == path } | 463 | history.removeAll { $0 == path } |
| 316 | outlineUpdates[path]?.cancel() | 464 | outlineUpdates[path]?.cancel() |
| 317 | outlineUpdates[path] = nil | 465 | outlineUpdates[path] = nil |
| @@ -426,6 +574,8 @@ public final class DocumentSession { | |||
| 426 | 574 | ||
| 427 | private func scheduleAutosave(_ entry: Entry) { | 575 | private func scheduleAutosave(_ entry: Entry) { |
| 428 | entry.autosave?.cancel() | 576 | entry.autosave?.cancel() |
| 577 | // A held file whose edits were undone, or whose tagged entries went, isn't held. | ||
| 578 | if held[entry.path] != nil, updateHold(entry) == nil { refresh(entry) } | ||
| 429 | guard saveMode == .automatic, entry.buffer.document.isDirty, entry.conflict == nil else { return } | 579 | guard saveMode == .automatic, entry.buffer.document.isDirty, entry.conflict == nil else { return } |
| 430 | entry.autosave = Task { [weak self, weak entry, autosaveDelay] in | 580 | entry.autosave = Task { [weak self, weak entry, autosaveDelay] in |
| 431 | try? await Task.sleep(for: autosaveDelay) | 581 | try? await Task.sleep(for: autosaveDelay) |
| @@ -460,6 +610,11 @@ public final class DocumentSession { | |||
| 460 | defer { interval.end((entry.path as NSString).lastPathComponent) } | 610 | defer { interval.end((entry.path as NSString).lastPathComponent) } |
| 461 | entry.autosave?.cancel() | 611 | entry.autosave?.cancel() |
| 462 | let name = (entry.path as NSString).lastPathComponent | 612 | let name = (entry.path as NSString).lastPathComponent |
| 613 | guard updateHold(entry) == nil else { | ||
| 614 | askKeychain(entry) | ||
| 615 | refresh(entry) | ||
| 616 | return false | ||
| 617 | } | ||
| 463 | guard entry.buffer.document.isDirty else { return true } | 618 | guard entry.buffer.document.isDirty else { return true } |
| 464 | guard entry.conflict == nil else { return false } | 619 | guard entry.conflict == nil else { return false } |
| 465 | do { | 620 | do { |
| @@ -484,6 +639,7 @@ public final class DocumentSession { | |||
| 484 | /// Resolves a conflict by writing the buffer over the disk version, which goes to recovery. | 639 | /// Resolves a conflict by writing the buffer over the disk version, which goes to recovery. |
| 485 | public func keepMine() { | 640 | public func keepMine() { |
| 486 | guard let buffer, let url else { return } | 641 | guard let buffer, let url else { return } |
| 642 | if let current, updateHold(current) != nil { return refresh() } | ||
| 487 | do { | 643 | do { |
| 488 | try buffer.update { try saver.overwrite(&$0, to: url) } | 644 | try buffer.update { try saver.overwrite(&$0, to: url) } |
| 489 | current?.conflict = nil | 645 | current?.conflict = nil |
| @@ -553,7 +709,7 @@ public final class DocumentSession { | |||
| 553 | public func resolve(copy: URL, _ resolution: CopyResolution) -> String? { | 709 | public func resolve(copy: URL, _ resolution: CopyResolution) -> String? { |
| 554 | guard let buffer, let url else { return "No file is open" } | 710 | guard let buffer, let url else { return "No file is open" } |
| 555 | do { | 711 | do { |
| 556 | guard let bytes = try fileSystem.read(copy) else { return "\(copy.lastPathComponent) is gone" } | 712 | guard let bytes = try diskFileSystem.read(copy).map({ try crypt.plain($0, for: url.path) }) else { return "\(copy.lastPathComponent) is gone" } |
| 557 | let copyText = SourceText(bytes: bytes).text | 713 | let copyText = SourceText(bytes: bytes).text |
| 558 | let mine = buffer.document.text | 714 | let mine = buffer.document.text |
| 559 | let new: String? = switch resolution { | 715 | let new: String? = switch resolution { |
| @@ -577,7 +733,7 @@ public final class DocumentSession { | |||
| 577 | /// Versions of the open file kept in recovery, newest first, with when and why each was | 733 | /// Versions of the open file kept in recovery, newest first, with when and why each was |
| 578 | /// kept. | 734 | /// kept. |
| 579 | public func recoveryVersions() -> [(url: URL, date: Date, label: String)] { | 735 | public func recoveryVersions() -> [(url: URL, date: Date, label: String)] { |
| 580 | guard let url, let store = recovery as? FileRecoveryStore, let versions = try? store.versions(for: url) else { return [] } | 736 | guard let url, let store = diskRecovery as? FileRecoveryStore, let versions = try? store.versions(for: url) else { return [] } |
| 581 | // `STAMP-LABEL-UUID8-NAME`, as `FileRecoveryStore.keep` names them. | 737 | // `STAMP-LABEL-UUID8-NAME`, as `FileRecoveryStore.keep` names them. |
| 582 | return versions.reversed().map { version in | 738 | return versions.reversed().map { version in |
| 583 | let m = version.lastPathComponent.firstMatch(of: /^([0-9]+)-(.+?)-([0-9A-Fa-f]{8})-/) | 739 | let m = version.lastPathComponent.firstMatch(of: /^([0-9]+)-(.+?)-([0-9A-Fa-f]{8})-/) |
| @@ -588,7 +744,9 @@ public final class DocumentSession { | |||
| 588 | 744 | ||
| 589 | /// The text of a kept version. | 745 | /// The text of a kept version. |
| 590 | public func recoveryText(_ version: URL) -> String? { | 746 | public func recoveryText(_ version: URL) -> String? { |
| 591 | (try? fileSystem.read(version)).flatMap { $0 }.map { SourceText(bytes: $0).text } | 747 | guard let bytes = (try? diskFileSystem.read(version)).flatMap({ $0 }) else { return nil } |
| 748 | // Kept as the open file is: encrypted with its passphrase, its entries' messages known. | ||
| 749 | return (try? path.map { try crypt.plain(bytes, for: $0) } ?? bytes).map { SourceText(bytes: $0).text } | ||
| 592 | } | 750 | } |
| 593 | 751 | ||
| 594 | /// Puts a kept version's text in the buffer, as an edit that can be undone; the buffer as it | 752 | /// Puts a kept version's text in the buffer, as an edit that can be undone; the buffer as it |
Sources/OrgApp/OrgPreferences.swift +4 · view
| @@ -236,6 +236,10 @@ public enum OrgPreferences { | |||
| 236 | let tag = string("cryptTagMatcher", defaults).trimmingCharacters(in: .whitespaces) | 236 | let tag = string("cryptTagMatcher", defaults).trimmingCharacters(in: .whitespaces) |
| 237 | return tag.isEmpty ? "crypt" : tag | 237 | return tag.isEmpty ? "crypt" : tag |
| 238 | } | 238 | } |
| 239 | /// `org-crypt-use-before-save-magic`. | ||
| 240 | public static func cryptBeforeSave(_ defaults: UserDefaults = .standard) -> Bool { | ||
| 241 | bool("cryptBeforeSave", defaults) | ||
| 242 | } | ||
| 239 | /// `org-icalendar-combined-agenda-file`, `~` expanded. | 243 | /// `org-icalendar-combined-agenda-file`, `~` expanded. |
| 240 | public static func icalendarCombinedFile(_ defaults: UserDefaults = .standard) -> String { | 244 | public static func icalendarCombinedFile(_ defaults: UserDefaults = .standard) -> String { |
| 241 | OrgPaths.expandingTilde(string("icalendarCombinedAgendaFile", defaults)) | 245 | OrgPaths.expandingTilde(string("icalendarCombinedAgendaFile", defaults)) |
Sources/OrgApp/UserConfig.swift +2 · view
| @@ -222,6 +222,8 @@ public enum UserConfig { | |||
| 222 | comment: "files dropped on the editor: ask, attach, open or file-link", legacy: ""), | 222 | comment: "files dropped on the editor: ask, attach, open or file-link", legacy: ""), |
| 223 | Setting(section: "", key: "org-crypt-tag-matcher", defaultsKey: "cryptTagMatcher", kind: .string, fallback: .string("crypt"), | 223 | Setting(section: "", key: "org-crypt-tag-matcher", defaultsKey: "cryptTagMatcher", kind: .string, fallback: .string("crypt"), |
| 224 | comment: "the tag of entries Encrypt Tagged Entries encrypts", legacy: ""), | 224 | comment: "the tag of entries Encrypt Tagged Entries encrypts", legacy: ""), |
| 225 | Setting(section: "", key: "org-crypt-use-before-save-magic", defaultsKey: "cryptBeforeSave", kind: .bool, fallback: .bool(false), | ||
| 226 | comment: "encrypt entries with org-crypt-tag-matcher's tag on every save; without their passphrase the file isn't saved", legacy: ""), | ||
| 225 | Setting(section: "", key: "org-display-remote-inline-images", defaultsKey: "remoteInlineImages", | 227 | Setting(section: "", key: "org-display-remote-inline-images", defaultsKey: "remoteInlineImages", |
| 226 | kind: .choice([("skip", "skip"), ("download", "download"), ("cache", "cache")]), fallback: .string("skip"), | 228 | kind: .choice([("skip", "skip"), ("download", "download"), ("cache", "cache")]), fallback: .string("skip"), |
| 227 | comment: "images at http(s) links: skip, download (each run) or cache (kept on disk)", legacy: ""), | 229 | comment: "images at http(s) links: skip, download (each run) or cache (kept on disk)", legacy: ""), |
Sources/OrgCore/Crypto/OpenPGP.swift +17 −1 · view
| @@ -329,6 +329,22 @@ public enum OpenPGP { | |||
| 329 | /// `gpg --symmetric --armor`: AES-256, an iterated and salted SHA-256 key, integrity | 329 | /// `gpg --symmetric --armor`: AES-256, an iterated and salted SHA-256 key, integrity |
| 330 | /// protection, binary literal data without a name. | 330 | /// protection, binary literal data without a name. |
| 331 | public static func encrypt(_ data: Data, passphrase: String, now: Date = Date()) throws -> String { | 331 | public static func encrypt(_ data: Data, passphrase: String, now: Date = Date()) throws -> String { |
| 332 | armor(try encryptedMessage(data, passphrase: passphrase, now: now)) | ||
| 333 | } | ||
| 334 | |||
| 335 | /// Whether `data` is an armored message rather than packets. | ||
| 336 | public static func isArmored(_ data: Data) -> Bool { | ||
| 337 | let head = String(decoding: data.prefix(64), as: UTF8.self).trimmingCharacters(in: .whitespacesAndNewlines) | ||
| 338 | return head.hasPrefix("-----BEGIN PGP MESSAGE") | ||
| 339 | } | ||
| 340 | |||
| 341 | /// The literal data of a passphrase-encrypted file, armored or not, as `gpg --decrypt` reads it. | ||
| 342 | public static func decryptFile(_ data: Data, passphrase: String) throws -> Data { | ||
| 343 | try decrypt(isArmored(data) ? dearmor(String(decoding: data, as: UTF8.self)) : data, passphrase: passphrase) | ||
| 344 | } | ||
| 345 | |||
| 346 | /// `gpg --symmetric` without `--armor`: the packets of `encrypt`. | ||
| 347 | public static func encryptedMessage(_ data: Data, passphrase: String, now: Date = Date()) throws -> Data { | ||
| 332 | let salt = random(8) | 348 | let salt = random(8) |
| 333 | let s2k = S2K(type: 3, hash: 8, salt: salt, count: (16 + (96 & 15)) << ((96 >> 4) + 6)) | 349 | let s2k = S2K(type: 3, hash: 8, salt: salt, count: (16 + (96 & 15)) << ((96 >> 4) + 6)) |
| 334 | let key = try s2k.key(passphrase, size: 32) | 350 | let key = try s2k.key(passphrase, size: 32) |
| @@ -340,6 +356,6 @@ public enum OpenPGP { | |||
| 340 | var plain = prefix + literal + Data([0xD3, 0x14]) | 356 | var plain = prefix + literal + Data([0xD3, 0x14]) |
| 341 | plain.append(Data(Insecure.SHA1.hash(data: plain))) | 357 | plain.append(Data(Insecure.SHA1.hash(data: plain))) |
| 342 | let seipd = packet(18, Data([1]) + (try cfb(plain, key: key, encrypt: true))) | 358 | let seipd = packet(18, Data([1]) + (try cfb(plain, key: key, encrypt: true))) |
| 343 | return armor(skesk + seipd) | 359 | return skesk + seipd |
| 344 | } | 360 | } |
| 345 | } | 361 | } |
Sources/OrgCore/Crypto/OrgCrypt.swift +66 · view
| @@ -1,3 +1,4 @@ | |||
| 1 | import CryptoKit | ||
| 1 | import Foundation | 2 | import Foundation |
| 2 | 3 | ||
| 3 | /// org-crypt (org-crypt.el, Org 9.8.7) with symmetric encryption, as with `org-crypt-key` | 4 | /// org-crypt (org-crypt.el, Org 9.8.7) with symmetric encryption, as with `org-crypt-key` |
| @@ -134,4 +135,69 @@ public enum OrgCrypt { | |||
| 134 | } | 135 | } |
| 135 | return (text, count) | 136 | return (text, count) |
| 136 | } | 137 | } |
| 138 | |||
| 139 | /// The tagged entries `seal` encrypts whose text isn't blank: those a save can't write | ||
| 140 | /// without the passphrase. Their headings' offsets. | ||
| 141 | public static func unencrypted(_ text: String, tag: String = "crypt", settings: OrgSettings = .default) -> [Int] { | ||
| 142 | guard text.contains(tag) else { return [] } | ||
| 143 | let ns = text as NSString | ||
| 144 | var found: [Int] = [] | ||
| 145 | var covered = 0 | ||
| 146 | for heading in taggedHeadings(text, tag: tag, settings: settings) where heading >= covered { | ||
| 147 | guard encryptedRange(text, at: heading) == nil, let range = bodyRange(text, at: heading) else { continue } | ||
| 148 | // Tagged children go inside this entry's message. | ||
| 149 | covered = range.upperBound | ||
| 150 | if !ns.substring(with: NSRange(range)).trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { found.append(heading) } | ||
| 151 | } | ||
| 152 | return found | ||
| 153 | } | ||
| 154 | |||
| 155 | /// `org-encrypt-entries` as `org-crypt-use-before-save-magic` runs it before a save. An | ||
| 156 | /// entry whose text `reuse` knows by its `checksum` gets that message again, as org-crypt | ||
| 157 | /// keeps an entry decrypted and left unchanged byte for byte. The text, and each message | ||
| 158 | /// with the text it holds. | ||
| 159 | public static func seal( | ||
| 160 | _ text: String, passphrase: String, tag: String = "crypt", settings: OrgSettings = .default, | ||
| 161 | reuse: (String) -> String? = { _ in nil }, now: Date = Date() | ||
| 162 | ) throws -> (text: String, messages: [(message: String, plaintext: String)]) { | ||
| 163 | guard text.contains(tag) else { return (text, []) } | ||
| 164 | var result = text as NSString | ||
| 165 | var messages: [(String, String)] = [] | ||
| 166 | var shift = 0 | ||
| 167 | var covered = 0 | ||
| 168 | for heading in taggedHeadings(text, tag: tag, settings: settings) where heading >= covered { | ||
| 169 | let current = result as String | ||
| 170 | guard encryptedRange(current, at: heading + shift) == nil, let range = bodyRange(current, at: heading + shift) else { continue } | ||
| 171 | covered = range.upperBound - shift | ||
| 172 | let contents = result.substring(with: NSRange(range)) | ||
| 173 | let message = try reuse(checksum(contents)) ?? OpenPGP.encrypt(Data(contents.utf8), passphrase: passphrase, now: now) | ||
| 174 | result = result.replacingCharacters(in: NSRange(range), with: message) as NSString | ||
| 175 | shift += (message as NSString).length - range.count | ||
| 176 | messages.append((message, contents)) | ||
| 177 | } | ||
| 178 | return (result as String, messages) | ||
| 179 | } | ||
| 180 | |||
| 181 | /// What an entry's text is known by, as `org-crypt-checksum` is. | ||
| 182 | public static func checksum(_ contents: String) -> String { | ||
| 183 | SHA256.hash(data: Data(contents.utf8)).map { String(format: "%02x", $0) }.joined() | ||
| 184 | } | ||
| 185 | |||
| 186 | /// The first encrypted entry's message in `text`. | ||
| 187 | public static func firstMessage(_ text: String) -> String? { | ||
| 188 | let ns = text as NSString | ||
| 189 | var search = NSRange(location: 0, length: ns.length) | ||
| 190 | while true { | ||
| 191 | let begin = ns.range(of: "-----BEGIN PGP MESSAGE-----", options: [], range: search) | ||
| 192 | guard begin.location != NSNotFound else { return nil } | ||
| 193 | let lineStart = ns.lineRange(for: NSRange(location: begin.location, length: 0)).location | ||
| 194 | if let range = encryptedRange(text, at: lineStart), range.lowerBound == lineStart { return ns.substring(with: NSRange(range)) } | ||
| 195 | search = NSRange(location: NSMaxRange(begin), length: ns.length - NSMaxRange(begin)) | ||
| 196 | } | ||
| 197 | } | ||
| 198 | |||
| 199 | /// Whether `passphrase` opens `message`. | ||
| 200 | public static func opens(_ message: String, passphrase: String) -> Bool { | ||
| 201 | (try? OpenPGP.decrypt(OpenPGP.dearmor(message), passphrase: passphrase)) != nil | ||
| 202 | } | ||
| 137 | } | 203 | } |
Sources/OrgDocument/Crypt.swift added +257 · view
| @@ -0,0 +1,257 @@ | |||
| 1 | import Foundation | ||
| 2 | import OrgCore | ||
| 3 | |||
| 4 | /// Why a file can't be written: what it would put on disk unencrypted. | ||
| 5 | public enum CryptHold: Error, Equatable, Sendable { | ||
| 6 | /// This many crypt-tagged entries with text aren't encrypted, and their passphrase isn't known. | ||
| 7 | case entries(Int) | ||
| 8 | /// An encrypted file (`.org.gpg`) whose passphrase isn't known. | ||
| 9 | case file | ||
| 10 | } | ||
| 11 | |||
| 12 | /// Why an encrypted file can't be read. | ||
| 13 | public enum CryptReadError: Error, Equatable, Sendable { | ||
| 14 | /// Its passphrase isn't known. | ||
| 15 | case locked | ||
| 16 | case wrongPassphrase | ||
| 17 | case failed(String) | ||
| 18 | } | ||
| 19 | |||
| 20 | /// What the session knows about encrypted text, by file: the passphrases unlocked while the | ||
| 21 | /// file is open, and for entries org-crypt encrypts on save (`org-crypt-use-before-save-magic`) | ||
| 22 | /// the messages and the text each holds. Through `CryptFileSystem`, buffers keep the | ||
| 23 | /// decrypted text while the file holds messages. | ||
| 24 | public final class CryptVault: @unchecked Sendable { | ||
| 25 | private let lock = NSLock() | ||
| 26 | private var entries = false | ||
| 27 | private var entryTag = "crypt" | ||
| 28 | private var passphrases: [String: String] = [:] | ||
| 29 | /// By file: messages for entry texts by checksum, to give an unchanged entry its message again. | ||
| 30 | private var reuse: [String: [String: String]] = [:] | ||
| 31 | /// By file: the text of each message this session wrote, to read the file back as the buffer has it. | ||
| 32 | private var revealed: [String: [String: String]] = [:] | ||
| 33 | /// By file: whether the encrypted file was armored when read. | ||
| 34 | private var armored: [String: Bool] = [:] | ||
| 35 | private var onWrite: ((String) -> Void)? | ||
| 36 | |||
| 37 | public init() {} | ||
| 38 | |||
| 39 | private func locked<T>(_ body: () throws -> T) rethrows -> T { | ||
| 40 | lock.lock() | ||
| 41 | defer { lock.unlock() } | ||
| 42 | return try body() | ||
| 43 | } | ||
| 44 | |||
| 45 | private static func key(_ path: String) -> String { URL(fileURLWithPath: path).standardizedFileURL.path } | ||
| 46 | |||
| 47 | /// Whether `path` is a whole encrypted file, as EasyPG's `epa-file` opens `.gpg` files. | ||
| 48 | public static func isEncryptedFile(_ path: String) -> Bool { path.hasSuffix(".gpg") } | ||
| 49 | |||
| 50 | /// `org-crypt-use-before-save-magic`. | ||
| 51 | public var encryptsTaggedEntries: Bool { | ||
| 52 | get { locked { entries } } | ||
| 53 | set { locked { entries = newValue } } | ||
| 54 | } | ||
| 55 | |||
| 56 | /// `org-crypt-tag-matcher`. | ||
| 57 | public var tag: String { | ||
| 58 | get { locked { entryTag } } | ||
| 59 | set { locked { entryTag = newValue } } | ||
| 60 | } | ||
| 61 | |||
| 62 | /// Called with a file's path each time it was written. | ||
| 63 | public var written: ((String) -> Void)? { | ||
| 64 | get { locked { onWrite } } | ||
| 65 | set { locked { onWrite = newValue } } | ||
| 66 | } | ||
| 67 | |||
| 68 | public func passphrase(for path: String) -> String? { | ||
| 69 | locked { passphrases[Self.key(path)] } | ||
| 70 | } | ||
| 71 | |||
| 72 | /// `passphrase` encrypts and decrypts `path` until it's forgotten. Messages kept for reuse | ||
| 73 | /// under another passphrase are dropped. | ||
| 74 | public func unlock(_ passphrase: String, for path: String) { | ||
| 75 | let key = Self.key(path) | ||
| 76 | locked { | ||
| 77 | if passphrases[key] != passphrase { reuse[key] = nil } | ||
| 78 | passphrases[key] = passphrase | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | /// Drops the passphrase of `path`; the next save that needs it is held. | ||
| 83 | public func forgetPassphrase(for path: String) { | ||
| 84 | let key = Self.key(path) | ||
| 85 | locked { | ||
| 86 | passphrases[key] = nil | ||
| 87 | reuse[key] = nil | ||
| 88 | } | ||
| 89 | } | ||
| 90 | |||
| 91 | /// Drops everything kept for `path`, as when its buffer closes. | ||
| 92 | public func close(_ path: String) { | ||
| 93 | let key = Self.key(path) | ||
| 94 | locked { | ||
| 95 | passphrases[key] = nil | ||
| 96 | reuse[key] = nil | ||
| 97 | revealed[key] = nil | ||
| 98 | armored[key] = nil | ||
| 99 | } | ||
| 100 | } | ||
| 101 | |||
| 102 | /// The entry of `path` holding `plaintext` was decrypted from `message`: while it stays | ||
| 103 | /// so, saving writes `message` back unchanged. | ||
| 104 | public func remember(message: String, plaintext: String, for path: String) { | ||
| 105 | let key = Self.key(path) | ||
| 106 | locked { reuse[key, default: [:]][OrgCrypt.checksum(plaintext)] = message } | ||
| 107 | } | ||
| 108 | |||
| 109 | /// What keeps `text`, the buffer of `path`, from being written: tagged entries without a | ||
| 110 | /// known passphrase, or an encrypted file without one. Nil when it can be written. | ||
| 111 | public func hold(_ text: String, for path: String) -> CryptHold? { | ||
| 112 | let (passphrase, entries, tag) = locked { (passphrases[Self.key(path)], self.entries, entryTag) } | ||
| 113 | guard passphrase == nil else { return nil } | ||
| 114 | if Self.isEncryptedFile(path) { return .file } | ||
| 115 | guard entries else { return nil } | ||
| 116 | let count = OrgCrypt.unencrypted(text, tag: tag).count | ||
| 117 | return count > 0 ? .entries(count) : nil | ||
| 118 | } | ||
| 119 | |||
| 120 | /// Whether `text`, the buffer of `path`, holds anything that isn't on disk as it shows: | ||
| 121 | /// an encrypted file, or entries decrypted that saving encrypts. Such a buffer is left out | ||
| 122 | /// of what other views read and keep (`DocumentSession.openTexts`). | ||
| 123 | public func isPrivate(_ text: String, for path: String) -> Bool { | ||
| 124 | if Self.isEncryptedFile(path) { return true } | ||
| 125 | let (entries, tag) = locked { (self.entries, entryTag) } | ||
| 126 | return entries && !OrgCrypt.unencrypted(text, tag: tag).isEmpty | ||
| 127 | } | ||
| 128 | |||
| 129 | // MARK: - Reading and writing | ||
| 130 | |||
| 131 | /// The text of messages this session wrote for `path`. | ||
| 132 | public func revealedMessages(for path: String) -> [String: String] { | ||
| 133 | locked { revealed[Self.key(path)] ?? [:] } | ||
| 134 | } | ||
| 135 | |||
| 136 | /// `bytes` from disk as the buffer of `path` has them: the file decrypted, and the | ||
| 137 | /// messages this session wrote (`messages`, by default those known now) back to their text. | ||
| 138 | public func plain(_ bytes: [UInt8], for path: String, messages: [String: String]? = nil) throws -> [UInt8] { | ||
| 139 | var bytes = bytes | ||
| 140 | if Self.isEncryptedFile(path) { bytes = try decryptFile(bytes, for: path) } | ||
| 141 | let known = messages ?? revealedMessages(for: path) | ||
| 142 | guard !known.isEmpty, var text = Self.text(bytes), text.contains("-----BEGIN PGP MESSAGE-----") else { return bytes } | ||
| 143 | for (message, plaintext) in known where text.contains(message) { | ||
| 144 | text = text.replacingOccurrences(of: message, with: plaintext) | ||
| 145 | } | ||
| 146 | return Array(text.utf8) | ||
| 147 | } | ||
| 148 | |||
| 149 | /// `bytes`, the buffer of `path`, as the file holds them: tagged entries encrypted, then | ||
| 150 | /// the file encrypted, and the messages written for entries. Throws `CryptHold` when a | ||
| 151 | /// passphrase is needed and not known. | ||
| 152 | public func cipher(_ bytes: [UInt8], for path: String) throws -> (bytes: [UInt8], messages: [(message: String, plaintext: String)]) { | ||
| 153 | let key = Self.key(path) | ||
| 154 | let (passphrase, entries, tag, known) = locked { (passphrases[key], self.entries, entryTag, reuse[key] ?? [:]) } | ||
| 155 | var bytes = bytes | ||
| 156 | var messages: [(String, String)] = [] | ||
| 157 | if entries, let text = Self.text(bytes), text.contains(tag) { | ||
| 158 | if let passphrase { | ||
| 159 | let sealed = try OrgCrypt.seal(text, passphrase: passphrase, tag: tag, reuse: { known[$0] }) | ||
| 160 | bytes = Array(sealed.text.utf8) | ||
| 161 | messages = sealed.messages | ||
| 162 | } else { | ||
| 163 | let count = OrgCrypt.unencrypted(text, tag: tag).count | ||
| 164 | if count > 0 { throw CryptHold.entries(count) } | ||
| 165 | } | ||
| 166 | } | ||
| 167 | if Self.isEncryptedFile(path) { | ||
| 168 | guard let passphrase else { throw CryptHold.file } | ||
| 169 | let message = try OpenPGP.encryptedMessage(Data(bytes), passphrase: passphrase) | ||
| 170 | bytes = locked { armored[key] ?? false } ? Array(OpenPGP.armor(message).utf8) : [UInt8](message) | ||
| 171 | } | ||
| 172 | return (bytes, messages) | ||
| 173 | } | ||
| 174 | |||
| 175 | /// The messages in a file `cipher` gave were written: reading it back gives their text. | ||
| 176 | public func didWrite(_ messages: [(message: String, plaintext: String)], to path: String) { | ||
| 177 | let key = Self.key(path) | ||
| 178 | let callback = locked { | ||
| 179 | for (message, plaintext) in messages { revealed[key, default: [:]][message] = plaintext } | ||
| 180 | return onWrite | ||
| 181 | } | ||
| 182 | callback?(path) | ||
| 183 | } | ||
| 184 | |||
| 185 | /// Whether `passphrase` opens the encrypted file `bytes`; an empty file takes any. | ||
| 186 | public static func opens(_ bytes: [UInt8], passphrase: String) -> Bool { | ||
| 187 | bytes.isEmpty || (try? OpenPGP.decryptFile(Data(bytes), passphrase: passphrase)) != nil | ||
| 188 | } | ||
| 189 | |||
| 190 | private func decryptFile(_ bytes: [UInt8], for path: String) throws -> [UInt8] { | ||
| 191 | // New File makes an empty file: it has no passphrase until it's first saved. | ||
| 192 | guard !bytes.isEmpty else { return [] } | ||
| 193 | let key = Self.key(path) | ||
| 194 | guard let passphrase = locked({ passphrases[key] }) else { throw CryptReadError.locked } | ||
| 195 | let data = Data(bytes) | ||
| 196 | do { | ||
| 197 | let plain = try OpenPGP.decryptFile(data, passphrase: passphrase) | ||
| 198 | locked { armored[key] = OpenPGP.isArmored(data) } | ||
| 199 | return [UInt8](plain) | ||
| 200 | } catch let failure as OpenPGP.Failure { | ||
| 201 | throw failure == OpenPGP.wrongPassphrase ? CryptReadError.wrongPassphrase : CryptReadError.failed(failure.description) | ||
| 202 | } | ||
| 203 | } | ||
| 204 | |||
| 205 | /// `bytes` as text when they are UTF-8 exactly, a BOM included. | ||
| 206 | private static func text(_ bytes: [UInt8]) -> String? { | ||
| 207 | let text = String(decoding: bytes, as: UTF8.self) | ||
| 208 | return text.utf8.elementsEqual(bytes) ? text : nil | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 212 | /// Files read and written through a `CryptVault`: what the buffer holds decrypted goes to | ||
| 213 | /// disk encrypted, and comes back as the buffer has it. | ||
| 214 | public struct CryptFileSystem: FileSystem { | ||
| 215 | public let base: FileSystem | ||
| 216 | public let vault: CryptVault | ||
| 217 | |||
| 218 | public init(base: FileSystem, vault: CryptVault) { | ||
| 219 | self.base = base | ||
| 220 | self.vault = vault | ||
| 221 | } | ||
| 222 | |||
| 223 | public func read(_ url: URL) throws -> [UInt8]? { | ||
| 224 | try base.read(url).map { try vault.plain($0, for: url.path) } | ||
| 225 | } | ||
| 226 | |||
| 227 | public func replace(_ url: URL, with bytes: [UInt8]) throws -> [UInt8]? { | ||
| 228 | let known = vault.revealedMessages(for: url.path) | ||
| 229 | let (encrypted, messages) = try vault.cipher(bytes, for: url.path) | ||
| 230 | let replaced = try base.replace(url, with: encrypted) | ||
| 231 | vault.didWrite(messages, to: url.path) | ||
| 232 | // The version replaced, as it read before this write's messages were known. | ||
| 233 | return replaced.map { (try? vault.plain($0, for: url.path, messages: known)) ?? $0 } | ||
| 234 | } | ||
| 235 | } | ||
| 236 | |||
| 237 | /// Recovery versions and snapshots through a `CryptVault`: kept encrypted as the file is, or | ||
| 238 | /// not kept when that needs a passphrase that isn't known. | ||
| 239 | public struct CryptRecoveryStore: RecoveryStore { | ||
| 240 | public let base: RecoveryStore | ||
| 241 | public let vault: CryptVault | ||
| 242 | |||
| 243 | public init(base: RecoveryStore, vault: CryptVault) { | ||
| 244 | self.base = base | ||
| 245 | self.vault = vault | ||
| 246 | } | ||
| 247 | |||
| 248 | public func keep(_ bytes: [UInt8], for url: URL, label: String) throws { | ||
| 249 | guard let encrypted = try? vault.cipher(bytes, for: url.path).bytes else { return } | ||
| 250 | try base.keep(encrypted, for: url, label: label) | ||
| 251 | } | ||
| 252 | |||
| 253 | public func keepSnapshot(_ bytes: [UInt8], for url: URL) throws { | ||
| 254 | guard let encrypted = try? vault.cipher(bytes, for: url.path).bytes else { return } | ||
| 255 | try base.keepSnapshot(encrypted, for: url) | ||
| 256 | } | ||
| 257 | } | ||
Sources/Orgstar/ContentView.swift +17 −2 · view
| @@ -35,6 +35,8 @@ struct ContentView: View { | |||
| 35 | @State private var menuToday: [AgendaSnapshot.Row] = [] | 35 | @State private var menuToday: [AgendaSnapshot.Row] = [] |
| 36 | @State private var hour = 0 | 36 | @State private var hour = 0 |
| 37 | @AppStorage("saveMode") private var saveMode = SaveMode.automatic | 37 | @AppStorage("saveMode") private var saveMode = SaveMode.automatic |
| 38 | @AppStorage("cryptBeforeSave") private var cryptBeforeSave = false | ||
| 39 | @AppStorage("cryptTagMatcher") private var cryptTagMatcher = "crypt" | ||
| 38 | @AppStorage("keymap") private var preset = KeymapPreset.emacs | 40 | @AppStorage("keymap") private var preset = KeymapPreset.emacs |
| 39 | @AppStorage("optionAsMeta") private var optionAsMeta = OptionAsMeta.left.rawValue | 41 | @AppStorage("optionAsMeta") private var optionAsMeta = OptionAsMeta.left.rawValue |
| 40 | @State private var keymap = KeymapPreset.emacs.keymap | 42 | @State private var keymap = KeymapPreset.emacs.keymap |
| @@ -194,6 +196,7 @@ struct ContentView: View { | |||
| 194 | .frame(height: 190) | 196 | .frame(height: 190) |
| 195 | Divider() | 197 | Divider() |
| 196 | } | 198 | } |
| 199 | CryptHoldBar(session: session) { commands.run("app.crypt.save") } | ||
| 197 | ModeLine(session: session, commands: commands) | 200 | ModeLine(session: session, commands: commands) |
| 198 | EchoArea(commands: commands) | 201 | EchoArea(commands: commands) |
| 199 | } | 202 | } |
| @@ -404,6 +407,11 @@ struct ContentView: View { | |||
| 404 | commands.editor = nil | 407 | commands.editor = nil |
| 405 | } | 408 | } |
| 406 | .onChange(of: saveMode, initial: true) { _, mode in session.saveMode = mode } | 409 | .onChange(of: saveMode, initial: true) { _, mode in session.saveMode = mode } |
| 410 | .onChange(of: cryptBeforeSave, initial: true) { _, on in session.encryptsTaggedEntries = on } | ||
| 411 | .onChange(of: cryptTagMatcher, initial: true) { session.cryptTag = OrgPreferences.cryptTag() } | ||
| 412 | .onChange(of: session.unlockRequest, initial: true) { _, path in | ||
| 413 | if let path { panel = .crypt(UUID(), CryptRequest(mode: .openFile, path: path, offset: 0)) } | ||
| 414 | } | ||
| 407 | .onChange(of: options, initial: true) { _, options in session.options = options } | 415 | .onChange(of: options, initial: true) { _, options in session.options = options } |
| 408 | .onAppear { TimerModel.shared.onDone = { [commands] in commands.show($0) } } | 416 | .onAppear { TimerModel.shared.onDone = { [commands] in commands.show($0) } } |
| 409 | .onReceive(NotificationCenter.default.publisher(for: UserDefaults.didChangeNotification)) { _ in defaultsChanges += 1 } | 417 | .onReceive(NotificationCenter.default.publisher(for: UserDefaults.didChangeNotification)) { _ in defaultsChanges += 1 } |
| @@ -902,12 +910,17 @@ struct ContentView: View { | |||
| 902 | 910 | ||
| 903 | /// org-crypt's commands at the caret, through the passphrase sheet. | 911 | /// org-crypt's commands at the caret, through the passphrase sheet. |
| 904 | private func crypt(_ id: String) { | 912 | private func crypt(_ id: String) { |
| 913 | if id == "app.crypt.save" { | ||
| 914 | guard let path = session.path, let hold = session.held[path] else { return } | ||
| 915 | panel = .crypt(UUID(), CryptRequest.save(path, hold: hold)) | ||
| 916 | return | ||
| 917 | } | ||
| 905 | guard let editor = commands.editor, let path = session.path else { return commands.show(String(localized: "No file is open")) } | 918 | guard let editor = commands.editor, let path = session.path else { return commands.show(String(localized: "No file is open")) } |
| 906 | let caret = editor.context().caret | 919 | let caret = editor.context().caret |
| 907 | let text = editor.context().text | 920 | let text = editor.context().text |
| 908 | switch id { | 921 | switch id { |
| 909 | case "app.crypt.forget-passphrase": | 922 | case "app.crypt.forget-passphrase": |
| 910 | CryptPassphrases.forget(path) | 923 | session.forgetPassphrase(for: path) |
| 911 | commands.show(String(localized: "Passphrase forgotten for \((path as NSString).lastPathComponent)")) | 924 | commands.show(String(localized: "Passphrase forgotten for \((path as NSString).lastPathComponent)")) |
| 912 | case "app.crypt.encrypt-entries": | 925 | case "app.crypt.encrypt-entries": |
| 913 | panel = .crypt(UUID(), CryptRequest(mode: .encryptAll(tag: OrgPreferences.cryptTag()), path: path, offset: caret)) | 926 | panel = .crypt(UUID(), CryptRequest(mode: .encryptAll(tag: OrgPreferences.cryptTag()), path: path, offset: caret)) |
| @@ -996,8 +1009,10 @@ struct ContentView: View { | |||
| 996 | case .shareSubtree(_, let share): | 1009 | case .shareSubtree(_, let share): |
| 997 | ShareSubtreeSheet(share: share) { commands.show($0) } | 1010 | ShareSubtreeSheet(share: share) { commands.show($0) } |
| 998 | case .crypt(_, let request): | 1011 | case .crypt(_, let request): |
| 999 | CryptSheet(request: request, text: { session.document?.text ?? "" }, apply: { applyText($0) }) { message in | 1012 | CryptSheet(request: request, session: session, text: { session.document(of: request.path)?.text ?? "" }, apply: { applyText($0) }) { message in |
| 1000 | self.panel = nil | 1013 | self.panel = nil |
| 1014 | // An encrypted file left closed: the sidebar shows the open file again. | ||
| 1015 | if case .openFile = request.mode, !session.isOpen(request.path) { selectedFile = session.path } | ||
| 1001 | if let message { commands.show(message) } | 1016 | if let message { commands.show(message) } |
| 1002 | } | 1017 | } |
| 1003 | case .conflict: | 1018 | case .conflict: |
Sources/Orgstar/CryptHoldBar.swift added +27 · view
| @@ -0,0 +1,27 @@ | |||
| 1 | import OrgApp | ||
| 2 | import OrgDocument | ||
| 3 | import SwiftUI | ||
| 4 | |||
| 5 | /// Above the mode line while the focused file isn't saved because it would put text on disk | ||
| 6 | /// unencrypted: why, and the button that asks for the passphrase. Stays while it applies. | ||
| 7 | struct CryptHoldBar: View { | ||
| 8 | let session: DocumentSession | ||
| 9 | let encrypt: () -> Void | ||
| 10 | |||
| 11 | var body: some View { | ||
| 12 | if let path = session.path, let hold = session.held[path] { | ||
| 13 | HStack(spacing: 8) { | ||
| 14 | Image(systemName: "lock.trianglebadge.exclamationmark").foregroundStyle(.orange) | ||
| 15 | Text(hold.notice(for: path)).lineLimit(2) | ||
| 16 | Spacer(minLength: 8) | ||
| 17 | Button(hold == .file ? "Set Passphrase…" : "Encrypt…", action: encrypt) | ||
| 18 | } | ||
| 19 | .font(.callout) | ||
| 20 | .padding(.horizontal, 10) | ||
| 21 | .padding(.vertical, 5) | ||
| 22 | .frame(maxWidth: .infinity, alignment: .leading) | ||
| 23 | .background(Color.orange.opacity(0.12)) | ||
| 24 | .accessibilityElement(children: .combine) | ||
| 25 | } | ||
| 26 | } | ||
| 27 | } | ||
Sources/Orgstar/EditorWindowView.swift +1 · view
| @@ -24,6 +24,7 @@ struct EditorWindowView: View { | |||
| 24 | } | 24 | } |
| 25 | .safeAreaInset(edge: .bottom, spacing: 0) { | 25 | .safeAreaInset(edge: .bottom, spacing: 0) { |
| 26 | VStack(spacing: 0) { | 26 | VStack(spacing: 0) { |
| 27 | CryptHoldBar(session: session) { run("app.crypt.save") } | ||
| 27 | ModeLine(session: session, commands: commands) | 28 | ModeLine(session: session, commands: commands) |
| 28 | EchoArea(commands: commands) | 29 | EchoArea(commands: commands) |
| 29 | } | 30 | } |
Sources/Orgstar/OrgstarApp.swift +50 −5 · view
| @@ -324,8 +324,8 @@ enum UnsavedChanges { | |||
| 324 | /// Whether the open file can be left: saved in automatic mode, or as the user chooses in | 324 | /// Whether the open file can be left: saved in automatic mode, or as the user chooses in |
| 325 | /// explicit mode. A save that fails or conflicts keeps the file open. | 325 | /// explicit mode. A save that fails or conflicts keeps the file open. |
| 326 | static func resolve(_ session: DocumentSession) -> Bool { | 326 | static func resolve(_ session: DocumentSession) -> Bool { |
| 327 | guard session.isDirty else { return true } | 327 | guard session.isDirty, let path = session.path else { return true } |
| 328 | if session.saveMode == .automatic { return session.save() } | 328 | if session.saveMode == .automatic { return save(session, path) } |
| 329 | let alert = NSAlert() | 329 | let alert = NSAlert() |
| 330 | alert.messageText = session.path.map { String(localized: "Save changes to \(($0 as NSString).lastPathComponent)?") } | 330 | alert.messageText = session.path.map { String(localized: "Save changes to \(($0 as NSString).lastPathComponent)?") } |
| 331 | ?? String(localized: "Save changes to this file?") | 331 | ?? String(localized: "Save changes to this file?") |
| @@ -334,7 +334,7 @@ enum UnsavedChanges { | |||
| 334 | alert.addButton(withTitle: String(localized: "Don't Save")) | 334 | alert.addButton(withTitle: String(localized: "Don't Save")) |
| 335 | alert.addButton(withTitle: String(localized: "Cancel")) | 335 | alert.addButton(withTitle: String(localized: "Cancel")) |
| 336 | switch alert.runModal() { | 336 | switch alert.runModal() { |
| 337 | case .alertFirstButtonReturn: return session.save() | 337 | case .alertFirstButtonReturn: return save(session, path) |
| 338 | case .alertSecondButtonReturn: return true | 338 | case .alertSecondButtonReturn: return true |
| 339 | default: return false | 339 | default: return false |
| 340 | } | 340 | } |
| @@ -345,7 +345,7 @@ enum UnsavedChanges { | |||
| 345 | static func resolve(_ session: DocumentSession, paths: [String]) -> Bool { | 345 | static func resolve(_ session: DocumentSession, paths: [String]) -> Bool { |
| 346 | let dirty = paths.filter(session.dirtyPaths.contains) | 346 | let dirty = paths.filter(session.dirtyPaths.contains) |
| 347 | guard !dirty.isEmpty else { return true } | 347 | guard !dirty.isEmpty else { return true } |
| 348 | if session.saveMode == .automatic { return dirty.map(session.save).allSatisfy { $0 } } | 348 | if session.saveMode == .automatic { return dirty.map { save(session, $0) }.allSatisfy { $0 } } |
| 349 | if dirty == [session.path] { return resolve(session) } | 349 | if dirty == [session.path] { return resolve(session) } |
| 350 | let alert = NSAlert() | 350 | let alert = NSAlert() |
| 351 | alert.messageText = String(localized: "Save changes to \(dirty.count) files?") | 351 | alert.messageText = String(localized: "Save changes to \(dirty.count) files?") |
| @@ -354,11 +354,56 @@ enum UnsavedChanges { | |||
| 354 | alert.addButton(withTitle: String(localized: "Don't Save")) | 354 | alert.addButton(withTitle: String(localized: "Don't Save")) |
| 355 | alert.addButton(withTitle: String(localized: "Cancel")) | 355 | alert.addButton(withTitle: String(localized: "Cancel")) |
| 356 | switch alert.runModal() { | 356 | switch alert.runModal() { |
| 357 | case .alertFirstButtonReturn: return dirty.map(session.save).allSatisfy { $0 } | 357 | case .alertFirstButtonReturn: return dirty.map { save(session, $0) }.allSatisfy { $0 } |
| 358 | case .alertSecondButtonReturn: return true | 358 | case .alertSecondButtonReturn: return true |
| 359 | default: return false | 359 | default: return false |
| 360 | } | 360 | } |
| 361 | } | 361 | } |
| 362 | |||
| 363 | /// Saves `path`. One held for its passphrase asks for it, or whether to leave without saving. | ||
| 364 | static func save(_ session: DocumentSession, _ path: String) -> Bool { | ||
| 365 | if session.save(path) { return true } | ||
| 366 | guard let hold = session.held[path] else { return false } | ||
| 367 | let name = (path as NSString).lastPathComponent | ||
| 368 | // A new passphrase is typed twice; one that must open what's encrypted already, once. | ||
| 369 | let twice = hold == .file || OrgCrypt.firstMessage(session.document(of: path)?.text ?? "") == nil | ||
| 370 | let fields = (twice ? [String(localized: "Passphrase"), String(localized: "Repeat passphrase")] : [String(localized: "Passphrase")]).map { placeholder in | ||
| 371 | let field = NSSecureTextField(frame: NSRect(x: 0, y: 0, width: 260, height: 22)) | ||
| 372 | field.placeholderString = placeholder | ||
| 373 | return field | ||
| 374 | } | ||
| 375 | let stack = NSStackView(views: fields) | ||
| 376 | stack.orientation = .vertical | ||
| 377 | stack.spacing = 6 | ||
| 378 | stack.frame = NSRect(x: 0, y: 0, width: 260, height: CGFloat(fields.count) * 28) | ||
| 379 | var problem: String? | ||
| 380 | while true { | ||
| 381 | let alert = NSAlert() | ||
| 382 | alert.messageText = String(localized: "Changes to \(name) aren't saved") | ||
| 383 | alert.informativeText = (problem.map { $0 + "\n\n" } ?? "") + hold.notice(for: path) + " " | ||
| 384 | + String(localized: "Enter the passphrase to encrypt and save them, or leave without saving.") | ||
| 385 | alert.accessoryView = stack | ||
| 386 | alert.addButton(withTitle: String(localized: "Encrypt and Save")) | ||
| 387 | alert.addButton(withTitle: String(localized: "Don't Save")) | ||
| 388 | alert.addButton(withTitle: String(localized: "Cancel")) | ||
| 389 | alert.window.initialFirstResponder = fields[0] | ||
| 390 | switch alert.runModal() { | ||
| 391 | case .alertFirstButtonReturn: | ||
| 392 | let passphrase = fields[0].stringValue | ||
| 393 | if passphrase.isEmpty { | ||
| 394 | problem = String(localized: "Enter a passphrase.") | ||
| 395 | } else if twice, fields[1].stringValue != passphrase { | ||
| 396 | problem = String(localized: "The passphrases differ") | ||
| 397 | } else if let failure = session.unlock(passphrase, for: path) { | ||
| 398 | problem = failure | ||
| 399 | } else { | ||
| 400 | return !session.dirtyPaths.contains(path) | ||
| 401 | } | ||
| 402 | case .alertSecondButtonReturn: return true | ||
| 403 | default: return false | ||
| 404 | } | ||
| 405 | } | ||
| 406 | } | ||
| 362 | } | 407 | } |
| 363 | 408 | ||
| 364 | /// The open buffers, their order and carets, kept for the next launch. | 409 | /// The open buffers, their order and carets, kept for the next launch. |
Sources/OrgstarMobile/EditorScreen.swift +30 −2 · view
| @@ -134,10 +134,32 @@ struct EditorScreen: View { | |||
| 134 | if let editor, let textView { | 134 | if let editor, let textView { |
| 135 | EditorTextView(editor: editor, view: textView, palette: { sheet = .palette }) | 135 | EditorTextView(editor: editor, view: textView, palette: { sheet = .palette }) |
| 136 | .ignoresSafeArea(.container, edges: .bottom) | 136 | .ignoresSafeArea(.container, edges: .bottom) |
| 137 | } else if DocumentSession.isEncryptedFile(path), !session.isOpen(path) { | ||
| 138 | ContentUnavailableView { | ||
| 139 | Label("\((path as NSString).lastPathComponent) is encrypted", systemImage: "lock") | ||
| 140 | } actions: { | ||
| 141 | Button("Decrypt…") { sheet = .crypt(CryptRequest(mode: .openFile, path: path, offset: 0)) } | ||
| 142 | } | ||
| 137 | } else { | 143 | } else { |
| 138 | ProgressView() | 144 | ProgressView() |
| 139 | } | 145 | } |
| 140 | } | 146 | } |
| 147 | // While the file isn't saved for want of a passphrase, and why; stays while it applies. | ||
| 148 | .safeAreaInset(edge: .top, spacing: 0) { | ||
| 149 | if let hold = session.held[path] { | ||
| 150 | HStack(spacing: 10) { | ||
| 151 | Image(systemName: "lock.trianglebadge.exclamationmark").foregroundStyle(.orange) | ||
| 152 | Text(hold.notice(for: path)).font(.callout).fixedSize(horizontal: false, vertical: true) | ||
| 153 | Spacer(minLength: 4) | ||
| 154 | Button(hold == .file ? "Set Passphrase…" : "Encrypt…") { sheet = .crypt(CryptRequest.save(path, hold: hold)) } | ||
| 155 | .buttonStyle(.borderedProminent) | ||
| 156 | } | ||
| 157 | .padding(.horizontal, 14).padding(.vertical, 8) | ||
| 158 | .glassEffect(.regular, in: .rect(cornerRadius: 18)) | ||
| 159 | .padding(8) | ||
| 160 | .accessibilityElement(children: .combine) | ||
| 161 | } | ||
| 162 | } | ||
| 141 | .modifier(EditorTitle(title: session.bufferName(path) + (session.dirtyPaths.contains(path) ? " •" : ""), shown: !inSplit)) | 163 | .modifier(EditorTitle(title: session.bufferName(path) + (session.dirtyPaths.contains(path) ? " •" : ""), shown: !inSplit)) |
| 142 | .toolbar(.hidden, for: .tabBar) | 164 | .toolbar(.hidden, for: .tabBar) |
| 143 | .toolbar { | 165 | .toolbar { |
| @@ -190,6 +212,8 @@ struct EditorScreen: View { | |||
| 190 | } | 212 | } |
| 191 | } | 213 | } |
| 192 | .sheet(item: $sheet, onDismiss: { | 214 | .sheet(item: $sheet, onDismiss: { |
| 215 | // An encrypted file opened with its passphrase. | ||
| 216 | if editor == nil, session.isOpen(path) { start() } | ||
| 193 | countVersions() | 217 | countVersions() |
| 194 | // After the sheet has gone, so a command's own prompt can show. | 218 | // After the sheet has gone, so a command's own prompt can show. |
| 195 | if let id = chosen { | 219 | if let id = chosen { |
| @@ -394,6 +418,10 @@ struct EditorScreen: View { | |||
| 394 | } | 418 | } |
| 395 | } | 419 | } |
| 396 | if pane.path != path { session.open(path, in: pane) } | 420 | if pane.path != path { session.open(path, in: pane) } |
| 421 | if session.unlockRequest == path { | ||
| 422 | sheet = .crypt(CryptRequest(mode: .openFile, path: path, offset: 0)) | ||
| 423 | return | ||
| 424 | } | ||
| 397 | model.editors.prune(session) | 425 | model.editors.prune(session) |
| 398 | guard let editor = model.editors.editor(for: path, session: session, make: makeEditor) else { return } | 426 | guard let editor = model.editors.editor(for: path, session: session, make: makeEditor) else { return } |
| 399 | let view = model.editors.view(for: pane.id, of: editor) | 427 | let view = model.editors.view(for: pane.id, of: editor) |
| @@ -751,7 +779,7 @@ extension EditorScreen { | |||
| 751 | let context = editor.editContext() | 779 | let context = editor.editContext() |
| 752 | switch id { | 780 | switch id { |
| 753 | case "app.crypt.forget-passphrase": | 781 | case "app.crypt.forget-passphrase": |
| 754 | CryptPassphrases.forget(path) | 782 | session.forgetPassphrase(for: path) |
| 755 | message = "Passphrase forgotten for \((path as NSString).lastPathComponent)" | 783 | message = "Passphrase forgotten for \((path as NSString).lastPathComponent)" |
| 756 | case "app.crypt.encrypt-entries": | 784 | case "app.crypt.encrypt-entries": |
| 757 | sheet = .crypt(CryptRequest(mode: .encryptAll(tag: OrgPreferences.cryptTag()), path: path, offset: context.caret)) | 785 | sheet = .crypt(CryptRequest(mode: .encryptAll(tag: OrgPreferences.cryptTag()), path: path, offset: context.caret)) |
| @@ -1227,7 +1255,7 @@ struct CryptScreen: View { | |||
| 1227 | 1255 | ||
| 1228 | var body: some View { | 1256 | var body: some View { |
| 1229 | NavigationStack { | 1257 | NavigationStack { |
| 1230 | CryptSheet(request: request, text: { session.document?.text ?? "" }, apply: apply) { message in | 1258 | CryptSheet(request: request, session: session, text: { session.document(of: request.path)?.text ?? "" }, apply: apply) { message in |
| 1231 | dismiss() | 1259 | dismiss() |
| 1232 | if let message { report(message) } | 1260 | if let message { report(message) } |
| 1233 | } | 1261 | } |
Sources/OrgstarMobile/MobileModel.swift +2 · view
| @@ -167,6 +167,8 @@ final class MobileModel { | |||
| 167 | let settings = OrgPreferences.orgSettings() | 167 | let settings = OrgPreferences.orgSettings() |
| 168 | session.defaults = settings | 168 | session.defaults = settings |
| 169 | session.options = OrgPreferences.options() | 169 | session.options = OrgPreferences.options() |
| 170 | session.encryptsTaggedEntries = OrgPreferences.cryptBeforeSave() | ||
| 171 | session.cryptTag = OrgPreferences.cryptTag() | ||
| 170 | session.options.snippets = SnippetLibrary.shared.snippets | 172 | session.options.snippets = SnippetLibrary.shared.snippets |
| 171 | workspace?.settings = .with(todoKeywords: settings) | 173 | workspace?.settings = .with(todoKeywords: settings) |
| 172 | if let agenda { | 174 | if let agenda { |
Sources/OrgstarMobile/OrgstarMobileApp.swift +8 −1 · view
| @@ -26,6 +26,8 @@ struct OrgstarMobileApp: App { | |||
| 26 | #endif | 26 | #endif |
| 27 | LiveClock.install() | 27 | LiveClock.install() |
| 28 | ProStore.shared.start() | 28 | ProStore.shared.start() |
| 29 | // Read before the app becomes active and clears it. | ||
| 30 | _ = UnsavedHeldFiles.atLaunch | ||
| 29 | // Early, so that the watch's actions are taken when iOS wakes the app for them. | 31 | // Early, so that the watch's actions are taken when iOS wakes the app for them. |
| 30 | WatchLink.shared.activate(MobileModel.shared) | 32 | WatchLink.shared.activate(MobileModel.shared) |
| 31 | } | 33 | } |
| @@ -406,6 +408,7 @@ struct RootView: View { | |||
| 406 | } | 408 | } |
| 407 | .task { | 409 | .task { |
| 408 | TimerModel.shared.onDone = { message = $0 } | 410 | TimerModel.shared.onDone = { message = $0 } |
| 411 | if let lost = UnsavedHeldFiles.atLaunch { message = lost } | ||
| 409 | takeShared() | 412 | takeShared() |
| 410 | // Development: `ORGSTAR_ROOT` adds a folder at launch, as on the Mac. | 413 | // Development: `ORGSTAR_ROOT` adds a folder at launch, as on the Mac. |
| 411 | if let root = ProcessInfo.processInfo.environment["ORGSTAR_ROOT"] { try? await workspace.addRoot(URL(fileURLWithPath: root)) } | 414 | if let root = ProcessInfo.processInfo.environment["ORGSTAR_ROOT"] { try? await workspace.addRoot(URL(fileURLWithPath: root)) } |
| @@ -430,10 +433,14 @@ struct RootView: View { | |||
| 430 | if let path = activity.userInfo?[CSSearchableItemActivityIdentifier] as? String { model.openRequest = .file(path) } | 433 | if let path = activity.userInfo?[CSSearchableItemActivityIdentifier] as? String { model.openRequest = .file(path) } |
| 431 | } | 434 | } |
| 432 | .onChange(of: scenePhase) { _, phase in | 435 | .onChange(of: scenePhase) { _, phase in |
| 433 | // Unsaved edits are written before the app may be stopped. | 436 | // Unsaved edits are written before the app may be stopped. A file held for its |
| 437 | // passphrase stays in memory; its name is kept so that, if iOS ends the app | ||
| 438 | // meanwhile, the next launch says its edits were lost. | ||
| 434 | if phase == .background { | 439 | if phase == .background { |
| 435 | for path in session.dirtyPaths { _ = session.save(path) } | 440 | for path in session.dirtyPaths { _ = session.save(path) } |
| 441 | UnsavedHeldFiles.record(session.held.keys.filter(session.dirtyPaths.contains).sorted()) | ||
| 436 | } | 442 | } |
| 443 | if phase == .active { UnsavedHeldFiles.record([]) } | ||
| 437 | // Files and settings synced while away; not every sync tool tells file presenters. | 444 | // Files and settings synced while away; not every sync tool tells file presenters. |
| 438 | guard phase == .active else { return } | 445 | guard phase == .active else { return } |
| 439 | // iOS has no idle time: time away from the app while a clock ran stands in for it. | 446 | // iOS has no idle time: time away from the app while a clock ran stands in for it. |
Sources/OrgstarMobile/UnsavedHeldFiles.swift added +23 · view
| @@ -0,0 +1,23 @@ | |||
| 1 | import Foundation | ||
| 2 | |||
| 3 | /// The files held for their passphrase when the app went to the background. iOS may end the | ||
| 4 | /// app there without asking, and their edits, kept only in memory, are lost: the next launch | ||
| 5 | /// says so. | ||
| 6 | enum UnsavedHeldFiles { | ||
| 7 | static let key = "heldFilesInBackground" | ||
| 8 | |||
| 9 | static func record(_ paths: [String]) { | ||
| 10 | if paths.isEmpty { | ||
| 11 | UserDefaults.standard.removeObject(forKey: key) | ||
| 12 | } else { | ||
| 13 | UserDefaults.standard.set(paths.map { ($0 as NSString).lastPathComponent }, forKey: key) | ||
| 14 | } | ||
| 15 | } | ||
| 16 | |||
| 17 | /// The message for files whose edits were lost when the app last ended; read once, at launch. | ||
| 18 | static let atLaunch: String? = { | ||
| 19 | guard let names = UserDefaults.standard.stringArray(forKey: key), !names.isEmpty else { return nil } | ||
| 20 | UserDefaults.standard.removeObject(forKey: key) | ||
| 21 | return String(localized: "Edits to \(names.joined(separator: ", ")) weren't saved: they were waiting for a passphrase when orgstar was closed.") | ||
| 22 | }() | ||
| 23 | } | ||
Tests/OrgAppTests/CryptSaveTests.swift added +300 · view
| @@ -0,0 +1,300 @@ | |||
| 1 | import Foundation | ||
| 2 | import OrgCore | ||
| 3 | import OrgDocument | ||
| 4 | import Testing | ||
| 5 | @testable import OrgApp | ||
| 6 | |||
| 7 | /// Saving with `org-crypt-use-before-save-magic`, and `.org.gpg` files: what reaches disk. | ||
| 8 | @MainActor | ||
| 9 | struct CryptSaveTests { | ||
| 10 | static let secret = "Account 12345" | ||
| 11 | static let file = "#+TITLE: Notes\n* Plain\nOpen text.\n* Bank :crypt:\n\(secret)\n* Last\n" | ||
| 12 | |||
| 13 | let notes: Folder | ||
| 14 | let file: URL | ||
| 15 | let recoveryFolder: URL | ||
| 16 | let session: DocumentSession | ||
| 17 | |||
| 18 | init() throws { | ||
| 19 | notes = try Folder() | ||
| 20 | file = try notes.write("a.org", Self.file) | ||
| 21 | recoveryFolder = notes.url.appendingPathComponent(".recovery") | ||
| 22 | session = DocumentSession(recovery: FileRecoveryStore(directory: recoveryFolder)) | ||
| 23 | session.saveMode = .explicit | ||
| 24 | session.encryptsTaggedEntries = true | ||
| 25 | session.hasStoredPassphrase = { _ in false } | ||
| 26 | } | ||
| 27 | |||
| 28 | /// Types `text` at `offset` in the open file, as the editor would. | ||
| 29 | func type(_ text: String, at offset: Int) throws { | ||
| 30 | let buffer = StateBuffer(session.document!) | ||
| 31 | session.attach(buffer) | ||
| 32 | try buffer.update { try $0.apply([TextEdit(range: offset..<offset, replacement: text)], baseRevision: $0.revision) } | ||
| 33 | session.bufferChanged() | ||
| 34 | } | ||
| 35 | |||
| 36 | /// Puts `text` in place of the open file's text. | ||
| 37 | func replace(with text: String) throws { | ||
| 38 | let buffer = StateBuffer(session.document!) | ||
| 39 | session.attach(buffer) | ||
| 40 | try buffer.update { try $0.apply([TextEdit(range: 0..<($0.text as NSString).length, replacement: text)], baseRevision: $0.revision) } | ||
| 41 | session.bufferChanged() | ||
| 42 | } | ||
| 43 | |||
| 44 | var disk: String { (try? String(contentsOf: file, encoding: .utf8)) ?? "" } | ||
| 45 | |||
| 46 | /// Every file the recovery folder holds, as text. | ||
| 47 | var recoveryFiles: [String] { | ||
| 48 | let files = FileManager.default.enumerator(at: recoveryFolder, includingPropertiesForKeys: nil)?.compactMap { $0 as? URL } ?? [] | ||
| 49 | return files.compactMap { try? Data(contentsOf: $0) }.map { String(decoding: $0, as: UTF8.self) } | ||
| 50 | } | ||
| 51 | |||
| 52 | func offset(of needle: String) -> Int { | ||
| 53 | (session.document!.text as NSString).range(of: needle).location | ||
| 54 | } | ||
| 55 | |||
| 56 | /// Waits for `condition`, as the Keychain's answer comes back on a task. | ||
| 57 | func wait(_ condition: () -> Bool) async throws { | ||
| 58 | for _ in 0..<200 where !condition() { try await Task.sleep(for: .milliseconds(10)) } | ||
| 59 | } | ||
| 60 | |||
| 61 | @Test func savesTaggedEntriesEncryptedWithTheRememberedPassphrase() async throws { | ||
| 62 | try notes.write("a.org", "* Bank :crypt:\nold\n* Last\n") | ||
| 63 | session.hasStoredPassphrase = { _ in true } | ||
| 64 | var asked = 0 | ||
| 65 | session.storedPassphrase = { _ in asked += 1; return "pw" } | ||
| 66 | var written: [String] = [] | ||
| 67 | session.fileSaved = { written.append($0) } | ||
| 68 | session.open(file.path) | ||
| 69 | try replace(with: Self.file) | ||
| 70 | #expect(!session.save()) | ||
| 71 | try await wait { !session.isDirty } | ||
| 72 | #expect(session.held.isEmpty) | ||
| 73 | #expect(asked == 1) | ||
| 74 | #expect(written == [file.path]) | ||
| 75 | // The buffer keeps the text; the file has a message in its place. | ||
| 76 | #expect(session.document?.text == Self.file) | ||
| 77 | #expect(!disk.contains(Self.secret) && !disk.contains("old")) | ||
| 78 | #expect(disk.contains("* Bank :crypt:\n-----BEGIN PGP MESSAGE-----\n")) | ||
| 79 | let bank = (disk as NSString).range(of: "* Bank").location | ||
| 80 | #expect(try OrgCrypt.decrypt(disk, at: bank, passphrase: "pw").plaintext == Self.secret + "\n") | ||
| 81 | // The version the save replaced went to recovery encrypted too. | ||
| 82 | #expect(!recoveryFiles.isEmpty) | ||
| 83 | #expect(recoveryFiles.allSatisfy { !$0.contains(Self.secret) && !$0.contains("old") }) | ||
| 84 | // Later saves don't ask again. | ||
| 85 | try type("More. ", at: offset(of: "Open text.")) | ||
| 86 | #expect(session.save()) | ||
| 87 | #expect(asked == 1) | ||
| 88 | #expect(written.count == 2) | ||
| 89 | #expect(!disk.contains(Self.secret)) | ||
| 90 | // The index reads the file from disk and keeps no text of the entry. | ||
| 91 | let workspace = try WorkspaceModel(directory: notes.url.appendingPathComponent(".index")) | ||
| 92 | try await workspace.addRoot(notes.url) | ||
| 93 | let database = try Data(contentsOf: notes.url.appendingPathComponent(".index/index.sqlite")) | ||
| 94 | #expect(database.range(of: Data(Self.secret.utf8)) == nil) | ||
| 95 | #expect(try workspace.search("12345").isEmpty) | ||
| 96 | #expect(try workspace.search("Open").map(\.title).contains("Plain")) | ||
| 97 | } | ||
| 98 | |||
| 99 | @Test func holdsTheWholeFileWithoutThePassphrase() throws { | ||
| 100 | try notes.write("a.org", "* Plain\nOpen text.\n") | ||
| 101 | session.open(file.path) | ||
| 102 | try replace(with: Self.file) | ||
| 103 | #expect(!session.save()) | ||
| 104 | #expect(session.held[file.path] == .entries(1)) | ||
| 105 | #expect(disk == "* Plain\nOpen text.\n") | ||
| 106 | #expect(recoveryFiles.isEmpty) | ||
| 107 | #expect(session.isDirty) | ||
| 108 | // Nothing reads the held text from the session for the agenda or widgets. | ||
| 109 | #expect(session.openTexts[file.path] == nil) | ||
| 110 | // Keep Mine holds too. | ||
| 111 | session.keepMine() | ||
| 112 | #expect(disk == "* Plain\nOpen text.\n") | ||
| 113 | #expect(recoveryFiles.isEmpty) | ||
| 114 | // The passphrase, when given, encrypts and saves. | ||
| 115 | #expect(session.unlock("pw", for: file.path) == nil) | ||
| 116 | #expect(session.held.isEmpty) | ||
| 117 | #expect(!session.isDirty) | ||
| 118 | #expect(!disk.contains(Self.secret)) | ||
| 119 | #expect(recoveryFiles.allSatisfy { !$0.contains(Self.secret) }) | ||
| 120 | #expect(session.openTexts[file.path] == nil) | ||
| 121 | } | ||
| 122 | |||
| 123 | @Test func aHeldFileIsReleasedWhenTheEntryGoes() throws { | ||
| 124 | session.saveMode = .automatic | ||
| 125 | session.autosaveDelay = .seconds(60) | ||
| 126 | session.open(file.path) | ||
| 127 | try type("x", at: 0) | ||
| 128 | #expect(!session.save()) | ||
| 129 | #expect(session.held[file.path] == .entries(1)) | ||
| 130 | let text = session.document!.text as NSString | ||
| 131 | try replace(with: text.replacingOccurrences(of: " :crypt:", with: "")) | ||
| 132 | #expect(session.held.isEmpty) | ||
| 133 | } | ||
| 134 | |||
| 135 | @Test func aWrongPassphraseForTheFilesEntriesIsRefused() throws { | ||
| 136 | let encrypted = try #require(try OrgCrypt.encrypt(Self.file, at: (Self.file as NSString).range(of: "* Bank").location, passphrase: "pw")) | ||
| 137 | try notes.write("a.org", encrypted + "* New :crypt:\nNew secret\n") | ||
| 138 | session.open(file.path) | ||
| 139 | try type("x", at: 0) | ||
| 140 | #expect(!session.save()) | ||
| 141 | #expect(session.held[file.path] == .entries(1)) | ||
| 142 | #expect(session.unlock("other", for: file.path) == "Wrong passphrase") | ||
| 143 | #expect(session.isDirty && disk.hasPrefix(encrypted)) | ||
| 144 | #expect(session.unlock("pw", for: file.path) == nil) | ||
| 145 | #expect(!disk.contains("New secret") && !session.isDirty) | ||
| 146 | } | ||
| 147 | |||
| 148 | @Test func blankTaggedEntriesDontHoldTheFile() throws { | ||
| 149 | try notes.write("a.org", "* Plain\n") | ||
| 150 | session.open(file.path) | ||
| 151 | try type("* Empty :crypt:\n", at: 8) | ||
| 152 | #expect(session.save()) | ||
| 153 | #expect(disk == "* Plain\n* Empty :crypt:\n") | ||
| 154 | } | ||
| 155 | |||
| 156 | @Test func unchangedEncryptedEntriesStayByteForByte() throws { | ||
| 157 | let bank = (Self.file as NSString).range(of: "* Bank").location | ||
| 158 | let encrypted = try #require(try OrgCrypt.encrypt(Self.file, at: bank, passphrase: "pw")) | ||
| 159 | try notes.write("a.org", encrypted) | ||
| 160 | session.open(file.path) | ||
| 161 | // Decrypt Entry in File, as the passphrase sheet runs it. | ||
| 162 | let message = try #require(OrgCrypt.firstMessage(encrypted)) | ||
| 163 | let decrypted = try OrgCrypt.decryptInPlace(encrypted, at: bank, passphrase: "pw") | ||
| 164 | session.cryptUsed("pw", for: file.path) | ||
| 165 | let body = try #require(OrgCrypt.bodyRange(decrypted, at: bank)) | ||
| 166 | session.cryptDecrypted(message: message, plaintext: (decrypted as NSString).substring(with: NSRange(body)), for: file.path) | ||
| 167 | try replace(with: decrypted) | ||
| 168 | #expect(session.document?.text.contains(Self.secret) == true) | ||
| 169 | // Saving writes the entry's message as it was. | ||
| 170 | #expect(session.save()) | ||
| 171 | #expect(disk == encrypted) | ||
| 172 | try type("More. ", at: offset(of: "Open text.")) | ||
| 173 | #expect(session.save()) | ||
| 174 | #expect(disk == (encrypted as NSString).replacingOccurrences(of: "Open text.", with: "More. Open text.")) | ||
| 175 | #expect(disk.contains(message)) | ||
| 176 | // A changed entry gets a new message. | ||
| 177 | try type("Changed. ", at: offset(of: Self.secret)) | ||
| 178 | #expect(session.save()) | ||
| 179 | #expect(!disk.contains(message) && !disk.contains("Changed.")) | ||
| 180 | let saved = disk | ||
| 181 | #expect(try OrgCrypt.decrypt(saved, at: (saved as NSString).range(of: "* Bank").location, passphrase: "pw").plaintext == "Changed. \(Self.secret)\n") | ||
| 182 | // An entry left encrypted in the buffer stays as it is. | ||
| 183 | let other = try notes.write("b.org", encrypted) | ||
| 184 | session.open(other.path) | ||
| 185 | try type("x", at: 0) | ||
| 186 | #expect(session.save()) | ||
| 187 | #expect((try String(contentsOf: other, encoding: .utf8)) == "x" + encrypted) | ||
| 188 | } | ||
| 189 | |||
| 190 | @Test func offWritesWhatTheBufferHas() throws { | ||
| 191 | session.encryptsTaggedEntries = false | ||
| 192 | try notes.write("a.org", "* Plain\n") | ||
| 193 | session.open(file.path) | ||
| 194 | try replace(with: Self.file) | ||
| 195 | #expect(session.save()) | ||
| 196 | #expect(disk == Self.file) | ||
| 197 | #expect(session.openTexts[file.path] == Self.file) | ||
| 198 | } | ||
| 199 | |||
| 200 | @Test func aFileChangedOnDiskMergesWithTheDecryptedBuffer() throws { | ||
| 201 | try notes.write("a.org", "* Plain\nOpen text.\n") | ||
| 202 | session.open(file.path) | ||
| 203 | session.cryptUsed("pw", for: file.path) | ||
| 204 | try replace(with: Self.file) | ||
| 205 | #expect(session.save()) | ||
| 206 | // Another program appends to the file; the buffer keeps its decrypted entry. | ||
| 207 | try notes.write("a.org", disk + "* From Emacs\n") | ||
| 208 | session.fileChanged(file.path) | ||
| 209 | #expect(session.document?.text == Self.file + "* From Emacs\n") | ||
| 210 | #expect(!session.isDirty) | ||
| 211 | try type("y", at: 0) | ||
| 212 | #expect(session.save()) | ||
| 213 | #expect(!disk.contains(Self.secret) && disk.hasSuffix("* From Emacs\n")) | ||
| 214 | } | ||
| 215 | |||
| 216 | // MARK: - Encrypted files | ||
| 217 | |||
| 218 | static let gpgText = "* Diary\nDear diary, \(secret).\n" | ||
| 219 | |||
| 220 | @Test func encryptedFilesOpenWithThePassphraseAndSaveEncrypted() throws { | ||
| 221 | let message = try OpenPGP.encryptedMessage(Data(Self.gpgText.utf8), passphrase: "pw") | ||
| 222 | let path = notes.url.appendingPathComponent("diary.org.gpg") | ||
| 223 | try message.write(to: path) | ||
| 224 | var written: [String] = [] | ||
| 225 | session.fileSaved = { written.append($0) } | ||
| 226 | session.open(path.path) | ||
| 227 | #expect(session.unlockRequest == path.path) | ||
| 228 | #expect(!session.isOpen(path.path)) | ||
| 229 | #expect(session.unlock("wrong", for: path.path) == "Wrong passphrase") | ||
| 230 | #expect(try Data(contentsOf: path) == message) | ||
| 231 | #expect(session.unlock("pw", for: path.path) == nil) | ||
| 232 | #expect(session.unlockRequest == nil) | ||
| 233 | #expect(session.path == path.path && session.document?.text == Self.gpgText) | ||
| 234 | #expect(session.isOrg) | ||
| 235 | #expect(session.openTexts[path.path] == nil) | ||
| 236 | try type("x", at: 0) | ||
| 237 | #expect(session.save()) | ||
| 238 | #expect(written == [path.path]) | ||
| 239 | let disk = try Data(contentsOf: path) | ||
| 240 | #expect(!OpenPGP.isArmored(disk)) | ||
| 241 | #expect(disk.range(of: Data(Self.secret.utf8)) == nil) | ||
| 242 | #expect(try OpenPGP.decryptFile(disk, passphrase: "pw") == Data(("x" + Self.gpgText).utf8)) | ||
| 243 | // Recovery keeps the version replaced, encrypted, and shows it decrypted. | ||
| 244 | #expect(!recoveryFiles.isEmpty && recoveryFiles.allSatisfy { !$0.contains(Self.secret) }) | ||
| 245 | let version = try #require(session.recoveryVersions().first) | ||
| 246 | #expect(session.recoveryText(version.url) == Self.gpgText) | ||
| 247 | // A passphrase forgotten while the file is open must be the file's when given again. | ||
| 248 | session.crypt.forgetPassphrase(for: path.path) | ||
| 249 | try type("y", at: 0) | ||
| 250 | #expect(!session.save()) | ||
| 251 | #expect(session.held[path.path] == .file) | ||
| 252 | #expect(session.unlock("typo", for: path.path) == "Wrong passphrase") | ||
| 253 | #expect(session.unlock("pw", for: path.path) == nil && !session.isDirty) | ||
| 254 | #expect(try OpenPGP.decryptFile(Data(contentsOf: path), passphrase: "pw") == Data(("yx" + Self.gpgText).utf8)) | ||
| 255 | // Closing forgets the passphrase. | ||
| 256 | session.kill(path.path) | ||
| 257 | session.open(path.path) | ||
| 258 | #expect(session.unlockRequest == path.path) | ||
| 259 | } | ||
| 260 | |||
| 261 | @Test func armoredFilesStayArmored() throws { | ||
| 262 | let armored = try OpenPGP.encrypt(Data(Self.gpgText.utf8), passphrase: "pw") | ||
| 263 | let path = try notes.write("diary.org.gpg", armored) | ||
| 264 | session.open(path.path) | ||
| 265 | #expect(session.unlock("pw", for: path.path) == nil) | ||
| 266 | try type("x", at: 0) | ||
| 267 | #expect(session.save()) | ||
| 268 | let disk = try Data(contentsOf: path) | ||
| 269 | #expect(OpenPGP.isArmored(disk)) | ||
| 270 | #expect(try OpenPGP.decryptFile(disk, passphrase: "pw") == Data(("x" + Self.gpgText).utf8)) | ||
| 271 | } | ||
| 272 | |||
| 273 | @Test func aNewEncryptedFileWaitsForItsPassphrase() throws { | ||
| 274 | let path = try notes.write("new.org.gpg", "") | ||
| 275 | session.open(path.path) | ||
| 276 | #expect(session.unlockRequest == nil && session.path == path.path) | ||
| 277 | try type(Self.gpgText, at: 0) | ||
| 278 | #expect(!session.save()) | ||
| 279 | #expect(session.held[path.path] == .file) | ||
| 280 | #expect(try Data(contentsOf: path).isEmpty) | ||
| 281 | #expect(recoveryFiles.isEmpty) | ||
| 282 | #expect(session.unlock("new", for: path.path) == nil) | ||
| 283 | #expect(!session.isDirty && session.held.isEmpty) | ||
| 284 | #expect(try OpenPGP.decryptFile(Data(contentsOf: path), passphrase: "new") == Data(Self.gpgText.utf8)) | ||
| 285 | } | ||
| 286 | |||
| 287 | @Test func anEncryptedFileChangedOnDiskMergesInMemory() throws { | ||
| 288 | let path = notes.url.appendingPathComponent("diary.org.gpg") | ||
| 289 | try OpenPGP.encryptedMessage(Data(Self.gpgText.utf8), passphrase: "pw").write(to: path) | ||
| 290 | session.open(path.path) | ||
| 291 | #expect(session.unlock("pw", for: path.path) == nil) | ||
| 292 | try type("x", at: 0) | ||
| 293 | try OpenPGP.encryptedMessage(Data((Self.gpgText + "* Added elsewhere\n").utf8), passphrase: "pw").write(to: path) | ||
| 294 | session.fileChanged(path.path) | ||
| 295 | #expect(session.document?.text == "x" + Self.gpgText + "* Added elsewhere\n") | ||
| 296 | #expect(session.save()) | ||
| 297 | #expect(try OpenPGP.decryptFile(Data(contentsOf: path), passphrase: "pw") == Data(("x" + Self.gpgText + "* Added elsewhere\n").utf8)) | ||
| 298 | #expect(recoveryFiles.allSatisfy { !$0.contains(Self.secret) && !$0.contains("Added elsewhere") }) | ||
| 299 | } | ||
| 300 | } | ||
docs/manual/guide/04-outlines.org +26 −1 · view
| @@ -953,7 +953,32 @@ The commands have no keys, as in Org; run them from the command palette, or bind | |||
| 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 | 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. |
| 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. Saving doesn't encrypt tagged entries, as =org-crypt-use-before-save-magic= does in Emacs; run Encrypt Tagged Entries…. | 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 | |||
| 958 | ** Encrypting on save | ||
| 959 | |||
| 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. | ||
| 961 | |||
| 962 | - The editor keeps the entries' text; the file gets the messages. Emacs leaves the encrypted messages in its buffer after a save; orgstar doesn't, since it saves a second after typing stops. | ||
| 963 | - An entry decrypted with Decrypt Entry in File… and saved unchanged gets its old message back, byte for byte, as org-crypt does. Only entries that changed get a new message, so syncing and git see no other change. | ||
| 964 | - 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 while the file is open, at the first save that needs it; a passphrase typed for an org-crypt command on the file is used too. Closing the file or Forget Encryption Passphrase forgets it. | ||
| 965 | - 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. | ||
| 966 | - When the file has encrypted entries already, the passphrase must open them. A first passphrase is asked twice. | ||
| 967 | - Closing the file, its window, or quitting while it's held asks for the passphrase, or whether to leave without saving. On iOS, the edits stay in memory while orgstar is in the background, and the notice is there on return; if iOS ends orgstar meanwhile, the edits are lost, and orgstar says so when it next opens. | ||
| 968 | - While an entry is decrypted in the editor, the agenda, widgets, the watch and reminders read the file from disk, where the entry is encrypted. The index, Spotlight and Quick Look read files from disk too. | ||
| 969 | |||
| 970 | * Encrypted files | ||
| 971 | |||
| 972 | 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. | ||
| 973 | |||
| 974 | 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. | ||
| 975 | |||
| 976 | The decrypted text is kept in memory only: | ||
| 977 | - Files are written with AES-256 and an iterated and salted SHA-256 key, binary, or armored when the file was armored. | ||
| 978 | - 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. | ||
| 979 | - The index, search, Spotlight, Quick Look, the agenda, widgets and the watch don't read the file's text. | ||
| 980 | |||
| 981 | =age= files (=.age=) aren't supported. | ||
| 957 | 982 | ||
| 958 | * The outline pane | 983 | * The outline pane |
| 959 | 984 | ||
docs/manual/guide/13-configuration.org +2 −1 · view
| @@ -218,7 +218,7 @@ These settings have no control in the Settings window. Some are in the View menu | |||
| 218 | | =notes-package=, =denote-directory=, =denote-prompts=, =denote-silo-directories=, =denote-sequence-scheme=, =denote-journal-directory=, =denote-journal-keyword=, =denote-journal-interval=, =denote-journal-title-format= | | | 218 | | =notes-package=, =denote-directory=, =denote-prompts=, =denote-silo-directories=, =denote-sequence-scheme=, =denote-journal-directory=, =denote-journal-keyword=, =denote-journal-interval=, =denote-journal-title-format= | | |
| 219 | | =org-attach-id-dir=, =org-attach-use-inheritance= | | | 219 | | =org-attach-id-dir=, =org-attach-use-inheritance= | | |
| 220 | | =org-yank-image-save-method=, =org-yank-dnd-method= | | | 220 | | =org-yank-image-save-method=, =org-yank-dnd-method= | | |
| 221 | | =org-crypt-tag-matcher= | | | 221 | | =org-crypt-tag-matcher=, =org-crypt-use-before-save-magic= | | |
| 222 | | =org-agenda-start-on-weekday= | | | 222 | | =org-agenda-start-on-weekday= | | |
| 223 | | =org-deadline-warning-days= | | | 223 | | =org-deadline-warning-days= | | |
| 224 | | =org-agenda-skip-scheduled-if-done= | | | 224 | | =org-agenda-skip-scheduled-if-done= | | |
| @@ -291,6 +291,7 @@ A key you remove from the file goes back to its default. A key that isn't in the | |||
| 291 | | =org-yank-image-save-method= | string | ="attach"= | Where a pasted image goes: =attach= for the entry's attachment folder, or a folder, relative to the org file's folder unless absolute. See [[file:09-links.org][Links]]. Mirrors =org-yank-image-save-method=. | | 291 | | =org-yank-image-save-method= | string | ="attach"= | Where a pasted image goes: =attach= for the entry's attachment folder, or a folder, relative to the org file's folder unless absolute. See [[file:09-links.org][Links]]. Mirrors =org-yank-image-save-method=. | |
| 292 | | =org-yank-dnd-method= | string | ="ask"= | What dropping files on the editor does: =ask=, =attach=, =open= or =file-link=. See [[file:09-links.org][Links]]. Mirrors =org-yank-dnd-method=. | | 292 | | =org-yank-dnd-method= | string | ="ask"= | What dropping files on the editor does: =ask=, =attach=, =open= or =file-link=. See [[file:09-links.org][Links]]. Mirrors =org-yank-dnd-method=. | |
| 293 | | =org-crypt-tag-matcher= | string | ="crypt"= | The tag Encrypt Tagged Entries… encrypts. A single tag. See [[file:04-outlines.org][Outlines]]. Mirrors =org-crypt-tag-matcher=. | | 293 | | =org-crypt-tag-matcher= | string | ="crypt"= | The tag Encrypt Tagged Entries… encrypts. A single tag. See [[file:04-outlines.org][Outlines]]. Mirrors =org-crypt-tag-matcher=. | |
| 294 | | =org-crypt-use-before-save-magic= | boolean | =false= | Encrypt the entries with =org-crypt-tag-matcher='s tag on every save. Without their passphrase the file isn't saved until it's given. See [[file:04-outlines.org][Outlines]]. Mirrors =org-crypt-use-before-save-magic=. | | ||
| 294 | | =org-startup-indented= | boolean | =true= | Indent bodies under their headings, as =org-indent-mode=. =#+STARTUP: indent= / =noindent= override it. Mirrors =org-startup-indented=. | | 295 | | =org-startup-indented= | boolean | =true= | Indent bodies under their headings, as =org-indent-mode=. =#+STARTUP: indent= / =noindent= override it. Mirrors =org-startup-indented=. | |
| 295 | | =org-hide-leading-stars= | boolean | =false= | Show only a heading's last star, without indentation. =#+STARTUP: hidestars= / =showstars= override it. Mirrors =org-hide-leading-stars=. | | 296 | | =org-hide-leading-stars= | boolean | =false= | Show only a heading's last star, without indentation. =#+STARTUP: hidestars= / =showstars= override it. Mirrors =org-hide-leading-stars=. | |
| 296 | | =org-startup-align-all-tables= | boolean | =false= | Align every table when a file opens. =#+STARTUP: align= / =noalign= override it. Mirrors =org-startup-align-all-tables=. | | 297 | | =org-startup-align-all-tables= | boolean | =false= | Align every table when a file opens. =#+STARTUP: align= / =noalign= override it. Mirrors =org-startup-align-all-tables=. | |
docs/manual/guide/14-ios.org +3 −1 · view
| @@ -208,6 +208,8 @@ Commands has the org-crypt commands; see [[file:04-outlines.org][Outlines]]. A r | |||
| 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 | ||
| 211 | With =org-crypt-use-before-save-magic=, a file whose tagged entries can't be encrypted isn't saved; a notice at the top of the editor says so, with Encrypt…. Going to the background saves every other file; the held file's edits stay in memory and the notice is there on return. iOS can end orgstar in the background without asking: the held edits are then lost, and the next launch names the files. Files named =NAME.org.gpg= are listed with the org files and open after their passphrase; see [[file:04-outlines.org][Outlines]]. | ||
| 212 | |||
| 211 | ** The menu bar on iPad | 213 | ** The menu bar on iPad |
| 212 | 214 | ||
| 213 | The iPad's menu bar, and the list of keys shown while =⌘= is held on a hardware keyboard, have these menus, after the Mac's and with the Mac's keys: | 215 | The iPad's menu bar, and the list of keys shown while =⌘= is held on a hardware keyboard, have these menus, after the Mac's and with the Mac's keys: |
| @@ -525,7 +527,7 @@ These settings from =config.toml= apply on iOS: | |||
| 525 | - =org-log-done=, =org-log-reschedule=, =org-log-redeadline=, =org-log-into-drawer= | 527 | - =org-log-done=, =org-log-reschedule=, =org-log-redeadline=, =org-log-into-drawer= |
| 526 | - =org-enforce-todo-dependencies=, =org-enforce-todo-checkbox-dependencies=, =org-track-ordered-property-with-tag=, =org-agenda-dim-blocked-tasks= | 528 | - =org-enforce-todo-dependencies=, =org-enforce-todo-checkbox-dependencies=, =org-track-ordered-property-with-tag=, =org-agenda-dim-blocked-tasks= |
| 527 | - =org-roam-directory=, =org-roam-dailies-directory=, =org-roam-dailies-file=, =org-roam-dailies-head=, =org-roam-dailies-entry= | 529 | - =org-roam-directory=, =org-roam-dailies-directory=, =org-roam-dailies-file=, =org-roam-dailies-head=, =org-roam-dailies-entry= |
| 528 | - =org-crypt-tag-matcher=, =org-attach-id-dir=, =org-attach-use-inheritance=, =org-yank-image-save-method=, =org-timer-format=, =org-timer-default-timer= | 530 | - =org-crypt-tag-matcher=, =org-crypt-use-before-save-magic=, =org-attach-id-dir=, =org-attach-use-inheritance=, =org-yank-image-save-method=, =org-timer-format=, =org-timer-default-timer= |
| 529 | - =org-archive-location=, =[org-structure-template-alist]= | 531 | - =org-archive-location=, =[org-structure-template-alist]= |
| 530 | - =org-use-tag-inheritance=, =org-tags-exclude-from-inheritance=, =org-tag-alist= | 532 | - =org-use-tag-inheritance=, =org-tags-exclude-from-inheritance=, =org-tag-alist= |
| 531 | - =org-use-speed-commands=, with a hardware keyboard | 533 | - =org-use-speed-commands=, with a hardware keyboard |
docs/manual/guide/15-alongside-emacs.org +2 −1 · view
| @@ -296,5 +296,6 @@ Other: | |||
| 296 | - org-timer: =org-timer-display= is always the mode line. The timer's =C-u= forms are separate commands bound to =C-u C-c C-x 0=, =C-u C-u C-c C-x 0= and =C-u C-c C-x ,=; Set Countdown Timer… has no prefix-argument forms. | 296 | - org-timer: =org-timer-display= is always the mode line. The timer's =C-u= forms are separate commands bound to =C-u C-c C-x 0=, =C-u C-u C-c C-x 0= and =C-u C-c C-x ,=; Set Countdown Timer… has no prefix-argument forms. |
| 297 | - Radio lists are Org 9.8's =#+ATTR_ORG: :radio= checkbox lists. The =#+ORGLST= radio lists of Org 9.1 and earlier, removed in Org 9.2, aren't supported, nor is =org-list-checkbox-radio-mode=. | 297 | - Radio lists are Org 9.8's =#+ATTR_ORG: :radio= checkbox lists. The =#+ORGLST= radio lists of Org 9.1 and earlier, removed in Org 9.2, aren't supported, nor is =org-list-checkbox-radio-mode=. |
| 298 | - org-attach: =org-attach-method= is always =cp= for Attach File… (the other methods have their own commands), =org-attach-auto-tag= is always =ATTACH=, =org-attach-preferred-new-method= is always =id=, and =org-attach-id-to-path-function-list= is Org's default. The dispatcher's =b=, =O= and =F= keys and =org-attach-archive-delete= aren't supported. Delete All Attachments… asks once and deletes the folder with what's in it. | 298 | - org-attach: =org-attach-method= is always =cp= for Attach File… (the other methods have their own commands), =org-attach-auto-tag= is always =ATTACH=, =org-attach-preferred-new-method= is always =id=, and =org-attach-id-to-path-function-list= is Org's default. The dispatcher's =b=, =O= and =F= keys and =org-attach-archive-delete= aren't supported. Delete All Attachments… asks once and deletes the folder with what's in it. |
| 299 | - org-crypt works with symmetric encryption only (=org-crypt-key= nil); public keys and =org-crypt-use-before-save-magic= aren't supported. =org-crypt-tag-matcher= is a single tag. | 299 | - org-crypt works with symmetric encryption only (=org-crypt-key= nil); public keys aren't supported. =org-crypt-tag-matcher= is a single tag. =org-crypt-use-before-save-magic= is a setting in =config.toml= rather than a function to call; with it, entries stay decrypted in the editor after a save, where Emacs's buffer holds the messages, and a file whose entries can't be encrypted isn't saved, where Emacs asks for the passphrase. Emacs Import doesn't read the call. =org-crypt-disable-auto-save= has no counterpart: orgstar keeps no auto-save files. |
| 300 | - EasyPG's =.gpg= files are read and written with a passphrase only (symmetric); files encrypted to public keys aren't supported. orgstar keeps no passphrase cache beyond the open file; =epa-file-cache-passphrase-for-symmetric-encryption= has no counterpart. | ||
| 300 | - When TODO dependencies refuse a change on a =COMMENT= heading, the heading keeps =COMMENT=. Org removes it before the check and doesn't put it back. | 301 | - When TODO dependencies refuse a change on a =COMMENT= heading, the heading keeps =COMMENT=. Org removes it before the check and doesn't put it back. |
l10n/Localizable.xcstrings +1293 · view
| @@ -471,6 +471,74 @@ | |||
| 471 | } | 471 | } |
| 472 | } | 472 | } |
| 473 | }, | 473 | }, |
| 474 | "%@ has another passphrase; open it first.": { | ||
| 475 | "localizations": { | ||
| 476 | "de": { | ||
| 477 | "stringUnit": { | ||
| 478 | "state": "translated", | ||
| 479 | "value": "„%@“ hat ein anderes Passwort; öffne die Datei zuerst." | ||
| 480 | } | ||
| 481 | }, | ||
| 482 | "es": { | ||
| 483 | "stringUnit": { | ||
| 484 | "state": "translated", | ||
| 485 | "value": "«%@» tiene otra frase de contraseña; ábrelo primero." | ||
| 486 | } | ||
| 487 | }, | ||
| 488 | "fr": { | ||
| 489 | "stringUnit": { | ||
| 490 | "state": "translated", | ||
| 491 | "value": "« %@ » a une autre phrase secrète ; ouvrez-le d'abord." | ||
| 492 | } | ||
| 493 | }, | ||
| 494 | "ja": { | ||
| 495 | "stringUnit": { | ||
| 496 | "state": "translated", | ||
| 497 | "value": "“%@”のパスフレーズは異なります。先に開いてください。" | ||
| 498 | } | ||
| 499 | }, | ||
| 500 | "pt-BR": { | ||
| 501 | "stringUnit": { | ||
| 502 | "state": "translated", | ||
| 503 | "value": "\"%@\" tem outra senha; abra-o primeiro." | ||
| 504 | } | ||
| 505 | } | ||
| 506 | } | ||
| 507 | }, | ||
| 508 | "%@ has decrypted entries that are encrypted on disk, so Emacs isn't given a copy of it.": { | ||
| 509 | "localizations": { | ||
| 510 | "de": { | ||
| 511 | "stringUnit": { | ||
| 512 | "state": "translated", | ||
| 513 | "value": "„%@“ hat entschlüsselte Einträge, die auf dem Datenträger verschlüsselt sind, daher erhält Emacs keine Kopie davon." | ||
| 514 | } | ||
| 515 | }, | ||
| 516 | "es": { | ||
| 517 | "stringUnit": { | ||
| 518 | "state": "translated", | ||
| 519 | "value": "«%@» tiene entradas descifradas que están cifradas en el disco, así que Emacs no recibe una copia." | ||
| 520 | } | ||
| 521 | }, | ||
| 522 | "fr": { | ||
| 523 | "stringUnit": { | ||
| 524 | "state": "translated", | ||
| 525 | "value": "« %@ » contient des entrées déchiffrées qui sont chiffrées sur le disque, donc Emacs n'en reçoit pas de copie." | ||
| 526 | } | ||
| 527 | }, | ||
| 528 | "ja": { | ||
| 529 | "stringUnit": { | ||
| 530 | "state": "translated", | ||
| 531 | "value": "“%@”にはディスク上で暗号化されている復号済みエントリがあるため、Emacsにはコピーを渡しません。" | ||
| 532 | } | ||
| 533 | }, | ||
| 534 | "pt-BR": { | ||
| 535 | "stringUnit": { | ||
| 536 | "state": "translated", | ||
| 537 | "value": "\"%@\" tem entradas descriptografadas que estão criptografadas no disco, então o Emacs não recebe uma cópia." | ||
| 538 | } | ||
| 539 | } | ||
| 540 | } | ||
| 541 | }, | ||
| 474 | "%@ in a buffer": { | 542 | "%@ in a buffer": { |
| 475 | "localizations": { | 543 | "localizations": { |
| 476 | "de": { | 544 | "de": { |
| @@ -505,6 +573,210 @@ | |||
| 505 | } | 573 | } |
| 506 | } | 574 | } |
| 507 | }, | 575 | }, |
| 576 | "%@ is encrypted": { | ||
| 577 | "localizations": { | ||
| 578 | "de": { | ||
| 579 | "stringUnit": { | ||
| 580 | "state": "translated", | ||
| 581 | "value": "„%@“ ist verschlüsselt" | ||
| 582 | } | ||
| 583 | }, | ||
| 584 | "es": { | ||
| 585 | "stringUnit": { | ||
| 586 | "state": "translated", | ||
| 587 | "value": "«%@» está cifrado" | ||
| 588 | } | ||
| 589 | }, | ||
| 590 | "fr": { | ||
| 591 | "stringUnit": { | ||
| 592 | "state": "translated", | ||
| 593 | "value": "« %@ » est chiffré" | ||
| 594 | } | ||
| 595 | }, | ||
| 596 | "ja": { | ||
| 597 | "stringUnit": { | ||
| 598 | "state": "translated", | ||
| 599 | "value": "“%@”は暗号化されています" | ||
| 600 | } | ||
| 601 | }, | ||
| 602 | "pt-BR": { | ||
| 603 | "stringUnit": { | ||
| 604 | "state": "translated", | ||
| 605 | "value": "\"%@\" está criptografado" | ||
| 606 | } | ||
| 607 | } | ||
| 608 | } | ||
| 609 | }, | ||
| 610 | "%@ is encrypted, and %@ isn't; the entry wasn't moved.": { | ||
| 611 | "localizations": { | ||
| 612 | "de": { | ||
| 613 | "stringUnit": { | ||
| 614 | "state": "translated", | ||
| 615 | "value": "„%1$@“ ist verschlüsselt, „%2$@“ nicht; der Eintrag wurde nicht verschoben." | ||
| 616 | } | ||
| 617 | }, | ||
| 618 | "es": { | ||
| 619 | "stringUnit": { | ||
| 620 | "state": "translated", | ||
| 621 | "value": "«%1$@» está cifrado y «%2$@» no; la entrada no se movió." | ||
| 622 | } | ||
| 623 | }, | ||
| 624 | "fr": { | ||
| 625 | "stringUnit": { | ||
| 626 | "state": "translated", | ||
| 627 | "value": "« %1$@ » est chiffré, « %2$@ » ne l'est pas ; l'entrée n'a pas été déplacée." | ||
| 628 | } | ||
| 629 | }, | ||
| 630 | "ja": { | ||
| 631 | "stringUnit": { | ||
| 632 | "state": "translated", | ||
| 633 | "value": "“%1$@”は暗号化されていますが“%2$@”はされていないため、エントリは移動しませんでした。" | ||
| 634 | } | ||
| 635 | }, | ||
| 636 | "pt-BR": { | ||
| 637 | "stringUnit": { | ||
| 638 | "state": "translated", | ||
| 639 | "value": "\"%1$@\" está criptografado e \"%2$@\" não; a entrada não foi movida." | ||
| 640 | } | ||
| 641 | } | ||
| 642 | } | ||
| 643 | }, | ||
| 644 | "%@ is encrypted, so Emacs isn't given a copy of it.": { | ||
| 645 | "localizations": { | ||
| 646 | "de": { | ||
| 647 | "stringUnit": { | ||
| 648 | "state": "translated", | ||
| 649 | "value": "„%@“ ist verschlüsselt, daher erhält Emacs keine Kopie davon." | ||
| 650 | } | ||
| 651 | }, | ||
| 652 | "es": { | ||
| 653 | "stringUnit": { | ||
| 654 | "state": "translated", | ||
| 655 | "value": "«%@» está cifrado, así que Emacs no recibe una copia." | ||
| 656 | } | ||
| 657 | }, | ||
| 658 | "fr": { | ||
| 659 | "stringUnit": { | ||
| 660 | "state": "translated", | ||
| 661 | "value": "« %@ » est chiffré, donc Emacs n'en reçoit pas de copie." | ||
| 662 | } | ||
| 663 | }, | ||
| 664 | "ja": { | ||
| 665 | "stringUnit": { | ||
| 666 | "state": "translated", | ||
| 667 | "value": "“%@”は暗号化されているため、Emacsにはコピーを渡しません。" | ||
| 668 | } | ||
| 669 | }, | ||
| 670 | "pt-BR": { | ||
| 671 | "stringUnit": { | ||
| 672 | "state": "translated", | ||
| 673 | "value": "\"%@\" está criptografado, então o Emacs não recebe uma cópia." | ||
| 674 | } | ||
| 675 | } | ||
| 676 | } | ||
| 677 | }, | ||
| 678 | "%@ is encrypted.": { | ||
| 679 | "localizations": { | ||
| 680 | "de": { | ||
| 681 | "stringUnit": { | ||
| 682 | "state": "translated", | ||
| 683 | "value": "„%@“ ist verschlüsselt." | ||
| 684 | } | ||
| 685 | }, | ||
| 686 | "es": { | ||
| 687 | "stringUnit": { | ||
| 688 | "state": "translated", | ||
| 689 | "value": "«%@» está cifrado." | ||
| 690 | } | ||
| 691 | }, | ||
| 692 | "fr": { | ||
| 693 | "stringUnit": { | ||
| 694 | "state": "translated", | ||
| 695 | "value": "« %@ » est chiffré." | ||
| 696 | } | ||
| 697 | }, | ||
| 698 | "ja": { | ||
| 699 | "stringUnit": { | ||
| 700 | "state": "translated", | ||
| 701 | "value": "“%@”は暗号化されています。" | ||
| 702 | } | ||
| 703 | }, | ||
| 704 | "pt-BR": { | ||
| 705 | "stringUnit": { | ||
| 706 | "state": "translated", | ||
| 707 | "value": "\"%@\" está criptografado." | ||
| 708 | } | ||
| 709 | } | ||
| 710 | } | ||
| 711 | }, | ||
| 712 | "%@ is saved encrypted with this passphrase.": { | ||
| 713 | "localizations": { | ||
| 714 | "de": { | ||
| 715 | "stringUnit": { | ||
| 716 | "state": "translated", | ||
| 717 | "value": "„%@“ wird mit diesem Passwort verschlüsselt gesichert." | ||
| 718 | } | ||
| 719 | }, | ||
| 720 | "es": { | ||
| 721 | "stringUnit": { | ||
| 722 | "state": "translated", | ||
| 723 | "value": "«%@» se guarda cifrado con esta frase de contraseña." | ||
| 724 | } | ||
| 725 | }, | ||
| 726 | "fr": { | ||
| 727 | "stringUnit": { | ||
| 728 | "state": "translated", | ||
| 729 | "value": "« %@ » est enregistré chiffré avec cette phrase secrète." | ||
| 730 | } | ||
| 731 | }, | ||
| 732 | "ja": { | ||
| 733 | "stringUnit": { | ||
| 734 | "state": "translated", | ||
| 735 | "value": "“%@”はこのパスフレーズで暗号化して保存されます。" | ||
| 736 | } | ||
| 737 | }, | ||
| 738 | "pt-BR": { | ||
| 739 | "stringUnit": { | ||
| 740 | "state": "translated", | ||
| 741 | "value": "\"%@\" é salvo criptografado com esta senha." | ||
| 742 | } | ||
| 743 | } | ||
| 744 | } | ||
| 745 | }, | ||
| 746 | "%@ is saved with its tagged entries encrypted.": { | ||
| 747 | "localizations": { | ||
| 748 | "de": { | ||
| 749 | "stringUnit": { | ||
| 750 | "state": "translated", | ||
| 751 | "value": "„%@“ wird mit verschlüsselten markierten Einträgen gesichert." | ||
| 752 | } | ||
| 753 | }, | ||
| 754 | "es": { | ||
| 755 | "stringUnit": { | ||
| 756 | "state": "translated", | ||
| 757 | "value": "«%@» se guarda con sus entradas etiquetadas cifradas." | ||
| 758 | } | ||
| 759 | }, | ||
| 760 | "fr": { | ||
| 761 | "stringUnit": { | ||
| 762 | "state": "translated", | ||
| 763 | "value": "« %@ » est enregistré avec ses entrées taguées chiffrées." | ||
| 764 | } | ||
| 765 | }, | ||
| 766 | "ja": { | ||
| 767 | "stringUnit": { | ||
| 768 | "state": "translated", | ||
| 769 | "value": "“%@”はタグ付きエントリを暗号化して保存されます。" | ||
| 770 | } | ||
| 771 | }, | ||
| 772 | "pt-BR": { | ||
| 773 | "stringUnit": { | ||
| 774 | "state": "translated", | ||
| 775 | "value": "\"%@\" é salvo com as entradas etiquetadas criptografadas." | ||
| 776 | } | ||
| 777 | } | ||
| 778 | } | ||
| 779 | }, | ||
| 508 | "%@ isn't available on iPhone and iPad. It runs on the Mac.": { | 780 | "%@ isn't available on iPhone and iPad. It runs on the Mac.": { |
| 509 | "comment": "A command that runs only on the Mac", | 781 | "comment": "A command that runs only on the Mac", |
| 510 | "localizations": { | 782 | "localizations": { |
| @@ -610,6 +882,40 @@ | |||
| 610 | } | 882 | } |
| 611 | } | 883 | } |
| 612 | }, | 884 | }, |
| 885 | "%@ isn't saved until it has a passphrase.": { | ||
| 886 | "localizations": { | ||
| 887 | "de": { | ||
| 888 | "stringUnit": { | ||
| 889 | "state": "translated", | ||
| 890 | "value": "„%@“ wird erst gesichert, wenn es ein Passwort hat." | ||
| 891 | } | ||
| 892 | }, | ||
| 893 | "es": { | ||
| 894 | "stringUnit": { | ||
| 895 | "state": "translated", | ||
| 896 | "value": "«%@» no se guarda hasta que tenga una frase de contraseña." | ||
| 897 | } | ||
| 898 | }, | ||
| 899 | "fr": { | ||
| 900 | "stringUnit": { | ||
| 901 | "state": "translated", | ||
| 902 | "value": "« %@ » n'est pas enregistré tant qu'il n'a pas de phrase secrète." | ||
| 903 | } | ||
| 904 | }, | ||
| 905 | "ja": { | ||
| 906 | "stringUnit": { | ||
| 907 | "state": "translated", | ||
| 908 | "value": "パスフレーズが設定されるまで“%@”は保存されません。" | ||
| 909 | } | ||
| 910 | }, | ||
| 911 | "pt-BR": { | ||
| 912 | "stringUnit": { | ||
| 913 | "state": "translated", | ||
| 914 | "value": "\"%@\" só é salvo quando tiver uma senha." | ||
| 915 | } | ||
| 916 | } | ||
| 917 | } | ||
| 918 | }, | ||
| 613 | "%@ late": { | 919 | "%@ late": { |
| 614 | "localizations": { | 920 | "localizations": { |
| 615 | "de": { | 921 | "de": { |
| @@ -2949,6 +3255,74 @@ | |||
| 2949 | } | 3255 | } |
| 2950 | } | 3256 | } |
| 2951 | }, | 3257 | }, |
| 3258 | "%lld tagged entries aren't encrypted": { | ||
| 3259 | "localizations": { | ||
| 3260 | "de": { | ||
| 3261 | "stringUnit": { | ||
| 3262 | "state": "translated", | ||
| 3263 | "value": "%lld markierte Einträge sind nicht verschlüsselt" | ||
| 3264 | } | ||
| 3265 | }, | ||
| 3266 | "es": { | ||
| 3267 | "stringUnit": { | ||
| 3268 | "state": "translated", | ||
| 3269 | "value": "%lld entradas etiquetadas no están cifradas" | ||
| 3270 | } | ||
| 3271 | }, | ||
| 3272 | "fr": { | ||
| 3273 | "stringUnit": { | ||
| 3274 | "state": "translated", | ||
| 3275 | "value": "%lld entrées taguées ne sont pas chiffrées" | ||
| 3276 | } | ||
| 3277 | }, | ||
| 3278 | "ja": { | ||
| 3279 | "stringUnit": { | ||
| 3280 | "state": "translated", | ||
| 3281 | "value": "%lld件のタグ付きエントリが暗号化されていません" | ||
| 3282 | } | ||
| 3283 | }, | ||
| 3284 | "pt-BR": { | ||
| 3285 | "stringUnit": { | ||
| 3286 | "state": "translated", | ||
| 3287 | "value": "%lld entradas etiquetadas não estão criptografadas" | ||
| 3288 | } | ||
| 3289 | } | ||
| 3290 | } | ||
| 3291 | }, | ||
| 3292 | "%lld tagged entries aren't encrypted. Changes to %@ aren't saved until they are.": { | ||
| 3293 | "localizations": { | ||
| 3294 | "de": { | ||
| 3295 | "stringUnit": { | ||
| 3296 | "state": "translated", | ||
| 3297 | "value": "%lld markierte Einträge sind nicht verschlüsselt. Änderungen an „%@“ werden erst gesichert, wenn sie es sind." | ||
| 3298 | } | ||
| 3299 | }, | ||
| 3300 | "es": { | ||
| 3301 | "stringUnit": { | ||
| 3302 | "state": "translated", | ||
| 3303 | "value": "%lld entradas etiquetadas no están cifradas. Los cambios en «%@» no se guardan hasta que lo estén." | ||
| 3304 | } | ||
| 3305 | }, | ||
| 3306 | "fr": { | ||
| 3307 | "stringUnit": { | ||
| 3308 | "state": "translated", | ||
| 3309 | "value": "%lld entrées taguées ne sont pas chiffrées. Les modifications de « %@ » ne sont pas enregistrées tant qu'elles ne le sont pas." | ||
| 3310 | } | ||
| 3311 | }, | ||
| 3312 | "ja": { | ||
| 3313 | "stringUnit": { | ||
| 3314 | "state": "translated", | ||
| 3315 | "value": "%lld件のタグ付きエントリが暗号化されていません。暗号化されるまで“%@”への変更は保存されません。" | ||
| 3316 | } | ||
| 3317 | }, | ||
| 3318 | "pt-BR": { | ||
| 3319 | "stringUnit": { | ||
| 3320 | "state": "translated", | ||
| 3321 | "value": "%lld entradas etiquetadas não estão criptografadas. As alterações em \"%@\" só são salvas quando elas estiverem." | ||
| 3322 | } | ||
| 3323 | } | ||
| 3324 | } | ||
| 3325 | }, | ||
| 2952 | "%lld words": { | 3326 | "%lld words": { |
| 2953 | "comment": "Modeline: words in the file", | 3327 | "comment": "Modeline: words in the file", |
| 2954 | "localizations": { | 3328 | "localizations": { |
| @@ -3246,6 +3620,74 @@ | |||
| 3246 | } | 3620 | } |
| 3247 | } | 3621 | } |
| 3248 | }, | 3622 | }, |
| 3623 | "1 tagged entry isn't encrypted": { | ||
| 3624 | "localizations": { | ||
| 3625 | "de": { | ||
| 3626 | "stringUnit": { | ||
| 3627 | "state": "translated", | ||
| 3628 | "value": "1 markierter Eintrag ist nicht verschlüsselt" | ||
| 3629 | } | ||
| 3630 | }, | ||
| 3631 | "es": { | ||
| 3632 | "stringUnit": { | ||
| 3633 | "state": "translated", | ||
| 3634 | "value": "1 entrada etiquetada no está cifrada" | ||
| 3635 | } | ||
| 3636 | }, | ||
| 3637 | "fr": { | ||
| 3638 | "stringUnit": { | ||
| 3639 | "state": "translated", | ||
| 3640 | "value": "1 entrée taguée n'est pas chiffrée" | ||
| 3641 | } | ||
| 3642 | }, | ||
| 3643 | "ja": { | ||
| 3644 | "stringUnit": { | ||
| 3645 | "state": "translated", | ||
| 3646 | "value": "1件のタグ付きエントリが暗号化されていません" | ||
| 3647 | } | ||
| 3648 | }, | ||
| 3649 | "pt-BR": { | ||
| 3650 | "stringUnit": { | ||
| 3651 | "state": "translated", | ||
| 3652 | "value": "1 entrada etiquetada não está criptografada" | ||
| 3653 | } | ||
| 3654 | } | ||
| 3655 | } | ||
| 3656 | }, | ||
| 3657 | "1 tagged entry isn't encrypted. Changes to %@ aren't saved until it is.": { | ||
| 3658 | "localizations": { | ||
| 3659 | "de": { | ||
| 3660 | "stringUnit": { | ||
| 3661 | "state": "translated", | ||
| 3662 | "value": "1 markierter Eintrag ist nicht verschlüsselt. Änderungen an „%@“ werden erst gesichert, wenn er es ist." | ||
| 3663 | } | ||
| 3664 | }, | ||
| 3665 | "es": { | ||
| 3666 | "stringUnit": { | ||
| 3667 | "state": "translated", | ||
| 3668 | "value": "1 entrada etiquetada no está cifrada. Los cambios en «%@» no se guardan hasta que lo esté." | ||
| 3669 | } | ||
| 3670 | }, | ||
| 3671 | "fr": { | ||
| 3672 | "stringUnit": { | ||
| 3673 | "state": "translated", | ||
| 3674 | "value": "1 entrée taguée n'est pas chiffrée. Les modifications de « %@ » ne sont pas enregistrées tant qu'elle ne l'est pas." | ||
| 3675 | } | ||
| 3676 | }, | ||
| 3677 | "ja": { | ||
| 3678 | "stringUnit": { | ||
| 3679 | "state": "translated", | ||
| 3680 | "value": "1件のタグ付きエントリが暗号化されていません。暗号化されるまで“%@”への変更は保存されません。" | ||
| 3681 | } | ||
| 3682 | }, | ||
| 3683 | "pt-BR": { | ||
| 3684 | "stringUnit": { | ||
| 3685 | "state": "translated", | ||
| 3686 | "value": "1 entrada etiquetada não está criptografada. As alterações em \"%@\" só são salvas quando ela estiver." | ||
| 3687 | } | ||
| 3688 | } | ||
| 3689 | } | ||
| 3690 | }, | ||
| 3249 | ":echo with a result that isn't text": { | 3691 | ":echo with a result that isn't text": { |
| 3250 | "comment": "Why an sqlite block can't run here", | 3692 | "comment": "Why an sqlite block can't run here", |
| 3251 | "localizations": { | 3693 | "localizations": { |
| @@ -8702,6 +9144,74 @@ | |||
| 8702 | } | 9144 | } |
| 8703 | } | 9145 | } |
| 8704 | }, | 9146 | }, |
| 9147 | "Changes to %@ aren't saved": { | ||
| 9148 | "localizations": { | ||
| 9149 | "de": { | ||
| 9150 | "stringUnit": { | ||
| 9151 | "state": "translated", | ||
| 9152 | "value": "Änderungen an „%@“ sind nicht gesichert" | ||
| 9153 | } | ||
| 9154 | }, | ||
| 9155 | "es": { | ||
| 9156 | "stringUnit": { | ||
| 9157 | "state": "translated", | ||
| 9158 | "value": "Los cambios en «%@» no están guardados" | ||
| 9159 | } | ||
| 9160 | }, | ||
| 9161 | "fr": { | ||
| 9162 | "stringUnit": { | ||
| 9163 | "state": "translated", | ||
| 9164 | "value": "Les modifications de « %@ » ne sont pas enregistrées" | ||
| 9165 | } | ||
| 9166 | }, | ||
| 9167 | "ja": { | ||
| 9168 | "stringUnit": { | ||
| 9169 | "state": "translated", | ||
| 9170 | "value": "“%@”への変更は保存されていません" | ||
| 9171 | } | ||
| 9172 | }, | ||
| 9173 | "pt-BR": { | ||
| 9174 | "stringUnit": { | ||
| 9175 | "state": "translated", | ||
| 9176 | "value": "As alterações em \"%@\" não estão salvas" | ||
| 9177 | } | ||
| 9178 | } | ||
| 9179 | } | ||
| 9180 | }, | ||
| 9181 | "Changes to %@ aren't saved until that's fixed.": { | ||
| 9182 | "localizations": { | ||
| 9183 | "de": { | ||
| 9184 | "stringUnit": { | ||
| 9185 | "state": "translated", | ||
| 9186 | "value": "Änderungen an „%@“ werden erst gesichert, wenn das behoben ist." | ||
| 9187 | } | ||
| 9188 | }, | ||
| 9189 | "es": { | ||
| 9190 | "stringUnit": { | ||
| 9191 | "state": "translated", | ||
| 9192 | "value": "Los cambios en «%@» no se guardan hasta que se corrija." | ||
| 9193 | } | ||
| 9194 | }, | ||
| 9195 | "fr": { | ||
| 9196 | "stringUnit": { | ||
| 9197 | "state": "translated", | ||
| 9198 | "value": "Les modifications de « %@ » ne sont pas enregistrées tant que ce n'est pas corrigé." | ||
| 9199 | } | ||
| 9200 | }, | ||
| 9201 | "ja": { | ||
| 9202 | "stringUnit": { | ||
| 9203 | "state": "translated", | ||
| 9204 | "value": "これが解決されるまで“%@”への変更は保存されません。" | ||
| 9205 | } | ||
| 9206 | }, | ||
| 9207 | "pt-BR": { | ||
| 9208 | "stringUnit": { | ||
| 9209 | "state": "translated", | ||
| 9210 | "value": "As alterações em \"%@\" só são salvas quando isso for corrigido." | ||
| 9211 | } | ||
| 9212 | } | ||
| 9213 | } | ||
| 9214 | }, | ||
| 8705 | "Check Spelling While Typing": { | 9215 | "Check Spelling While Typing": { |
| 8706 | "comment": "Command title", | 9216 | "comment": "Command title", |
| 8707 | "localizations": { | 9217 | "localizations": { |
| @@ -12051,6 +12561,41 @@ | |||
| 12051 | } | 12561 | } |
| 12052 | } | 12562 | } |
| 12053 | }, | 12563 | }, |
| 12564 | "Couldn't Keep a Copy": { | ||
| 12565 | "comment": "Error alert title", | ||
| 12566 | "localizations": { | ||
| 12567 | "de": { | ||
| 12568 | "stringUnit": { | ||
| 12569 | "state": "translated", | ||
| 12570 | "value": "Kopie nicht behalten" | ||
| 12571 | } | ||
| 12572 | }, | ||
| 12573 | "es": { | ||
| 12574 | "stringUnit": { | ||
| 12575 | "state": "translated", | ||
| 12576 | "value": "No se pudo guardar una copia" | ||
| 12577 | } | ||
| 12578 | }, | ||
| 12579 | "fr": { | ||
| 12580 | "stringUnit": { | ||
| 12581 | "state": "translated", | ||
| 12582 | "value": "Impossible de garder une copie" | ||
| 12583 | } | ||
| 12584 | }, | ||
| 12585 | "ja": { | ||
| 12586 | "stringUnit": { | ||
| 12587 | "state": "translated", | ||
| 12588 | "value": "コピーを保持できません" | ||
| 12589 | } | ||
| 12590 | }, | ||
| 12591 | "pt-BR": { | ||
| 12592 | "stringUnit": { | ||
| 12593 | "state": "translated", | ||
| 12594 | "value": "Não Foi Possível Manter uma Cópia" | ||
| 12595 | } | ||
| 12596 | } | ||
| 12597 | } | ||
| 12598 | }, | ||
| 12054 | "Couldn't Merge": { | 12599 | "Couldn't Merge": { |
| 12055 | "comment": "Error alert title", | 12600 | "comment": "Error alert title", |
| 12056 | "localizations": { | 12601 | "localizations": { |
| @@ -13189,6 +13734,40 @@ | |||
| 13189 | } | 13734 | } |
| 13190 | } | 13735 | } |
| 13191 | }, | 13736 | }, |
| 13737 | "Decrypt File": { | ||
| 13738 | "localizations": { | ||
| 13739 | "de": { | ||
| 13740 | "stringUnit": { | ||
| 13741 | "state": "translated", | ||
| 13742 | "value": "Datei entschlüsseln" | ||
| 13743 | } | ||
| 13744 | }, | ||
| 13745 | "es": { | ||
| 13746 | "stringUnit": { | ||
| 13747 | "state": "translated", | ||
| 13748 | "value": "Descifrar archivo" | ||
| 13749 | } | ||
| 13750 | }, | ||
| 13751 | "fr": { | ||
| 13752 | "stringUnit": { | ||
| 13753 | "state": "translated", | ||
| 13754 | "value": "Déchiffrer le fichier" | ||
| 13755 | } | ||
| 13756 | }, | ||
| 13757 | "ja": { | ||
| 13758 | "stringUnit": { | ||
| 13759 | "state": "translated", | ||
| 13760 | "value": "ファイルを復号" | ||
| 13761 | } | ||
| 13762 | }, | ||
| 13763 | "pt-BR": { | ||
| 13764 | "stringUnit": { | ||
| 13765 | "state": "translated", | ||
| 13766 | "value": "Descriptografar Arquivo" | ||
| 13767 | } | ||
| 13768 | } | ||
| 13769 | } | ||
| 13770 | }, | ||
| 13192 | "Decrypt in File": { | 13771 | "Decrypt in File": { |
| 13193 | "localizations": { | 13772 | "localizations": { |
| 13194 | "de": { | 13773 | "de": { |
| @@ -13223,6 +13802,40 @@ | |||
| 13223 | } | 13802 | } |
| 13224 | } | 13803 | } |
| 13225 | }, | 13804 | }, |
| 13805 | "Decrypt…": { | ||
| 13806 | "localizations": { | ||
| 13807 | "de": { | ||
| 13808 | "stringUnit": { | ||
| 13809 | "state": "translated", | ||
| 13810 | "value": "Entschlüsseln …" | ||
| 13811 | } | ||
| 13812 | }, | ||
| 13813 | "es": { | ||
| 13814 | "stringUnit": { | ||
| 13815 | "state": "translated", | ||
| 13816 | "value": "Descifrar…" | ||
| 13817 | } | ||
| 13818 | }, | ||
| 13819 | "fr": { | ||
| 13820 | "stringUnit": { | ||
| 13821 | "state": "translated", | ||
| 13822 | "value": "Déchiffrer…" | ||
| 13823 | } | ||
| 13824 | }, | ||
| 13825 | "ja": { | ||
| 13826 | "stringUnit": { | ||
| 13827 | "state": "translated", | ||
| 13828 | "value": "復号…" | ||
| 13829 | } | ||
| 13830 | }, | ||
| 13831 | "pt-BR": { | ||
| 13832 | "stringUnit": { | ||
| 13833 | "state": "translated", | ||
| 13834 | "value": "Descriptografar…" | ||
| 13835 | } | ||
| 13836 | } | ||
| 13837 | } | ||
| 13838 | }, | ||
| 13226 | "Default": { | 13839 | "Default": { |
| 13227 | "localizations": { | 13840 | "localizations": { |
| 13228 | "de": { | 13841 | "de": { |
| @@ -15053,6 +15666,40 @@ | |||
| 15053 | } | 15666 | } |
| 15054 | } | 15667 | } |
| 15055 | }, | 15668 | }, |
| 15669 | "Edits to %@ weren't saved: they were waiting for a passphrase when orgstar was closed.": { | ||
| 15670 | "localizations": { | ||
| 15671 | "de": { | ||
| 15672 | "stringUnit": { | ||
| 15673 | "state": "translated", | ||
| 15674 | "value": "Änderungen an %@ wurden nicht gesichert: Sie warteten auf ein Passwort, als orgstar beendet wurde." | ||
| 15675 | } | ||
| 15676 | }, | ||
| 15677 | "es": { | ||
| 15678 | "stringUnit": { | ||
| 15679 | "state": "translated", | ||
| 15680 | "value": "Los cambios en %@ no se guardaron: esperaban una frase de contraseña cuando orgstar se cerró." | ||
| 15681 | } | ||
| 15682 | }, | ||
| 15683 | "fr": { | ||
| 15684 | "stringUnit": { | ||
| 15685 | "state": "translated", | ||
| 15686 | "value": "Les modifications de %@ n'ont pas été enregistrées : elles attendaient une phrase secrète quand orgstar a été fermé." | ||
| 15687 | } | ||
| 15688 | }, | ||
| 15689 | "ja": { | ||
| 15690 | "stringUnit": { | ||
| 15691 | "state": "translated", | ||
| 15692 | "value": "%@への編集は保存されませんでした。orgstarが終了したとき、パスフレーズの入力を待っていました。" | ||
| 15693 | } | ||
| 15694 | }, | ||
| 15695 | "pt-BR": { | ||
| 15696 | "stringUnit": { | ||
| 15697 | "state": "translated", | ||
| 15698 | "value": "As alterações em %@ não foram salvas: aguardavam uma senha quando o orgstar foi fechado." | ||
| 15699 | } | ||
| 15700 | } | ||
| 15701 | } | ||
| 15702 | }, | ||
| 15056 | "Effort filter (<0:30, >1:00, =1:00):": { | 15703 | "Effort filter (<0:30, >1:00, =1:00):": { |
| 15057 | "localizations": { | 15704 | "localizations": { |
| 15058 | "de": { | 15705 | "de": { |
| @@ -15364,6 +16011,40 @@ | |||
| 15364 | } | 16011 | } |
| 15365 | } | 16012 | } |
| 15366 | }, | 16013 | }, |
| 16014 | "Encrypt Tagged Entries": { | ||
| 16015 | "localizations": { | ||
| 16016 | "de": { | ||
| 16017 | "stringUnit": { | ||
| 16018 | "state": "translated", | ||
| 16019 | "value": "Markierte Einträge verschlüsseln" | ||
| 16020 | } | ||
| 16021 | }, | ||
| 16022 | "es": { | ||
| 16023 | "stringUnit": { | ||
| 16024 | "state": "translated", | ||
| 16025 | "value": "Cifrar entradas etiquetadas" | ||
| 16026 | } | ||
| 16027 | }, | ||
| 16028 | "fr": { | ||
| 16029 | "stringUnit": { | ||
| 16030 | "state": "translated", | ||
| 16031 | "value": "Chiffrer les entrées taguées" | ||
| 16032 | } | ||
| 16033 | }, | ||
| 16034 | "ja": { | ||
| 16035 | "stringUnit": { | ||
| 16036 | "state": "translated", | ||
| 16037 | "value": "タグ付きエントリを暗号化" | ||
| 16038 | } | ||
| 16039 | }, | ||
| 16040 | "pt-BR": { | ||
| 16041 | "stringUnit": { | ||
| 16042 | "state": "translated", | ||
| 16043 | "value": "Criptografar Entradas Etiquetadas" | ||
| 16044 | } | ||
| 16045 | } | ||
| 16046 | } | ||
| 16047 | }, | ||
| 15367 | "Encrypt Tagged Entries…": { | 16048 | "Encrypt Tagged Entries…": { |
| 15368 | "comment": "Command title", | 16049 | "comment": "Command title", |
| 15369 | "localizations": { | 16050 | "localizations": { |
| @@ -15399,6 +16080,40 @@ | |||
| 15399 | } | 16080 | } |
| 15400 | } | 16081 | } |
| 15401 | }, | 16082 | }, |
| 16083 | "Encrypt and Save": { | ||
| 16084 | "localizations": { | ||
| 16085 | "de": { | ||
| 16086 | "stringUnit": { | ||
| 16087 | "state": "translated", | ||
| 16088 | "value": "Verschlüsseln und sichern" | ||
| 16089 | } | ||
| 16090 | }, | ||
| 16091 | "es": { | ||
| 16092 | "stringUnit": { | ||
| 16093 | "state": "translated", | ||
| 16094 | "value": "Cifrar y guardar" | ||
| 16095 | } | ||
| 16096 | }, | ||
| 16097 | "fr": { | ||
| 16098 | "stringUnit": { | ||
| 16099 | "state": "translated", | ||
| 16100 | "value": "Chiffrer et enregistrer" | ||
| 16101 | } | ||
| 16102 | }, | ||
| 16103 | "ja": { | ||
| 16104 | "stringUnit": { | ||
| 16105 | "state": "translated", | ||
| 16106 | "value": "暗号化して保存" | ||
| 16107 | } | ||
| 16108 | }, | ||
| 16109 | "pt-BR": { | ||
| 16110 | "stringUnit": { | ||
| 16111 | "state": "translated", | ||
| 16112 | "value": "Criptografar e Salvar" | ||
| 16113 | } | ||
| 16114 | } | ||
| 16115 | } | ||
| 16116 | }, | ||
| 15402 | "Encrypted Entry": { | 16117 | "Encrypted Entry": { |
| 15403 | "localizations": { | 16118 | "localizations": { |
| 15404 | "de": { | 16119 | "de": { |
| @@ -15433,6 +16148,74 @@ | |||
| 15433 | } | 16148 | } |
| 15434 | } | 16149 | } |
| 15435 | }, | 16150 | }, |
| 16151 | "Encrypted entry": { | ||
| 16152 | "localizations": { | ||
| 16153 | "de": { | ||
| 16154 | "stringUnit": { | ||
| 16155 | "state": "translated", | ||
| 16156 | "value": "Verschlüsselter Eintrag" | ||
| 16157 | } | ||
| 16158 | }, | ||
| 16159 | "es": { | ||
| 16160 | "stringUnit": { | ||
| 16161 | "state": "translated", | ||
| 16162 | "value": "Entrada cifrada" | ||
| 16163 | } | ||
| 16164 | }, | ||
| 16165 | "fr": { | ||
| 16166 | "stringUnit": { | ||
| 16167 | "state": "translated", | ||
| 16168 | "value": "Entrée chiffrée" | ||
| 16169 | } | ||
| 16170 | }, | ||
| 16171 | "ja": { | ||
| 16172 | "stringUnit": { | ||
| 16173 | "state": "translated", | ||
| 16174 | "value": "暗号化されたエントリ" | ||
| 16175 | } | ||
| 16176 | }, | ||
| 16177 | "pt-BR": { | ||
| 16178 | "stringUnit": { | ||
| 16179 | "state": "translated", | ||
| 16180 | "value": "Entrada criptografada" | ||
| 16181 | } | ||
| 16182 | } | ||
| 16183 | } | ||
| 16184 | }, | ||
| 16185 | "Encrypted files were left out, and encrypted entries were exported as they are on disk.": { | ||
| 16186 | "localizations": { | ||
| 16187 | "de": { | ||
| 16188 | "stringUnit": { | ||
| 16189 | "state": "translated", | ||
| 16190 | "value": "Verschlüsselte Dateien wurden ausgelassen, und verschlüsselte Einträge wurden so exportiert, wie sie auf dem Datenträger stehen." | ||
| 16191 | } | ||
| 16192 | }, | ||
| 16193 | "es": { | ||
| 16194 | "stringUnit": { | ||
| 16195 | "state": "translated", | ||
| 16196 | "value": "Se omitieron los archivos cifrados, y las entradas cifradas se exportaron tal como están en el disco." | ||
| 16197 | } | ||
| 16198 | }, | ||
| 16199 | "fr": { | ||
| 16200 | "stringUnit": { | ||
| 16201 | "state": "translated", | ||
| 16202 | "value": "Les fichiers chiffrés ont été omis, et les entrées chiffrées ont été exportées telles qu'elles sont sur le disque." | ||
| 16203 | } | ||
| 16204 | }, | ||
| 16205 | "ja": { | ||
| 16206 | "stringUnit": { | ||
| 16207 | "state": "translated", | ||
| 16208 | "value": "暗号化されたファイルは除外され、暗号化されたエントリはディスク上のまま書き出されました。" | ||
| 16209 | } | ||
| 16210 | }, | ||
| 16211 | "pt-BR": { | ||
| 16212 | "stringUnit": { | ||
| 16213 | "state": "translated", | ||
| 16214 | "value": "Arquivos criptografados foram deixados de fora, e entradas criptografadas foram exportadas como estão no disco." | ||
| 16215 | } | ||
| 16216 | } | ||
| 16217 | } | ||
| 16218 | }, | ||
| 15436 | "Encryption": { | 16219 | "Encryption": { |
| 15437 | "localizations": { | 16220 | "localizations": { |
| 15438 | "de": { | 16221 | "de": { |
| @@ -15467,6 +16250,40 @@ | |||
| 15467 | } | 16250 | } |
| 15468 | } | 16251 | } |
| 15469 | }, | 16252 | }, |
| 16253 | "Encrypt…": { | ||
| 16254 | "localizations": { | ||
| 16255 | "de": { | ||
| 16256 | "stringUnit": { | ||
| 16257 | "state": "translated", | ||
| 16258 | "value": "Verschlüsseln …" | ||
| 16259 | } | ||
| 16260 | }, | ||
| 16261 | "es": { | ||
| 16262 | "stringUnit": { | ||
| 16263 | "state": "translated", | ||
| 16264 | "value": "Cifrar…" | ||
| 16265 | } | ||
| 16266 | }, | ||
| 16267 | "fr": { | ||
| 16268 | "stringUnit": { | ||
| 16269 | "state": "translated", | ||
| 16270 | "value": "Chiffrer…" | ||
| 16271 | } | ||
| 16272 | }, | ||
| 16273 | "ja": { | ||
| 16274 | "stringUnit": { | ||
| 16275 | "state": "translated", | ||
| 16276 | "value": "暗号化…" | ||
| 16277 | } | ||
| 16278 | }, | ||
| 16279 | "pt-BR": { | ||
| 16280 | "stringUnit": { | ||
| 16281 | "state": "translated", | ||
| 16282 | "value": "Criptografar…" | ||
| 16283 | } | ||
| 16284 | } | ||
| 16285 | } | ||
| 16286 | }, | ||
| 15470 | "End of Buffer": { | 16287 | "End of Buffer": { |
| 15471 | "comment": "Command title", | 16288 | "comment": "Command title", |
| 15472 | "localizations": { | 16289 | "localizations": { |
| @@ -15571,6 +16388,74 @@ | |||
| 15571 | } | 16388 | } |
| 15572 | } | 16389 | } |
| 15573 | }, | 16390 | }, |
| 16391 | "Enter a passphrase.": { | ||
| 16392 | "localizations": { | ||
| 16393 | "de": { | ||
| 16394 | "stringUnit": { | ||
| 16395 | "state": "translated", | ||
| 16396 | "value": "Gib ein Passwort ein." | ||
| 16397 | } | ||
| 16398 | }, | ||
| 16399 | "es": { | ||
| 16400 | "stringUnit": { | ||
| 16401 | "state": "translated", | ||
| 16402 | "value": "Introduce una frase de contraseña." | ||
| 16403 | } | ||
| 16404 | }, | ||
| 16405 | "fr": { | ||
| 16406 | "stringUnit": { | ||
| 16407 | "state": "translated", | ||
| 16408 | "value": "Saisissez une phrase secrète." | ||
| 16409 | } | ||
| 16410 | }, | ||
| 16411 | "ja": { | ||
| 16412 | "stringUnit": { | ||
| 16413 | "state": "translated", | ||
| 16414 | "value": "パスフレーズを入力してください。" | ||
| 16415 | } | ||
| 16416 | }, | ||
| 16417 | "pt-BR": { | ||
| 16418 | "stringUnit": { | ||
| 16419 | "state": "translated", | ||
| 16420 | "value": "Digite uma senha." | ||
| 16421 | } | ||
| 16422 | } | ||
| 16423 | } | ||
| 16424 | }, | ||
| 16425 | "Enter the passphrase to encrypt and save them, or leave without saving.": { | ||
| 16426 | "localizations": { | ||
| 16427 | "de": { | ||
| 16428 | "stringUnit": { | ||
| 16429 | "state": "translated", | ||
| 16430 | "value": "Gib das Passwort ein, um sie zu verschlüsseln und zu sichern, oder verlasse die Datei ohne Sichern." | ||
| 16431 | } | ||
| 16432 | }, | ||
| 16433 | "es": { | ||
| 16434 | "stringUnit": { | ||
| 16435 | "state": "translated", | ||
| 16436 | "value": "Introduce la frase de contraseña para cifrarlos y guardarlos, o sal sin guardar." | ||
| 16437 | } | ||
| 16438 | }, | ||
| 16439 | "fr": { | ||
| 16440 | "stringUnit": { | ||
| 16441 | "state": "translated", | ||
| 16442 | "value": "Saisissez la phrase secrète pour les chiffrer et les enregistrer, ou quittez sans enregistrer." | ||
| 16443 | } | ||
| 16444 | }, | ||
| 16445 | "ja": { | ||
| 16446 | "stringUnit": { | ||
| 16447 | "state": "translated", | ||
| 16448 | "value": "パスフレーズを入力して暗号化して保存するか、保存せずに閉じてください。" | ||
| 16449 | } | ||
| 16450 | }, | ||
| 16451 | "pt-BR": { | ||
| 16452 | "stringUnit": { | ||
| 16453 | "state": "translated", | ||
| 16454 | "value": "Digite a senha para criptografá-las e salvá-las, ou saia sem salvar." | ||
| 16455 | } | ||
| 16456 | } | ||
| 16457 | } | ||
| 16458 | }, | ||
| 15574 | "Entries can't be done before their TODO children": { | 16459 | "Entries can't be done before their TODO children": { |
| 15575 | "localizations": { | 16460 | "localizations": { |
| 15576 | "de": { | 16461 | "de": { |
| @@ -18771,6 +19656,40 @@ | |||
| 18771 | } | 19656 | } |
| 18772 | } | 19657 | } |
| 18773 | }, | 19658 | }, |
| 19659 | "Give the passphrase with Encrypt… first, so that a copy of your edits can be kept encrypted.": { | ||
| 19660 | "localizations": { | ||
| 19661 | "de": { | ||
| 19662 | "stringUnit": { | ||
| 19663 | "state": "translated", | ||
| 19664 | "value": "Gib zuerst mit „Verschlüsseln …“ das Passwort ein, damit eine Kopie deiner Änderungen verschlüsselt behalten werden kann." | ||
| 19665 | } | ||
| 19666 | }, | ||
| 19667 | "es": { | ||
| 19668 | "stringUnit": { | ||
| 19669 | "state": "translated", | ||
| 19670 | "value": "Introduce primero la frase de contraseña con Cifrar… para que se pueda guardar cifrada una copia de tus cambios." | ||
| 19671 | } | ||
| 19672 | }, | ||
| 19673 | "fr": { | ||
| 19674 | "stringUnit": { | ||
| 19675 | "state": "translated", | ||
| 19676 | "value": "Saisissez d'abord la phrase secrète avec Chiffrer… pour qu'une copie de vos modifications puisse être gardée chiffrée." | ||
| 19677 | } | ||
| 19678 | }, | ||
| 19679 | "ja": { | ||
| 19680 | "stringUnit": { | ||
| 19681 | "state": "translated", | ||
| 19682 | "value": "編集内容のコピーを暗号化して保持できるよう、まず「暗号化…」でパスフレーズを入力してください。" | ||
| 19683 | } | ||
| 19684 | }, | ||
| 19685 | "pt-BR": { | ||
| 19686 | "stringUnit": { | ||
| 19687 | "state": "translated", | ||
| 19688 | "value": "Informe primeiro a senha em Criptografar… para que uma cópia das suas alterações possa ser mantida criptografada." | ||
| 19689 | } | ||
| 19690 | } | ||
| 19691 | } | ||
| 19692 | }, | ||
| 18774 | "Go": { | 19693 | "Go": { |
| 18775 | "comment": "The iPad menu bar's Go menu", | 19694 | "comment": "The iPad menu bar's Go menu", |
| 18776 | "localizations": { | 19695 | "localizations": { |
| @@ -36643,6 +37562,40 @@ | |||
| 36643 | } | 37562 | } |
| 36644 | } | 37563 | } |
| 36645 | }, | 37564 | }, |
| 37565 | "Saved encrypted": { | ||
| 37566 | "localizations": { | ||
| 37567 | "de": { | ||
| 37568 | "stringUnit": { | ||
| 37569 | "state": "translated", | ||
| 37570 | "value": "Verschlüsselt gesichert" | ||
| 37571 | } | ||
| 37572 | }, | ||
| 37573 | "es": { | ||
| 37574 | "stringUnit": { | ||
| 37575 | "state": "translated", | ||
| 37576 | "value": "Guardado cifrado" | ||
| 37577 | } | ||
| 37578 | }, | ||
| 37579 | "fr": { | ||
| 37580 | "stringUnit": { | ||
| 37581 | "state": "translated", | ||
| 37582 | "value": "Enregistré chiffré" | ||
| 37583 | } | ||
| 37584 | }, | ||
| 37585 | "ja": { | ||
| 37586 | "stringUnit": { | ||
| 37587 | "state": "translated", | ||
| 37588 | "value": "暗号化して保存しました" | ||
| 37589 | } | ||
| 37590 | }, | ||
| 37591 | "pt-BR": { | ||
| 37592 | "stringUnit": { | ||
| 37593 | "state": "translated", | ||
| 37594 | "value": "Salvo criptografado" | ||
| 37595 | } | ||
| 37596 | } | ||
| 37597 | } | ||
| 37598 | }, | ||
| 36646 | "Save…": { | 37599 | "Save…": { |
| 36647 | "localizations": { | 37600 | "localizations": { |
| 36648 | "de": { | 37601 | "de": { |
| @@ -37780,6 +38733,74 @@ | |||
| 37780 | } | 38733 | } |
| 37781 | } | 38734 | } |
| 37782 | }, | 38735 | }, |
| 38736 | "Set Passphrase": { | ||
| 38737 | "localizations": { | ||
| 38738 | "de": { | ||
| 38739 | "stringUnit": { | ||
| 38740 | "state": "translated", | ||
| 38741 | "value": "Passwort festlegen" | ||
| 38742 | } | ||
| 38743 | }, | ||
| 38744 | "es": { | ||
| 38745 | "stringUnit": { | ||
| 38746 | "state": "translated", | ||
| 38747 | "value": "Definir frase de contraseña" | ||
| 38748 | } | ||
| 38749 | }, | ||
| 38750 | "fr": { | ||
| 38751 | "stringUnit": { | ||
| 38752 | "state": "translated", | ||
| 38753 | "value": "Définir la phrase secrète" | ||
| 38754 | } | ||
| 38755 | }, | ||
| 38756 | "ja": { | ||
| 38757 | "stringUnit": { | ||
| 38758 | "state": "translated", | ||
| 38759 | "value": "パスフレーズを設定" | ||
| 38760 | } | ||
| 38761 | }, | ||
| 38762 | "pt-BR": { | ||
| 38763 | "stringUnit": { | ||
| 38764 | "state": "translated", | ||
| 38765 | "value": "Definir Senha" | ||
| 38766 | } | ||
| 38767 | } | ||
| 38768 | } | ||
| 38769 | }, | ||
| 38770 | "Set Passphrase…": { | ||
| 38771 | "localizations": { | ||
| 38772 | "de": { | ||
| 38773 | "stringUnit": { | ||
| 38774 | "state": "translated", | ||
| 38775 | "value": "Passwort festlegen …" | ||
| 38776 | } | ||
| 38777 | }, | ||
| 38778 | "es": { | ||
| 38779 | "stringUnit": { | ||
| 38780 | "state": "translated", | ||
| 38781 | "value": "Definir frase de contraseña…" | ||
| 38782 | } | ||
| 38783 | }, | ||
| 38784 | "fr": { | ||
| 38785 | "stringUnit": { | ||
| 38786 | "state": "translated", | ||
| 38787 | "value": "Définir la phrase secrète…" | ||
| 38788 | } | ||
| 38789 | }, | ||
| 38790 | "ja": { | ||
| 38791 | "stringUnit": { | ||
| 38792 | "state": "translated", | ||
| 38793 | "value": "パスフレーズを設定…" | ||
| 38794 | } | ||
| 38795 | }, | ||
| 38796 | "pt-BR": { | ||
| 38797 | "stringUnit": { | ||
| 38798 | "state": "translated", | ||
| 38799 | "value": "Definir Senha…" | ||
| 38800 | } | ||
| 38801 | } | ||
| 38802 | } | ||
| 38803 | }, | ||
| 37783 | "Set Priority A": { | 38804 | "Set Priority A": { |
| 37784 | "comment": "Command title", | 38805 | "comment": "Command title", |
| 37785 | "localizations": { | 38806 | "localizations": { |
| @@ -42261,6 +43282,74 @@ | |||
| 42261 | } | 43282 | } |
| 42262 | } | 43283 | } |
| 42263 | }, | 43284 | }, |
| 43285 | "Tagged entries encrypted and saved": { | ||
| 43286 | "localizations": { | ||
| 43287 | "de": { | ||
| 43288 | "stringUnit": { | ||
| 43289 | "state": "translated", | ||
| 43290 | "value": "Markierte Einträge verschlüsselt und gesichert" | ||
| 43291 | } | ||
| 43292 | }, | ||
| 43293 | "es": { | ||
| 43294 | "stringUnit": { | ||
| 43295 | "state": "translated", | ||
| 43296 | "value": "Entradas etiquetadas cifradas y guardadas" | ||
| 43297 | } | ||
| 43298 | }, | ||
| 43299 | "fr": { | ||
| 43300 | "stringUnit": { | ||
| 43301 | "state": "translated", | ||
| 43302 | "value": "Entrées taguées chiffrées et enregistrées" | ||
| 43303 | } | ||
| 43304 | }, | ||
| 43305 | "ja": { | ||
| 43306 | "stringUnit": { | ||
| 43307 | "state": "translated", | ||
| 43308 | "value": "タグ付きエントリを暗号化して保存しました" | ||
| 43309 | } | ||
| 43310 | }, | ||
| 43311 | "pt-BR": { | ||
| 43312 | "stringUnit": { | ||
| 43313 | "state": "translated", | ||
| 43314 | "value": "Entradas etiquetadas criptografadas e salvas" | ||
| 43315 | } | ||
| 43316 | } | ||
| 43317 | } | ||
| 43318 | }, | ||
| 43319 | "Tagged entries in the subtree aren't encrypted; give the passphrase with Encrypt… first.": { | ||
| 43320 | "localizations": { | ||
| 43321 | "de": { | ||
| 43322 | "stringUnit": { | ||
| 43323 | "state": "translated", | ||
| 43324 | "value": "Markierte Einträge im Teilbaum sind nicht verschlüsselt; gib zuerst mit „Verschlüsseln …“ das Passwort ein." | ||
| 43325 | } | ||
| 43326 | }, | ||
| 43327 | "es": { | ||
| 43328 | "stringUnit": { | ||
| 43329 | "state": "translated", | ||
| 43330 | "value": "Hay entradas etiquetadas sin cifrar en el subárbol; introduce primero la frase de contraseña con Cifrar…." | ||
| 43331 | } | ||
| 43332 | }, | ||
| 43333 | "fr": { | ||
| 43334 | "stringUnit": { | ||
| 43335 | "state": "translated", | ||
| 43336 | "value": "Des entrées taguées du sous-arbre ne sont pas chiffrées ; saisissez d'abord la phrase secrète avec Chiffrer…." | ||
| 43337 | } | ||
| 43338 | }, | ||
| 43339 | "ja": { | ||
| 43340 | "stringUnit": { | ||
| 43341 | "state": "translated", | ||
| 43342 | "value": "サブツリー内のタグ付きエントリが暗号化されていません。まず「暗号化…」でパスフレーズを入力してください。" | ||
| 43343 | } | ||
| 43344 | }, | ||
| 43345 | "pt-BR": { | ||
| 43346 | "stringUnit": { | ||
| 43347 | "state": "translated", | ||
| 43348 | "value": "Há entradas etiquetadas não criptografadas na subárvore; informe primeiro a senha em Criptografar…." | ||
| 43349 | } | ||
| 43350 | } | ||
| 43351 | } | ||
| 43352 | }, | ||
| 42264 | "Tags": { | 43353 | "Tags": { |
| 42265 | "comment": "Key bar button", | 43354 | "comment": "Key bar button", |
| 42266 | "localizations": { | 43355 | "localizations": { |
| @@ -43354,6 +44443,74 @@ | |||
| 43354 | } | 44443 | } |
| 43355 | } | 44444 | } |
| 43356 | }, | 44445 | }, |
| 44446 | "The file has no passphrase yet": { | ||
| 44447 | "localizations": { | ||
| 44448 | "de": { | ||
| 44449 | "stringUnit": { | ||
| 44450 | "state": "translated", | ||
| 44451 | "value": "Die Datei hat noch kein Passwort" | ||
| 44452 | } | ||
| 44453 | }, | ||
| 44454 | "es": { | ||
| 44455 | "stringUnit": { | ||
| 44456 | "state": "translated", | ||
| 44457 | "value": "El archivo aún no tiene frase de contraseña" | ||
| 44458 | } | ||
| 44459 | }, | ||
| 44460 | "fr": { | ||
| 44461 | "stringUnit": { | ||
| 44462 | "state": "translated", | ||
| 44463 | "value": "Le fichier n'a pas encore de phrase secrète" | ||
| 44464 | } | ||
| 44465 | }, | ||
| 44466 | "ja": { | ||
| 44467 | "stringUnit": { | ||
| 44468 | "state": "translated", | ||
| 44469 | "value": "このファイルにはまだパスフレーズがありません" | ||
| 44470 | } | ||
| 44471 | }, | ||
| 44472 | "pt-BR": { | ||
| 44473 | "stringUnit": { | ||
| 44474 | "state": "translated", | ||
| 44475 | "value": "O arquivo ainda não tem senha" | ||
| 44476 | } | ||
| 44477 | } | ||
| 44478 | } | ||
| 44479 | }, | ||
| 44480 | "The file is encrypted, and its passphrase isn't known": { | ||
| 44481 | "localizations": { | ||
| 44482 | "de": { | ||
| 44483 | "stringUnit": { | ||
| 44484 | "state": "translated", | ||
| 44485 | "value": "Die Datei ist verschlüsselt, und ihr Passwort ist nicht bekannt" | ||
| 44486 | } | ||
| 44487 | }, | ||
| 44488 | "es": { | ||
| 44489 | "stringUnit": { | ||
| 44490 | "state": "translated", | ||
| 44491 | "value": "El archivo está cifrado y no se conoce su frase de contraseña" | ||
| 44492 | } | ||
| 44493 | }, | ||
| 44494 | "fr": { | ||
| 44495 | "stringUnit": { | ||
| 44496 | "state": "translated", | ||
| 44497 | "value": "Le fichier est chiffré et sa phrase secrète n'est pas connue" | ||
| 44498 | } | ||
| 44499 | }, | ||
| 44500 | "ja": { | ||
| 44501 | "stringUnit": { | ||
| 44502 | "state": "translated", | ||
| 44503 | "value": "このファイルは暗号化されていて、パスフレーズが不明です" | ||
| 44504 | } | ||
| 44505 | }, | ||
| 44506 | "pt-BR": { | ||
| 44507 | "stringUnit": { | ||
| 44508 | "state": "translated", | ||
| 44509 | "value": "O arquivo está criptografado e sua senha não é conhecida" | ||
| 44510 | } | ||
| 44511 | } | ||
| 44512 | } | ||
| 44513 | }, | ||
| 43357 | "The folder and its files stay on disk.": { | 44514 | "The folder and its files stay on disk.": { |
| 43358 | "localizations": { | 44515 | "localizations": { |
| 43359 | "de": { | 44516 | "de": { |
| @@ -43661,6 +44818,74 @@ | |||
| 43661 | } | 44818 | } |
| 43662 | } | 44819 | } |
| 43663 | }, | 44820 | }, |
| 44821 | "The passphrase wasn't remembered: the Keychain refused it.": { | ||
| 44822 | "localizations": { | ||
| 44823 | "de": { | ||
| 44824 | "stringUnit": { | ||
| 44825 | "state": "translated", | ||
| 44826 | "value": "Das Passwort wurde nicht gemerkt: Der Schlüsselbund hat es abgelehnt." | ||
| 44827 | } | ||
| 44828 | }, | ||
| 44829 | "es": { | ||
| 44830 | "stringUnit": { | ||
| 44831 | "state": "translated", | ||
| 44832 | "value": "No se recordó la frase de contraseña: el llavero la rechazó." | ||
| 44833 | } | ||
| 44834 | }, | ||
| 44835 | "fr": { | ||
| 44836 | "stringUnit": { | ||
| 44837 | "state": "translated", | ||
| 44838 | "value": "La phrase secrète n'a pas été mémorisée : le trousseau l'a refusée." | ||
| 44839 | } | ||
| 44840 | }, | ||
| 44841 | "ja": { | ||
| 44842 | "stringUnit": { | ||
| 44843 | "state": "translated", | ||
| 44844 | "value": "パスフレーズは保存されませんでした。キーチェーンが拒否しました。" | ||
| 44845 | } | ||
| 44846 | }, | ||
| 44847 | "pt-BR": { | ||
| 44848 | "stringUnit": { | ||
| 44849 | "state": "translated", | ||
| 44850 | "value": "A senha não foi lembrada: as Chaves a recusaram." | ||
| 44851 | } | ||
| 44852 | } | ||
| 44853 | } | ||
| 44854 | }, | ||
| 44855 | "The passphrases differ": { | ||
| 44856 | "localizations": { | ||
| 44857 | "de": { | ||
| 44858 | "stringUnit": { | ||
| 44859 | "state": "translated", | ||
| 44860 | "value": "Die Passwörter stimmen nicht überein" | ||
| 44861 | } | ||
| 44862 | }, | ||
| 44863 | "es": { | ||
| 44864 | "stringUnit": { | ||
| 44865 | "state": "translated", | ||
| 44866 | "value": "Las frases de contraseña no coinciden" | ||
| 44867 | } | ||
| 44868 | }, | ||
| 44869 | "fr": { | ||
| 44870 | "stringUnit": { | ||
| 44871 | "state": "translated", | ||
| 44872 | "value": "Les phrases secrètes diffèrent" | ||
| 44873 | } | ||
| 44874 | }, | ||
| 44875 | "ja": { | ||
| 44876 | "stringUnit": { | ||
| 44877 | "state": "translated", | ||
| 44878 | "value": "パスフレーズが一致しません" | ||
| 44879 | } | ||
| 44880 | }, | ||
| 44881 | "pt-BR": { | ||
| 44882 | "stringUnit": { | ||
| 44883 | "state": "translated", | ||
| 44884 | "value": "As senhas não coincidem" | ||
| 44885 | } | ||
| 44886 | } | ||
| 44887 | } | ||
| 44888 | }, | ||
| 43664 | "The purchase didn't go through. %@": { | 44889 | "The purchase didn't go through. %@": { |
| 43665 | "localizations": { | 44890 | "localizations": { |
| 43666 | "de": { | 44891 | "de": { |
| @@ -44456,6 +45681,40 @@ | |||
| 44456 | } | 45681 | } |
| 44457 | } | 45682 | } |
| 44458 | }, | 45683 | }, |
| 45684 | "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.": { | ||
| 45685 | "localizations": { | ||
| 45686 | "de": { | ||
| 45687 | "stringUnit": { | ||
| 45688 | "state": "translated", | ||
| 45689 | "value": "Diese Version von orgstar bewahrt gemerkte Passwörter im Anmeldeschlüsselbund auf, ohne sie auf diesen Mac zu beschränken; Touch ID oder dein Passwort wird trotzdem abgefragt, bevor eines verwendet wird." | ||
| 45690 | } | ||
| 45691 | }, | ||
| 45692 | "es": { | ||
| 45693 | "stringUnit": { | ||
| 45694 | "state": "translated", | ||
| 45695 | "value": "Esta versión de orgstar guarda las frases de contraseña recordadas en tu llavero de inicio de sesión sin limitarlas a este Mac; aun así se pide Touch ID o tu contraseña antes de usar una." | ||
| 45696 | } | ||
| 45697 | }, | ||
| 45698 | "fr": { | ||
| 45699 | "stringUnit": { | ||
| 45700 | "state": "translated", | ||
| 45701 | "value": "Cette version d'orgstar garde les phrases secrètes mémorisées dans votre trousseau de session sans les limiter à ce Mac ; Touch ID ou votre mot de passe est quand même demandé avant d'en utiliser une." | ||
| 45702 | } | ||
| 45703 | }, | ||
| 45704 | "ja": { | ||
| 45705 | "stringUnit": { | ||
| 45706 | "state": "translated", | ||
| 45707 | "value": "このバージョンのorgstarは、保存したパスフレーズをこのMacに限定せずログインキーチェーンに保持します。使用する前にTouch IDまたはパスワードを求めます。" | ||
| 45708 | } | ||
| 45709 | }, | ||
| 45710 | "pt-BR": { | ||
| 45711 | "stringUnit": { | ||
| 45712 | "state": "translated", | ||
| 45713 | "value": "Esta versão do orgstar guarda as senhas lembradas nas suas chaves de início de sessão sem limitá-las a este Mac; o Touch ID ou sua senha ainda são pedidos antes de usar uma." | ||
| 45714 | } | ||
| 45715 | } | ||
| 45716 | } | ||
| 45717 | }, | ||
| 44459 | "This view can't be saved from here; write it in views.toml.": { | 45718 | "This view can't be saved from here; write it in views.toml.": { |
| 44460 | "localizations": { | 45719 | "localizations": { |
| 44461 | "de": { | 45720 | "de": { |
| @@ -47210,6 +48469,40 @@ | |||
| 47210 | } | 48469 | } |
| 47211 | } | 48470 | } |
| 47212 | }, | 48471 | }, |
| 48472 | "Wrong passphrase": { | ||
| 48473 | "localizations": { | ||
| 48474 | "de": { | ||
| 48475 | "stringUnit": { | ||
| 48476 | "state": "translated", | ||
| 48477 | "value": "Falsches Passwort" | ||
| 48478 | } | ||
| 48479 | }, | ||
| 48480 | "es": { | ||
| 48481 | "stringUnit": { | ||
| 48482 | "state": "translated", | ||
| 48483 | "value": "Frase de contraseña incorrecta" | ||
| 48484 | } | ||
| 48485 | }, | ||
| 48486 | "fr": { | ||
| 48487 | "stringUnit": { | ||
| 48488 | "state": "translated", | ||
| 48489 | "value": "Phrase secrète incorrecte" | ||
| 48490 | } | ||
| 48491 | }, | ||
| 48492 | "ja": { | ||
| 48493 | "stringUnit": { | ||
| 48494 | "state": "translated", | ||
| 48495 | "value": "パスフレーズが違います" | ||
| 48496 | } | ||
| 48497 | }, | ||
| 48498 | "pt-BR": { | ||
| 48499 | "stringUnit": { | ||
| 48500 | "state": "translated", | ||
| 48501 | "value": "Senha incorreta" | ||
| 48502 | } | ||
| 48503 | } | ||
| 48504 | } | ||
| 48505 | }, | ||
| 47213 | "Yank": { | 48506 | "Yank": { |
| 47214 | "comment": "Command title", | 48507 | "comment": "Command title", |
| 47215 | "localizations": { | 48508 | "localizations": { |