Interface ISharedKeyService
Provides a service to authenticate requests using shared keys.
Assembly: DataWeb.Core.dll
Syntax
public interface ISharedKeyService
Methods
Generates a dictionary of HTTP headers for authenticating a request.
Declaration
Dictionary<string, string> GetHttpHeaders(Uri url, string appName, string secretKey, string httpMethod)
Parameters
Type |
Name |
Description |
Uri |
url |
|
string |
appName |
|
string |
secretKey |
|
string |
httpMethod |
|
Returns
Type |
Description |
Dictionary<string, string> |
|
GetSignature(string, string)
Computes the signature of the provided data using the provided secret key.
Declaration
string GetSignature(string data, string privateKey)
Parameters
Type |
Name |
Description |
string |
data |
|
string |
privateKey |
|
Returns
GetStamp()
Retrieves the current Unix timestamp.
Declaration
Returns
IsValidRequest(string, string, string, ulong, string, string, string, ulong)
Validates if a request is valid based on the provided parameters.
Declaration
bool IsValidRequest(string appName, string secretKey, string requestAppName, ulong requestStamp, string requestSignature, string requestUrl, string requestProtocol, ulong seconds = 300)
Parameters
Type |
Name |
Description |
string |
appName |
|
string |
secretKey |
|
string |
requestAppName |
|
ulong |
requestStamp |
|
string |
requestSignature |
|
string |
requestUrl |
|
string |
requestProtocol |
|
ulong |
seconds |
|
Returns
ValidateStamp(ulong, ulong)
Validates if the request timestamp is within the specified time range.
Declaration
bool ValidateStamp(ulong requestStamp, ulong seconds)
Parameters
Type |
Name |
Description |
ulong |
requestStamp |
|
ulong |
seconds |
|
Returns