Skip to content

Instantly share code, notes, and snippets.

View DavidMoore's full-sized avatar

David Moore DavidMoore

View GitHub Profile
@ReubenBond
ReubenBond / docdb_signature.cs
Last active August 29, 2015 14:05
Azure DocumentDB: Compute Signature
public static string GetSignature(string masterKey, string resourceId, string resourceType, string xDate = null, string date = null)
{
if (string.IsNullOrEmpty(xDate) && string.IsNullOrEmpty(date))
{
throw new ArgumentException("Either xDate or date must be provided.");
}
const string AuthorizationFormat = "type={0}&ver={1}&sig={2}";
const string MasterToken = "master";
const string TokenVersion = "1.0";