@tencent-sdk/capi
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -1,2 +0,1 @@ | ||
import * as rp from 'request-promise-native'; | ||
export { tencentSign, tencentSignV1 } from './utils'; | ||
@@ -45,4 +44,4 @@ export interface CapiOptions { | ||
constructor(options: CapiOptions); | ||
request(data: RequestData, opts?: RequestOptions, isV3?: boolean): rp.RequestPromise<any>; | ||
request(data: RequestData, opts?: RequestOptions, isV3?: boolean): any; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,17 +0,16 @@ | ||
import crypto from 'crypto'; | ||
import rp__default from 'request-promise-native'; | ||
import { createHash, createHmac } from 'crypto'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */ | ||
@@ -54,3 +53,2 @@ | ||
if (isV1 === void 0) { isV1 = false; } | ||
opts = opts || {}; | ||
var host = getHost(opts, isV1); | ||
@@ -62,3 +60,3 @@ var path = opts.path || '/'; | ||
if (algorithm === void 0) { algorithm = 'sha256'; } | ||
var hmac = crypto.createHmac(algorithm, secretKey); | ||
var hmac = createHmac(algorithm, secretKey); | ||
return hmac.update(Buffer.from(str, 'utf8')).digest(); | ||
@@ -168,3 +166,3 @@ } | ||
var d = new Date(); | ||
var Timestamp = getUnixTime(d); | ||
var Timestamp = String(getUnixTime(d)); | ||
var date = getDate(d); | ||
@@ -178,4 +176,3 @@ var Algorithm = 'TC3-HMAC-SHA256'; | ||
var SignedHeaders = 'content-type;host'; | ||
var HashedRequestPayload = crypto | ||
.createHash('sha256') | ||
var HashedRequestPayload = createHash('sha256') | ||
.update(JSON.stringify(payload)) | ||
@@ -186,4 +183,3 @@ .digest('hex'); | ||
var CredentialScope = date + "/" + options.ServiceType + "/tc3_request"; | ||
var HashedCanonicalRequest = crypto | ||
.createHash('sha256') | ||
var HashedCanonicalRequest = createHash('sha256') | ||
.update(CanonicalRequest) | ||
@@ -196,4 +192,3 @@ .digest('hex'); | ||
var SecretSigning = sign('tc3_request', SecretService); | ||
var Signature = crypto | ||
.createHmac('sha256', SecretSigning) | ||
var Signature = createHmac('sha256', SecretSigning) | ||
.update(Buffer.from(StringToSign, 'utf8')) | ||
@@ -310,2 +305,3 @@ .digest('hex'); | ||
var rp = require('request-promise-native'); | ||
var Capi = /** @class */ (function () { | ||
@@ -387,3 +383,3 @@ function Capi(options) { | ||
} | ||
return rp__default(reqOption); | ||
return rp(reqOption); | ||
}; | ||
@@ -390,0 +386,0 @@ return Capi; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto'), require('request-promise-native')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'crypto', 'request-promise-native'], factory) : | ||
(factory((global.capi = {}),global.crypto,global['request-promise-native'])); | ||
}(this, (function (exports,crypto,rp) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'crypto'], factory) : | ||
(factory((global.capi = {}),global.crypto)); | ||
}(this, (function (exports,crypto) { 'use strict'; | ||
crypto = crypto && crypto.hasOwnProperty('default') ? crypto['default'] : crypto; | ||
var rp__default = 'default' in rp ? rp['default'] : rp; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */ | ||
@@ -60,3 +57,2 @@ | ||
if (isV1 === void 0) { isV1 = false; } | ||
opts = opts || {}; | ||
var host = getHost(opts, isV1); | ||
@@ -173,3 +169,3 @@ var path = opts.path || '/'; | ||
var d = new Date(); | ||
var Timestamp = getUnixTime(d); | ||
var Timestamp = String(getUnixTime(d)); | ||
var date = getDate(d); | ||
@@ -183,4 +179,3 @@ var Algorithm = 'TC3-HMAC-SHA256'; | ||
var SignedHeaders = 'content-type;host'; | ||
var HashedRequestPayload = crypto | ||
.createHash('sha256') | ||
var HashedRequestPayload = crypto.createHash('sha256') | ||
.update(JSON.stringify(payload)) | ||
@@ -191,4 +186,3 @@ .digest('hex'); | ||
var CredentialScope = date + "/" + options.ServiceType + "/tc3_request"; | ||
var HashedCanonicalRequest = crypto | ||
.createHash('sha256') | ||
var HashedCanonicalRequest = crypto.createHash('sha256') | ||
.update(CanonicalRequest) | ||
@@ -201,4 +195,3 @@ .digest('hex'); | ||
var SecretSigning = sign('tc3_request', SecretService); | ||
var Signature = crypto | ||
.createHmac('sha256', SecretSigning) | ||
var Signature = crypto.createHmac('sha256', SecretSigning) | ||
.update(Buffer.from(StringToSign, 'utf8')) | ||
@@ -315,2 +308,3 @@ .digest('hex'); | ||
var rp = require('request-promise-native'); | ||
var Capi = /** @class */ (function () { | ||
@@ -392,3 +386,3 @@ function Capi(options) { | ||
} | ||
return rp__default(reqOption); | ||
return rp(reqOption); | ||
}; | ||
@@ -395,0 +389,0 @@ return Capi; |
@@ -23,3 +23,3 @@ /// <reference types="node" /> | ||
Authorization: string; | ||
Timestamp: number | string; | ||
Timestamp: string | string[] | undefined; | ||
} | ||
@@ -26,0 +26,0 @@ export interface TencentSignResultV1 { |
{ | ||
"name": "@tencent-sdk/capi", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "Tencent cloud api sdk", | ||
@@ -16,3 +16,2 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"test": "ts-node test/index.spec.ts", | ||
"clean": "rimraf ./dist tsconfig.tsbuildinfo" | ||
@@ -43,3 +42,3 @@ }, | ||
"homepage": "https://github.com/yugasun/tencent-sdk#readme", | ||
"gitHead": "e428f65cab50b91d42629fbf69e1ac73c832ed6f" | ||
"gitHead": "4f73d7a0fcbe084e5a45de1d012c3ff388399194" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38419
8
942
1