replace calls to deprecated function

changes PasswordStore.encrypt behavior when .gpg-id support is off
(default):
  old:
    * ignores passed in keyID
    * encrypt with first public key in keychain (gopenPGP), or entire
      keychain (ObjectivePGP)
  new:
    * honor passed in keyID
    * encrypt with all keys in keychain
This commit is contained in:
Lysann Tranvouez 2026-03-11 09:01:12 +01:00
parent 09b0b150ce
commit e69e590e36
7 changed files with 11 additions and 110 deletions

View file

@ -420,12 +420,15 @@ public class PasswordStore {
}
public func encrypt(password: Password, keyID: String? = nil) throws -> Data {
var keyID = keyID
if Defaults.isEnableGPGIDOn {
let encryptedDataPath = password.fileURL(in: storeURL)
let keyID = keyID ?? findGPGID(from: encryptedDataPath)
return try PGPAgent.shared.encrypt(plainData: password.plainData, keyID: keyID)
keyID = keyID ?? findGPGID(from: encryptedDataPath)
}
return try PGPAgent.shared.encrypt(plainData: password.plainData)
if let keyID {
return try PGPAgent.shared.encrypt(plainData: password.plainData, keyIDs: [keyID])
}
return try PGPAgent.shared.encryptWithAllKeys(plainData: password.plainData)
}
public func removeGitSSHKeys() {