@@ -62,47 +62,48 @@ public override string PeriodSecondsToString(int seconds)
6262 }
6363 }
6464
65- #region ProcessRequest
65+ #region ProcessRequest
6666
67- protected override async Task ProcessRequestAsync ( IHttpWebRequest request , Dictionary < string , object > payload )
68- {
69- if ( CanMakeAuthenticatedRequest ( payload ) )
70- {
71- request . AddHeader ( "KC-API-KEY" , PublicApiKey . ToUnsecureString ( ) ) ;
72- request . AddHeader ( "KC-API-TIMESTAMP" , payload [ "nonce" ] . ToStringInvariant ( ) ) ;
73- request . AddHeader ( "KC-API-PASSPHRASE" , Passphrase . ToUnsecureString ( ) ) ;
74-
75- var endpoint = request . RequestUri . PathAndQuery ;
76- //For Gets, Deletes, no need to add the parameters in JSON format
77- var message = "" ;
78- var sig = "" ;
79- if ( request . Method == "GET" || request . Method == "DELETE" )
80- {
81- //Request will be a querystring
82- message = string . Format ( "{0}{1}{2}" , payload [ "nonce" ] , request . Method , endpoint ) ;
83- sig = CryptoUtility . SHA256Sign ( message , PrivateApiKey . ToUnsecureString ( ) , true ) ;
84- }
85- else if ( request . Method == "POST" )
86- {
87- message = string . Format ( "{0}{1}{2}{3}" , payload [ "nonce" ] , request . Method , endpoint , CryptoUtility . GetJsonForPayload ( payload , true ) ) ;
88- sig = CryptoUtility . SHA256Sign ( message , PrivateApiKey . ToUnsecureString ( ) , true ) ;
89- }
90- request . AddHeader ( "KC-API-SIGN" , sig ) ;
91- }
67+ protected override async Task ProcessRequestAsync ( IHttpWebRequest request , Dictionary < string , object > payload )
68+ {
69+ if ( CanMakeAuthenticatedRequest ( payload ) )
70+ {
71+ request . AddHeader ( "KC-API-KEY" , PublicApiKey . ToUnsecureString ( ) ) ;
72+ request . AddHeader ( "KC-API-TIMESTAMP" , payload [ "nonce" ] . ToStringInvariant ( ) ) ;
73+ request . AddHeader ( "KC-API-PASSPHRASE" , CryptoUtility . SHA256Sign ( Passphrase . ToUnsecureString ( ) , PrivateApiKey . ToUnsecureString ( ) , true ) ) ;
74+ var endpoint = request . RequestUri . PathAndQuery ;
75+ //For Gets, Deletes, no need to add the parameters in JSON format
76+ var message = "" ;
77+ var sig = "" ;
78+ if ( request . Method == "GET" || request . Method == "DELETE" )
79+ {
80+ //Request will be a querystring
81+ message = string . Format ( "{0}{1}{2}" , payload [ "nonce" ] , request . Method , endpoint ) ;
82+ sig = CryptoUtility . SHA256Sign ( message , PrivateApiKey . ToUnsecureString ( ) , true ) ;
83+ }
84+ else if ( request . Method == "POST" )
85+ {
86+ message = string . Format ( "{0}{1}{2}{3}" , payload [ "nonce" ] , request . Method , endpoint , CryptoUtility . GetJsonForPayload ( payload , true ) ) ;
87+ sig = CryptoUtility . SHA256Sign ( message , PrivateApiKey . ToUnsecureString ( ) , true ) ;
88+ }
89+ request . AddHeader ( "KC-API-KEY-VERSION" , 2 . ToStringInvariant ( ) ) ;
90+ request . AddHeader ( "KC-API-SIGN" , sig ) ;
9291
93- if ( request . Method == "POST" )
94- {
95- string msg = CryptoUtility . GetJsonForPayload ( payload , true ) ;
96- byte [ ] content = msg . ToBytesUTF8 ( ) ;
97- await request . WriteAllAsync ( content , 0 , content . Length ) ;
98- }
99- }
92+ }
93+
94+ if ( request . Method == "POST" )
95+ {
96+ string msg = CryptoUtility . GetJsonForPayload ( payload , true ) ;
97+ byte [ ] content = msg . ToBytesUTF8 ( ) ;
98+ await request . WriteAllAsync ( content , 0 , content . Length ) ;
99+ }
100+ }
100101
101- #endregion ProcessRequest
102+ #endregion ProcessRequest
102103
103- #region Public APIs
104+ #region Public APIs
104105
105- protected override async Task < IReadOnlyDictionary < string , ExchangeCurrency > > OnGetCurrenciesAsync ( )
106+ protected override async Task < IReadOnlyDictionary < string , ExchangeCurrency > > OnGetCurrenciesAsync ( )
106107 {
107108 Dictionary < string , ExchangeCurrency > currencies = new Dictionary < string , ExchangeCurrency > ( ) ;
108109 List < string > symbols = new List < string > ( ) ;
0 commit comments