Socket
Socket
Sign inDemoInstall

qcloud-iotexplorer-common-libs

Package Overview
Dependencies
12
Maintainers
2
Versions
84
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.12.1 to 0.12.2

2

lib/utils/index.d.ts

@@ -7,3 +7,3 @@ export declare const U32ToHexString: (length: any) => string;

export declare const gen4BytesIntHex: () => string;
export declare const hex2str: (hex: any) => any;
export declare const hex2str: (hex: any) => string;
export declare const str2hexStr: (str: any) => string;

@@ -10,0 +10,0 @@ export declare const hexArrayTo128BleAdvertUUIDStr: (hexArr: any) => string;

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getProductDateTemplate=exports.hmacSHA1=exports.md5=exports.downloadFile=exports.hexArrayTo128BleAdvertUUIDStr=exports.str2hexStr=exports.hex2str=exports.gen4BytesIntHex=exports.gen2BytesIntHex=exports.get8ByteFromStr=exports.U8ToHexString=exports.U16ToHexString=exports.U32ToHexString=void 0;var tslib_1=require("tslib"),qcloud_iotexplorer_appdev_sdk_1=require("qcloud-iotexplorer-appdev-sdk"),spark_md5_1=tslib_1.__importDefault(require("spark-md5")),_a=qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils,noop=_a.noop,byteUtil=_a.byteUtil,CryptoJS=_a.CryptoJS;exports.U32ToHexString=function(t){var e=t.toString(16).toUpperCase();return""+"00000000".slice(0,8-e.length)+e},exports.U16ToHexString=function(t){var e=t.toString(16).toUpperCase();return""+"0000".slice(0,4-e.length)+e},exports.U8ToHexString=function(t){var e=t.toString(16).toUpperCase();if(e.length>2)throw"length error,must less then 255";return""+"00".slice(0,2-e.length)+e},exports.get8ByteFromStr=function(t){for(var e=exports.md5(t),r=byteUtil.hexStringToByteArray(e.substring(0,e.length/2)),o=byteUtil.hexStringToByteArray(e.substring(e.length/2)),n=[],s=0;s<r.length;s++)n[s]=r[s]^o[s];return byteUtil.byteArrayToHex(n)},exports.gen2BytesIntHex=function(){var t=Math.floor(Math.random()*Math.pow(10,4)).toString(16);return""+t+"feaa".slice(0,4-t.length)},exports.gen4BytesIntHex=function(){var t=Math.floor(Math.random()*Math.pow(10,9)).toString(16);return""+t+"feaa12dd".slice(0,8-t.length)},exports.hex2str=function(t){var e;return e="string"==typeof t?t.match(/[\da-f]{2}/gi):t,byteUtil.byteArrayToString(new Int8Array(e.map((function(t){return parseInt(t,16)}))))},exports.str2hexStr=function(t){return byteUtil.byteArrayToHex(byteUtil.stringToByteArray(t))},exports.hexArrayTo128BleAdvertUUIDStr=function(t){var e=tslib_1.__spread(t);return e.splice(4,0,"-"),e.splice(7,0,"-"),e.splice(10,0,"-"),e.splice(13,0,"-"),e.join("")},exports.downloadFile=function(t,e){var r=(void 0===e?{}:e).onProgress,o=void 0===r?noop:r;return new Promise((function(e){wx.downloadFile({url:t,success:function(t){console.log(t),wx.getFileSystemManager().readFile({filePath:t.tempFilePath,success:function(t){console.log(t);var r=t.data.byteLength;e({fileSize:r,fileBuffer:t.data})}})}}).onProgressUpdate((function(t){return o(t)}))}))},exports.md5=function(t){return spark_md5_1.default.hash(t)},exports.hmacSHA1=function(t,e){var r=CryptoJS.enc.Hex.parse(String(e)),o=CryptoJS.HmacSHA1(String(t),r);return console.log("encrypt",r,t,o.toString(CryptoJS.enc.Hex)),o.toString(CryptoJS.enc.Hex)},exports.getProductDateTemplate=function(t){try{if(!t)throw{code:"GET_PRODUCT_INFO_FAIL",msg:"获取产品信息失败"};var e=t.DataTemplate;return"string"==typeof e&&(e=JSON.parse(e)),e}catch(t){throw tslib_1.__assign({code:"TEMPLATE_ERROR"},t)}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getProductDateTemplate=exports.hmacSHA1=exports.md5=exports.downloadFile=exports.hexArrayTo128BleAdvertUUIDStr=exports.str2hexStr=exports.hex2str=exports.gen4BytesIntHex=exports.gen2BytesIntHex=exports.get8ByteFromStr=exports.U8ToHexString=exports.U16ToHexString=exports.U32ToHexString=void 0;var tslib_1=require("tslib"),qcloud_iotexplorer_appdev_sdk_1=require("qcloud-iotexplorer-appdev-sdk"),spark_md5_1=tslib_1.__importDefault(require("spark-md5")),_a=qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils,noop=_a.noop,byteUtil=_a.byteUtil,CryptoJS=_a.CryptoJS;exports.U32ToHexString=function(t){var e=t.toString(16).toUpperCase();return""+"00000000".slice(0,8-e.length)+e},exports.U16ToHexString=function(t){var e=t.toString(16).toUpperCase();return""+"0000".slice(0,4-e.length)+e},exports.U8ToHexString=function(t){var e=t.toString(16).toUpperCase();if(e.length>2)throw"length error,must less then 255";return""+"00".slice(0,2-e.length)+e},exports.get8ByteFromStr=function(t){for(var e=exports.md5(t),r=byteUtil.hexStringToByteArray(e.substring(0,e.length/2)),o=byteUtil.hexStringToByteArray(e.substring(e.length/2)),n=[],s=0;s<r.length;s++)n[s]=r[s]^o[s];return byteUtil.byteArrayToHex(n)},exports.gen2BytesIntHex=function(){var t=Math.floor(Math.random()*Math.pow(10,4)).toString(16);return""+t+"feaa".slice(0,4-t.length)},exports.gen4BytesIntHex=function(){var t=Math.floor(Math.random()*Math.pow(10,9)).toString(16);return""+t+"feaa12dd".slice(0,8-t.length)},exports.hex2str=function(t){var e;return e="string"==typeof t?t.match(/[\da-f]{2}/gi):t,byteUtil.utf8ByteArrayToString(e.map((function(t){return parseInt(t,16)})))},exports.str2hexStr=function(t){return byteUtil.byteArrayToHex(byteUtil.stringToByteArray(t))},exports.hexArrayTo128BleAdvertUUIDStr=function(t){var e=tslib_1.__spread(t);return e.splice(4,0,"-"),e.splice(7,0,"-"),e.splice(10,0,"-"),e.splice(13,0,"-"),e.join("")},exports.downloadFile=function(t,e){var r=(void 0===e?{}:e).onProgress,o=void 0===r?noop:r;return new Promise((function(e){wx.downloadFile({url:t,success:function(t){console.log(t),wx.getFileSystemManager().readFile({filePath:t.tempFilePath,success:function(t){console.log(t);var r=t.data.byteLength;e({fileSize:r,fileBuffer:t.data})}})}}).onProgressUpdate((function(t){return o(t)}))}))},exports.md5=function(t){return spark_md5_1.default.hash(t)},exports.hmacSHA1=function(t,e){var r=CryptoJS.enc.Hex.parse(String(e)),o=CryptoJS.HmacSHA1(String(t),r);return console.log("encrypt",r,t,o.toString(CryptoJS.enc.Hex)),o.toString(CryptoJS.enc.Hex)},exports.getProductDateTemplate=function(t){try{if(!t)throw{code:"GET_PRODUCT_INFO_FAIL",msg:"获取产品信息失败"};var e=t.DataTemplate;return"string"==typeof e&&(e=JSON.parse(e)),e}catch(t){throw tslib_1.__assign({code:"TEMPLATE_ERROR"},t)}};
//# sourceMappingURL=index.js.map
{
"name": "qcloud-iotexplorer-common-libs",
"version": "0.12.1",
"version": "0.12.2",
"description": "腾讯云IOT前端通用工具库",

@@ -24,3 +24,3 @@ "main": "lib/index.js",

},
"gitHead": "606b36e9ef95cbe322c385c76a6c39b9ac32deeb"
"gitHead": "819b06cdd6eaa78d3513b0070d9f1e68814381d8"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc