@ukeyfe/hardware-transport 1.1.13
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.
- package/.eslintrc +24 -0
- package/README.md +29 -0
- package/__tests__/build-receive.test.js +117 -0
- package/__tests__/decode-features.test.js +72 -0
- package/__tests__/encode-decode-basic.test.js +272 -0
- package/__tests__/encode-decode.test.js +532 -0
- package/__tests__/messages.test.js +86 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/index.d.ts +5203 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +942 -0
- package/dist/serialization/index.d.ts +6 -0
- package/dist/serialization/index.d.ts.map +1 -0
- package/dist/serialization/protobuf/decode.d.ts +6 -0
- package/dist/serialization/protobuf/decode.d.ts.map +1 -0
- package/dist/serialization/protobuf/encode.d.ts +5 -0
- package/dist/serialization/protobuf/encode.d.ts.map +1 -0
- package/dist/serialization/protobuf/index.d.ts +4 -0
- package/dist/serialization/protobuf/index.d.ts.map +1 -0
- package/dist/serialization/protobuf/messages.d.ts +11 -0
- package/dist/serialization/protobuf/messages.d.ts.map +1 -0
- package/dist/serialization/protocol/decode.d.ts +11 -0
- package/dist/serialization/protocol/decode.d.ts.map +1 -0
- package/dist/serialization/protocol/encode.d.ts +11 -0
- package/dist/serialization/protocol/encode.d.ts.map +1 -0
- package/dist/serialization/protocol/index.d.ts +3 -0
- package/dist/serialization/protocol/index.d.ts.map +1 -0
- package/dist/serialization/receive.d.ts +8 -0
- package/dist/serialization/receive.d.ts.map +1 -0
- package/dist/serialization/send.d.ts +7 -0
- package/dist/serialization/send.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/messages.d.ts +3762 -0
- package/dist/types/messages.d.ts.map +1 -0
- package/dist/types/transport.d.ts +62 -0
- package/dist/types/transport.d.ts.map +1 -0
- package/dist/utils/highlevel-checks.d.ts +10 -0
- package/dist/utils/highlevel-checks.d.ts.map +1 -0
- package/dist/utils/logBlockCommand.d.ts +2 -0
- package/dist/utils/logBlockCommand.d.ts.map +1 -0
- package/dist/utils/protobuf.d.ts +2 -0
- package/dist/utils/protobuf.d.ts.map +1 -0
- package/jest.config.js +7 -0
- package/package.json +31 -0
- package/protocol.md +21 -0
- package/scripts/protobuf-build.sh +58 -0
- package/scripts/protobuf-patches/TxAck.js +44 -0
- package/scripts/protobuf-patches/TxInputType.js +49 -0
- package/scripts/protobuf-patches/TxOutputType.js +50 -0
- package/scripts/protobuf-patches/index.js +274 -0
- package/scripts/protobuf-types.js +283 -0
- package/src/constants.ts +8 -0
- package/src/index.ts +41 -0
- package/src/serialization/index.ts +8 -0
- package/src/serialization/protobuf/decode.ts +95 -0
- package/src/serialization/protobuf/encode.ts +79 -0
- package/src/serialization/protobuf/index.ts +3 -0
- package/src/serialization/protobuf/messages.ts +37 -0
- package/src/serialization/protocol/decode.ts +48 -0
- package/src/serialization/protocol/encode.ts +59 -0
- package/src/serialization/protocol/index.ts +2 -0
- package/src/serialization/receive.ts +18 -0
- package/src/serialization/send.ts +56 -0
- package/src/types/index.ts +2 -0
- package/src/types/messages.ts +4864 -0
- package/src/types/transport.ts +71 -0
- package/src/utils/highlevel-checks.ts +88 -0
- package/src/utils/logBlockCommand.ts +1 -0
- package/src/utils/protobuf.ts +24 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/serialization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAE1B,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Type } from 'protobufjs/light';
|
|
2
|
+
import ByteBuffer from 'bytebuffer';
|
|
3
|
+
export declare function patch(Message: Type, payload: any): any;
|
|
4
|
+
export declare const encode: (Message: Type, data: Record<string, unknown>) => ByteBuffer;
|
|
5
|
+
//# sourceMappingURL=encode.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/serialization/protobuf/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as protobuf from 'protobufjs/light';
|
|
2
|
+
export declare function parseConfigure(data: protobuf.INamespace): protobuf.Root;
|
|
3
|
+
export declare const createMessageFromName: (messages: protobuf.Root, name: string) => {
|
|
4
|
+
Message: protobuf.Type;
|
|
5
|
+
messageType: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const createMessageFromType: (messages: protobuf.Root, typeId: number) => {
|
|
8
|
+
Message: protobuf.Type;
|
|
9
|
+
messageName: string;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/serialization/protobuf/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,iBAMvD;AAED,eAAO,MAAM,qBAAqB,aAAc,SAAS,IAAI,QAAQ,MAAM;;;CAa1E,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,SAAS,IAAI,UAAU,MAAM;;;CAW5E,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import ByteBuffer from 'bytebuffer';
|
|
2
|
+
export declare const decode: (byteBuffer: ByteBuffer) => {
|
|
3
|
+
typeId: number;
|
|
4
|
+
buffer: ByteBuffer;
|
|
5
|
+
};
|
|
6
|
+
export declare const decodeChunked: (bytes: ArrayBuffer) => {
|
|
7
|
+
length: number;
|
|
8
|
+
typeId: number;
|
|
9
|
+
restBuffer: ByteBuffer;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import ByteBuffer from 'bytebuffer';
|
|
3
|
+
type Options<Chunked> = {
|
|
4
|
+
chunked: Chunked;
|
|
5
|
+
addTrezorHeaders: boolean;
|
|
6
|
+
messageType: number;
|
|
7
|
+
};
|
|
8
|
+
declare function encode(data: ByteBuffer, options: Options<true>): Buffer[];
|
|
9
|
+
declare function encode(data: ByteBuffer, options: Options<false>): Buffer;
|
|
10
|
+
export { encode };
|
|
11
|
+
//# sourceMappingURL=encode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/serialization/protocol/encode.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAIpC,KAAK,OAAO,CAAC,OAAO,IAAI;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,iBAAS,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC;AACpE,iBAAS,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;AA+CnE,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/serialization/protocol/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Root } from 'protobufjs/light';
|
|
3
|
+
import ByteBuffer from 'bytebuffer';
|
|
4
|
+
export declare function buildOne(messages: Root, name: string, data: Record<string, unknown>): Buffer;
|
|
5
|
+
export declare const buildEncodeBuffers: (messages: Root, name: string, data: Record<string, unknown>) => Buffer[];
|
|
6
|
+
export declare const buildBuffers: (messages: Root, name: string, data: Record<string, unknown>) => ByteBuffer[];
|
|
7
|
+
//# sourceMappingURL=send.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC"}
|