@secux/utility
Advanced tools
Comparing version 3.0.11 to 3.0.12
@@ -33,3 +33,3 @@ /*! | ||
#private; | ||
constructor(code: number); | ||
constructor(code: number, version?: number); | ||
get name(): string; | ||
@@ -39,2 +39,3 @@ get message(): string; | ||
get statusText(): string; | ||
get version(): number; | ||
} | ||
@@ -53,1 +54,13 @@ export declare type base64String = string; | ||
} | ||
export declare enum StatusCodeV2 { | ||
OK = 0, | ||
NO_LEADING_PACKET = 1, | ||
COMMAND_OVERLAY = 2, | ||
INVALID_COMMAND = 3, | ||
INCORRENT_PARAMETER_SIZE = 4, | ||
INVALID_PARAMETER_VALUE = 5, | ||
NOT_FOUND = 6, | ||
ALREADY_EXIST = 7, | ||
IO_ERROR = 8, | ||
NOT_SUPPORT = 9 | ||
} |
@@ -18,2 +18,2 @@ "use strict"; | ||
limitations under the License. | ||
*/var t,e,r,o,s=this&&this.__classPrivateFieldSet||function(t,e,r,o,s){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?s.call(t,r):s?s.value=r:e.set(t,r),r},a=this&&this.__classPrivateFieldGet||function(t,e,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(t):o?o.value:e.get(t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.StatusCode=exports.ow_communicationData=exports.ow_base64String=exports.base64_regexp=exports.TransportStatusError=exports.to_L1_APDU=exports.getBuffer=exports.toAPDUResponse=exports.Send=exports.wrapResult=exports.toCommunicationData=exports.MAX_HEAD_SIZE=exports.ONESIGN_THRESHOLD=void 0;const n=require("ow"),i=require("./utility"),u=null===i.Logger||void 0===i.Logger?void 0:i.Logger.child({id:"protocol"}),f="service"===process.env.SECUX_PLATFROM;function c(t){return"string"==typeof t?Buffer.from(t,"base64"):t}exports.ONESIGN_THRESHOLD=4e3,exports.MAX_HEAD_SIZE=25,exports.toCommunicationData=f?t=>t.toString("base64"):t=>t,exports.wrapResult=function(t){return f?"object"!=typeof t?t:JSON.stringify(t):t},exports.Send=function(t,e,r=0,o=0,s=Buffer.alloc(0)){const a=Buffer.alloc(2);a.writeUInt16LE(s.length,0);const n=Buffer.concat([Buffer.from([t,e,r,o]),a,s,Buffer.alloc(2),Buffer.from([0,0,0,0])]);return null==u||u.debug(`send data: ${n.toString("hex")}`),(0,exports.toCommunicationData)(n)},exports.toAPDUResponse=function(t){const e=t.readUInt16LE(0),r=t.readUInt16BE(2+e);if(e+6>t.length)throw null==u||u.warn(`Received data missing error: ${t.toString("hex")}`),Error(`Received data error: ${t.toString("hex")}`);return{data:t.slice(2,2+e),dataLength:e,status:r}},exports.getBuffer=c;const p=Buffer.from([248,2,0,0]);exports.to_L1_APDU=function(t){const e=c(t),r=Buffer.concat([p,e]);return(0,exports.toCommunicationData)(r)};class d extends Error{constructor(n){super(),t.set(this,"TransportStatusError"),e.set(this,void 0),r.set(this,void 0),o.set(this,void 0),s(this,o,n in l?l[n]:"UNKNOWN_ERROR","f"),s(this,r,n,"f"),s(this,e,`[SecuX device] ${a(this,o,"f")} (0x${n.toString(16)})`,"f")}get name(){return a(this,t,"f")}get message(){return a(this,e,"f")}get statusCode(){return a(this,r,"f")}get statusText(){return a(this,o,"f")}}var l;exports.TransportStatusError=d,t=new WeakMap,e=new WeakMap,r=new WeakMap,o=new WeakMap,exports.base64_regexp=/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/,exports.ow_base64String=n.default.string.matches(exports.base64_regexp),exports.ow_communicationData=n.default.any(exports.ow_base64String,n.default.buffer),function(t){t[t.SUCCESS=36864]="SUCCESS",t[t.USER_CANCEL=36865]="USER_CANCEL",t[t.DATA_ERROR=20481]="DATA_ERROR",t[t.CLA_ERROR=20482]="CLA_ERROR",t[t.INS_ERROR=20483]="INS_ERROR"}(l=exports.StatusCode||(exports.StatusCode={})); | ||
*/var t,e,r,o,s,a=this&&this.__classPrivateFieldSet||function(t,e,r,o,s){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?s.call(t,r):s?s.value=r:e.set(t,r),r},n=this&&this.__classPrivateFieldGet||function(t,e,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(t):o?o.value:e.get(t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.StatusCodeV2=exports.StatusCode=exports.ow_communicationData=exports.ow_base64String=exports.base64_regexp=exports.TransportStatusError=exports.to_L1_APDU=exports.getBuffer=exports.toAPDUResponse=exports.Send=exports.wrapResult=exports.toCommunicationData=exports.MAX_HEAD_SIZE=exports.ONESIGN_THRESHOLD=void 0;const i=require("ow"),u=require("./utility"),f=null===u.Logger||void 0===u.Logger?void 0:u.Logger.child({id:"protocol"}),p="service"===process.env.SECUX_PLATFROM;function c(t){return"string"==typeof t?Buffer.from(t,"base64"):t}exports.ONESIGN_THRESHOLD=4e3,exports.MAX_HEAD_SIZE=25,exports.toCommunicationData=p?t=>t.toString("base64"):t=>t,exports.wrapResult=function(t){return p?"object"!=typeof t?t:JSON.stringify(t):t},exports.Send=function(t,e,r=0,o=0,s=Buffer.alloc(0)){const a=Buffer.alloc(2);a.writeUInt16LE(s.length,0);const n=Buffer.concat([Buffer.from([t,e,r,o]),a,s,Buffer.alloc(2),Buffer.from([0,0,0,0])]);return null==f||f.debug(`send data: ${n.toString("hex")}`),(0,exports.toCommunicationData)(n)},exports.toAPDUResponse=function(t){const e=t.readUInt16LE(0),r=t.readUInt16BE(2+e);if(e+6>t.length)throw null==f||f.warn(`Received data missing error: ${t.toString("hex")}`),Error(`Received data error: ${t.toString("hex")}`);return{data:t.slice(2,2+e),dataLength:e,status:r}},exports.getBuffer=c;const E=Buffer.from([248,2,0,0]);exports.to_L1_APDU=function(t){const e=c(t),r=Buffer.concat([E,e]);return(0,exports.toCommunicationData)(r)};class _ extends Error{constructor(i,u=1){var f;if(super(),t.set(this,"TransportStatusError"),e.set(this,void 0),r.set(this,void 0),o.set(this,void 0),s.set(this,void 0),a(this,s,u,"f"),2===u)a(this,o,d[i],"f");else a(this,o,R[i],"f");a(this,o,null!==(f=n(this,o,"f"))&&void 0!==f?f:"UNKNOWN_ERROR","f"),a(this,r,i,"f"),a(this,e,`[SecuX device] ${n(this,o,"f")} (0x${i.toString(16)})`,"f")}get name(){return n(this,t,"f")}get message(){return n(this,e,"f")}get statusCode(){return n(this,r,"f")}get statusText(){return n(this,o,"f")}get version(){return n(this,s,"f")}}var R,d;exports.TransportStatusError=_,t=new WeakMap,e=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,exports.base64_regexp=/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/,exports.ow_base64String=i.default.string.matches(exports.base64_regexp),exports.ow_communicationData=i.default.any(exports.ow_base64String,i.default.buffer),function(t){t[t.SUCCESS=36864]="SUCCESS",t[t.USER_CANCEL=36865]="USER_CANCEL",t[t.DATA_ERROR=20481]="DATA_ERROR",t[t.CLA_ERROR=20482]="CLA_ERROR",t[t.INS_ERROR=20483]="INS_ERROR"}(R=exports.StatusCode||(exports.StatusCode={})),function(t){t[t.OK=0]="OK",t[t.NO_LEADING_PACKET=1]="NO_LEADING_PACKET",t[t.COMMAND_OVERLAY=2]="COMMAND_OVERLAY",t[t.INVALID_COMMAND=3]="INVALID_COMMAND",t[t.INCORRENT_PARAMETER_SIZE=4]="INCORRENT_PARAMETER_SIZE",t[t.INVALID_PARAMETER_VALUE=5]="INVALID_PARAMETER_VALUE",t[t.NOT_FOUND=6]="NOT_FOUND",t[t.ALREADY_EXIST=7]="ALREADY_EXIST",t[t.IO_ERROR=8]="IO_ERROR",t[t.NOT_SUPPORT=9]="NOT_SUPPORT"}(d=exports.StatusCodeV2||(exports.StatusCodeV2={})); |
{ | ||
"name": "@secux/utility", | ||
"version": "3.0.11", | ||
"version": "3.0.12", | ||
"description": "SecuX Hardware Wallet internal tools for SDK", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
"scripts": { | ||
"build": "sh ../../build.sh && sh dist.sh", | ||
"build": "sh ../../build.sh", | ||
"test": "echo \"Error: run tests from root\" && exit 1", | ||
@@ -29,0 +29,0 @@ "tsc": "tsc" |
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
395
9
48821