예제 #1
0
        public string GetSignature(JObject data)
        {
            var hash      = InstaCryptoHelper.CalculateHash(ApiVersion.SignatureKey, data.ToString(Formatting.None));
            var payload   = data.ToString(Formatting.None);
            var signature = $"{hash}.{payload}";

            return(signature);
        }
예제 #2
0
        public HttpRequestMessage GetSignedRequest(HttpMethod method, Uri uri, AndroidDevice deviceInfo, JObject data)
        {
            var hash = InstaCryptoHelper.CalculateHash(
                ApiVersion.SignatureKey,
                data.ToString(Formatting.None));
            var payload   = data.ToString(Formatting.None);
            var signature = $"{hash}.{payload}";
            var fields    = new Dictionary <string, string>
            {
                { InstaApiConstants.HeaderIgSignature, signature },
                { InstaApiConstants.HeaderIgSignatureKeyVersion, InstaApiConstants.IgSignatureKeyVersion }
            };
            var request = GetDefaultRequest(HttpMethod.Post, uri, deviceInfo);

            request.Content = new FormUrlEncodedContent(fields);
            request.Properties.Add(InstaApiConstants.HeaderIgSignature, signature);
            request.Properties.Add(
                InstaApiConstants.HeaderIgSignatureKeyVersion,
                InstaApiConstants.IgSignatureKeyVersion);
            return(request);
        }