@onekeyfe/hd-transport 1.1.22-alpha.6 → 1.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
1
  const { parseConfigure } = require('../src/serialization/protobuf/messages');
2
2
  const { buildOne } = require('../src/serialization/send');
3
3
  const { receiveOne } = require('../src/serialization/receive');
4
-
5
4
  const { buildEncodeBuffers } = require('../src/serialization/send');
6
5
 
7
6
  const messages = {
@@ -1,4 +1,5 @@
1
1
  const ProtoBuf = require('protobufjs/light');
2
+
2
3
  const { encode } = require('../src/serialization/protobuf/encode');
3
4
  const { decode } = require('../src/serialization/protobuf/decode');
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAGL,QAAQ,EACR,cAAc,EACd,cAAc,EACd,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAKlD,YAAY,EACV,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,2BAA2B,EAC3B,iBAAiB,EACjB,6BAA6B,EAC7B,cAAc,EACd,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AAExC,cAAc,aAAa,CAAC;;;;;;;;;;AAE5B,wBAQE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAG7C,OAAO,EAGL,QAAQ,EACR,cAAc,EACd,cAAc,EACd,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAKlD,YAAY,EACV,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,2BAA2B,EAC3B,iBAAiB,EACjB,6BAA6B,EAC7B,cAAc,EACd,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AAExC,cAAc,aAAa,CAAC;;;;;;;;;;AAE5B,wBAQE"}
@@ -1,5 +1,5 @@
1
- import { Type } from 'protobufjs/light';
2
1
  import ByteBuffer from 'bytebuffer';
2
+ import type { Type } from 'protobufjs/light';
3
3
  export declare const decode: (Message: Type, data: ByteBuffer) => {
4
4
  [key: string]: any;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/serialization/protobuf/decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,kBAAkB,CAAC;AACxD,OAAO,UAAU,MAAM,YAAY,CAAC;AAuEpC,eAAO,MAAM,MAAM,YAAa,IAAI,QAAQ,UAAU;;CAsBrD,CAAC"}
1
+ {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/serialization/protobuf/decode.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAIpC,OAAO,KAAK,EAAkB,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAsE7D,eAAO,MAAM,MAAM,YAAa,IAAI,QAAQ,UAAU;;CAsBrD,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Type } from 'protobufjs/light';
2
1
  import ByteBuffer from 'bytebuffer';
2
+ import type { Type } from 'protobufjs/light';
3
3
  export declare function patch(Message: Type, payload: any): any;
4
4
  export declare const encode: (Message: Type, data: Record<string, unknown>) => ByteBuffer;
5
5
  //# sourceMappingURL=encode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/serialization/protobuf/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,UAAU,MAAM,YAAY,CAAC;AAqBpC,wBAAgB,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OA4ChD;AAED,eAAO,MAAM,MAAM,YAAa,IAAI,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,eASlE,CAAC"}
1
+ {"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/serialization/protobuf/encode.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAIpC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAmB7C,wBAAgB,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OA4ChD;AAED,eAAO,MAAM,MAAM,YAAa,IAAI,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,eASlE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/serialization/protocol/decode.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAyBpC,eAAO,MAAM,MAAM,eAAgB,UAAU;;;CAO5C,CAAC;AAIF,eAAO,MAAM,aAAa,UAAW,WAAW;;;;CAW/C,CAAC"}
1
+ {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/serialization/protocol/decode.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AA0BpC,eAAO,MAAM,MAAM,eAAgB,UAAU;;;CAO5C,CAAC;AAIF,eAAO,MAAM,aAAa,UAAW,WAAW;;;;CAW/C,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Root } from 'protobufjs/light';
1
+ import type { Root } from 'protobufjs/light';
2
2
  export declare function receiveOne(messages: Root, data: string): {
3
3
  message: {
4
4
  [key: string]: any;
@@ -1 +1 @@
1
- {"version":3,"file":"receive.d.ts","sourceRoot":"","sources":["../../src/serialization/receive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAOxC,wBAAgB,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM;;;;;EAUtD"}
1
+ {"version":3,"file":"receive.d.ts","sourceRoot":"","sources":["../../src/serialization/receive.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,wBAAgB,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM;;;;;EAUtD"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
- import { Root } from 'protobufjs/light';
3
2
  import ByteBuffer from 'bytebuffer';
3
+ import type { Root } from 'protobufjs/light';
4
4
  export declare function buildOne(messages: Root, name: string, data: Record<string, unknown>): Buffer;
5
5
  export declare const buildEncodeBuffers: (messages: Root, name: string, data: Record<string, unknown>) => Buffer[];
6
6
  export declare const buildBuffers: (messages: Root, name: string, data: Record<string, unknown>) => ByteBuffer[];
@@ -1 +1 @@
1
- {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/serialization/send.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AAQpC,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UASnF;AAED,eAAO,MAAM,kBAAkB,aAAc,IAAI,QAAQ,MAAM,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,aAQ7F,CAAC;AAEF,eAAO,MAAM,YAAY,aAAc,IAAI,QAAQ,MAAM,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,iBAsBvF,CAAC"}
1
+ {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/serialization/send.ts"],"names":[],"mappings":";AAGA,OAAO,UAAU,MAAM,YAAY,CAAC;AAOpC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UASnF;AAED,eAAO,MAAM,kBAAkB,aAAc,IAAI,QAAQ,MAAM,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,aAQ7F,CAAC;AAEF,eAAO,MAAM,YAAY,aAAc,IAAI,QAAQ,MAAM,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,iBAsBvF,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { OneKeyDeviceInfoWithSession, MessageFromOneKey } from '../types';
1
+ import type { MessageFromOneKey, OneKeyDeviceInfoWithSession } from '../types';
2
2
  export declare function info(res: any): {
3
3
  version: string;
4
4
  configured: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"highlevel-checks.d.ts","sourceRoot":"","sources":["../../src/utils/highlevel-checks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI/E,wBAAgB,IAAI,CAAC,GAAG,EAAE,GAAG;;;EAU5B;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,GAAG,UAKnC;AAYD,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,CAAC,2BAA2B,CAAC,CA0BpE;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,UAS/B;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,iBAAiB,CAahD"}
1
+ {"version":3,"file":"highlevel-checks.d.ts","sourceRoot":"","sources":["../../src/utils/highlevel-checks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAI/E,wBAAgB,IAAI,CAAC,GAAG,EAAE,GAAG;;;EAU5B;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,GAAG,UAKnC;AAYD,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,CAAC,2BAA2B,CAAC,CA0BpE;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,UAS/B;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,iBAAiB,CAahD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport",
3
- "version": "1.1.22-alpha.6",
3
+ "version": "1.1.22",
4
4
  "description": "Transport layer abstractions and utilities for OneKey hardware SDK.",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -28,5 +28,5 @@
28
28
  "long": "^4.0.0",
29
29
  "protobufjs": "^6.11.2"
30
30
  },
31
- "gitHead": "c49887aa4e741a01b60239fe247441f811e8e3b9"
31
+ "gitHead": "d9d816ec5c818397549202ecb42d127af99a03f1"
32
32
  }
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as protobuf from 'protobufjs/light';
2
2
  import * as Long from 'long';
3
+
3
4
  import {
4
5
  buildBuffers,
5
6
  buildEncodeBuffers,
@@ -1,7 +1,9 @@
1
- import { Type, Message, Field } from 'protobufjs/light';
2
1
  import ByteBuffer from 'bytebuffer';
2
+
3
3
  import { isPrimitiveField } from '../../utils/protobuf';
4
4
 
5
+ import type { Field, Message, Type } from 'protobufjs/light';
6
+
5
7
  const transform = (field: Field, value: any) => {
6
8
  // [compatibility]: optional undefined keys should be null. Example: Features.fw_major.
7
9
  if (field?.optional && typeof value === 'undefined') {
@@ -1,9 +1,10 @@
1
- import { Type } from 'protobufjs/light';
2
1
  import { Buffer } from 'buffer';
3
2
  import ByteBuffer from 'bytebuffer';
4
3
 
5
4
  import { isPrimitiveField } from '../../utils/protobuf';
6
5
 
6
+ import type { Type } from 'protobufjs/light';
7
+
7
8
  const transform = (fieldType: string, value: any) => {
8
9
  if (fieldType === 'bytes') {
9
10
  // special edge case
@@ -1,4 +1,5 @@
1
1
  import ByteBuffer from 'bytebuffer';
2
+
2
3
  import { MESSAGE_HEADER_BYTE } from '../../constants';
3
4
 
4
5
  /**
@@ -1,6 +1,6 @@
1
1
  import ByteBuffer from 'bytebuffer';
2
2
 
3
- import { HEADER_SIZE, MESSAGE_HEADER_BYTE, BUFFER_SIZE } from '../../constants';
3
+ import { BUFFER_SIZE, HEADER_SIZE, MESSAGE_HEADER_BYTE } from '../../constants';
4
4
 
5
5
  type Options<Chunked> = {
6
6
  chunked: Chunked;
@@ -1,10 +1,11 @@
1
- import { Root } from 'protobufjs/light';
2
1
  import ByteBuffer from 'bytebuffer';
3
2
 
4
3
  import * as decodeProtobuf from './protobuf/decode';
5
4
  import * as decodeProtocol from './protocol/decode';
6
5
  import { createMessageFromType } from './protobuf/messages';
7
6
 
7
+ import type { Root } from 'protobufjs/light';
8
+
8
9
  export function receiveOne(messages: Root, data: string) {
9
10
  const bytebuffer = ByteBuffer.wrap(data, 'hex');
10
11
 
@@ -1,13 +1,15 @@
1
1
  // Logic of sending data to trezor
2
2
  //
3
3
  // Logic of "call" is broken to two parts - sending and receiving
4
- import { Root } from 'protobufjs/light';
5
4
  import ByteBuffer from 'bytebuffer';
5
+
6
6
  import { encode as encodeProtobuf } from './protobuf';
7
7
  import { encode as encodeProtocol } from './protocol';
8
8
  import { createMessageFromName } from './protobuf/messages';
9
9
  import { BUFFER_SIZE, MESSAGE_TOP_CHAR } from '../constants';
10
10
 
11
+ import type { Root } from 'protobufjs/light';
12
+
11
13
  // Sends message to device.
12
14
  // Resolves if everything gets sent
13
15
  export function buildOne(messages: Root, name: string, data: Record<string, unknown>) {
@@ -1,6 +1,6 @@
1
1
  // input checks for high-level transports
2
2
 
3
- import type { OneKeyDeviceInfoWithSession, MessageFromOneKey } from '../types';
3
+ import type { MessageFromOneKey, OneKeyDeviceInfoWithSession } from '../types';
4
4
 
5
5
  const ERROR = 'Wrong result type.';
6
6