Skip to content

Commit 99e1620

Browse files
committed
feat(api): allow updating SSH public key data
Add support for updating the public key data field when modifying an SSH key. The Data field is now included in the PublicKeyUpdate request structure and properly updated in the service layer.
1 parent 943603e commit 99e1620

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

api/services/sshkeys.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ func (s *service) UpdatePublicKey(ctx context.Context, fingerprint, tenant strin
195195
}
196196
}
197197

198-
// Update the public key fields
199198
publicKey.Name = key.Name
200199
publicKey.Username = key.Username
201200
publicKey.Filter.Hostname = key.Filter.Hostname
202201
publicKey.Filter.TagIDs = tagIDs
203202
publicKey.Filter.Tags = nil
203+
publicKey.Data = key.Data
204204

205205
if err := s.store.PublicKeyUpdate(ctx, publicKey); err != nil {
206206
return nil, err

pkg/api/requests/publickey.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type PublicKeyUpdate struct {
4242
Username string `json:"username" validate:"required,regexp"`
4343
// Filter is the public key's filter.
4444
Filter PublicKeyFilter `json:"filter" validate:"required"`
45+
Data []byte `json:"data" validate:"omitempty"`
4546
}
4647

4748
// PublicKeyDelete is the structure to represent the request data for delete public key endpoint.

0 commit comments

Comments
 (0)