support reading several key IDs in .gpg-id files

This commit is contained in:
Lysann Tranvouez 2026-03-11 22:57:51 +01:00
parent 566b7253f5
commit 77f85ccdd1
8 changed files with 19 additions and 9 deletions

View file

@ -32,7 +32,7 @@ final class PasswordStoreTest: XCTestCase {
try cloneRepository(.withGPGID)
XCTAssertEqual(passwordStore.numberOfPasswords, 4)
XCTAssertEqual(passwordStore.numberOfCommits, 16)
XCTAssertEqual(passwordStore.numberOfCommits, 17)
XCTAssertEqual(passwordStore.numberOfLocalCommits, 0)
let entity = passwordStore.fetchPasswordEntity(with: "personal/github.com.gpg")
@ -319,11 +319,12 @@ final class PasswordStoreTest: XCTestCase {
Defaults.isEnableGPGIDOn = true
[
("work/github.com", "4712286271220DB299883EA7062E678DA1024DAE"),
("personal/github.com", "787EAE1A5FA3E749AA34CC6AA0645EBED862027E"),
].forEach { path, id in
let keyID = findGPGID(from: localRepoURL.appendingPathComponent(path))
XCTAssertEqual(keyID, id)
("work/github.com", ["4712286271220DB299883EA7062E678DA1024DAE"]),
("personal/github.com", ["787EAE1A5FA3E749AA34CC6AA0645EBED862027E"]),
("shared/github.com", ["4712286271220DB299883EA7062E678DA1024DAE", "787EAE1A5FA3E749AA34CC6AA0645EBED862027E"]),
].forEach { path, keyIDs in
let foundKeyIDs = findGPGIDs(from: localRepoURL.appendingPathComponent(path))
XCTAssertEqual(foundKeyIDs, keyIDs)
}
let personal = try decrypt(path: "personal/github.com.gpg")