@zondax/ledger-cosmos-js 2.1.8 → 3.0.0
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/LICENSE +1 -1
- package/README.md +39 -7
- package/dist/commandsV1.d.ts +4 -0
- package/dist/commandsV1.js +129 -0
- package/dist/commandsV1.js.map +1 -0
- package/dist/commandsV2.d.ts +4 -0
- package/dist/commandsV2.js +104 -0
- package/dist/commandsV2.js.map +1 -0
- package/dist/common.d.ts +39 -0
- package/dist/common.js +143 -132
- package/dist/common.js.map +1 -0
- package/dist/cosmosApp.d.ts +19 -0
- package/dist/cosmosApp.js +377 -0
- package/dist/cosmosApp.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +17 -608
- package/dist/index.js.map +1 -0
- package/package.json +64 -50
- package/yarn.lock +6661 -0
- package/.babelrc +0 -13
- package/.circleci/config.yml +0 -62
- package/.editorconfig +0 -14
- package/.eslintrc.json +0 -31
- package/.idea/codeStyles/Project.xml +0 -57
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/ledger-cosmos-js.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -57
- package/.prettierrc.json +0 -4
- package/certs/.gitkeep +0 -0
- package/certs/openssl.cnf +0 -12
- package/dist/helperV1.js +0 -127
- package/dist/helperV2.js +0 -97
- package/docs/example.png +0 -0
- package/jest.config.integration.js +0 -9
- package/jest.config.js +0 -32
- package/jest.config.unit.js +0 -9
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/common.js +0 -114
- package/src/helperV1.js +0 -73
- package/src/helperV2.js +0 -44
- package/src/index.js +0 -336
- package/tests/basic.ispec.js +0 -390
- package/tests/basic.spec.js +0 -8
- package/tests/jest.js +0 -2
- package/vue.config.js +0 -11
- package/vue_example/App.vue +0 -29
- package/vue_example/assets/logo.png +0 -0
- package/vue_example/components/LedgerExample.vue +0 -252
- package/vue_example/main.js +0 -9
package/.babelrc
DELETED
package/.circleci/config.yml
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
|
|
3
|
-
defaults: &defaults
|
|
4
|
-
working_directory: ~/repo
|
|
5
|
-
docker:
|
|
6
|
-
- image: circleci/node:12.13.1
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
<<: *defaults
|
|
11
|
-
steps:
|
|
12
|
-
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
|
|
13
|
-
- checkout
|
|
14
|
-
- run: yarn install
|
|
15
|
-
- run: yarn build
|
|
16
|
-
|
|
17
|
-
test:
|
|
18
|
-
<<: *defaults
|
|
19
|
-
steps:
|
|
20
|
-
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
|
|
21
|
-
- checkout
|
|
22
|
-
- run: yarn install
|
|
23
|
-
- run: yarn test:unit
|
|
24
|
-
|
|
25
|
-
publish:
|
|
26
|
-
<<: *defaults
|
|
27
|
-
steps:
|
|
28
|
-
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
|
|
29
|
-
- checkout
|
|
30
|
-
- run: yarn install
|
|
31
|
-
- run: yarn build
|
|
32
|
-
- run:
|
|
33
|
-
name: prepare authentication config
|
|
34
|
-
command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/repo/.npmrc
|
|
35
|
-
- run:
|
|
36
|
-
name: Update tag
|
|
37
|
-
command: npm --no-git-tag-version version $CIRCLE_TAG
|
|
38
|
-
- run:
|
|
39
|
-
name: Publish package
|
|
40
|
-
command: npm publish
|
|
41
|
-
|
|
42
|
-
workflows:
|
|
43
|
-
version: 2
|
|
44
|
-
test-suite:
|
|
45
|
-
jobs:
|
|
46
|
-
- build:
|
|
47
|
-
filters:
|
|
48
|
-
tags:
|
|
49
|
-
only: /.*/
|
|
50
|
-
- test:
|
|
51
|
-
filters:
|
|
52
|
-
tags:
|
|
53
|
-
only: /.*/
|
|
54
|
-
- publish:
|
|
55
|
-
requires:
|
|
56
|
-
- build
|
|
57
|
-
- test
|
|
58
|
-
filters:
|
|
59
|
-
tags:
|
|
60
|
-
only: /^v[0-9]+(\.[0-9]+)*/
|
|
61
|
-
branches:
|
|
62
|
-
ignore: /.*/
|
package/.editorconfig
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es6": true,
|
|
5
|
-
"node": true,
|
|
6
|
-
"jest/globals": true
|
|
7
|
-
},
|
|
8
|
-
"plugins": [
|
|
9
|
-
"jest",
|
|
10
|
-
"prettier"
|
|
11
|
-
],
|
|
12
|
-
"extends": [
|
|
13
|
-
"airbnb-base",
|
|
14
|
-
"plugin:vue/recommended",
|
|
15
|
-
"plugin:prettier/recommended"
|
|
16
|
-
],
|
|
17
|
-
"globals": {
|
|
18
|
-
"Atomics": "readonly",
|
|
19
|
-
"SharedArrayBuffer": "readonly"
|
|
20
|
-
},
|
|
21
|
-
"parserOptions": {
|
|
22
|
-
"parser": "babel-eslint",
|
|
23
|
-
"ecmaVersion": 2018,
|
|
24
|
-
"sourceType": "module"
|
|
25
|
-
},
|
|
26
|
-
"rules": {
|
|
27
|
-
"import/prefer-default-export": "off",
|
|
28
|
-
"vue/html-self-closing": "off",
|
|
29
|
-
"vue/max-attributes-per-line": "off"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
-
<code_scheme name="Project" version="173">
|
|
3
|
-
<HTMLCodeStyleSettings>
|
|
4
|
-
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
5
|
-
</HTMLCodeStyleSettings>
|
|
6
|
-
<JSCodeStyleSettings version="0">
|
|
7
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
8
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
9
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
10
|
-
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
11
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
12
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
13
|
-
</JSCodeStyleSettings>
|
|
14
|
-
<TypeScriptCodeStyleSettings version="0">
|
|
15
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
16
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
17
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
18
|
-
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
19
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
20
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
21
|
-
</TypeScriptCodeStyleSettings>
|
|
22
|
-
<VueCodeStyleSettings>
|
|
23
|
-
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
|
24
|
-
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
|
25
|
-
</VueCodeStyleSettings>
|
|
26
|
-
<codeStyleSettings language="HTML">
|
|
27
|
-
<option name="SOFT_MARGINS" value="110" />
|
|
28
|
-
<indentOptions>
|
|
29
|
-
<option name="INDENT_SIZE" value="2" />
|
|
30
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
31
|
-
<option name="TAB_SIZE" value="2" />
|
|
32
|
-
</indentOptions>
|
|
33
|
-
</codeStyleSettings>
|
|
34
|
-
<codeStyleSettings language="JavaScript">
|
|
35
|
-
<option name="SOFT_MARGINS" value="110" />
|
|
36
|
-
<indentOptions>
|
|
37
|
-
<option name="INDENT_SIZE" value="2" />
|
|
38
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
39
|
-
<option name="TAB_SIZE" value="2" />
|
|
40
|
-
</indentOptions>
|
|
41
|
-
</codeStyleSettings>
|
|
42
|
-
<codeStyleSettings language="TypeScript">
|
|
43
|
-
<option name="SOFT_MARGINS" value="110" />
|
|
44
|
-
<indentOptions>
|
|
45
|
-
<option name="INDENT_SIZE" value="2" />
|
|
46
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
47
|
-
<option name="TAB_SIZE" value="2" />
|
|
48
|
-
</indentOptions>
|
|
49
|
-
</codeStyleSettings>
|
|
50
|
-
<codeStyleSettings language="Vue">
|
|
51
|
-
<option name="SOFT_MARGINS" value="110" />
|
|
52
|
-
<indentOptions>
|
|
53
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
54
|
-
</indentOptions>
|
|
55
|
-
</codeStyleSettings>
|
|
56
|
-
</code_scheme>
|
|
57
|
-
</component>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/ledger-cosmos-js.iml" filepath="$PROJECT_DIR$/.idea/ledger-cosmos-js.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/.idea/vcs.xml
DELETED
package/.idea/workspace.xml
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="AutoImportSettings">
|
|
4
|
-
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
|
-
</component>
|
|
6
|
-
<component name="ChangeListManager">
|
|
7
|
-
<list default="true" id="50258102-ecde-405f-adc0-c05c082db363" name="Default Changelist" comment="">
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
9
|
-
</list>
|
|
10
|
-
<option name="SHOW_DIALOG" value="false" />
|
|
11
|
-
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
12
|
-
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
13
|
-
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
14
|
-
</component>
|
|
15
|
-
<component name="Git.Settings">
|
|
16
|
-
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
17
|
-
</component>
|
|
18
|
-
<component name="ProjectId" id="1iKAFGlk2weYwDfWlA9vo1mMlMs" />
|
|
19
|
-
<component name="ProjectViewState">
|
|
20
|
-
<option name="hideEmptyMiddlePackages" value="true" />
|
|
21
|
-
<option name="showLibraryContents" value="true" />
|
|
22
|
-
</component>
|
|
23
|
-
<component name="PropertiesComponent">
|
|
24
|
-
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
|
25
|
-
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
|
26
|
-
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
27
|
-
<property name="javascript.nodejs.core.library.configured.version" value="14.5.0" />
|
|
28
|
-
<property name="javascript.nodejs.core.library.typings.version" value="14.11.2" />
|
|
29
|
-
<property name="last_opened_file_path" value="$PROJECT_DIR$/../ledger-filecoin-js/package.json" />
|
|
30
|
-
<property name="node.js.detected.package.eslint" value="true" />
|
|
31
|
-
<property name="node.js.detected.package.tslint" value="true" />
|
|
32
|
-
<property name="node.js.path.for.package.eslint" value="project" />
|
|
33
|
-
<property name="node.js.path.for.package.tslint" value="project" />
|
|
34
|
-
<property name="node.js.selected.package.eslint" value="(autodetect)" />
|
|
35
|
-
<property name="node.js.selected.package.tslint" value="(autodetect)" />
|
|
36
|
-
<property name="nodejs_interpreter_path" value="node" />
|
|
37
|
-
<property name="nodejs_package_manager_path" value="yarn" />
|
|
38
|
-
<property name="settings.editor.selected.configurable" value="preferences.fileTypes" />
|
|
39
|
-
<property name="two.files.diff.last.used.file" value="$PROJECT_DIR$/../ledger-filecoin-js/package.json" />
|
|
40
|
-
<property name="vue.rearranger.settings.migration" value="true" />
|
|
41
|
-
</component>
|
|
42
|
-
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
43
|
-
<component name="TaskManager">
|
|
44
|
-
<task active="true" id="Default" summary="Default task">
|
|
45
|
-
<changelist id="50258102-ecde-405f-adc0-c05c082db363" name="Default Changelist" comment="" />
|
|
46
|
-
<created>1601645804748</created>
|
|
47
|
-
<option name="number" value="Default" />
|
|
48
|
-
<option name="presentableId" value="Default" />
|
|
49
|
-
<updated>1601645804748</updated>
|
|
50
|
-
<workItem from="1601645806220" duration="2762000" />
|
|
51
|
-
</task>
|
|
52
|
-
<servers />
|
|
53
|
-
</component>
|
|
54
|
-
<component name="TypeScriptGeneratedFilesManager">
|
|
55
|
-
<option name="version" value="3" />
|
|
56
|
-
</component>
|
|
57
|
-
</project>
|
package/.prettierrc.json
DELETED
package/certs/.gitkeep
DELETED
|
File without changes
|
package/certs/openssl.cnf
DELETED
package/dist/helperV1.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.serializePathv1 = serializePathv1;
|
|
9
|
-
exports.signSendChunkv1 = signSendChunkv1;
|
|
10
|
-
exports.publicKeyv1 = publicKeyv1;
|
|
11
|
-
|
|
12
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
-
|
|
14
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
-
|
|
16
|
-
var _common = require("./common");
|
|
17
|
-
|
|
18
|
-
function serializePathv1(path) {
|
|
19
|
-
if (path == null || path.length < 3) {
|
|
20
|
-
throw new Error("Invalid path.");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (path.length > 10) {
|
|
24
|
-
throw new Error("Invalid path. Length should be <= 10");
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var buf = Buffer.alloc(1 + 4 * path.length);
|
|
28
|
-
buf.writeUInt8(path.length, 0);
|
|
29
|
-
|
|
30
|
-
for (var i = 0; i < path.length; i += 1) {
|
|
31
|
-
var v = path[i];
|
|
32
|
-
|
|
33
|
-
if (i < 3) {
|
|
34
|
-
// eslint-disable-next-line no-bitwise
|
|
35
|
-
v |= 0x80000000; // Harden
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
buf.writeInt32LE(v, 1 + i * 4);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return buf;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function signSendChunkv1(_x, _x2, _x3, _x4) {
|
|
45
|
-
return _signSendChunkv.apply(this, arguments);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function _signSendChunkv() {
|
|
49
|
-
_signSendChunkv = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(app, chunkIdx, chunkNum, chunk) {
|
|
50
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
51
|
-
while (1) {
|
|
52
|
-
switch (_context.prev = _context.next) {
|
|
53
|
-
case 0:
|
|
54
|
-
return _context.abrupt("return", app.transport.send(_common.CLA, _common.INS.SIGN_SECP256K1, chunkIdx, chunkNum, chunk, [_common.ERROR_CODE.NoError, 0x6984, 0x6a80]).then(function (response) {
|
|
55
|
-
var errorCodeData = response.slice(-2);
|
|
56
|
-
var returnCode = errorCodeData[0] * 256 + errorCodeData[1];
|
|
57
|
-
var errorMessage = (0, _common.errorCodeToString)(returnCode);
|
|
58
|
-
|
|
59
|
-
if (returnCode === 0x6a80 || returnCode === 0x6984) {
|
|
60
|
-
errorMessage = "".concat(errorMessage, " : ").concat(response.slice(0, response.length - 2).toString("ascii"));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
var signature = null;
|
|
64
|
-
|
|
65
|
-
if (response.length > 2) {
|
|
66
|
-
signature = response.slice(0, response.length - 2);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
signature: signature,
|
|
71
|
-
return_code: returnCode,
|
|
72
|
-
error_message: errorMessage
|
|
73
|
-
};
|
|
74
|
-
}, _common.processErrorResponse));
|
|
75
|
-
|
|
76
|
-
case 1:
|
|
77
|
-
case "end":
|
|
78
|
-
return _context.stop();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}, _callee);
|
|
82
|
-
}));
|
|
83
|
-
return _signSendChunkv.apply(this, arguments);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function compressPublicKey(publicKey) {
|
|
87
|
-
if (publicKey.length !== 65) {
|
|
88
|
-
throw new Error("decompressed public key length should be 65 bytes");
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
var y = publicKey.slice(33, 65); // eslint-disable-next-line no-bitwise
|
|
92
|
-
|
|
93
|
-
var z = Buffer.from([2 + (y[y.length - 1] & 1)]);
|
|
94
|
-
return Buffer.concat([z, publicKey.slice(1, 33)]);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function publicKeyv1(_x5, _x6) {
|
|
98
|
-
return _publicKeyv.apply(this, arguments);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function _publicKeyv() {
|
|
102
|
-
_publicKeyv = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(app, data) {
|
|
103
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
104
|
-
while (1) {
|
|
105
|
-
switch (_context2.prev = _context2.next) {
|
|
106
|
-
case 0:
|
|
107
|
-
return _context2.abrupt("return", app.transport.send(_common.CLA, _common.INS.INS_PUBLIC_KEY_SECP256K1, 0, 0, data, [_common.ERROR_CODE.NoError]).then(function (response) {
|
|
108
|
-
var errorCodeData = response.slice(-2);
|
|
109
|
-
var returnCode = errorCodeData[0] * 256 + errorCodeData[1];
|
|
110
|
-
var pk = Buffer.from(response.slice(0, 65));
|
|
111
|
-
return {
|
|
112
|
-
pk: pk,
|
|
113
|
-
compressed_pk: compressPublicKey(pk),
|
|
114
|
-
return_code: returnCode,
|
|
115
|
-
error_message: (0, _common.errorCodeToString)(returnCode)
|
|
116
|
-
};
|
|
117
|
-
}, _common.processErrorResponse));
|
|
118
|
-
|
|
119
|
-
case 1:
|
|
120
|
-
case "end":
|
|
121
|
-
return _context2.stop();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}, _callee2);
|
|
125
|
-
}));
|
|
126
|
-
return _publicKeyv.apply(this, arguments);
|
|
127
|
-
}
|
package/dist/helperV2.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.serializePathv2 = serializePathv2;
|
|
9
|
-
exports.signSendChunkv2 = signSendChunkv2;
|
|
10
|
-
exports.publicKeyv2 = publicKeyv2;
|
|
11
|
-
|
|
12
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
-
|
|
14
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
-
|
|
16
|
-
var _helperV = require("./helperV1");
|
|
17
|
-
|
|
18
|
-
var _common = require("./common");
|
|
19
|
-
|
|
20
|
-
function serializePathv2(path) {
|
|
21
|
-
if (!path || path.length !== 5) {
|
|
22
|
-
throw new Error("Invalid path.");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var buf = Buffer.alloc(20);
|
|
26
|
-
buf.writeUInt32LE(0x80000000 + path[0], 0);
|
|
27
|
-
buf.writeUInt32LE(0x80000000 + path[1], 4);
|
|
28
|
-
buf.writeUInt32LE(0x80000000 + path[2], 8);
|
|
29
|
-
buf.writeUInt32LE(path[3], 12);
|
|
30
|
-
buf.writeUInt32LE(path[4], 16);
|
|
31
|
-
return buf;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function signSendChunkv2(_x, _x2, _x3, _x4) {
|
|
35
|
-
return _signSendChunkv.apply(this, arguments);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _signSendChunkv() {
|
|
39
|
-
_signSendChunkv = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(app, chunkIdx, chunkNum, chunk) {
|
|
40
|
-
var payloadType;
|
|
41
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
|
-
while (1) {
|
|
43
|
-
switch (_context.prev = _context.next) {
|
|
44
|
-
case 0:
|
|
45
|
-
payloadType = _common.PAYLOAD_TYPE.ADD;
|
|
46
|
-
|
|
47
|
-
if (chunkIdx === 1) {
|
|
48
|
-
payloadType = _common.PAYLOAD_TYPE.INIT;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (chunkIdx === chunkNum) {
|
|
52
|
-
payloadType = _common.PAYLOAD_TYPE.LAST;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return _context.abrupt("return", (0, _helperV.signSendChunkv1)(app, payloadType, 0, chunk));
|
|
56
|
-
|
|
57
|
-
case 4:
|
|
58
|
-
case "end":
|
|
59
|
-
return _context.stop();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}, _callee);
|
|
63
|
-
}));
|
|
64
|
-
return _signSendChunkv.apply(this, arguments);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function publicKeyv2(_x5, _x6) {
|
|
68
|
-
return _publicKeyv.apply(this, arguments);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function _publicKeyv() {
|
|
72
|
-
_publicKeyv = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(app, data) {
|
|
73
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
74
|
-
while (1) {
|
|
75
|
-
switch (_context2.prev = _context2.next) {
|
|
76
|
-
case 0:
|
|
77
|
-
return _context2.abrupt("return", app.transport.send(_common.CLA, _common.INS.GET_ADDR_SECP256K1, 0, 0, data, [_common.ERROR_CODE.NoError]).then(function (response) {
|
|
78
|
-
var errorCodeData = response.slice(-2);
|
|
79
|
-
var returnCode = errorCodeData[0] * 256 + errorCodeData[1];
|
|
80
|
-
var compressedPk = Buffer.from(response.slice(0, 33));
|
|
81
|
-
return {
|
|
82
|
-
pk: "OBSOLETE PROPERTY",
|
|
83
|
-
compressed_pk: compressedPk,
|
|
84
|
-
return_code: returnCode,
|
|
85
|
-
error_message: (0, _common.errorCodeToString)(returnCode)
|
|
86
|
-
};
|
|
87
|
-
}, _common.processErrorResponse));
|
|
88
|
-
|
|
89
|
-
case 1:
|
|
90
|
-
case "end":
|
|
91
|
-
return _context2.stop();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}, _callee2);
|
|
95
|
-
}));
|
|
96
|
-
return _publicKeyv.apply(this, arguments);
|
|
97
|
-
}
|
package/docs/example.png
DELETED
|
Binary file
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const config = require("./jest.config");
|
|
2
|
-
|
|
3
|
-
// Override default configuration
|
|
4
|
-
config.testMatch = ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(ispec|test).[tj]s?(x)"];
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line no-console
|
|
7
|
-
console.log("RUNNING INTEGRATION TESTS");
|
|
8
|
-
|
|
9
|
-
module.exports = config;
|
package/jest.config.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
modulePaths: ["<rootDir>/src", "<rootDir>/tests"],
|
|
6
|
-
|
|
7
|
-
moduleNameMapper: {
|
|
8
|
-
"^jest$": "<rootDir>/tests/jest.js",
|
|
9
|
-
"^index.js$": "<rootDir>/src/index.js",
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
// Automatically clear mock calls and instances between every test
|
|
13
|
-
clearMocks: true,
|
|
14
|
-
|
|
15
|
-
// The directory where Jest should output its coverage files
|
|
16
|
-
coverageDirectory: "coverage",
|
|
17
|
-
|
|
18
|
-
// A list of paths to directories that Jest should use to search for files in
|
|
19
|
-
roots: ["<rootDir>"],
|
|
20
|
-
|
|
21
|
-
runner: "jest-serial-runner",
|
|
22
|
-
|
|
23
|
-
// The test environment that will be used for testing
|
|
24
|
-
testEnvironment: "node",
|
|
25
|
-
|
|
26
|
-
// The glob patterns Jest uses to detect test files
|
|
27
|
-
testMatch: [
|
|
28
|
-
"**/__tests__/**/*.[jt]s?(x)",
|
|
29
|
-
"**/?(*.)+(spec|test).[tj]s?(x)",
|
|
30
|
-
"**/?(*.)+(ispec|test).[tj]s?(x)",
|
|
31
|
-
],
|
|
32
|
-
};
|
package/jest.config.unit.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const config = require("./jest.config");
|
|
2
|
-
|
|
3
|
-
// Override default configuration
|
|
4
|
-
config.testMatch = ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[tj]s?(x)"];
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line no-console
|
|
7
|
-
console.log("RUNNING UNIT TESTS");
|
|
8
|
-
|
|
9
|
-
module.exports = config;
|
package/public/favicon.ico
DELETED
|
Binary file
|
package/public/index.html
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
-
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
-
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
|
8
|
-
<title>App Integration Example</title>
|
|
9
|
-
</head>
|
|
10
|
-
<body>
|
|
11
|
-
<noscript>
|
|
12
|
-
<strong>We're sorry but the integration example doesn't work properly when JavaScript is disabled. Please enable it to continue.</strong>
|
|
13
|
-
</noscript>
|
|
14
|
-
<div id="app"></div>
|
|
15
|
-
<!-- built files will be auto injected -->
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|