support reading several key IDs in .gpg-id files
This commit is contained in:
parent
566b7253f5
commit
77f85ccdd1
8 changed files with 19 additions and 9 deletions
|
|
@ -410,7 +410,7 @@ public class PasswordStore {
|
|||
}
|
||||
if Defaults.isEnableGPGIDOn {
|
||||
let encryptedDataPath = password.fileURL(in: storeURL)
|
||||
return [findGPGID(from: encryptedDataPath)]
|
||||
return findGPGIDs(from: encryptedDataPath)
|
||||
}
|
||||
return []
|
||||
}()
|
||||
|
|
@ -461,7 +461,7 @@ extension PasswordStore {
|
|||
}
|
||||
}
|
||||
|
||||
func findGPGID(from url: URL) -> String {
|
||||
func findGPGIDs(from url: URL) -> [String] {
|
||||
var path = url
|
||||
while !FileManager.default.fileExists(atPath: path.appendingPathComponent(".gpg-id").path),
|
||||
path.path != "file:///" {
|
||||
|
|
@ -469,5 +469,9 @@ func findGPGID(from url: URL) -> String {
|
|||
}
|
||||
path = path.appendingPathComponent(".gpg-id")
|
||||
|
||||
return (try? String(contentsOf: path))?.trimmed ?? ""
|
||||
let allKeysSeparatedByNewline = (try? String(contentsOf: path)) ?? ""
|
||||
return allKeysSeparatedByNewline
|
||||
.split(separator: "\n")
|
||||
.map { String($0).trimmed }
|
||||
.filter { !$0.isEmpty }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue