Click here to Skip to main content
15,441,629 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: How do you guys handle db password change in appsettings.json? Pin
SeanChupas13-May-21 2:11
MemberSeanChupas13-May-21 2:11 
AnswerRe: How do you guys handle db password change in appsettings.json? Pin
jsc4213-May-21 2:23
professionaljsc4213-May-21 2:23 
GeneralRe: How do you guys handle db password change in appsettings.json? Pin
SeanChupas13-May-21 4:31
MemberSeanChupas13-May-21 4:31 
AnswerRe: How do you guys handle db password change in appsettings.json? Pin
Gerry Schmitz13-May-21 7:35
mveGerry Schmitz13-May-21 7:35 
Questionhelp to implement encryption-based authentication for exchange DEX-TRADE Pin
Member 145001841-May-21 0:14
MemberMember 145001841-May-21 0:14 
AnswerRe: help to implement encryption-based authentication for exchange DEX-TRADE Pin
Eddy Vluggen3-May-21 11:20
professionalEddy Vluggen3-May-21 11:20 
AnswerRe: help to implement encryption-based authentication for exchange DEX-TRADE Pin
Member 145001843-May-21 21:39
MemberMember 145001843-May-21 21:39 
Questionhelp to implement encryption-based authentication for exchange btc-alpha Pin
Member 145001841-May-21 0:04
MemberMember 145001841-May-21 0:04 
I would like to create a wrap to call the API of the exchange btc-aplha as it implements the DCY currency which is the only one of an Italian project. My difficulty is understanding the rules for implementing key based authorization. The documentation is very sparse and I don't understand the examples which are in phyton or node.js

https://btc-alpha.github.io/api-docs/?javascript#authorization

Can anyone help me to implement the following methods I took from the node.js example


JavaScript
<pre>const hmacSha256 = require('crypto-js/hmac-sha256'); // sha256 hash. or use you favorite u like
const request = require('request'); // for http requests. or use you favorite u like

const BASE_URL = 'https://btc-alpha.com/api/v1';
const API_KEY = '0000-0000...';
const SECRET = 'Z%2........';

//Serialize for singing only. Can be used in request body if u like urlencoded form format instead of json
function serializePayload(payload) {
  return Object
    .keys(payload) // get keys of payload object
    .sort() // sort keys
    .map((key) => key + "=" + encodeURIComponent(payload[key])) // each value should be url encoded. the most sensitive part for sign checking
    .join('&'); // to sting, separate with ampersand
}

// Generates auth headers
function getAuthHeaders(payload) {
  // get SHA256 of <API_KEY><sorted urlencoded payload string><SECRET>
  const sign = hmacSha256(API_KEY + serializePayload(payload), SECRET).toString();

  return {
    'X-KEY': API_KEY,
    'X-SIGN': sign,
    'X-NONCE': Date.now()
  };
}

function getWallets(callback) {
  payload = {};

  const options = {
    method: 'get',
    url: `${BASE_URL}/wallets/`,
    headers: getAuthHeaders(payload)
  };

  request(options, callback);
}

function createOrder(order, callback) {
  const options = {
    method: 'post',
    url: `${BASE_URL}/order/`,
    headers: getAuthHeaders(order),
    form: order, // API accepts urlencoded form or json. Use appropriate headers!
  };

  request(options, callback);
}

// test
getWallets((error, response, body) => {
  console.log('error', error);
  console.log('body', body);
});

const order = {
  type: 'buy',
  pair: 'BTC_USD',
  amount: '0.0001',
  price: '0.1'
};

createOrder(order, (error, response, body) => {
  // get json, etc
  console.log('error', error);
  console.log('body', body);
});

QuestionOpenSSL Signing with RSA key in Dot Net on Windows Pin
David Carta28-Apr-21 14:18
professionalDavid Carta28-Apr-21 14:18 
AnswerRe: OpenSSL Signing with RSA key in Dot Net on Windows Pin
Richard Andrew x643-May-21 10:34
professionalRichard Andrew x643-May-21 10:34 
QuestionC# .Net Core error : server error in '/' application Pin
Member 1514832212-Apr-21 7:09
MemberMember 1514832212-Apr-21 7:09 
AnswerRe: C# .Net Core error : server error in '/' application Pin
Richard MacCutchan12-Apr-21 8:09
mveRichard MacCutchan12-Apr-21 8:09 
AnswerRe: C# .Net Core error : server error in '/' application Pin
Member 1514832212-Apr-21 8:27
MemberMember 1514832212-Apr-21 8:27 
AnswerRe: C# .Net Core error : server error in '/' application Pin
Richard Deeming12-Apr-21 21:26
mveRichard Deeming12-Apr-21 21:26 
GeneralRe: C# .Net Core error : server error in '/' application Pin
Member 1514832212-Apr-21 22:37
MemberMember 1514832212-Apr-21 22:37 
GeneralRe: C# .Net Core error : server error in '/' application Pin
Richard Deeming12-Apr-21 22:55
mveRichard Deeming12-Apr-21 22:55 
GeneralRe: C# .Net Core error : server error in '/' application Pin
Member 1514832213-Apr-21 0:02
MemberMember 1514832213-Apr-21 0:02 
GeneralRe: C# .Net Core error : server error in '/' application Pin
Richard Deeming13-Apr-21 0:24
mveRichard Deeming13-Apr-21 0:24 
GeneralRe: C# .Net Core error : server error in '/' application Pin
Member 1514832213-Apr-21 0:51
MemberMember 1514832213-Apr-21 0:51 
GeneralRe: C# .Net Core error : server error in '/' application Pin
Richard Deeming13-Apr-21 1:21
mveRichard Deeming13-Apr-21 1:21 
GeneralRe: C# .Net Core error : server error in '/' application Pin
Member 1514832212-Apr-21 23:49
MemberMember 1514832212-Apr-21 23:49 
AnswerRe: C# .Net Core error : server error in '/' application Pin
C0ding_j3ff18-Apr-21 10:54
MemberC0ding_j3ff18-Apr-21 10:54 
Generalsql server, database stored procedure not working with ip address, please help. Pin
Member 1472928712-Apr-21 0:38
MemberMember 1472928712-Apr-21 0:38 
AnswerRe: sql server, database stored procedure not working with ip address, please help. Pin
Richard Deeming12-Apr-21 2:13
mveRichard Deeming12-Apr-21 2:13 
GeneralRe: sql server, database stored procedure not working with ip address, please help. Pin
Dave Kreskowiak12-Apr-21 4:03
mveDave Kreskowiak12-Apr-21 4:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.