-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
36 lines (36 loc) · 1.05 KB
/
index.d.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
import { AxiosRequestConfig } from "axios";
export declare enum PUBLIC_HEADERS_TYPE {
content_type = "content-type",
accesskey = "x-heng-accesskey",
nonce = "x-heng-nonce",
signature = "x-heng-signature",
timestamp = "x-heng-timestamp"
}
export interface S_AxiosRequestConfig extends AxiosRequestConfig {
ak?: string;
sk?: string;
}
export interface SignParam {
method: string;
path: string;
query?: any;
data?: any;
content_type: string;
ak: string;
sk: string;
nonce: string;
timestamp: string;
}
export interface Encrypt {
SHA256(data: string): string;
HmacSHA256(key: string, data: string): string;
}
export declare class Sign {
private readonly encrypt;
private readonly ak?;
private readonly sk?;
private readonly debug;
constructor(encrypt: Encrypt, ak?: string, sk?: string, debug?: boolean);
generateSign: ({ method, path, query, data, content_type, ak, sk, nonce, timestamp, }: SignParam) => string;
sign: (config: S_AxiosRequestConfig) => AxiosRequestConfig;
}