-
-
Notifications
You must be signed in to change notification settings - Fork 270
/
Copy pathrest-private-rsa.ts
78 lines (73 loc) · 3.93 KB
/
rest-private-rsa.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { MainClient } from '../src/index';
// or
// import { MainClient } from 'binance';
// Received after creating a new API key with a self-generated RSA public key on binance
const api_key =
'SIHqWcDeRoj6gkOjLjQh1dnV1CD7IgwQTfL4LVa8wu04zNTYVSmJBIHsjQjgwWqt';
// The self-generated RSA private key, this is never directly given to binance, but used to generate a signature
// Note: this MUST include the "BEGIN PRIVATE KEY" header so the SDK understands this is RSA auth
const rsaPrivateKey = `
-----BEGIN RSA PRIVATE KEY-----
MIIJKQIBAAKCAgEA1uWxxOXZUaX6AeZszf4xrBsU6axA5ipwxG7VPihVgssphDrr
SOD0hZqnBmtF2bvT9ee1U0XOfMn+H+J5SH+1jgUpfioqH0L+KXl6wmLoPsadgfJz
0SiQlFnKTkDXvMmecr6cdMHi2qNEx4CMc68CobvQ4Voz5qqpDwbohGtJh0p10PB/
/0Ejcoz0UwrTDq8BGeFmWa9pL/7h2vHtw+QUUxlnGmt98M8KkKqqvVicMK+IVtng
/QlDw9ofG2kQcbBkPRaTjNI+8ULtCDH0sOkZnT8PtGm4sEwmWH/dRWtUTWkMnUwC
zuo/rWPb7WMprW2pKDTrLjUAr9M161t3Xa6WJO03K3NOxupy7ilululLY8d/WKWY
DOZMvS5bPiPRUoZqlJneC0CT/2q1W6GfWzsTDCDTpgq/Ao7jTtnME9iadpwvFn0n
MtNgJSrFDWPq8vKY9pRcEp/Na5qvIEOQIFnp/kIDPuMf+LZwO8lGFO3jnndY+628
35rm7t6ZNM3NLoNCarvUCEasobgDJHw7x7c1fW/OxYtLrWGdMpsP0MewgGJ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oT0uuHXTbBkXzJnZZ13lQ/irJFEo31HhRyvfW01YVUs29ktFon2IrvzmuM5
ZBBZh4WIFS5l+hTtMq7Zk4J9vjwWxjnBAoIBAQCw9201wNS2dFYy54WCERT461eA
+WIIqPjFD7AdOIH6k0BfBNMB2JaOjer8j8C6IwfIPq3SRB/LmpoVpE8bsb8T3wdx
wPZu6fD4iFLB1wFy7IX8P0kQGWFzn/RSncr874SwZrS/SKxA44KhfJj6yU7qTSsO
d4H/emTf84drILclX7IPlGgufKjig/C0sn0xcxghrFU64W9vCoNksWSeoQjXMdy9
/duDQ5JtkhOaIABC9dStV1GlcwPGhXP417sYKmrPOF2DuCPyUbtrxtCeiui7vBAJ
ko/Y2e8MTPM3iWn+SPWqYb0MUnGdFGv1m86ig9JgWZVHuWS3rnjzqp4vpfZv
-----END RSA PRIVATE KEY-----
`;
const client = new MainClient({
api_key: api_key,
api_secret: rsaPrivateKey,
beautifyResponses: true,
});
(async () => {
try {
console.log('private api call result: ', await client.getBalances());
} catch (e) {
console.error('request failed: ', e);
}
})();