Skip to content

Commit

Permalink
improving compatibility with v2.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jleni committed Nov 17, 2019
1 parent 007384f commit 2ab5615
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/helperV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function signSendChunkv2(app, chunkIdx, chunkNum, chunk) {
}

export async function publicKeyv2(app, data) {
return this.transport.send(CLA, INS.GET_ADDR_SECP256K1, 0, 0, data, [0x9000]).then(response => {
return app.transport.send(CLA, INS.GET_ADDR_SECP256K1, 0, 0, data, [0x9000]).then(response => {
const errorCodeData = response.slice(-2);
const returnCode = errorCodeData[0] * 256 + errorCodeData[1];
const compressedPk = Buffer.from(response.slice(0, 33));
Expand Down
10 changes: 3 additions & 7 deletions tests/basic.ispec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ test("publicKey", async () => {
// Derivation path. First 3 items are automatically hardened!
const path = [44, 118, 0, 0, 0];

let elapsed = new Date().getTime();
const resp = await app.publicKey(path);
elapsed = new Date().getTime() - elapsed;
console.log("Elapsed: ", elapsed);

console.log(resp);

expect(resp.return_code).toEqual(0x9000);
expect(resp.error_message).toEqual("No errors");
Expand Down Expand Up @@ -217,16 +212,17 @@ test("sign_big_tx", async () => {

expect(responsePk.return_code).toEqual(0x9000);
expect(responsePk.error_message).toEqual("No errors");
expect(responseSign.return_code).toEqual(0x6a80);

switch (app.versionResponse.major) {
case 1:
expect(responseSign.return_code).toEqual(0x6a80);
expect(responseSign.error_message).toEqual(
"Bad key handle : NOMEM: JSON string contains too many tokens",
);
break;
case 2:
expect(responseSign.error_message).toEqual("NOMEM: JSON string contains too many tokens");
expect(responseSign.return_code).toEqual(0x6984);
expect(responseSign.error_message).toEqual("Data is invalid : JSON. Too many tokens");
break;
default:
expect.fail("Version not supported");
Expand Down

0 comments on commit 2ab5615

Please sign in to comment.