run linter
This commit is contained in:
@@ -18,5 +18,5 @@ export const DefaultLogger = {
|
||||
},
|
||||
error: (...params: LogParams): void => {
|
||||
console.error(params);
|
||||
}
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import axios, { AxiosRequestConfig, AxiosResponse, Method } from 'axios';
|
||||
import { APIResponse, APIResponseWithTime } from '../types/shared';
|
||||
|
||||
import { signMessage } from './node-support';
|
||||
import {
|
||||
@@ -36,19 +35,12 @@ interface SignedRequest<T> {
|
||||
|
||||
export default abstract class BaseRestClient {
|
||||
private timeOffset: number | null;
|
||||
|
||||
private syncTimePromise: null | Promise<any>;
|
||||
|
||||
private options: RestClientOptions;
|
||||
|
||||
private baseUrl: string;
|
||||
|
||||
private globalRequestOptions: AxiosRequestConfig;
|
||||
|
||||
private key: string | undefined;
|
||||
|
||||
private secret: string | undefined;
|
||||
|
||||
private clientType: RestClientType;
|
||||
|
||||
/** Function that calls exchange API to query & resolve server time, used by time sync */
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
|
||||
export async function signMessage(message: string, secret: string): Promise<string> {
|
||||
export async function signMessage(
|
||||
message: string,
|
||||
secret: string
|
||||
): Promise<string> {
|
||||
const encoder = new TextEncoder();
|
||||
const key = await window.crypto.subtle.importKey(
|
||||
'raw',
|
||||
encoder.encode(secret),
|
||||
{name: 'HMAC', hash: {name: 'SHA-256'}},
|
||||
{ name: 'HMAC', hash: { name: 'SHA-256' } },
|
||||
false,
|
||||
['sign']
|
||||
);
|
||||
|
||||
const signature = await window.crypto.subtle.sign('HMAC', key, encoder.encode(message));
|
||||
const signature = await window.crypto.subtle.sign(
|
||||
'HMAC',
|
||||
key,
|
||||
encoder.encode(message)
|
||||
);
|
||||
|
||||
return Array.prototype.map.call(
|
||||
new Uint8Array(signature),
|
||||
(x: any) => ('00'+x.toString(16)).slice(-2)
|
||||
).join('');
|
||||
};
|
||||
return Array.prototype.map
|
||||
.call(new Uint8Array(signature), (x: any) =>
|
||||
('00' + x.toString(16)).slice(-2)
|
||||
)
|
||||
.join('');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user