@ledgerhq/hw-ledger-key-ring-protocol 0.5.2 → 0.5.3-nightly.1
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +14 -0
- package/package.json +3 -3
- package/lib/__tests__/codec.d.ts +0 -2
- package/lib/__tests__/codec.d.ts.map +0 -1
- package/lib/__tests__/codec.js +0 -99
- package/lib/__tests__/codec.js.map +0 -1
- package/lib/__tests__/crypto.d.ts +0 -2
- package/lib/__tests__/crypto.d.ts.map +0 -1
- package/lib/__tests__/crypto.js +0 -37
- package/lib/__tests__/crypto.js.map +0 -1
- package/lib/__tests__/indexed_tree.d.ts +0 -2
- package/lib/__tests__/indexed_tree.d.ts.map +0 -1
- package/lib/__tests__/indexed_tree.js +0 -44
- package/lib/__tests__/indexed_tree.js.map +0 -1
- package/lib/__tests__/key_exchange.d.ts +0 -2
- package/lib/__tests__/key_exchange.d.ts.map +0 -1
- package/lib/__tests__/key_exchange.js +0 -120
- package/lib/__tests__/key_exchange.js.map +0 -1
- package/lib/__tests__/seedId.d.ts +0 -2
- package/lib/__tests__/seedId.d.ts.map +0 -1
- package/lib/__tests__/seedId.js +0 -92
- package/lib/__tests__/seedId.js.map +0 -1
- package/lib/__tests__/shared_object.d.ts +0 -2
- package/lib/__tests__/shared_object.d.ts.map +0 -1
- package/lib/__tests__/shared_object.js +0 -65
- package/lib/__tests__/shared_object.js.map +0 -1
- package/lib/__tests__/units/NobleCrypto.test.d.ts +0 -2
- package/lib/__tests__/units/NobleCrypto.test.d.ts.map +0 -1
- package/lib/__tests__/units/NobleCrypto.test.js +0 -58
- package/lib/__tests__/units/NobleCrypto.test.js.map +0 -1
- package/lib-es/__tests__/codec.d.ts +0 -2
- package/lib-es/__tests__/codec.d.ts.map +0 -1
- package/lib-es/__tests__/codec.js +0 -97
- package/lib-es/__tests__/codec.js.map +0 -1
- package/lib-es/__tests__/crypto.d.ts +0 -2
- package/lib-es/__tests__/crypto.d.ts.map +0 -1
- package/lib-es/__tests__/crypto.js +0 -35
- package/lib-es/__tests__/crypto.js.map +0 -1
- package/lib-es/__tests__/indexed_tree.d.ts +0 -2
- package/lib-es/__tests__/indexed_tree.d.ts.map +0 -1
- package/lib-es/__tests__/indexed_tree.js +0 -42
- package/lib-es/__tests__/indexed_tree.js.map +0 -1
- package/lib-es/__tests__/key_exchange.d.ts +0 -2
- package/lib-es/__tests__/key_exchange.d.ts.map +0 -1
- package/lib-es/__tests__/key_exchange.js +0 -115
- package/lib-es/__tests__/key_exchange.js.map +0 -1
- package/lib-es/__tests__/seedId.d.ts +0 -2
- package/lib-es/__tests__/seedId.d.ts.map +0 -1
- package/lib-es/__tests__/seedId.js +0 -90
- package/lib-es/__tests__/seedId.js.map +0 -1
- package/lib-es/__tests__/shared_object.d.ts +0 -2
- package/lib-es/__tests__/shared_object.d.ts.map +0 -1
- package/lib-es/__tests__/shared_object.js +0 -63
- package/lib-es/__tests__/shared_object.js.map +0 -1
- package/lib-es/__tests__/units/NobleCrypto.test.d.ts +0 -2
- package/lib-es/__tests__/units/NobleCrypto.test.d.ts.map +0 -1
- package/lib-es/__tests__/units/NobleCrypto.test.js +0 -56
- package/lib-es/__tests__/units/NobleCrypto.test.js.map +0 -1
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { NobleCryptoSecp256k1 } from "../../NobleCrypto";
|
|
2
|
-
describe("NobleCryptoSecp256k1", () => {
|
|
3
|
-
const crypto = new NobleCryptoSecp256k1();
|
|
4
|
-
describe("derEncode", () => {
|
|
5
|
-
it("should encode a valid DER signature", () => {
|
|
6
|
-
// The R component starts with a byte < 0x80
|
|
7
|
-
// The S component starts with a 0 but the next byte is >= 0x80
|
|
8
|
-
const der32 = crypto.derEncode(Uint8Array.from([
|
|
9
|
-
...Buffer.from("4802f9f997e06b7e98ec35ba75a10a0e0a5bd1a15767d7d1124869301081d891", "hex"),
|
|
10
|
-
...Buffer.from("008022731cd6cd05ac285829d8d588b51bb4c5be5bad5a44cbd966fcf670f809", "hex"),
|
|
11
|
-
]));
|
|
12
|
-
expect(Buffer.from(der32).toString("hex")).toBe(noWS `
|
|
13
|
-
30 44
|
|
14
|
-
02 20 4802f9f997e06b7e98ec35ba75a10a0e0a5bd1a15767d7d1124869301081d891
|
|
15
|
-
02 20 008022731cd6cd05ac285829d8d588b51bb4c5be5bad5a44cbd966fcf670f809
|
|
16
|
-
`);
|
|
17
|
-
// The R and S component both start with a byte >= 0x80
|
|
18
|
-
const der33 = crypto.derEncode(Uint8Array.from([
|
|
19
|
-
...Buffer.from("8002f9f997e06b7e98ec35ba75a10a0e0a5bd1a15767d7d1124869301081d891", "hex"),
|
|
20
|
-
...Buffer.from("ff7222731cd6cd05ac285829d8d588b51bb4c5be5bad5a44cbd966fcf670f809", "hex"),
|
|
21
|
-
]));
|
|
22
|
-
expect(Buffer.from(der33).toString("hex")).toBe(noWS `
|
|
23
|
-
30 46
|
|
24
|
-
02 21 008002f9f997e06b7e98ec35ba75a10a0e0a5bd1a15767d7d1124869301081d891
|
|
25
|
-
02 21 00ff7222731cd6cd05ac285829d8d588b51bb4c5be5bad5a44cbd966fcf670f809
|
|
26
|
-
`);
|
|
27
|
-
// The R and S component both start with a 0 then have a byte < 0x80
|
|
28
|
-
const der31 = crypto.derEncode(Uint8Array.from([
|
|
29
|
-
...Buffer.from("0002f9f997e06b7e98ec35ba75a10a0e0a5bd1a15767d7d1124869301081d891", "hex"),
|
|
30
|
-
...Buffer.from("007222731cd6cd05ac285829d8d588b51bb4c5be5bad5a44cbd966fcf670f809", "hex"),
|
|
31
|
-
]));
|
|
32
|
-
expect(Buffer.from(der31).toString("hex")).toBe(noWS `
|
|
33
|
-
30 42
|
|
34
|
-
02 1f 02f9f997e06b7e98ec35ba75a10a0e0a5bd1a15767d7d1124869301081d891
|
|
35
|
-
02 1f 7222731cd6cd05ac285829d8d588b51bb4c5be5bad5a44cbd966fcf670f809
|
|
36
|
-
`);
|
|
37
|
-
// The R and S component both start several leading 0s
|
|
38
|
-
const derLeadingZeros = crypto.derEncode(Uint8Array.from([
|
|
39
|
-
...Buffer.from("000000f997e06b7e98ec35ba75a10a0e0a5bd1a15767d7d1124869301081d891", "hex"),
|
|
40
|
-
...Buffer.from("000000731cd6cd05ac285829d8d588b51bb4c5be5bad5a44cbd966fcf670f809", "hex"),
|
|
41
|
-
]));
|
|
42
|
-
expect(Buffer.from(derLeadingZeros).toString("hex")).toBe(noWS `
|
|
43
|
-
30 3f
|
|
44
|
-
02 1e 00f997e06b7e98ec35ba75a10a0e0a5bd1a15767d7d1124869301081d891
|
|
45
|
-
02 1d 731cd6cd05ac285829d8d588b51bb4c5be5bad5a44cbd966fcf670f809
|
|
46
|
-
`);
|
|
47
|
-
});
|
|
48
|
-
it("should throw if a component is null", () => {
|
|
49
|
-
expect(() => crypto.derEncode(Uint8Array.from({ length: 64 }, () => 0))).toThrow(`Invalid DER component: 0000000000000000000000000000000000000000000000000000000000000000`);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
function noWS(...str) {
|
|
54
|
-
return str.join("").replace(/\s+/g, "");
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=NobleCrypto.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NobleCrypto.test.js","sourceRoot":"","sources":["../../../src/__tests__/units/NobleCrypto.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,MAAM,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE1C,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;YAC7C,4CAA4C;YAC5C,+DAA+D;YAC/D,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAC5B,UAAU,CA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