diff --git a/src/Auth0.ManagementApi/Clients/IKeysClient.cs b/src/Auth0.ManagementApi/Clients/IKeysClient.cs
index 772c62d1d..961b718ab 100644
--- a/src/Auth0.ManagementApi/Clients/IKeysClient.cs
+++ b/src/Auth0.ManagementApi/Clients/IKeysClient.cs
@@ -4,6 +4,7 @@ namespace Auth0.ManagementApi.Clients
using System.Threading;
using System.Threading.Tasks;
using Models.Keys;
+ using Paging;
public interface IKeysClient
{
@@ -36,5 +37,50 @@ public interface IKeysClient
/// The cancellation token to cancel operation.
/// The revoked key's cert and kid.
Task RevokeSigningKeyAsync(string kid, CancellationToken cancellationToken = default);
+
+ ///
+ /// Retrieve details of all the encryption keys associated with your tenant.
+ ///
+ ///
+ /// The cancellation token to cancel operation.
+ /// Retrieve details of all the encryption keys associated with your tenant. .
+ Task> GetAllEncryptionKeysAsync(PaginationInfo pagination, CancellationToken cancellationToken = default);
+
+ ///
+ /// Create the new, pre-activated encryption key, without the key material.
+ ///
+ ///
+ /// The cancellation token to cancel operation.
+ /// Newly created pre-activated encryption key .
+ Task CreateEncryptionKeyAsync(EncryptionKeyCreateRequest request, CancellationToken cancellationToken = default);
+
+ ///
+ /// Retrieve details of the encryption key with the given ID.
+ ///
+ ///
+ /// The cancellation token to cancel operation.
+ /// Retrieve details of the encryption key associated with the id. .
+ Task GetEncryptionKeyAsync(EncryptionKeyGetRequest request, CancellationToken cancellationToken = default);
+
+ ///
+ /// Delete the custom provided encryption key with the given ID and move back to using native encryption key.
+ ///
+ /// Encryption key ID
+ /// The cancellation token to cancel operation.
+ Task DeleteEncryptionKeyAsync(string kid, CancellationToken cancellationToken = default);
+
+ ///
+ /// Import wrapped key material and activate encryption key.
+ ///
+ ///
+ /// The cancellation token to cancel operation.
+ Task ImportEncryptionKeyAsync(EncryptionKeyImportRequest request, CancellationToken cancellationToken = default);
+
+ ///
+ /// Create the public wrapping key to wrap your own encryption key material.
+ ///
+ ///
+ /// The cancellation token to cancel operation.
+ Task CreatePublicWrappingKeyAsync(WrappingKeyCreateRequest request, CancellationToken cancellationToken = default);
}
}
diff --git a/src/Auth0.ManagementApi/Clients/KeysClient.cs b/src/Auth0.ManagementApi/Clients/KeysClient.cs
index 965260a02..455c12160 100644
--- a/src/Auth0.ManagementApi/Clients/KeysClient.cs
+++ b/src/Auth0.ManagementApi/Clients/KeysClient.cs
@@ -5,6 +5,9 @@
using System.Threading;
using System.Threading.Tasks;
using Auth0.ManagementApi.Models.Keys;
+using Auth0.ManagementApi.Paging;
+using Newtonsoft.Json;
+using EncryptionKey = Auth0.ManagementApi.Models.Keys.EncryptionKey;
namespace Auth0.ManagementApi.Clients
{
@@ -13,6 +16,7 @@ namespace Auth0.ManagementApi.Clients
///
public class KeysClient : BaseClient, IKeysClient
{
+ readonly JsonConverter[] converters = new JsonConverter[] { new PagedListConverter("keys") };
///
/// Initializes a new instance of the class.
///
@@ -65,5 +69,104 @@ public Task RevokeSigningKeyAsync(string kid, Cancella
{
return Connection.SendAsync(HttpMethod.Put, BuildUri($"keys/signing/{EncodePath(kid)}/revoke"), null, DefaultHeaders, cancellationToken: cancellationToken);
}
+
+ ///
+ public Task> GetAllEncryptionKeysAsync(
+ PaginationInfo pagination, CancellationToken cancellationToken = default)
+ {
+ var queryStrings = new Dictionary();
+
+ if (pagination != null)
+ {
+ queryStrings["page"] = pagination.PageNo.ToString();
+ queryStrings["per_page"] = pagination.PerPage.ToString();
+ queryStrings["include_totals"] = pagination.IncludeTotals.ToString().ToLower();
+ }
+
+ return Connection.GetAsync>(
+ BuildUri("keys/encryption", queryStrings), DefaultHeaders, converters, cancellationToken);
+ }
+
+ ///
+ public Task CreateEncryptionKeyAsync(
+ EncryptionKeyCreateRequest request, CancellationToken cancellationToken = default)
+ {
+ if (request == null)
+ throw new ArgumentNullException(nameof(request));
+
+ if (string.IsNullOrEmpty(request.Type))
+ throw new ArgumentNullException(nameof(request.Type));
+
+ return Connection.SendAsync(
+ HttpMethod.Post,
+ BuildUri("keys/encryption"),
+ request,
+ DefaultHeaders,
+ cancellationToken: cancellationToken);
+ }
+
+ ///
+ public Task GetEncryptionKeyAsync(
+ EncryptionKeyGetRequest request, CancellationToken cancellationToken = default)
+ {
+ if (request == null)
+ throw new ArgumentNullException(nameof(request));
+
+ if (string.IsNullOrEmpty(request.Kid))
+ throw new ArgumentNullException(nameof(request.Kid));
+
+ return Connection.GetAsync(
+ BuildUri($"keys/encryption/{EncodePath(request.Kid)}"), DefaultHeaders, null, cancellationToken);
+ }
+
+ ///
+ public Task DeleteEncryptionKeyAsync(string kid, CancellationToken cancellationToken = default)
+ {
+ if (kid == null)
+ throw new ArgumentNullException(nameof(kid));
+
+ return Connection.SendAsync