-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for Transform Secrets Engine
- Loading branch information
Showing
15 changed files
with
328 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/VaultSharp/V1/SecretsEngines/Transform/DecodeRequestOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace VaultSharp.V1.SecretsEngines.Transform | ||
{ | ||
/// <summary> | ||
/// Represents the Decode Request Options. | ||
/// </summary> | ||
public class DecodeRequestOptions : DecodingItem | ||
{ | ||
/// <summary> | ||
/// Specifies the transformation within the role that should be used for this decode operation. | ||
/// If a single transformation exists for role, this parameter may be skipped and will be inferred. | ||
/// If multiple transformations exist, one must be specified. | ||
/// </summary> | ||
[JsonProperty("batch_input")] | ||
public List<DecodingItem> BatchItems { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace VaultSharp.V1.SecretsEngines.Transform | ||
{ | ||
/// <summary> | ||
/// Represents a single Decoded item. | ||
/// </summary> | ||
public class DecodedItem | ||
{ | ||
/// <summary> | ||
/// Specifies the decoded value. | ||
/// </summary> | ||
[JsonProperty("decoded_value")] | ||
public string DecodedValue { get; set; } | ||
|
||
/// <summary> | ||
/// Specifies the base64 encoded tweak that was provided during encoding. | ||
/// </summary> | ||
[JsonProperty("tweak")] | ||
public string Tweak { get; set; } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/VaultSharp/V1/SecretsEngines/Transform/DecodedResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace VaultSharp.V1.SecretsEngines.Transform | ||
{ | ||
/// <summary> | ||
/// Response for decoding. | ||
/// </summary> | ||
public class DecodedResponse : DecodedItem | ||
{ | ||
/// <summary> | ||
/// Decoded items. | ||
/// </summary> | ||
[JsonProperty("batch_results")] | ||
public List<DecodedItem> DecodedItems { get; set; } | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/VaultSharp/V1/SecretsEngines/Transform/DecodingItem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace VaultSharp.V1.SecretsEngines.Transform | ||
{ | ||
/// <summary> | ||
/// Represents a single Decoding item. | ||
/// </summary> | ||
public class DecodingItem | ||
{ | ||
/// <summary> | ||
/// Specifies the value to be decoded. | ||
/// </summary> | ||
[JsonProperty("value")] | ||
public string Value { get; set; } | ||
|
||
/// <summary> | ||
/// Specifies the transformation within the role that should be used for this decode operation. | ||
/// If a single transformation exists for role, this parameter may be skipped and will be inferred. | ||
/// If multiple transformations exist, one must be specified. | ||
/// </summary> | ||
[JsonProperty("transformation")] | ||
public string Transformation { get; set; } | ||
|
||
/// <summary> | ||
/// Specifies the base64 decoded tweak to use. | ||
/// Only applicable for FPE transformations with supplied as the tweak source. | ||
/// </summary> | ||
[JsonProperty("tweak")] | ||
public string Tweak { get; set; } | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/VaultSharp/V1/SecretsEngines/Transform/EncodeRequestOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace VaultSharp.V1.SecretsEngines.Transform | ||
{ | ||
/// <summary> | ||
/// Represents the Encode Request Options. | ||
/// </summary> | ||
public class EncodeRequestOptions : EncodingItem | ||
{ | ||
/// <summary> | ||
/// Specifies a list of items to be encoded in a single batch. | ||
/// When this parameter is set, the 'value', 'transformation' and 'tweak' parameters are ignored. | ||
/// Instead, the aforementioned parameters should be provided within each object in the list. | ||
/// </summary> | ||
[JsonProperty("batch_input")] | ||
public List<EncodingItem> BatchItems { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace VaultSharp.V1.SecretsEngines.Transform | ||
{ | ||
/// <summary> | ||
/// Represents a single Encoded item. | ||
/// </summary> | ||
public class EncodedItem | ||
{ | ||
/// <summary> | ||
/// Specifies the encoded value. | ||
/// </summary> | ||
[JsonProperty("encoded_value")] | ||
public string EncodedValue { get; set; } | ||
|
||
/// <summary> | ||
/// Specifies the base64 encoded tweak that was provided during encoding. | ||
/// </summary> | ||
[JsonProperty("tweak")] | ||
public string Tweak { get; set; } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/VaultSharp/V1/SecretsEngines/Transform/EncodedResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace VaultSharp.V1.SecretsEngines.Transform | ||
{ | ||
/// <summary> | ||
/// Response for encoding. | ||
/// </summary> | ||
public class EncodedResponse : EncodedItem | ||
{ | ||
/// <summary> | ||
/// Encoded items. | ||
/// </summary> | ||
[JsonProperty("batch_results")] | ||
public List<EncodedItem> EncodedItems { get; set; } | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/VaultSharp/V1/SecretsEngines/Transform/EncodingItem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace VaultSharp.V1.SecretsEngines.Transform | ||
{ | ||
/// <summary> | ||
/// Represents a single Encoding item. | ||
/// </summary> | ||
public class EncodingItem | ||
{ | ||
/// <summary> | ||
/// Specifies the value to be encoded. | ||
/// </summary> | ||
[JsonProperty("value")] | ||
public string Value { get; set; } | ||
|
||
/// <summary> | ||
/// Specifies the transformation within the role that should be used for this encode operation. | ||
/// If a single transformation exists for role, this parameter may be skipped and will be inferred. | ||
/// If multiple transformations exist, one must be specified. | ||
/// </summary> | ||
[JsonProperty("transformation")] | ||
public string Transformation { get; set; } | ||
|
||
/// <summary> | ||
/// Specifies the base64 encoded tweak to use. | ||
/// Only applicable for FPE transformations with supplied as the tweak source. | ||
/// </summary> | ||
[JsonProperty("tweak")] | ||
public string Tweak { get; set; } | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/VaultSharp/V1/SecretsEngines/Transform/ITransformSecretsEngine.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System.Threading.Tasks; | ||
using VaultSharp.V1.Commons; | ||
|
||
namespace VaultSharp.V1.SecretsEngines.Transform | ||
{ | ||
/// <summary> | ||
/// The Transform Secrets Engine. | ||
/// </summary> | ||
public interface ITransformSecretsEngine | ||
{ | ||
/// <summary> | ||
/// This endpoint encodes the provided value using a named role. | ||
/// </summary> | ||
/// <param name="roleName"> | ||
/// [required] | ||
/// Specifies the role name to use for this operation. | ||
/// </param> | ||
/// <param name="encodeRequestOptions"><para>[required]</para> | ||
/// The options. | ||
/// </param> | ||
/// <param name="mountPoint"><para>[optional]</para> | ||
/// The mount point for the Transform backend. Defaults to <see cref="SecretsEngineDefaultPaths.Transform" /> | ||
/// Provide a value only if you have customized the mount point. | ||
/// </param> | ||
/// <param name="wrapTimeToLive"> | ||
/// <para>[optional]</para> | ||
/// The TTL for the token and can be either an integer number of seconds or a string duration of seconds. | ||
/// </param> | ||
/// <returns> | ||
/// The secret with encoded text. | ||
/// </returns> | ||
Task<Secret<EncodedResponse>> EncodeAsync(string roleName, EncodeRequestOptions encodeRequestOptions, string mountPoint = SecretsEngineDefaultPaths.Transform, string wrapTimeToLive = null); | ||
|
||
/// <summary> | ||
/// This endpoint decodes the provided value using a named role. | ||
/// </summary> | ||
/// <param name="roleName"> | ||
/// [required] | ||
/// Specifies the role name to use for this operation. | ||
/// </param> | ||
/// <param name="decodeRequestOptions"><para>[required]</para> | ||
/// The options. | ||
/// </param> | ||
/// <param name="mountPoint"><para>[optional]</para> | ||
/// The mount point for the Transform backend. Defaults to <see cref="SecretsEngineDefaultPaths.Transform" /> | ||
/// Provide a value only if you have customized the mount point. | ||
/// </param> | ||
/// <param name="wrapTimeToLive"> | ||
/// <para>[optional]</para> | ||
/// The TTL for the token and can be either an integer number of seconds or a string duration of seconds. | ||
/// </param> | ||
/// <returns> | ||
/// The secret with decoded text. | ||
/// </returns> | ||
Task<Secret<DecodedResponse>> DecodeAsync(string roleName, DecodeRequestOptions decodeRequestOptions, string mountPoint = SecretsEngineDefaultPaths.Transform, string wrapTimeToLive = null); | ||
} | ||
} |
Oops, something went wrong.