@ledgerhq/ledger-key-ring-protocol 0.5.1-nightly.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.
Files changed (180) hide show
  1. package/.eslintrc.js +33 -0
  2. package/.turbo/turbo-build.log +4 -0
  3. package/.unimportedrc.json +16 -0
  4. package/CHANGELOG.md +299 -0
  5. package/LICENSE.txt +21 -0
  6. package/README.md +3 -0
  7. package/jest.config.js +13 -0
  8. package/lib/HWDeviceProvider.d.ts +25 -0
  9. package/lib/HWDeviceProvider.d.ts.map +1 -0
  10. package/lib/HWDeviceProvider.js +88 -0
  11. package/lib/HWDeviceProvider.js.map +1 -0
  12. package/lib/api.d.ts +77 -0
  13. package/lib/api.d.ts.map +1 -0
  14. package/lib/api.js +150 -0
  15. package/lib/api.js.map +1 -0
  16. package/lib/auth.d.ts +3 -0
  17. package/lib/auth.d.ts.map +1 -0
  18. package/lib/auth.js +79 -0
  19. package/lib/auth.js.map +1 -0
  20. package/lib/errors.d.ts +40 -0
  21. package/lib/errors.d.ts.map +1 -0
  22. package/lib/errors.js +18 -0
  23. package/lib/errors.js.map +1 -0
  24. package/lib/index.d.ts +6 -0
  25. package/lib/index.d.ts.map +1 -0
  26. package/lib/index.js +17 -0
  27. package/lib/index.js.map +1 -0
  28. package/lib/mockSdk.d.ts +22 -0
  29. package/lib/mockSdk.d.ts.map +1 -0
  30. package/lib/mockSdk.js +208 -0
  31. package/lib/mockSdk.js.map +1 -0
  32. package/lib/qrcode/cipher.d.ts +12 -0
  33. package/lib/qrcode/cipher.d.ts.map +1 -0
  34. package/lib/qrcode/cipher.js +69 -0
  35. package/lib/qrcode/cipher.js.map +1 -0
  36. package/lib/qrcode/cipher.test.d.ts +2 -0
  37. package/lib/qrcode/cipher.test.d.ts.map +1 -0
  38. package/lib/qrcode/cipher.test.js +40 -0
  39. package/lib/qrcode/cipher.test.js.map +1 -0
  40. package/lib/qrcode/index.d.ts +70 -0
  41. package/lib/qrcode/index.d.ts.map +1 -0
  42. package/lib/qrcode/index.js +312 -0
  43. package/lib/qrcode/index.js.map +1 -0
  44. package/lib/qrcode/index.test.d.ts +2 -0
  45. package/lib/qrcode/index.test.d.ts.map +1 -0
  46. package/lib/qrcode/index.test.js +131 -0
  47. package/lib/qrcode/index.test.js.map +1 -0
  48. package/lib/qrcode/types.d.ts +69 -0
  49. package/lib/qrcode/types.d.ts.map +1 -0
  50. package/lib/qrcode/types.js +3 -0
  51. package/lib/qrcode/types.js.map +1 -0
  52. package/lib/sdk.d.ts +31 -0
  53. package/lib/sdk.d.ts.map +1 -0
  54. package/lib/sdk.js +380 -0
  55. package/lib/sdk.js.map +1 -0
  56. package/lib/store.d.ts +71 -0
  57. package/lib/store.d.ts.map +1 -0
  58. package/lib/store.js +62 -0
  59. package/lib/store.js.map +1 -0
  60. package/lib/types.d.ts +181 -0
  61. package/lib/types.d.ts.map +1 -0
  62. package/lib/types.js +10 -0
  63. package/lib/types.js.map +1 -0
  64. package/lib-es/HWDeviceProvider.d.ts +25 -0
  65. package/lib-es/HWDeviceProvider.d.ts.map +1 -0
  66. package/lib-es/HWDeviceProvider.js +81 -0
  67. package/lib-es/HWDeviceProvider.js.map +1 -0
  68. package/lib-es/api.d.ts +77 -0
  69. package/lib-es/api.d.ts.map +1 -0
  70. package/lib-es/api.js +145 -0
  71. package/lib-es/api.js.map +1 -0
  72. package/lib-es/auth.d.ts +3 -0
  73. package/lib-es/auth.d.ts.map +1 -0
  74. package/lib-es/auth.js +75 -0
  75. package/lib-es/auth.js.map +1 -0
  76. package/lib-es/errors.d.ts +40 -0
  77. package/lib-es/errors.d.ts.map +1 -0
  78. package/lib-es/errors.js +15 -0
  79. package/lib-es/errors.js.map +1 -0
  80. package/lib-es/index.d.ts +6 -0
  81. package/lib-es/index.d.ts.map +1 -0
  82. package/lib-es/index.js +13 -0
  83. package/lib-es/index.js.map +1 -0
  84. package/lib-es/mockSdk.d.ts +22 -0
  85. package/lib-es/mockSdk.d.ts.map +1 -0
  86. package/lib-es/mockSdk.js +201 -0
  87. package/lib-es/mockSdk.js.map +1 -0
  88. package/lib-es/qrcode/cipher.d.ts +12 -0
  89. package/lib-es/qrcode/cipher.d.ts.map +1 -0
  90. package/lib-es/qrcode/cipher.js +61 -0
  91. package/lib-es/qrcode/cipher.js.map +1 -0
  92. package/lib-es/qrcode/cipher.test.d.ts +2 -0
  93. package/lib-es/qrcode/cipher.test.d.ts.map +1 -0
  94. package/lib-es/qrcode/cipher.test.js +38 -0
  95. package/lib-es/qrcode/cipher.test.js.map +1 -0
  96. package/lib-es/qrcode/index.d.ts +70 -0
  97. package/lib-es/qrcode/index.d.ts.map +1 -0
  98. package/lib-es/qrcode/index.js +304 -0
  99. package/lib-es/qrcode/index.js.map +1 -0
  100. package/lib-es/qrcode/index.test.d.ts +2 -0
  101. package/lib-es/qrcode/index.test.d.ts.map +1 -0
  102. package/lib-es/qrcode/index.test.js +126 -0
  103. package/lib-es/qrcode/index.test.js.map +1 -0
  104. package/lib-es/qrcode/types.d.ts +69 -0
  105. package/lib-es/qrcode/types.d.ts.map +1 -0
  106. package/lib-es/qrcode/types.js +2 -0
  107. package/lib-es/qrcode/types.js.map +1 -0
  108. package/lib-es/sdk.d.ts +31 -0
  109. package/lib-es/sdk.d.ts.map +1 -0
  110. package/lib-es/sdk.js +371 -0
  111. package/lib-es/sdk.js.map +1 -0
  112. package/lib-es/store.d.ts +71 -0
  113. package/lib-es/store.d.ts.map +1 -0
  114. package/lib-es/store.js +51 -0
  115. package/lib-es/store.js.map +1 -0
  116. package/lib-es/types.d.ts +181 -0
  117. package/lib-es/types.d.ts.map +1 -0
  118. package/lib-es/types.js +7 -0
  119. package/lib-es/types.js.map +1 -0
  120. package/mocks/scenarios/addSameMemberMultipleTimes.json +426 -0
  121. package/mocks/scenarios/create2trustchainInARow.json +616 -0
  122. package/mocks/scenarios/getOrCreateTransactionCases.json +591 -0
  123. package/mocks/scenarios/member3implicitlyAdded.json +648 -0
  124. package/mocks/scenarios/membersManySelfAdd.json +1427 -0
  125. package/mocks/scenarios/randomMemberTryToDestroy.json +371 -0
  126. package/mocks/scenarios/removeMemberWithTheWrongSeed.json +510 -0
  127. package/mocks/scenarios/removedMemberEjectedOnDeletedTrustchain.json +481 -0
  128. package/mocks/scenarios/removedMemberEjectedOnGetMembers.json +648 -0
  129. package/mocks/scenarios/removedMemberEjectedOnRestore.json +648 -0
  130. package/mocks/scenarios/removingAMemberCreatesAnInteraction.json +593 -0
  131. package/mocks/scenarios/removingYourselfIsForbidden.json +397 -0
  132. package/mocks/scenarios/success.json +978 -0
  133. package/mocks/scenarios/tokenExpires.json +371 -0
  134. package/mocks/scenarios/twoAddMembersFollowedByDeviceAdd.json +705 -0
  135. package/mocks/scenarios/userRefusesAuth.json +40 -0
  136. package/mocks/scenarios/userRefusesRemoveMember.json +542 -0
  137. package/package.json +91 -0
  138. package/scripts/README.md +15 -0
  139. package/scripts/e2e.ts +57 -0
  140. package/src/HWDeviceProvider.ts +105 -0
  141. package/src/__tests__/integration/mock.sdk.test.ts +47 -0
  142. package/src/__tests__/integration/sdk.test.ts +20 -0
  143. package/src/__tests__/tsconfig.json +8 -0
  144. package/src/__tests__/unit/sdk.test.ts +236 -0
  145. package/src/api.ts +202 -0
  146. package/src/auth.ts +81 -0
  147. package/src/errors.ts +18 -0
  148. package/src/index.ts +20 -0
  149. package/src/mockSdk.ts +253 -0
  150. package/src/qrcode/cipher.test.ts +30 -0
  151. package/src/qrcode/cipher.ts +63 -0
  152. package/src/qrcode/index.test.ts +138 -0
  153. package/src/qrcode/index.ts +395 -0
  154. package/src/qrcode/types.ts +70 -0
  155. package/src/sdk.ts +542 -0
  156. package/src/store.ts +99 -0
  157. package/src/types.ts +242 -0
  158. package/tests/scenarios/_template.ts +18 -0
  159. package/tests/scenarios/addSameMemberMultipleTimes.ts +20 -0
  160. package/tests/scenarios/create2trustchainInARow.ts +14 -0
  161. package/tests/scenarios/getOrCreateTransactionCases.ts +74 -0
  162. package/tests/scenarios/member3implicitlyAdded.ts +51 -0
  163. package/tests/scenarios/membersManySelfAdd.ts +18 -0
  164. package/tests/scenarios/randomMemberTryToDestroy.ts +23 -0
  165. package/tests/scenarios/removeMemberWithTheWrongSeed.ts +28 -0
  166. package/tests/scenarios/removedMemberEjectedOnDeletedTrustchain.ts +31 -0
  167. package/tests/scenarios/removedMemberEjectedOnGetMembers.ts +29 -0
  168. package/tests/scenarios/removedMemberEjectedOnRestore.ts +31 -0
  169. package/tests/scenarios/removingAMemberCreatesAnInteraction.ts +42 -0
  170. package/tests/scenarios/removingYourselfIsForbidden.ts +11 -0
  171. package/tests/scenarios/success.ts +94 -0
  172. package/tests/scenarios/tokenExpires.ts +20 -0
  173. package/tests/scenarios/twoAddMembersFollowedByDeviceAdd.ts +49 -0
  174. package/tests/scenarios/userRefusesAuth.ts +28 -0
  175. package/tests/scenarios/userRefusesRemoveMember.ts +66 -0
  176. package/tests/test-helpers/recordTrustchainSdkTests.ts +178 -0
  177. package/tests/test-helpers/replayTrustchainSdkTests.ts +141 -0
  178. package/tests/test-helpers/types.ts +45 -0
  179. package/tests/tsconfig.json +8 -0
  180. package/tsconfig.json +15 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,33 @@
1
+ module.exports = {
2
+ settings: {
3
+ react: {
4
+ version: "detect",
5
+ },
6
+ },
7
+ env: {
8
+ browser: true,
9
+ es6: true,
10
+ },
11
+ globals: {
12
+ Atomics: "readonly",
13
+ SharedArrayBuffer: "readonly",
14
+ },
15
+ extends: ["plugin:import/typescript", "plugin:jsx-a11y/recommended"],
16
+ plugins: ["import", "jsx-a11y"],
17
+ rules: {
18
+ "no-console": ["error", { allow: ["warn", "error"] }],
19
+ "linebreak-style": ["error", "unix"],
20
+ "@typescript-eslint/no-empty-function": "off",
21
+ "@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }],
22
+ "@typescript-eslint/no-explicit-any": "warn",
23
+ },
24
+ overrides: [
25
+ {
26
+ files: ["src/**/*.test.{ts,tsx}"],
27
+ env: {
28
+ "jest/globals": true,
29
+ },
30
+ plugins: ["jest"],
31
+ },
32
+ ],
33
+ };
@@ -0,0 +1,4 @@
1
+
2
+ > @ledgerhq/ledger-key-ring-protocol@0.5.1-nightly.0 build /home/runner/work/ledger-live/ledger-live/libs/ledger-key-ring-protocol
3
+ > tsc && tsc -m ES6 --outDir lib-es
4
+
@@ -0,0 +1,16 @@
1
+ {
2
+ "entry": ["src/index.ts", "src/store.ts", "src/qrcode/index.ts"],
3
+ "ignorePatterns": [
4
+ "**/node_modules/**",
5
+ "**/*.test.ts",
6
+ "**/__tests__/**",
7
+ "**/test-scenarios/**",
8
+ "**/test-helpers/**"
9
+ ],
10
+ "ignoreUnused": [
11
+ "@ledgerhq/hw-transport-mocker",
12
+ "@ledgerhq/speculos-transport",
13
+ "@ledgerhq/types-devices",
14
+ "@ledgerhq/live-env"
15
+ ]
16
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,299 @@
1
+ # @ledgerhq/live-wallet
2
+
3
+ ## 0.5.1-nightly.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`5c13c7b`](https://github.com/LedgerHQ/ledger-live/commit/5c13c7bf743333f09cbfee720d275dfae7e157d2)]:
8
+ - @ledgerhq/live-env@2.4.1-nightly.0
9
+ - @ledgerhq/hw-ledger-key-ring-protocol@0.2.1-nightly.0
10
+ - @ledgerhq/live-network@2.0.3-nightly.0
11
+ - @ledgerhq/speculos-transport@0.1.8-nightly.0
12
+
13
+ ## 0.5.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#7964](https://github.com/LedgerHQ/ledger-live/pull/7964) [`9032845`](https://github.com/LedgerHQ/ledger-live/commit/9032845a3cbadf40d545d6832e0280880e0be3d7) Thanks [@KVNLS](https://github.com/KVNLS)! - Use Ledger Key Ring Protocol naming
18
+
19
+ ### Patch Changes
20
+
21
+ - [#7945](https://github.com/LedgerHQ/ledger-live/pull/7945) [`a47e68b`](https://github.com/LedgerHQ/ledger-live/commit/a47e68b568a3b888a241c30345b4935557404215) Thanks [@thesan](https://github.com/thesan)! - Fix type errors in `@ledgerhq/ledger-key-ring-protocol` tests
22
+
23
+ - Updated dependencies [[`ced792c`](https://github.com/LedgerHQ/ledger-live/commit/ced792c37b42135f2b7596228c14ccd0783a803f), [`9032845`](https://github.com/LedgerHQ/ledger-live/commit/9032845a3cbadf40d545d6832e0280880e0be3d7)]:
24
+ - @ledgerhq/live-env@2.4.0
25
+ - @ledgerhq/hw-ledger-key-ring-protocol@0.2.0
26
+ - @ledgerhq/live-network@2.0.2
27
+ - @ledgerhq/speculos-transport@0.1.7
28
+
29
+ ## 0.5.0-next.0
30
+
31
+ ### Minor Changes
32
+
33
+ - [#7964](https://github.com/LedgerHQ/ledger-live/pull/7964) [`9032845`](https://github.com/LedgerHQ/ledger-live/commit/9032845a3cbadf40d545d6832e0280880e0be3d7) Thanks [@KVNLS](https://github.com/KVNLS)! - Use Ledger Key Ring Protocol naming
34
+
35
+ ### Patch Changes
36
+
37
+ - [#7945](https://github.com/LedgerHQ/ledger-live/pull/7945) [`a47e68b`](https://github.com/LedgerHQ/ledger-live/commit/a47e68b568a3b888a241c30345b4935557404215) Thanks [@thesan](https://github.com/thesan)! - Fix type errors in `@ledgerhq/ledger-key-ring-protocol` tests
38
+
39
+ - Updated dependencies [[`ced792c`](https://github.com/LedgerHQ/ledger-live/commit/ced792c37b42135f2b7596228c14ccd0783a803f), [`9032845`](https://github.com/LedgerHQ/ledger-live/commit/9032845a3cbadf40d545d6832e0280880e0be3d7)]:
40
+ - @ledgerhq/live-env@2.4.0-next.0
41
+ - @ledgerhq/hw-ledger-key-ring-protocol@0.2.0-next.0
42
+ - @ledgerhq/live-network@2.0.2-next.0
43
+ - @ledgerhq/speculos-transport@0.1.7-next.0
44
+
45
+ ## 0.4.1
46
+
47
+ ### Patch Changes
48
+
49
+ - [#7945](https://github.com/LedgerHQ/ledger-live/pull/7945) [`a47e68b`](https://github.com/LedgerHQ/ledger-live/commit/a47e68b568a3b888a241c30345b4935557404215) Thanks [@thesan](https://github.com/thesan)! - Fix type errors in `@ledgerhq/trustchain` tests
50
+
51
+ ## 0.4.1-next.0
52
+
53
+ ### Patch Changes
54
+
55
+ - [#7945](https://github.com/LedgerHQ/ledger-live/pull/7945) [`a47e68b`](https://github.com/LedgerHQ/ledger-live/commit/a47e68b568a3b888a241c30345b4935557404215) Thanks [@thesan](https://github.com/thesan)! - Fix type errors in `@ledgerhq/trustchain` tests
56
+
57
+ ## 0.4.0
58
+
59
+ ### Minor Changes
60
+
61
+ - [#7823](https://github.com/LedgerHQ/ledger-live/pull/7823) [`c4309b1`](https://github.com/LedgerHQ/ledger-live/commit/c4309b17f8e34e664896fd357d1eeac14e318473) Thanks [@thesan](https://github.com/thesan)! - Allow members to sync immediately after getting removed
62
+
63
+ ### Patch Changes
64
+
65
+ - [#7800](https://github.com/LedgerHQ/ledger-live/pull/7800) [`52ae4d3`](https://github.com/LedgerHQ/ledger-live/commit/52ae4d3ea2ae52306e868923e48f4a5807a78d57) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Ledger Sync - Display relevant error when scanning old accounts export qr code or an invalid one
66
+
67
+ - Updated dependencies [[`f805d14`](https://github.com/LedgerHQ/ledger-live/commit/f805d1470f927824233f94eaba065b00d7af18cf), [`0a71c43`](https://github.com/LedgerHQ/ledger-live/commit/0a71c4344b7bb2c6640f3e5dda152ae815573330)]:
68
+ - @ledgerhq/live-network@2.0.1
69
+ - @ledgerhq/errors@6.19.1
70
+ - @ledgerhq/speculos-transport@0.1.6
71
+ - @ledgerhq/hw-transport@6.31.4
72
+ - @ledgerhq/hw-trustchain@0.1.6
73
+ - @ledgerhq/hw-transport-mocker@6.29.4
74
+
75
+ ## 0.4.0-next.1
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [[`f805d14`](https://github.com/LedgerHQ/ledger-live/commit/f805d1470f927824233f94eaba065b00d7af18cf)]:
80
+ - @ledgerhq/live-network@2.0.1-next.1
81
+ - @ledgerhq/speculos-transport@0.1.6-next.1
82
+
83
+ ## 0.4.0-next.0
84
+
85
+ ### Minor Changes
86
+
87
+ - [#7823](https://github.com/LedgerHQ/ledger-live/pull/7823) [`c4309b1`](https://github.com/LedgerHQ/ledger-live/commit/c4309b17f8e34e664896fd357d1eeac14e318473) Thanks [@thesan](https://github.com/thesan)! - Allow members to sync immediately after getting removed
88
+
89
+ ### Patch Changes
90
+
91
+ - [#7800](https://github.com/LedgerHQ/ledger-live/pull/7800) [`52ae4d3`](https://github.com/LedgerHQ/ledger-live/commit/52ae4d3ea2ae52306e868923e48f4a5807a78d57) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Ledger Sync - Display relevant error when scanning old accounts export qr code or an invalid one
92
+
93
+ - Updated dependencies [[`0a71c43`](https://github.com/LedgerHQ/ledger-live/commit/0a71c4344b7bb2c6640f3e5dda152ae815573330)]:
94
+ - @ledgerhq/errors@6.19.1-next.0
95
+ - @ledgerhq/hw-transport@6.31.4-next.0
96
+ - @ledgerhq/live-network@2.0.1-next.0
97
+ - @ledgerhq/speculos-transport@0.1.6-next.0
98
+ - @ledgerhq/hw-trustchain@0.1.6-next.0
99
+ - @ledgerhq/hw-transport-mocker@6.29.4-next.0
100
+
101
+ ## 0.3.0
102
+
103
+ ### Minor Changes
104
+
105
+ - [#7603](https://github.com/LedgerHQ/ledger-live/pull/7603) [`5c738cb`](https://github.com/LedgerHQ/ledger-live/commit/5c738cbd35ce5d0ca39ad3b86a61cc6234d1bdf7) Thanks [@thesan](https://github.com/thesan)! - Fix Trustchain error when switching device while logged in
106
+
107
+ - [#7646](https://github.com/LedgerHQ/ledger-live/pull/7646) [`267526c`](https://github.com/LedgerHQ/ledger-live/commit/267526c3f8cc4863d4947ab3c28ba20dc5593028) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Ledger Sync - Added the synchronization of a trustchain from mobile to desktop by scanning the QR code
108
+
109
+ - [#7691](https://github.com/LedgerHQ/ledger-live/pull/7691) [`ce18c9b`](https://github.com/LedgerHQ/ledger-live/commit/ce18c9bde11fbd6cc196091716b1547354063d89) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Ledger Sync - Added a Loading screen on LLM and LLD when initializing ledger sync while accounts are synchronizing
110
+
111
+ - [#7440](https://github.com/LedgerHQ/ledger-live/pull/7440) [`bc044e4`](https://github.com/LedgerHQ/ledger-live/commit/bc044e482ea2827dca281c44ec36526d63da5194) Thanks [@thesan](https://github.com/thesan)! - Request device access within `HWDeviceProvider`
112
+
113
+ ### Patch Changes
114
+
115
+ - [#7591](https://github.com/LedgerHQ/ledger-live/pull/7591) [`87c160d`](https://github.com/LedgerHQ/ledger-live/commit/87c160d855b512d5a0394eaee7626e2b8cd431ee) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Trustchain - Prevent duplicate add member
116
+
117
+ - [#7588](https://github.com/LedgerHQ/ledger-live/pull/7588) [`d60a022`](https://github.com/LedgerHQ/ledger-live/commit/d60a02238db9ed16142de4c1874e26d27aaaa98c) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Trustchain - Removed member ejected on get members
118
+
119
+ - [#7561](https://github.com/LedgerHQ/ledger-live/pull/7561) [`1fb2b90`](https://github.com/LedgerHQ/ledger-live/commit/1fb2b909c5d97e373a0f72baa37578132bd8b24a) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Fix get Members errors GetMember :Error: ["useGetMembers", null] data is undefined
120
+
121
+ - [#7733](https://github.com/LedgerHQ/ledger-live/pull/7733) [`ef99222`](https://github.com/LedgerHQ/ledger-live/commit/ef99222a5adcd9732d06600bc875309c440e084f) Thanks [@thesan](https://github.com/thesan)! - Handle Ledgersync onboarding errors
122
+
123
+ - [#7712](https://github.com/LedgerHQ/ledger-live/pull/7712) [`a84f3d3`](https://github.com/LedgerHQ/ledger-live/commit/a84f3d344e37301dc76f182c0f99b0b01106abfa) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Handle TrustchainAlreadyInitialized & TrustchainAlreadyInitializedWithOtherSeed on Scan QR
124
+
125
+ - [#7632](https://github.com/LedgerHQ/ledger-live/pull/7632) [`271f90d`](https://github.com/LedgerHQ/ledger-live/commit/271f90dc0f5b46ddaf136873dc034d4c44045dd0) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - LLM / LLD - Fix the getOrCreateTrustchain that wasn't working when another instance destroyed the trustchain
126
+
127
+ - [#7687](https://github.com/LedgerHQ/ledger-live/pull/7687) [`297ce51`](https://github.com/LedgerHQ/ledger-live/commit/297ce513f496f256efe8f9011734324125f462a5) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Handling alredy created key with new or same Ledger device
128
+
129
+ - [#7690](https://github.com/LedgerHQ/ledger-live/pull/7690) [`a3fd728`](https://github.com/LedgerHQ/ledger-live/commit/a3fd72861f2a7df676bd793062b3816fdb9d1f57) Thanks [@thesan](https://github.com/thesan)! - Refresh ledger sync QR code on expiration
130
+
131
+ - Updated dependencies [[`5c738cb`](https://github.com/LedgerHQ/ledger-live/commit/5c738cbd35ce5d0ca39ad3b86a61cc6234d1bdf7), [`187293c`](https://github.com/LedgerHQ/ledger-live/commit/187293c6cf6093f15f07d5effc1ded0843a9e6ab), [`187293c`](https://github.com/LedgerHQ/ledger-live/commit/187293c6cf6093f15f07d5effc1ded0843a9e6ab), [`fb9466a`](https://github.com/LedgerHQ/ledger-live/commit/fb9466a4d7827fd4759c726ad3ae0b43dddcacd3), [`5758950`](https://github.com/LedgerHQ/ledger-live/commit/5758950841fbf8018dd848e745017484aec67333), [`4799d5d`](https://github.com/LedgerHQ/ledger-live/commit/4799d5de3fb1dcef2b01de31fe29b59e76922576), [`8e0ac04`](https://github.com/LedgerHQ/ledger-live/commit/8e0ac04ac8cdaaee59633ebdf219e5dcf44a10df), [`a3fd728`](https://github.com/LedgerHQ/ledger-live/commit/a3fd72861f2a7df676bd793062b3816fdb9d1f57), [`eb9a36f`](https://github.com/LedgerHQ/ledger-live/commit/eb9a36f6ee8487c9ffbb841c3e6c0ca84f68bb0a)]:
132
+ - @ledgerhq/errors@6.19.0
133
+ - @ledgerhq/live-network@2.0.0
134
+ - @ledgerhq/speculos-transport@0.1.5
135
+ - @ledgerhq/live-env@2.3.0
136
+ - @ledgerhq/hw-trustchain@0.1.5
137
+ - @ledgerhq/hw-transport@6.31.3
138
+ - @ledgerhq/hw-transport-mocker@6.29.3
139
+
140
+ ## 0.3.0-next.0
141
+
142
+ ### Minor Changes
143
+
144
+ - [#7603](https://github.com/LedgerHQ/ledger-live/pull/7603) [`5c738cb`](https://github.com/LedgerHQ/ledger-live/commit/5c738cbd35ce5d0ca39ad3b86a61cc6234d1bdf7) Thanks [@thesan](https://github.com/thesan)! - Fix Trustchain error when switching device while logged in
145
+
146
+ - [#7646](https://github.com/LedgerHQ/ledger-live/pull/7646) [`267526c`](https://github.com/LedgerHQ/ledger-live/commit/267526c3f8cc4863d4947ab3c28ba20dc5593028) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Ledger Sync - Added the synchronization of a trustchain from mobile to desktop by scanning the QR code
147
+
148
+ - [#7691](https://github.com/LedgerHQ/ledger-live/pull/7691) [`ce18c9b`](https://github.com/LedgerHQ/ledger-live/commit/ce18c9bde11fbd6cc196091716b1547354063d89) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Ledger Sync - Added a Loading screen on LLM and LLD when initializing ledger sync while accounts are synchronizing
149
+
150
+ - [#7440](https://github.com/LedgerHQ/ledger-live/pull/7440) [`bc044e4`](https://github.com/LedgerHQ/ledger-live/commit/bc044e482ea2827dca281c44ec36526d63da5194) Thanks [@thesan](https://github.com/thesan)! - Request device access within `HWDeviceProvider`
151
+
152
+ ### Patch Changes
153
+
154
+ - [#7591](https://github.com/LedgerHQ/ledger-live/pull/7591) [`87c160d`](https://github.com/LedgerHQ/ledger-live/commit/87c160d855b512d5a0394eaee7626e2b8cd431ee) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Trustchain - Prevent duplicate add member
155
+
156
+ - [#7588](https://github.com/LedgerHQ/ledger-live/pull/7588) [`d60a022`](https://github.com/LedgerHQ/ledger-live/commit/d60a02238db9ed16142de4c1874e26d27aaaa98c) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Trustchain - Removed member ejected on get members
157
+
158
+ - [#7561](https://github.com/LedgerHQ/ledger-live/pull/7561) [`1fb2b90`](https://github.com/LedgerHQ/ledger-live/commit/1fb2b909c5d97e373a0f72baa37578132bd8b24a) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Fix get Members errors GetMember :Error: ["useGetMembers", null] data is undefined
159
+
160
+ - [#7733](https://github.com/LedgerHQ/ledger-live/pull/7733) [`ef99222`](https://github.com/LedgerHQ/ledger-live/commit/ef99222a5adcd9732d06600bc875309c440e084f) Thanks [@thesan](https://github.com/thesan)! - Handle Ledgersync onboarding errors
161
+
162
+ - [#7712](https://github.com/LedgerHQ/ledger-live/pull/7712) [`a84f3d3`](https://github.com/LedgerHQ/ledger-live/commit/a84f3d344e37301dc76f182c0f99b0b01106abfa) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Handle TrustchainAlreadyInitialized & TrustchainAlreadyInitializedWithOtherSeed on Scan QR
163
+
164
+ - [#7632](https://github.com/LedgerHQ/ledger-live/pull/7632) [`271f90d`](https://github.com/LedgerHQ/ledger-live/commit/271f90dc0f5b46ddaf136873dc034d4c44045dd0) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - LLM / LLD - Fix the getOrCreateTrustchain that wasn't working when another instance destroyed the trustchain
165
+
166
+ - [#7687](https://github.com/LedgerHQ/ledger-live/pull/7687) [`297ce51`](https://github.com/LedgerHQ/ledger-live/commit/297ce513f496f256efe8f9011734324125f462a5) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Handling alredy created key with new or same Ledger device
167
+
168
+ - [#7690](https://github.com/LedgerHQ/ledger-live/pull/7690) [`a3fd728`](https://github.com/LedgerHQ/ledger-live/commit/a3fd72861f2a7df676bd793062b3816fdb9d1f57) Thanks [@thesan](https://github.com/thesan)! - Refresh ledger sync QR code on expiration
169
+
170
+ - Updated dependencies [[`5c738cb`](https://github.com/LedgerHQ/ledger-live/commit/5c738cbd35ce5d0ca39ad3b86a61cc6234d1bdf7), [`187293c`](https://github.com/LedgerHQ/ledger-live/commit/187293c6cf6093f15f07d5effc1ded0843a9e6ab), [`187293c`](https://github.com/LedgerHQ/ledger-live/commit/187293c6cf6093f15f07d5effc1ded0843a9e6ab), [`fb9466a`](https://github.com/LedgerHQ/ledger-live/commit/fb9466a4d7827fd4759c726ad3ae0b43dddcacd3), [`5758950`](https://github.com/LedgerHQ/ledger-live/commit/5758950841fbf8018dd848e745017484aec67333), [`4799d5d`](https://github.com/LedgerHQ/ledger-live/commit/4799d5de3fb1dcef2b01de31fe29b59e76922576), [`8e0ac04`](https://github.com/LedgerHQ/ledger-live/commit/8e0ac04ac8cdaaee59633ebdf219e5dcf44a10df), [`a3fd728`](https://github.com/LedgerHQ/ledger-live/commit/a3fd72861f2a7df676bd793062b3816fdb9d1f57), [`eb9a36f`](https://github.com/LedgerHQ/ledger-live/commit/eb9a36f6ee8487c9ffbb841c3e6c0ca84f68bb0a)]:
171
+ - @ledgerhq/errors@6.19.0-next.0
172
+ - @ledgerhq/live-network@2.0.0-next.0
173
+ - @ledgerhq/speculos-transport@0.1.5-next.0
174
+ - @ledgerhq/live-env@2.3.0-next.0
175
+ - @ledgerhq/hw-trustchain@0.1.5-next.0
176
+ - @ledgerhq/hw-transport@6.31.3-next.0
177
+ - @ledgerhq/hw-transport-mocker@6.29.3-next.0
178
+
179
+ ## 0.2.0
180
+
181
+ ### Minor Changes
182
+
183
+ - [#7497](https://github.com/LedgerHQ/ledger-live/pull/7497) [`52daa39`](https://github.com/LedgerHQ/ledger-live/commit/52daa3998709ac3538afd447fe771faa3e3441be) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Added parameters to lldWalletSync and llmWalletSync to be able to configure the wallet sync feature remotely
184
+
185
+ ### Patch Changes
186
+
187
+ - [#7131](https://github.com/LedgerHQ/ledger-live/pull/7131) [`08e85c3`](https://github.com/LedgerHQ/ledger-live/commit/08e85c3fbaf5e27b072e39730f9ceb4135a59d1e) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Persistent Trustchain store
188
+
189
+ - [#7303](https://github.com/LedgerHQ/ledger-live/pull/7303) [`c0f4803`](https://github.com/LedgerHQ/ledger-live/commit/c0f48035b974f2bcde9df8423c6bb9bbb31d4b38) Thanks [@thesan](https://github.com/thesan)! - Test refusing member removal on device
190
+
191
+ - [#7435](https://github.com/LedgerHQ/ledger-live/pull/7435) [`ecc3ee4`](https://github.com/LedgerHQ/ledger-live/commit/ecc3ee46b8d5bf5631bcbcf73b3c3a2fb1a8964d) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Add Ledger Sync check status
192
+
193
+ - [#7388](https://github.com/LedgerHQ/ledger-live/pull/7388) [`506a3c3`](https://github.com/LedgerHQ/ledger-live/commit/506a3c33f59acf0afc9350e4f36f22f11cf7da26) Thanks [@thesan](https://github.com/thesan)! - Factor device interactions out of the Trustchain SDK
194
+
195
+ - Updated dependencies [[`08e85c3`](https://github.com/LedgerHQ/ledger-live/commit/08e85c3fbaf5e27b072e39730f9ceb4135a59d1e), [`4bd91de`](https://github.com/LedgerHQ/ledger-live/commit/4bd91de13442d12acce3ee83d5f2fd5f087570cf), [`53ff78c`](https://github.com/LedgerHQ/ledger-live/commit/53ff78c541d3ed69a3e74854d77f58a7e0d93978), [`52daa39`](https://github.com/LedgerHQ/ledger-live/commit/52daa3998709ac3538afd447fe771faa3e3441be), [`60f1b5c`](https://github.com/LedgerHQ/ledger-live/commit/60f1b5c6cab125f5281468bb3e36f1abfae2d70c), [`8dd0fb1`](https://github.com/LedgerHQ/ledger-live/commit/8dd0fb195525eef4600a8ecbca2a80a1899de321)]:
196
+ - @ledgerhq/hw-trustchain@0.1.4
197
+ - @ledgerhq/live-env@2.2.0
198
+ - @ledgerhq/live-network@1.4.0
199
+ - @ledgerhq/types-devices@6.25.3
200
+ - @ledgerhq/speculos-transport@0.1.4
201
+
202
+ ## 0.2.0-next.0
203
+
204
+ ### Minor Changes
205
+
206
+ - [#7497](https://github.com/LedgerHQ/ledger-live/pull/7497) [`52daa39`](https://github.com/LedgerHQ/ledger-live/commit/52daa3998709ac3538afd447fe771faa3e3441be) Thanks [@cgrellard-ledger](https://github.com/cgrellard-ledger)! - Added parameters to lldWalletSync and llmWalletSync to be able to configure the wallet sync feature remotely
207
+
208
+ ### Patch Changes
209
+
210
+ - [#7131](https://github.com/LedgerHQ/ledger-live/pull/7131) [`08e85c3`](https://github.com/LedgerHQ/ledger-live/commit/08e85c3fbaf5e27b072e39730f9ceb4135a59d1e) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Persistent Trustchain store
211
+
212
+ - [#7303](https://github.com/LedgerHQ/ledger-live/pull/7303) [`c0f4803`](https://github.com/LedgerHQ/ledger-live/commit/c0f48035b974f2bcde9df8423c6bb9bbb31d4b38) Thanks [@thesan](https://github.com/thesan)! - Test refusing member removal on device
213
+
214
+ - [#7435](https://github.com/LedgerHQ/ledger-live/pull/7435) [`ecc3ee4`](https://github.com/LedgerHQ/ledger-live/commit/ecc3ee46b8d5bf5631bcbcf73b3c3a2fb1a8964d) Thanks [@mcayuelas-ledger](https://github.com/mcayuelas-ledger)! - Add Ledger Sync check status
215
+
216
+ - [#7388](https://github.com/LedgerHQ/ledger-live/pull/7388) [`506a3c3`](https://github.com/LedgerHQ/ledger-live/commit/506a3c33f59acf0afc9350e4f36f22f11cf7da26) Thanks [@thesan](https://github.com/thesan)! - Factor device interactions out of the Trustchain SDK
217
+
218
+ - Updated dependencies [[`08e85c3`](https://github.com/LedgerHQ/ledger-live/commit/08e85c3fbaf5e27b072e39730f9ceb4135a59d1e), [`4bd91de`](https://github.com/LedgerHQ/ledger-live/commit/4bd91de13442d12acce3ee83d5f2fd5f087570cf), [`53ff78c`](https://github.com/LedgerHQ/ledger-live/commit/53ff78c541d3ed69a3e74854d77f58a7e0d93978), [`52daa39`](https://github.com/LedgerHQ/ledger-live/commit/52daa3998709ac3538afd447fe771faa3e3441be), [`60f1b5c`](https://github.com/LedgerHQ/ledger-live/commit/60f1b5c6cab125f5281468bb3e36f1abfae2d70c), [`8dd0fb1`](https://github.com/LedgerHQ/ledger-live/commit/8dd0fb195525eef4600a8ecbca2a80a1899de321)]:
219
+ - @ledgerhq/hw-trustchain@0.1.4-next.0
220
+ - @ledgerhq/live-env@2.2.0-next.0
221
+ - @ledgerhq/live-network@1.4.0-next.0
222
+ - @ledgerhq/types-devices@6.25.3-next.0
223
+ - @ledgerhq/speculos-transport@0.1.4-next.0
224
+
225
+ ## 0.1.3
226
+
227
+ ### Patch Changes
228
+
229
+ - Updated dependencies [[`af3d126`](https://github.com/LedgerHQ/ledger-live/commit/af3d126b524dbacf606e3beb56246608f2243eca)]:
230
+ - @ledgerhq/types-devices@6.25.2
231
+ - @ledgerhq/hw-transport@6.31.2
232
+ - @ledgerhq/speculos-transport@0.1.3
233
+ - @ledgerhq/hw-trustchain@0.1.3
234
+ - @ledgerhq/hw-transport-mocker@6.29.2
235
+
236
+ ## 0.1.3-hotfix.1
237
+
238
+ ### Patch Changes
239
+
240
+ - Updated dependencies [[`af3d126`](https://github.com/LedgerHQ/ledger-live/commit/af3d126b524dbacf606e3beb56246608f2243eca)]:
241
+ - @ledgerhq/types-devices@6.25.2-hotfix.0
242
+
243
+ ## 0.1.3-hotfix.0
244
+
245
+ ### Patch Changes
246
+
247
+ - Updated dependencies []:
248
+ - @ledgerhq/hw-transport@6.31.2-hotfix.0
249
+ - @ledgerhq/speculos-transport@0.1.3-hotfix.0
250
+ - @ledgerhq/hw-trustchain@0.1.3-hotfix.0
251
+ - @ledgerhq/hw-transport-mocker@6.29.2-hotfix.0
252
+
253
+ ## 0.1.2
254
+
255
+ ### Patch Changes
256
+
257
+ - Updated dependencies [[`c9329bb`](https://github.com/LedgerHQ/ledger-live/commit/c9329bb94d115bef23b02fdbed7c62f01c186d0a), [`e78f3b7`](https://github.com/LedgerHQ/ledger-live/commit/e78f3b75296c7a063f6cddbeae44c36d236055f3), [`f979216`](https://github.com/LedgerHQ/ledger-live/commit/f9792160293fc8215c6d099f02e1b136c6655f9b), [`c1d2bb0`](https://github.com/LedgerHQ/ledger-live/commit/c1d2bb0866723c10d6e2899d40ddd9b9801189f4)]:
258
+ - @ledgerhq/types-devices@6.25.1
259
+ - @ledgerhq/errors@6.18.0
260
+ - @ledgerhq/hw-transport@6.31.1
261
+ - @ledgerhq/live-network@1.3.1
262
+ - @ledgerhq/speculos-transport@0.1.2
263
+ - @ledgerhq/hw-trustchain@0.1.2
264
+ - @ledgerhq/hw-transport-mocker@6.29.1
265
+
266
+ ## 0.1.2-next.0
267
+
268
+ ### Patch Changes
269
+
270
+ - Updated dependencies [[`c9329bb`](https://github.com/LedgerHQ/ledger-live/commit/c9329bb94d115bef23b02fdbed7c62f01c186d0a), [`e78f3b7`](https://github.com/LedgerHQ/ledger-live/commit/e78f3b75296c7a063f6cddbeae44c36d236055f3), [`f979216`](https://github.com/LedgerHQ/ledger-live/commit/f9792160293fc8215c6d099f02e1b136c6655f9b), [`c1d2bb0`](https://github.com/LedgerHQ/ledger-live/commit/c1d2bb0866723c10d6e2899d40ddd9b9801189f4)]:
271
+ - @ledgerhq/types-devices@6.25.1-next.0
272
+ - @ledgerhq/errors@6.18.0-next.0
273
+ - @ledgerhq/hw-transport@6.31.1-next.0
274
+ - @ledgerhq/live-network@1.3.1-next.0
275
+ - @ledgerhq/speculos-transport@0.1.2-next.0
276
+ - @ledgerhq/hw-trustchain@0.1.2-next.0
277
+ - @ledgerhq/hw-transport-mocker@6.29.1-next.0
278
+
279
+ ## 0.1.1
280
+
281
+ ### Patch Changes
282
+
283
+ - Updated dependencies [[`77fa530`](https://github.com/LedgerHQ/ledger-live/commit/77fa530c8626df94fa7f9c0a8b3a99f2efa7cb11), [`815ae3d`](https://github.com/LedgerHQ/ledger-live/commit/815ae3dae8027823854ada837df3dc983d09b10f), [`326cae0`](https://github.com/LedgerHQ/ledger-live/commit/326cae088cc33795536deb1d868c86e8dbeb6a13), [`cec1599`](https://github.com/LedgerHQ/ledger-live/commit/cec1599a41aa1a18a249e34312164bc93b63972f), [`6d44f25`](https://github.com/LedgerHQ/ledger-live/commit/6d44f255c5b2f453c61d0b754807db1f76d7174e), [`6623cd1`](https://github.com/LedgerHQ/ledger-live/commit/6623cd13102bd8340bd7d4dfdd469934527985c3), [`6552679`](https://github.com/LedgerHQ/ledger-live/commit/65526794bb4d1fbc7e286c0e1c0b6d021413fc8c)]:
284
+ - @ledgerhq/hw-transport@6.31.0
285
+ - @ledgerhq/errors@6.17.0
286
+ - @ledgerhq/live-network@1.3.0
287
+ - @ledgerhq/live-env@2.1.0
288
+ - @ledgerhq/hw-trustchain@0.1.1
289
+
290
+ ## 0.1.1-next.0
291
+
292
+ ### Patch Changes
293
+
294
+ - Updated dependencies [[`77fa530`](https://github.com/LedgerHQ/ledger-live/commit/77fa530c8626df94fa7f9c0a8b3a99f2efa7cb11), [`815ae3d`](https://github.com/LedgerHQ/ledger-live/commit/815ae3dae8027823854ada837df3dc983d09b10f), [`326cae0`](https://github.com/LedgerHQ/ledger-live/commit/326cae088cc33795536deb1d868c86e8dbeb6a13), [`cec1599`](https://github.com/LedgerHQ/ledger-live/commit/cec1599a41aa1a18a249e34312164bc93b63972f), [`6d44f25`](https://github.com/LedgerHQ/ledger-live/commit/6d44f255c5b2f453c61d0b754807db1f76d7174e), [`6623cd1`](https://github.com/LedgerHQ/ledger-live/commit/6623cd13102bd8340bd7d4dfdd469934527985c3), [`6552679`](https://github.com/LedgerHQ/ledger-live/commit/65526794bb4d1fbc7e286c0e1c0b6d021413fc8c)]:
295
+ - @ledgerhq/hw-transport@6.31.0-next.0
296
+ - @ledgerhq/errors@6.17.0-next.0
297
+ - @ledgerhq/live-network@1.3.0-next.0
298
+ - @ledgerhq/live-env@2.1.0-next.0
299
+ - @ledgerhq/hw-trustchain@0.1.1-next.0
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2017-present Ledger https://www.ledger.com/
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ ## ledger key ring protocol
2
+
3
+ Ledger Key Ring Protocol layer.
package/jest.config.js ADDED
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ transform: {
3
+ "^.+\\.(ts|tsx)?$": [
4
+ "ts-jest",
5
+ {
6
+ globals: {
7
+ isolatedModules: true,
8
+ },
9
+ },
10
+ ],
11
+ },
12
+ testPathIgnorePatterns: ["lib/", "lib-es/"],
13
+ };
@@ -0,0 +1,25 @@
1
+ import { ApduDevice } from "@ledgerhq/hw-ledger-key-ring-protocol/ApduDevice";
2
+ import { AuthCachePolicy, JWT, TrustchainDeviceCallbacks, WithDevice } from "./types";
3
+ export declare class HWDeviceProvider {
4
+ /**
5
+ * TODO withDevice should be imported statically from @ledgerhq/live-common/hw/deviceAccess
6
+ *
7
+ * but ATM making @ledgerhq/live-common a dependency of @ledgerhq/ledger-key-ring-protocol causes:
8
+ * > Turbo error: Invalid package dependency graph: cyclic dependency detected:
9
+ * > @ledgerhq/ledger-key-ring-protocol,@ledgerhq/live-wallet,@ledgerhq/live-common
10
+ *
11
+ * Maybe hw/deviceAccess.ts and hw/index.ts could be moved to @ledgerhq/devices
12
+ * This would break the cyclic dependency as @ledgerhq/live-common would depend on @ledgerhq/devices
13
+ * but not the other way around.
14
+ */
15
+ private withDevice;
16
+ private jwt?;
17
+ private api;
18
+ constructor(apiBaseURL: string, withDevice: WithDevice);
19
+ withJwt<T>(deviceId: string, job: (jwt: JWT) => Promise<T>, policy?: AuthCachePolicy, callbacks?: TrustchainDeviceCallbacks): Promise<T>;
20
+ withHw<T>(deviceId: string, job: (hw: ApduDevice) => Promise<T>, callbacks?: TrustchainDeviceCallbacks): Promise<T>;
21
+ refreshJwt(deviceId: string, callbacks?: TrustchainDeviceCallbacks): Promise<void>;
22
+ clearJwt(): void;
23
+ private _authWithDevice;
24
+ }
25
+ //# sourceMappingURL=HWDeviceProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HWDeviceProvider.d.ts","sourceRoot":"","sources":["../src/HWDeviceProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAK9E,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGtF,qBAAa,gBAAgB;IAC3B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,GAAG,CAAC,CAAM;IAClB,OAAO,CAAC,GAAG,CAA4B;gBAE3B,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU;IAK/C,OAAO,CAAC,CAAC,EACd,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,EAC7B,MAAM,CAAC,EAAE,eAAe,EACxB,SAAS,CAAC,EAAE,yBAAyB,GACpC,OAAO,CAAC,CAAC,CAAC;IAaA,MAAM,CAAC,CAAC,EACnB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,EACnC,SAAS,CAAC,EAAE,yBAAyB,GACpC,OAAO,CAAC,CAAC,CAAC;IA0BA,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxF,QAAQ;YAID,eAAe;CAiB9B"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.HWDeviceProvider = void 0;
16
+ const rxjs_1 = require("rxjs");
17
+ const errors_1 = require("@ledgerhq/errors");
18
+ const hw_transport_1 = require("@ledgerhq/hw-transport");
19
+ const hw_ledger_key_ring_protocol_1 = require("@ledgerhq/hw-ledger-key-ring-protocol");
20
+ const api_1 = __importDefault(require("./api"));
21
+ const auth_1 = require("./auth");
22
+ const errors_2 = require("./errors");
23
+ class HWDeviceProvider {
24
+ constructor(apiBaseURL, withDevice) {
25
+ this.api = (0, api_1.default)(apiBaseURL);
26
+ this.withDevice = withDevice;
27
+ }
28
+ withJwt(deviceId, job, policy, callbacks) {
29
+ return (0, auth_1.genericWithJWT)(jwt => {
30
+ this.jwt = jwt;
31
+ return job(jwt);
32
+ }, this.jwt, () => this._authWithDevice(deviceId, callbacks), (jwt) => this.api.refreshAuth(jwt), policy);
33
+ }
34
+ withHw(deviceId, job, callbacks) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ var _a, _b;
37
+ (_a = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onStartRequestUserInteraction) === null || _a === void 0 ? void 0 : _a.call(callbacks);
38
+ const runWithDevice = this.withDevice(deviceId);
39
+ try {
40
+ return yield (0, rxjs_1.lastValueFrom)(runWithDevice(transport => (0, rxjs_1.from)(job(hw_ledger_key_ring_protocol_1.device.apdu(transport)))));
41
+ }
42
+ catch (error) {
43
+ if (!(error instanceof hw_transport_1.TransportStatusError)) {
44
+ throw error;
45
+ }
46
+ switch (error.statusCode) {
47
+ case hw_transport_1.StatusCodes.USER_REFUSED_ON_DEVICE:
48
+ case hw_transport_1.StatusCodes.CONDITIONS_OF_USE_NOT_SATISFIED:
49
+ throw new errors_1.UserRefusedOnDevice();
50
+ case hw_transport_1.StatusCodes.TRUSTCHAIN_WRONG_SEED:
51
+ this.clearJwt();
52
+ throw new errors_2.TrustchainNotAllowed();
53
+ default:
54
+ throw error;
55
+ }
56
+ }
57
+ finally {
58
+ (_b = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onEndRequestUserInteraction) === null || _b === void 0 ? void 0 : _b.call(callbacks);
59
+ }
60
+ });
61
+ }
62
+ refreshJwt(deviceId, callbacks) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ this.jwt = yield this.withJwt(deviceId, this.api.refreshAuth, "cache", callbacks);
65
+ });
66
+ }
67
+ clearJwt() {
68
+ this.jwt = undefined;
69
+ }
70
+ _authWithDevice(deviceId, callbacks) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const challenge = yield this.api.getAuthenticationChallenge();
73
+ const data = hw_ledger_key_ring_protocol_1.crypto.from_hex(challenge.tlv);
74
+ const seedId = yield this.withHw(deviceId, hw => hw.getSeedId(data), callbacks);
75
+ const signature = hw_ledger_key_ring_protocol_1.crypto.to_hex(seedId.signature);
76
+ return this.api.postChallengeResponse({
77
+ challenge: challenge.json,
78
+ signature: {
79
+ credential: seedId.pubkeyCredential.toJSON(),
80
+ signature,
81
+ attestation: hw_ledger_key_ring_protocol_1.crypto.to_hex(seedId.attestationResult),
82
+ },
83
+ });
84
+ });
85
+ }
86
+ }
87
+ exports.HWDeviceProvider = HWDeviceProvider;
88
+ //# sourceMappingURL=HWDeviceProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HWDeviceProvider.js","sourceRoot":"","sources":["../src/HWDeviceProvider.ts"],"names":[],"mappings":"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"}
package/lib/api.d.ts ADDED
@@ -0,0 +1,77 @@
1
+ import { JWT } from "./types";
2
+ export type StatusAPIResponse = {
3
+ name: string;
4
+ version: string;
5
+ };
6
+ export type APIJWT = {
7
+ access_token: string;
8
+ permissions: {
9
+ [trustchainId: string]: {
10
+ [path: string]: string[];
11
+ };
12
+ };
13
+ };
14
+ export type Challenge = {
15
+ version: number;
16
+ challenge: {
17
+ data: string;
18
+ expiry: string;
19
+ };
20
+ host: string;
21
+ rp: {
22
+ credential: {
23
+ version: number;
24
+ curveId: number;
25
+ signAlgorithm: number;
26
+ publicKey: string;
27
+ };
28
+ signature: string;
29
+ }[];
30
+ protocolVersion: {
31
+ major: number;
32
+ minor: number;
33
+ patch: number;
34
+ };
35
+ };
36
+ export type ChallengeSignature = {
37
+ credential: {
38
+ version: number;
39
+ curveId: number;
40
+ signAlgorithm: number;
41
+ publicKey: string;
42
+ };
43
+ signature: string;
44
+ attestation: string;
45
+ };
46
+ export type TrustchainsResponse = {
47
+ [trustchainId: string]: {
48
+ [path: string]: string[];
49
+ };
50
+ };
51
+ export type TrustchainResponse = {
52
+ [key: string]: string;
53
+ };
54
+ export type PutCommandsRequest = {
55
+ path: string;
56
+ blocks: string[];
57
+ };
58
+ declare const getApi: (apiBaseURL: string) => {
59
+ getAuthenticationChallenge: () => Promise<{
60
+ json: Challenge;
61
+ tlv: string;
62
+ }>;
63
+ postChallengeResponse: (request: {
64
+ challenge: Challenge;
65
+ signature: ChallengeSignature;
66
+ }) => Promise<JWT>;
67
+ refreshAuth: (jwt: JWT) => Promise<JWT>;
68
+ getTrustchains: (jwt: JWT) => Promise<TrustchainsResponse>;
69
+ getTrustchain: (jwt: JWT, trustchain_id: string) => Promise<TrustchainResponse>;
70
+ postDerivation: (jwt: JWT, trustchain_id: string, commandStream: string) => Promise<void>;
71
+ postSeed: (jwt: JWT, commandStream: string) => Promise<void>;
72
+ putCommands: (jwt: JWT, trustchain_id: string, request: PutCommandsRequest) => Promise<void>;
73
+ deleteTrustchain: (jwt: JWT, trustchain_id: string) => Promise<void>;
74
+ fetchStatus: () => Promise<StatusAPIResponse>;
75
+ };
76
+ export default getApi;
77
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAE9B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE;QACX,CAAC,YAAY,EAAE,MAAM,GAAG;YACtB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;SAC1B,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE;QACF,UAAU,EAAE;YACV,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC;YAChB,aAAa,EAAE,MAAM,CAAC;YACtB,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC;QACF,SAAS,EAAE,MAAM,CAAC;KACnB,EAAE,CAAC;IACJ,eAAe,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,YAAY,EAAE,MAAM,GAAG;QACtB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,MAAM,eAAgB,MAAM;sCACa,QAAQ;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;qCAQxC;QAC5C,SAAS,EAAE,SAAS,CAAC;QACrB,SAAS,EAAE,kBAAkB,CAAC;KAC/B,KAAG,QAAQ,GAAG,CAAC;uBAYgB,GAAG,KAAG,QAAQ,GAAG,CAAC;0BAcf,GAAG,KAAG,QAAQ,mBAAmB,CAAC;yBAWnC,GAAG,iBAAiB,MAAM,KAAG,QAAQ,kBAAkB,CAAC;0BAYnF,GAAG,iBACO,MAAM,iBACN,MAAM,KACpB,QAAQ,IAAI,CAAC;oBAYa,GAAG,iBAAiB,MAAM,KAAG,QAAQ,IAAI,CAAC;uBAahE,GAAG,iBACO,MAAM,WACZ,kBAAkB,KAC1B,QAAQ,IAAI,CAAC;4BAWqB,GAAG,iBAAiB,MAAM,KAAG,QAAQ,IAAI,CAAC;uBAUjD,QAAQ,iBAAiB,CAAC;CAoBzD,CAAC;AAEF,eAAe,MAAM,CAAC"}