diff --git a/src/Api/Controllers/OrganizationsController.cs b/src/Api/Controllers/OrganizationsController.cs index 1d0e9d148..e1301e3f2 100644 --- a/src/Api/Controllers/OrganizationsController.cs +++ b/src/Api/Controllers/OrganizationsController.cs @@ -682,8 +682,8 @@ public class OrganizationsController : Controller await _paymentService.SaveTaxInfoAsync(organization, taxInfo); } - [HttpGet("{id}/keys")] - public async Task GetKeys(string id) + [HttpGet("{id}/public-key")] + public async Task GetPublicKey(string id) { var org = await _organizationRepository.GetByIdAsync(new Guid(id)); if (org == null) @@ -691,7 +691,14 @@ public class OrganizationsController : Controller throw new NotFoundException(); } - return new OrganizationKeysResponseModel(org); + return new OrganizationPublicKeyResponseModel(org); + } + + [Obsolete("TDL-136 Renamed to public-key (2023.8), left for backwards compatability with older clients.")] + [HttpGet("{id}/keys")] + public async Task GetKeys(string id) + { + return await GetPublicKey(id); } [HttpPost("{id}/keys")] diff --git a/src/Api/Models/Response/Organizations/OrganizationPublicKeyResponseModel.cs b/src/Api/Models/Response/Organizations/OrganizationPublicKeyResponseModel.cs new file mode 100644 index 000000000..0451433e1 --- /dev/null +++ b/src/Api/Models/Response/Organizations/OrganizationPublicKeyResponseModel.cs @@ -0,0 +1,19 @@ +using Bit.Core.Entities; +using Bit.Core.Models.Api; + +namespace Bit.Api.Models.Response.Organizations; + +public class OrganizationPublicKeyResponseModel : ResponseModel +{ + public OrganizationPublicKeyResponseModel(Organization org) : base("organizationPublicKey") + { + if (org == null) + { + throw new ArgumentNullException(nameof(org)); + } + + PublicKey = org.PublicKey; + } + + public string PublicKey { get; set; } +}