Class Hmac256SignatureGenerator
Used to generate signatures using the HMACSHA256 hash algorithm, currently the default and only supported algorithm by Humm.
Inherited Members
Namespace: Yort.Humm.InStore.Infrastructure
Assembly: Yort.Humm.InStore.dll
Syntax
public sealed class Hmac256SignatureGenerator : ISignatureGenerator, IDisposable
Constructors
| Improve this Doc View SourceHmac256SignatureGenerator(String)
Initializes a new instance of the Hmac256SignatureGenerator class.
Declaration
public Hmac256SignatureGenerator([ValidatedNotNull] string apiKey)
Parameters
Type | Name | Description |
---|---|---|
String | apiKey | The secret key to use when generating the signature. This should be a Humm Device Key (DeviceKey). |
Methods
| Improve this Doc View SourceDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
GenerateSignature(IEnumerable<KeyValuePair<String, Object>>)
Generates the signature and returns it as a string.
Declaration
public string GenerateSignature(IEnumerable<KeyValuePair<string, object>> properties)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<KeyValuePair<String, Object>> | properties | A dictionary of values to be considered for use in the signature generation. See remarks for more details. |
Returns
Type | Description |
---|---|
String | A string containing the signature calculated from the properties provided. |
Remarks
Humm signatures are currently case-insensitive hexadecimal strings.
Only values from the properties
argument where the key starts with "x_" will be used, so the caller may pass the full property set if desired.
Values of type decimal are treated as dollar values and will be automatically multiplied by 100, so should be passed as their decimal dollar representation.
Values that are null will be ignored (treated as a missing/undeclared property and excluded from the signature generation).
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | Hmac256SignatureGenerator |
ArgumentNullException | Thrown if |