From 07156180789b02d4f22a87f22a37c912e7543190 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Fri, 7 Aug 2026 16:29:04 -0500 Subject: Deploy keys: manage git.sr.ht repository deploy keys (v3.10.0) Wire git.sr.ht createDeployKey / deleteDeployKey and Repository.deployKeys into an owner-only Deploy Keys sheet in the repository actions menu, next to ACLs: list keys (fingerprint, comment, access), add an SSH public key with RO/RW access, and delete behind a confirmation. Verified live against the ~hutch account. The createDeployKey response returns an empty access value, so create selects only rid and the list is reloaded rather than decoding the partial key. Bumps to 3.10.0 (build 95); roadmap marks deploy keys shipped. --- HutchTests/RepositoryDeployKeyTests.swift | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 HutchTests/RepositoryDeployKeyTests.swift (limited to 'HutchTests') diff --git a/HutchTests/RepositoryDeployKeyTests.swift b/HutchTests/RepositoryDeployKeyTests.swift new file mode 100644 index 0000000..c6ff667 --- /dev/null +++ b/HutchTests/RepositoryDeployKeyTests.swift @@ -0,0 +1,27 @@ +import Foundation +import Testing +@testable import Hutch + +struct RepositoryDeployKeyTests { + @Test + func decodesDeployKey() throws { + let json = """ + { "rid": "k1", "keyType": "ssh-ed25519", "fingerprintSHA256": "SHA256:abc", "comment": "laptop", "access": "RW" } + """ + let key = try JSONDecoder().decode(RepositoryDeployKey.self, from: Data(json.utf8)) + #expect(key.rid == "k1") + #expect(key.id == "k1") + #expect(key.access == .rw) + #expect(key.comment == "laptop") + } + + @Test + func decodesDeployKeyWithNullComment() throws { + let json = """ + { "rid": "k2", "keyType": "ssh-rsa", "fingerprintSHA256": "SHA256:def", "comment": null, "access": "RO" } + """ + let key = try JSONDecoder().decode(RepositoryDeployKey.self, from: Data(json.utf8)) + #expect(key.comment == nil) + #expect(key.access == .ro) + } +} -- cgit v1.2.3