You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/// <reference types="node" />
export declare const signedParamsSeparator = ";";
interface IKV {
[key: string]: any;
}
interface ICredential {
secretId: string;
secretKey: string;
}
interface ISignerOptions {
allowSignBuffer?: boolean;
}
export declare class Signer {
private credential;
private service;
private algorithm;
private options;
constructor(credential: ICredential, service: string, options?: ISignerOptions);
static camSafeUrlEncode(str: any): string;
/**
* 将一个对象处理成 KeyValue 形式嵌套的对象将会被处理成字符串Key转换成小写字母
* @param {Object} obj - 待处理的对象
* @param {Object} options
* @param {Boolean} options.enableBuffer
*/
static formatKeyAndValue(obj: any, options?: {
multipart?: boolean;
enableValueToLowerCase?: boolean;
selectedKeys?: string[];
filter?: Function;
}): any;
static calcParamsHash(params: any, keys?: null | string[], options?: any): string;
/**
* 计算签名信息
* @param {string} method - Http VerbGET/get POST/post 区分大小写
* @param {string} url - 地址http://abc.org/api/v1?a=1&b=2
* @param {Object} headers - 需要签名的头部字段
* @param {string} params - 请求参数
* @param {number} [timestamp] - 签名时间戳
* @param {object} [options] - 可选参数
*/
tc3sign(method: string, url: string, headers: IKV, params: IKV | string, timestamp: number, options?: {
enableHostCheck?: boolean;
enableContentTypeCheck?: boolean;
withSignedParams?: boolean;
}): {
authorization: string;
signedParams: string[];
signedHeaders: string[];
signature: string | Buffer;
timestamp: number;
multipart: any;
};
}
export {};