@ledgerhq/device-trusted-app-kit-ledger-keyring-protocol 0.0.0-rn-ble-pairing-removed-while-reconnecting-20250807094338 → 0.0.0-transaction-unfunded-20250917151052

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 (535) hide show
  1. package/lib/cjs/api/LedgerKeyringProtocol.js +1 -1
  2. package/lib/cjs/api/LedgerKeyringProtocol.js.map +1 -1
  3. package/lib/cjs/api/LedgerKeyringProtocolBuilder.js +1 -1
  4. package/lib/cjs/api/LedgerKeyringProtocolBuilder.js.map +3 -3
  5. package/lib/cjs/api/app-binder/AddToTrustchainDeviceActionTypes.js +1 -1
  6. package/lib/cjs/api/app-binder/AddToTrustchainDeviceActionTypes.js.map +3 -3
  7. package/lib/cjs/api/app-binder/AuthenticateDeviceActionTypes.js +1 -1
  8. package/lib/cjs/api/app-binder/AuthenticateDeviceActionTypes.js.map +3 -3
  9. package/lib/cjs/api/app-binder/GetVersionCommandTypes.js +1 -1
  10. package/lib/cjs/api/app-binder/GetVersionCommandTypes.js.map +1 -1
  11. package/lib/cjs/api/crypto/CryptoService.js +2 -0
  12. package/lib/cjs/api/crypto/CryptoService.js.map +7 -0
  13. package/lib/cjs/api/crypto/Key.js +2 -0
  14. package/lib/cjs/api/crypto/Key.js.map +7 -0
  15. package/lib/cjs/api/crypto/KeyPair.js +2 -0
  16. package/lib/cjs/api/crypto/KeyPair.js.map +7 -0
  17. package/lib/cjs/api/crypto/noble/NobleCryptoService.js +2 -0
  18. package/lib/cjs/api/crypto/noble/NobleCryptoService.js.map +7 -0
  19. package/lib/cjs/api/crypto/noble/NobleCryptoService.test.js +2 -0
  20. package/lib/cjs/api/crypto/noble/NobleCryptoService.test.js.map +7 -0
  21. package/lib/cjs/api/crypto/noble/NobleKey.js +2 -0
  22. package/lib/cjs/api/crypto/noble/NobleKey.js.map +7 -0
  23. package/lib/cjs/api/crypto/noble/NobleKey.test.js +2 -0
  24. package/lib/cjs/api/crypto/noble/NobleKey.test.js.map +7 -0
  25. package/lib/cjs/api/crypto/noble/NobleKeyPair.js +2 -0
  26. package/lib/cjs/api/crypto/noble/NobleKeyPair.js.map +7 -0
  27. package/lib/cjs/api/crypto/noble/NobleKeyPair.test.js +2 -0
  28. package/lib/cjs/api/crypto/noble/NobleKeyPair.test.js.map +7 -0
  29. package/lib/cjs/api/index.js +1 -1
  30. package/lib/cjs/api/index.js.map +2 -2
  31. package/lib/cjs/api/model/Env.js +2 -0
  32. package/lib/cjs/api/model/Env.js.map +7 -0
  33. package/lib/cjs/api/model/Errors.js +2 -0
  34. package/lib/cjs/api/model/Errors.js.map +7 -0
  35. package/lib/cjs/api/model/JWT.js +2 -0
  36. package/lib/cjs/api/model/JWT.js.map +7 -0
  37. package/lib/cjs/api/model/Permissions.js +2 -0
  38. package/lib/cjs/api/model/Permissions.js.map +7 -0
  39. package/lib/cjs/internal/DefaultLedgerKeyringProtocol.js +1 -1
  40. package/lib/cjs/internal/DefaultLedgerKeyringProtocol.js.map +3 -3
  41. package/lib/cjs/internal/app-binder/LedgerKeyringProtocolBinder.js +1 -1
  42. package/lib/cjs/internal/app-binder/LedgerKeyringProtocolBinder.js.map +3 -3
  43. package/lib/cjs/internal/app-binder/command/GetAppNameCommand.js +1 -1
  44. package/lib/cjs/internal/app-binder/command/GetAppNameCommand.js.map +2 -2
  45. package/lib/cjs/internal/app-binder/command/GetSeedIdCommand.js +1 -1
  46. package/lib/cjs/internal/app-binder/command/GetSeedIdCommand.js.map +3 -3
  47. package/lib/cjs/internal/app-binder/command/GetSeedIdCommand.test.js +2 -2
  48. package/lib/cjs/internal/app-binder/command/GetSeedIdCommand.test.js.map +3 -3
  49. package/lib/cjs/internal/app-binder/command/GetVersionCommand.js.map +2 -2
  50. package/lib/cjs/internal/app-binder/command/InitCommand.js +1 -1
  51. package/lib/cjs/internal/app-binder/command/InitCommand.js.map +2 -2
  52. package/lib/cjs/internal/app-binder/command/InitCommand.test.js +1 -1
  53. package/lib/cjs/internal/app-binder/command/InitCommand.test.js.map +2 -2
  54. package/lib/cjs/internal/app-binder/command/ParseBlockSignatureCommand.js +1 -1
  55. package/lib/cjs/internal/app-binder/command/ParseBlockSignatureCommand.js.map +2 -2
  56. package/lib/cjs/internal/app-binder/command/ParseBlockSignatureCommand.test.js +1 -1
  57. package/lib/cjs/internal/app-binder/command/ParseBlockSignatureCommand.test.js.map +2 -2
  58. package/lib/cjs/internal/app-binder/command/ParseStreamBlockCommand.js.map +2 -2
  59. package/lib/cjs/internal/app-binder/command/ParseStreamBlockCommand.test.js +1 -1
  60. package/lib/cjs/internal/app-binder/command/ParseStreamBlockCommand.test.js.map +2 -2
  61. package/lib/cjs/internal/app-binder/command/ParseStreamBlockHeader.js +1 -1
  62. package/lib/cjs/internal/app-binder/command/ParseStreamBlockHeader.js.map +2 -2
  63. package/lib/cjs/internal/app-binder/command/ParseStreamBlockHeader.test.js.map +2 -2
  64. package/lib/cjs/internal/app-binder/command/SetTrustedMemberCommand.js +1 -1
  65. package/lib/cjs/internal/app-binder/command/SetTrustedMemberCommand.js.map +3 -3
  66. package/lib/cjs/internal/app-binder/command/SetTrustedMemberCommand.test.js.map +2 -2
  67. package/lib/cjs/internal/app-binder/command/SignBlockHeader.js +1 -1
  68. package/lib/cjs/internal/app-binder/command/SignBlockHeader.js.map +3 -3
  69. package/lib/cjs/internal/app-binder/command/SignBlockHeader.test.js +1 -1
  70. package/lib/cjs/internal/app-binder/command/SignBlockHeader.test.js.map +3 -3
  71. package/lib/cjs/internal/app-binder/command/SignBlockSignatureCommand.js +1 -1
  72. package/lib/cjs/internal/app-binder/command/SignBlockSignatureCommand.js.map +2 -2
  73. package/lib/cjs/internal/app-binder/command/SignBlockSignatureCommand.test.js +1 -1
  74. package/lib/cjs/internal/app-binder/command/SignBlockSignatureCommand.test.js.map +2 -2
  75. package/lib/cjs/internal/app-binder/command/SignBlockSingleCommand.js +1 -1
  76. package/lib/cjs/internal/app-binder/command/SignBlockSingleCommand.js.map +2 -2
  77. package/lib/cjs/internal/app-binder/command/SignBlockSingleCommand.test.js +1 -1
  78. package/lib/cjs/internal/app-binder/command/SignBlockSingleCommand.test.js.map +2 -2
  79. package/lib/cjs/internal/app-binder/device-action/AddToTrustchainDeviceAction.js +1 -1
  80. package/lib/cjs/internal/app-binder/device-action/AddToTrustchainDeviceAction.js.map +3 -3
  81. package/lib/cjs/internal/app-binder/device-action/AuthenticateWithDeviceDeviceAction.js +2 -0
  82. package/lib/cjs/internal/app-binder/device-action/AuthenticateWithDeviceDeviceAction.js.map +7 -0
  83. package/lib/cjs/internal/app-binder/device-action/AuthenticateWithKeypairDeviceAction.js +2 -0
  84. package/lib/cjs/internal/app-binder/device-action/AuthenticateWithKeypairDeviceAction.js.map +7 -0
  85. package/lib/cjs/internal/app-binder/device-action/models/AuthenticateWithDeviceDeviceActionTypes.js +2 -0
  86. package/lib/cjs/internal/app-binder/device-action/models/AuthenticateWithDeviceDeviceActionTypes.js.map +7 -0
  87. package/lib/cjs/internal/app-binder/device-action/models/AuthenticateWithKeypairDeviceActionTypes.js +2 -0
  88. package/lib/cjs/internal/app-binder/device-action/models/AuthenticateWithKeypairDeviceActionTypes.js.map +7 -0
  89. package/lib/cjs/internal/app-binder/task/AuthenticateTask.js +2 -0
  90. package/lib/cjs/internal/app-binder/task/AuthenticateTask.js.map +7 -0
  91. package/lib/cjs/internal/app-binder/task/ExtractEncryptionKeyTask.js +2 -0
  92. package/lib/cjs/internal/app-binder/task/ExtractEncryptionKeyTask.js.map +7 -0
  93. package/lib/cjs/internal/app-binder/task/InitTask.js +1 -1
  94. package/lib/cjs/internal/app-binder/task/InitTask.js.map +3 -3
  95. package/lib/cjs/internal/app-binder/task/ParseStreamToDeviceTask.js +1 -1
  96. package/lib/cjs/internal/app-binder/task/ParseStreamToDeviceTask.js.map +3 -3
  97. package/lib/cjs/internal/app-binder/task/SignBlockTask.js +1 -1
  98. package/lib/cjs/internal/app-binder/task/SignBlockTask.js.map +3 -3
  99. package/lib/cjs/internal/app-binder/task/SignChallengeWithKeypairTask.js +1 -1
  100. package/lib/cjs/internal/app-binder/task/SignChallengeWithKeypairTask.js.map +3 -3
  101. package/lib/cjs/internal/app-binder/task/SignChallengeWithKeypairTask.test.js +1 -1
  102. package/lib/cjs/internal/app-binder/task/SignChallengeWithKeypairTask.test.js.map +3 -3
  103. package/lib/cjs/internal/app-binder/task/utils/TrustedProperties.js +1 -1
  104. package/lib/cjs/internal/app-binder/task/utils/TrustedProperties.js.map +3 -3
  105. package/lib/cjs/internal/di.js +1 -1
  106. package/lib/cjs/internal/di.js.map +3 -3
  107. package/lib/cjs/internal/externalTypes.js +1 -1
  108. package/lib/cjs/internal/externalTypes.js.map +2 -2
  109. package/lib/cjs/internal/lkrp-datasource/data/HttpLKRPDataSource.js +1 -1
  110. package/lib/cjs/internal/lkrp-datasource/data/HttpLKRPDataSource.js.map +3 -3
  111. package/lib/cjs/internal/lkrp-datasource/data/HttpLKRPDataSource.test.js +1 -1
  112. package/lib/cjs/internal/lkrp-datasource/data/HttpLKRPDataSource.test.js.map +3 -3
  113. package/lib/cjs/internal/lkrp-datasource/data/LKRPDataSource.js +1 -1
  114. package/lib/cjs/internal/lkrp-datasource/data/LKRPDataSource.js.map +1 -1
  115. package/lib/cjs/internal/models/LKRPBlockTypes.js +2 -0
  116. package/lib/cjs/internal/models/LKRPBlockTypes.js.map +7 -0
  117. package/lib/cjs/internal/models/LKRPCommandTypes.js +2 -0
  118. package/lib/cjs/internal/models/LKRPCommandTypes.js.map +7 -0
  119. package/lib/cjs/internal/{utils/TLVTags.js → models/Tags.js} +1 -1
  120. package/lib/cjs/internal/{utils/TLVTags.js.map → models/Tags.js.map} +2 -2
  121. package/lib/cjs/internal/models/Types.js +2 -0
  122. package/lib/cjs/internal/models/Types.js.map +7 -0
  123. package/lib/cjs/internal/use-cases/authentication/AuthenticateUseCase.js +1 -1
  124. package/lib/cjs/internal/use-cases/authentication/AuthenticateUseCase.js.map +3 -3
  125. package/lib/cjs/internal/use-cases/authentication/DecryptDataUseCase.js +2 -0
  126. package/lib/cjs/internal/use-cases/authentication/DecryptDataUseCase.js.map +7 -0
  127. package/lib/cjs/internal/use-cases/authentication/EncryptDataUseCase.js +2 -0
  128. package/lib/cjs/internal/use-cases/authentication/EncryptDataUseCase.js.map +7 -0
  129. package/lib/cjs/internal/use-cases/di/useCasesModule.js +1 -1
  130. package/lib/cjs/internal/use-cases/di/useCasesModule.js.map +3 -3
  131. package/lib/cjs/internal/use-cases/di/useCasesTypes.js +1 -1
  132. package/lib/cjs/internal/use-cases/di/useCasesTypes.js.map +2 -2
  133. package/lib/cjs/internal/utils/LKRPBlock.js +4 -4
  134. package/lib/cjs/internal/utils/LKRPBlock.js.map +3 -3
  135. package/lib/cjs/internal/utils/LKRPBlock.test.js +3 -3
  136. package/lib/cjs/internal/utils/LKRPBlock.test.js.map +3 -3
  137. package/lib/cjs/internal/utils/LKRPBlockStream.js +2 -2
  138. package/lib/cjs/internal/utils/LKRPBlockStream.js.map +3 -3
  139. package/lib/cjs/internal/utils/LKRPBlockStream.test.js +3 -3
  140. package/lib/cjs/internal/utils/LKRPBlockStream.test.js.map +3 -3
  141. package/lib/cjs/internal/utils/LKRPCommand.js +2 -2
  142. package/lib/cjs/internal/utils/LKRPCommand.js.map +3 -3
  143. package/lib/cjs/internal/utils/LKRPCommand.test.js +1 -1
  144. package/lib/cjs/internal/utils/LKRPCommand.test.js.map +3 -3
  145. package/lib/cjs/internal/utils/TLVParser.js +1 -1
  146. package/lib/cjs/internal/utils/TLVParser.js.map +3 -3
  147. package/lib/cjs/internal/utils/TLVParser.test.js +1 -1
  148. package/lib/cjs/internal/utils/TLVParser.test.js.map +3 -3
  149. package/lib/cjs/internal/utils/Trustchain.js +2 -0
  150. package/lib/cjs/internal/utils/Trustchain.js.map +7 -0
  151. package/lib/cjs/internal/utils/required.js +1 -1
  152. package/lib/cjs/internal/utils/required.js.map +2 -2
  153. package/lib/cjs/package.json +3 -2
  154. package/lib/esm/api/LedgerKeyringProtocolBuilder.js +1 -1
  155. package/lib/esm/api/LedgerKeyringProtocolBuilder.js.map +3 -3
  156. package/lib/esm/api/app-binder/AddToTrustchainDeviceActionTypes.js +1 -0
  157. package/lib/esm/api/app-binder/AddToTrustchainDeviceActionTypes.js.map +4 -4
  158. package/lib/esm/api/app-binder/AuthenticateDeviceActionTypes.js +1 -0
  159. package/lib/esm/api/app-binder/AuthenticateDeviceActionTypes.js.map +4 -4
  160. package/lib/esm/api/crypto/CryptoService.js +2 -0
  161. package/lib/esm/api/crypto/CryptoService.js.map +7 -0
  162. package/lib/esm/api/crypto/Key.js +2 -0
  163. package/lib/esm/api/crypto/Key.js.map +7 -0
  164. package/lib/esm/api/crypto/KeyPair.js +2 -0
  165. package/lib/esm/api/crypto/KeyPair.js.map +7 -0
  166. package/lib/esm/api/crypto/noble/NobleCryptoService.js +2 -0
  167. package/lib/esm/api/crypto/noble/NobleCryptoService.js.map +7 -0
  168. package/lib/esm/api/crypto/noble/NobleCryptoService.test.js +2 -0
  169. package/lib/esm/api/crypto/noble/NobleCryptoService.test.js.map +7 -0
  170. package/lib/esm/api/crypto/noble/NobleKey.js +2 -0
  171. package/lib/esm/api/crypto/noble/NobleKey.js.map +7 -0
  172. package/lib/esm/api/crypto/noble/NobleKey.test.js +2 -0
  173. package/lib/esm/api/crypto/noble/NobleKey.test.js.map +7 -0
  174. package/lib/esm/api/crypto/noble/NobleKeyPair.js +2 -0
  175. package/lib/esm/api/crypto/noble/NobleKeyPair.js.map +7 -0
  176. package/lib/esm/api/crypto/noble/NobleKeyPair.test.js +2 -0
  177. package/lib/esm/api/crypto/noble/NobleKeyPair.test.js.map +7 -0
  178. package/lib/esm/api/index.js +1 -1
  179. package/lib/esm/api/index.js.map +2 -2
  180. package/lib/esm/api/model/Env.js +2 -0
  181. package/lib/esm/api/model/Env.js.map +7 -0
  182. package/lib/esm/api/model/Errors.js +2 -0
  183. package/lib/esm/api/model/Errors.js.map +7 -0
  184. package/lib/esm/api/model/JWT.js +1 -0
  185. package/lib/esm/api/model/Permissions.js +2 -0
  186. package/lib/esm/api/model/Permissions.js.map +7 -0
  187. package/lib/esm/internal/DefaultLedgerKeyringProtocol.js +1 -1
  188. package/lib/esm/internal/DefaultLedgerKeyringProtocol.js.map +3 -3
  189. package/lib/esm/internal/app-binder/LedgerKeyringProtocolBinder.js +1 -1
  190. package/lib/esm/internal/app-binder/LedgerKeyringProtocolBinder.js.map +3 -3
  191. package/lib/esm/internal/app-binder/command/GetAppNameCommand.js +1 -1
  192. package/lib/esm/internal/app-binder/command/GetAppNameCommand.js.map +2 -2
  193. package/lib/esm/internal/app-binder/command/GetSeedIdCommand.js +1 -1
  194. package/lib/esm/internal/app-binder/command/GetSeedIdCommand.js.map +3 -3
  195. package/lib/esm/internal/app-binder/command/GetSeedIdCommand.test.js +1 -1
  196. package/lib/esm/internal/app-binder/command/GetSeedIdCommand.test.js.map +3 -3
  197. package/lib/esm/internal/app-binder/command/GetVersionCommand.js.map +2 -2
  198. package/lib/esm/internal/app-binder/command/InitCommand.js +1 -1
  199. package/lib/esm/internal/app-binder/command/InitCommand.js.map +2 -2
  200. package/lib/esm/internal/app-binder/command/InitCommand.test.js +1 -1
  201. package/lib/esm/internal/app-binder/command/InitCommand.test.js.map +2 -2
  202. package/lib/esm/internal/app-binder/command/ParseBlockSignatureCommand.js +1 -1
  203. package/lib/esm/internal/app-binder/command/ParseBlockSignatureCommand.js.map +2 -2
  204. package/lib/esm/internal/app-binder/command/ParseBlockSignatureCommand.test.js +1 -1
  205. package/lib/esm/internal/app-binder/command/ParseBlockSignatureCommand.test.js.map +2 -2
  206. package/lib/esm/internal/app-binder/command/ParseStreamBlockCommand.js.map +2 -2
  207. package/lib/esm/internal/app-binder/command/ParseStreamBlockCommand.test.js +1 -1
  208. package/lib/esm/internal/app-binder/command/ParseStreamBlockCommand.test.js.map +2 -2
  209. package/lib/esm/internal/app-binder/command/ParseStreamBlockHeader.js +1 -1
  210. package/lib/esm/internal/app-binder/command/ParseStreamBlockHeader.js.map +2 -2
  211. package/lib/esm/internal/app-binder/command/ParseStreamBlockHeader.test.js.map +2 -2
  212. package/lib/esm/internal/app-binder/command/SetTrustedMemberCommand.js +1 -1
  213. package/lib/esm/internal/app-binder/command/SetTrustedMemberCommand.js.map +2 -2
  214. package/lib/esm/internal/app-binder/command/SetTrustedMemberCommand.test.js +1 -1
  215. package/lib/esm/internal/app-binder/command/SetTrustedMemberCommand.test.js.map +2 -2
  216. package/lib/esm/internal/app-binder/command/SignBlockHeader.js +1 -1
  217. package/lib/esm/internal/app-binder/command/SignBlockHeader.js.map +3 -3
  218. package/lib/esm/internal/app-binder/command/SignBlockHeader.test.js +1 -1
  219. package/lib/esm/internal/app-binder/command/SignBlockHeader.test.js.map +3 -3
  220. package/lib/esm/internal/app-binder/command/SignBlockSignatureCommand.js +1 -1
  221. package/lib/esm/internal/app-binder/command/SignBlockSignatureCommand.js.map +2 -2
  222. package/lib/esm/internal/app-binder/command/SignBlockSignatureCommand.test.js +1 -1
  223. package/lib/esm/internal/app-binder/command/SignBlockSignatureCommand.test.js.map +2 -2
  224. package/lib/esm/internal/app-binder/command/SignBlockSingleCommand.js +1 -1
  225. package/lib/esm/internal/app-binder/command/SignBlockSingleCommand.js.map +2 -2
  226. package/lib/esm/internal/app-binder/command/SignBlockSingleCommand.test.js +1 -1
  227. package/lib/esm/internal/app-binder/command/SignBlockSingleCommand.test.js.map +2 -2
  228. package/lib/esm/internal/app-binder/device-action/AddToTrustchainDeviceAction.js +1 -1
  229. package/lib/esm/internal/app-binder/device-action/AddToTrustchainDeviceAction.js.map +3 -3
  230. package/lib/esm/internal/app-binder/device-action/AuthenticateWithDeviceDeviceAction.js +2 -0
  231. package/lib/esm/internal/app-binder/device-action/AuthenticateWithDeviceDeviceAction.js.map +7 -0
  232. package/lib/esm/internal/app-binder/device-action/AuthenticateWithKeypairDeviceAction.js +2 -0
  233. package/lib/esm/internal/app-binder/device-action/AuthenticateWithKeypairDeviceAction.js.map +7 -0
  234. package/lib/esm/internal/app-binder/device-action/models/AuthenticateWithDeviceDeviceActionTypes.js +1 -0
  235. package/lib/esm/internal/app-binder/device-action/models/AuthenticateWithKeypairDeviceActionTypes.js +1 -0
  236. package/lib/esm/internal/app-binder/task/AuthenticateTask.js +2 -0
  237. package/lib/esm/internal/app-binder/task/AuthenticateTask.js.map +7 -0
  238. package/lib/esm/internal/app-binder/task/ExtractEncryptionKeyTask.js +2 -0
  239. package/lib/esm/internal/app-binder/task/ExtractEncryptionKeyTask.js.map +7 -0
  240. package/lib/esm/internal/app-binder/task/InitTask.js +1 -1
  241. package/lib/esm/internal/app-binder/task/InitTask.js.map +3 -3
  242. package/lib/esm/internal/app-binder/task/ParseStreamToDeviceTask.js +1 -1
  243. package/lib/esm/internal/app-binder/task/ParseStreamToDeviceTask.js.map +3 -3
  244. package/lib/esm/internal/app-binder/task/SignBlockTask.js +1 -1
  245. package/lib/esm/internal/app-binder/task/SignBlockTask.js.map +3 -3
  246. package/lib/esm/internal/app-binder/task/SignChallengeWithKeypairTask.js +1 -1
  247. package/lib/esm/internal/app-binder/task/SignChallengeWithKeypairTask.js.map +3 -3
  248. package/lib/esm/internal/app-binder/task/SignChallengeWithKeypairTask.test.js +1 -1
  249. package/lib/esm/internal/app-binder/task/SignChallengeWithKeypairTask.test.js.map +3 -3
  250. package/lib/esm/internal/app-binder/task/utils/TrustedProperties.js +1 -1
  251. package/lib/esm/internal/app-binder/task/utils/TrustedProperties.js.map +3 -3
  252. package/lib/esm/internal/di.js +1 -1
  253. package/lib/esm/internal/di.js.map +3 -3
  254. package/lib/esm/internal/externalTypes.js +1 -1
  255. package/lib/esm/internal/externalTypes.js.map +2 -2
  256. package/lib/esm/internal/lkrp-datasource/data/HttpLKRPDataSource.js +1 -1
  257. package/lib/esm/internal/lkrp-datasource/data/HttpLKRPDataSource.js.map +3 -3
  258. package/lib/esm/internal/lkrp-datasource/data/HttpLKRPDataSource.test.js +1 -1
  259. package/lib/esm/internal/lkrp-datasource/data/HttpLKRPDataSource.test.js.map +3 -3
  260. package/lib/esm/internal/models/LKRPBlockTypes.js +1 -0
  261. package/lib/esm/internal/models/LKRPCommandTypes.js +1 -0
  262. package/lib/esm/internal/{utils/TLVTags.js → models/Tags.js} +1 -1
  263. package/lib/esm/internal/{utils/TLVTags.js.map → models/Tags.js.map} +1 -1
  264. package/lib/esm/internal/models/Types.js +1 -0
  265. package/lib/esm/internal/use-cases/authentication/AuthenticateUseCase.js +1 -1
  266. package/lib/esm/internal/use-cases/authentication/AuthenticateUseCase.js.map +3 -3
  267. package/lib/esm/internal/use-cases/authentication/DecryptDataUseCase.js +2 -0
  268. package/lib/esm/internal/use-cases/authentication/DecryptDataUseCase.js.map +7 -0
  269. package/lib/esm/internal/use-cases/authentication/EncryptDataUseCase.js +2 -0
  270. package/lib/esm/internal/use-cases/authentication/EncryptDataUseCase.js.map +7 -0
  271. package/lib/esm/internal/use-cases/di/useCasesModule.js +1 -1
  272. package/lib/esm/internal/use-cases/di/useCasesModule.js.map +3 -3
  273. package/lib/esm/internal/use-cases/di/useCasesTypes.js +1 -1
  274. package/lib/esm/internal/use-cases/di/useCasesTypes.js.map +2 -2
  275. package/lib/esm/internal/utils/LKRPBlock.js +3 -3
  276. package/lib/esm/internal/utils/LKRPBlock.js.map +3 -3
  277. package/lib/esm/internal/utils/LKRPBlock.test.js +2 -2
  278. package/lib/esm/internal/utils/LKRPBlock.test.js.map +3 -3
  279. package/lib/esm/internal/utils/LKRPBlockStream.js +2 -2
  280. package/lib/esm/internal/utils/LKRPBlockStream.js.map +3 -3
  281. package/lib/esm/internal/utils/LKRPBlockStream.test.js +3 -3
  282. package/lib/esm/internal/utils/LKRPBlockStream.test.js.map +3 -3
  283. package/lib/esm/internal/utils/LKRPCommand.js +2 -2
  284. package/lib/esm/internal/utils/LKRPCommand.js.map +3 -3
  285. package/lib/esm/internal/utils/LKRPCommand.test.js +1 -1
  286. package/lib/esm/internal/utils/LKRPCommand.test.js.map +3 -3
  287. package/lib/esm/internal/utils/TLVParser.js +1 -1
  288. package/lib/esm/internal/utils/TLVParser.js.map +3 -3
  289. package/lib/esm/internal/utils/TLVParser.test.js +1 -1
  290. package/lib/esm/internal/utils/TLVParser.test.js.map +3 -3
  291. package/lib/esm/internal/utils/Trustchain.js +2 -0
  292. package/lib/esm/internal/utils/Trustchain.js.map +7 -0
  293. package/lib/esm/internal/utils/required.js +1 -1
  294. package/lib/esm/internal/utils/required.js.map +2 -2
  295. package/lib/esm/package.json +3 -2
  296. package/lib/types/api/LedgerKeyringProtocol.d.ts +4 -5
  297. package/lib/types/api/LedgerKeyringProtocol.d.ts.map +1 -1
  298. package/lib/types/api/LedgerKeyringProtocolBuilder.d.ts +12 -6
  299. package/lib/types/api/LedgerKeyringProtocolBuilder.d.ts.map +1 -1
  300. package/lib/types/api/app-binder/AddToTrustchainDeviceActionTypes.d.ts +25 -11
  301. package/lib/types/api/app-binder/AddToTrustchainDeviceActionTypes.d.ts.map +1 -1
  302. package/lib/types/api/app-binder/AuthenticateDeviceActionTypes.d.ts +27 -31
  303. package/lib/types/api/app-binder/AuthenticateDeviceActionTypes.d.ts.map +1 -1
  304. package/lib/types/api/app-binder/GetVersionCommandTypes.d.ts +0 -1
  305. package/lib/types/api/app-binder/GetVersionCommandTypes.d.ts.map +1 -1
  306. package/lib/types/api/crypto/CryptoService.d.ts +22 -0
  307. package/lib/types/api/crypto/CryptoService.d.ts.map +1 -0
  308. package/lib/types/api/crypto/Key.d.ts +7 -0
  309. package/lib/types/api/crypto/Key.d.ts.map +1 -0
  310. package/lib/types/api/crypto/KeyPair.d.ts +13 -0
  311. package/lib/types/api/crypto/KeyPair.d.ts.map +1 -0
  312. package/lib/types/api/crypto/noble/NobleCryptoService.d.ts +13 -0
  313. package/lib/types/api/crypto/noble/NobleCryptoService.d.ts.map +1 -0
  314. package/lib/types/api/crypto/noble/NobleCryptoService.test.d.ts +2 -0
  315. package/lib/types/api/crypto/noble/NobleCryptoService.test.d.ts.map +1 -0
  316. package/lib/types/api/crypto/noble/NobleKey.d.ts +11 -0
  317. package/lib/types/api/crypto/noble/NobleKey.d.ts.map +1 -0
  318. package/lib/types/api/crypto/noble/NobleKey.test.d.ts +2 -0
  319. package/lib/types/api/crypto/noble/NobleKey.test.d.ts.map +1 -0
  320. package/lib/types/api/crypto/noble/NobleKeyPair.d.ts +18 -0
  321. package/lib/types/api/crypto/noble/NobleKeyPair.d.ts.map +1 -0
  322. package/lib/types/api/crypto/noble/NobleKeyPair.test.d.ts +2 -0
  323. package/lib/types/api/crypto/noble/NobleKeyPair.test.d.ts.map +1 -0
  324. package/lib/types/api/index.d.ts +10 -2
  325. package/lib/types/api/index.d.ts.map +1 -1
  326. package/lib/types/api/model/Env.d.ts +5 -0
  327. package/lib/types/api/model/Env.d.ts.map +1 -0
  328. package/lib/types/api/model/Errors.d.ts +53 -0
  329. package/lib/types/api/model/Errors.d.ts.map +1 -0
  330. package/lib/types/api/model/JWT.d.ts +9 -0
  331. package/lib/types/api/model/JWT.d.ts.map +1 -0
  332. package/lib/types/api/{app-binder/LKRPTypes.d.ts → model/Permissions.d.ts} +1 -15
  333. package/lib/types/api/model/Permissions.d.ts.map +1 -0
  334. package/lib/types/internal/DefaultLedgerKeyringProtocol.d.ts +12 -9
  335. package/lib/types/internal/DefaultLedgerKeyringProtocol.d.ts.map +1 -1
  336. package/lib/types/internal/app-binder/LedgerKeyringProtocolBinder.d.ts +14 -8
  337. package/lib/types/internal/app-binder/LedgerKeyringProtocolBinder.d.ts.map +1 -1
  338. package/lib/types/internal/app-binder/command/GetAppNameCommand.d.ts +4 -1
  339. package/lib/types/internal/app-binder/command/GetAppNameCommand.d.ts.map +1 -1
  340. package/lib/types/internal/app-binder/command/GetSeedIdCommand.d.ts +13 -1
  341. package/lib/types/internal/app-binder/command/GetSeedIdCommand.d.ts.map +1 -1
  342. package/lib/types/internal/app-binder/command/GetVersionCommand.d.ts +2 -1
  343. package/lib/types/internal/app-binder/command/GetVersionCommand.d.ts.map +1 -1
  344. package/lib/types/internal/app-binder/command/InitCommand.d.ts +4 -1
  345. package/lib/types/internal/app-binder/command/InitCommand.d.ts.map +1 -1
  346. package/lib/types/internal/app-binder/command/ParseBlockSignatureCommand.d.ts +4 -1
  347. package/lib/types/internal/app-binder/command/ParseBlockSignatureCommand.d.ts.map +1 -1
  348. package/lib/types/internal/app-binder/command/ParseStreamBlockCommand.d.ts +5 -1
  349. package/lib/types/internal/app-binder/command/ParseStreamBlockCommand.d.ts.map +1 -1
  350. package/lib/types/internal/app-binder/command/ParseStreamBlockHeader.d.ts +4 -1
  351. package/lib/types/internal/app-binder/command/ParseStreamBlockHeader.d.ts.map +1 -1
  352. package/lib/types/internal/app-binder/command/SetTrustedMemberCommand.d.ts +5 -1
  353. package/lib/types/internal/app-binder/command/SetTrustedMemberCommand.d.ts.map +1 -1
  354. package/lib/types/internal/app-binder/command/SignBlockHeader.d.ts +6 -1
  355. package/lib/types/internal/app-binder/command/SignBlockHeader.d.ts.map +1 -1
  356. package/lib/types/internal/app-binder/command/SignBlockSignatureCommand.d.ts +5 -1
  357. package/lib/types/internal/app-binder/command/SignBlockSignatureCommand.d.ts.map +1 -1
  358. package/lib/types/internal/app-binder/command/SignBlockSingleCommand.d.ts +4 -1
  359. package/lib/types/internal/app-binder/command/SignBlockSingleCommand.d.ts.map +1 -1
  360. package/lib/types/internal/app-binder/device-action/AddToTrustchainDeviceAction.d.ts +10 -6
  361. package/lib/types/internal/app-binder/device-action/AddToTrustchainDeviceAction.d.ts.map +1 -1
  362. package/lib/types/internal/app-binder/device-action/AuthenticateWithDeviceDeviceAction.d.ts +32 -0
  363. package/lib/types/internal/app-binder/device-action/AuthenticateWithDeviceDeviceAction.d.ts.map +1 -0
  364. package/lib/types/internal/app-binder/device-action/AuthenticateWithKeypairDeviceAction.d.ts +33 -0
  365. package/lib/types/internal/app-binder/device-action/AuthenticateWithKeypairDeviceAction.d.ts.map +1 -0
  366. package/lib/types/internal/app-binder/device-action/models/AuthenticateWithDeviceDeviceActionTypes.d.ts +22 -0
  367. package/lib/types/internal/app-binder/device-action/models/AuthenticateWithDeviceDeviceActionTypes.d.ts.map +1 -0
  368. package/lib/types/internal/app-binder/device-action/models/AuthenticateWithKeypairDeviceActionTypes.d.ts +19 -0
  369. package/lib/types/internal/app-binder/device-action/models/AuthenticateWithKeypairDeviceActionTypes.d.ts.map +1 -0
  370. package/lib/types/internal/app-binder/task/AuthenticateTask.d.ts +9 -0
  371. package/lib/types/internal/app-binder/task/AuthenticateTask.d.ts.map +1 -0
  372. package/lib/types/internal/app-binder/task/ExtractEncryptionKeyTask.d.ts +8 -0
  373. package/lib/types/internal/app-binder/task/ExtractEncryptionKeyTask.d.ts.map +1 -0
  374. package/lib/types/internal/app-binder/task/InitTask.d.ts +5 -3
  375. package/lib/types/internal/app-binder/task/InitTask.d.ts.map +1 -1
  376. package/lib/types/internal/app-binder/task/ParseStreamToDeviceTask.d.ts +3 -3
  377. package/lib/types/internal/app-binder/task/ParseStreamToDeviceTask.d.ts.map +1 -1
  378. package/lib/types/internal/app-binder/task/SignBlockTask.d.ts +15 -13
  379. package/lib/types/internal/app-binder/task/SignBlockTask.d.ts.map +1 -1
  380. package/lib/types/internal/app-binder/task/SignChallengeWithKeypairTask.d.ts +6 -5
  381. package/lib/types/internal/app-binder/task/SignChallengeWithKeypairTask.d.ts.map +1 -1
  382. package/lib/types/internal/app-binder/task/utils/TrustedProperties.d.ts +2 -2
  383. package/lib/types/internal/app-binder/task/utils/TrustedProperties.d.ts.map +1 -1
  384. package/lib/types/internal/di.d.ts +7 -3
  385. package/lib/types/internal/di.d.ts.map +1 -1
  386. package/lib/types/internal/externalTypes.d.ts +2 -1
  387. package/lib/types/internal/externalTypes.d.ts.map +1 -1
  388. package/lib/types/internal/lkrp-datasource/data/HttpLKRPDataSource.d.ts +8 -10
  389. package/lib/types/internal/lkrp-datasource/data/HttpLKRPDataSource.d.ts.map +1 -1
  390. package/lib/types/internal/lkrp-datasource/data/LKRPDataSource.d.ts +8 -8
  391. package/lib/types/internal/lkrp-datasource/data/LKRPDataSource.d.ts.map +1 -1
  392. package/lib/types/internal/models/LKRPBlockTypes.d.ts +11 -0
  393. package/lib/types/internal/models/LKRPBlockTypes.d.ts.map +1 -0
  394. package/lib/types/internal/{utils/types.d.ts → models/LKRPCommandTypes.d.ts} +6 -29
  395. package/lib/types/internal/models/LKRPCommandTypes.d.ts.map +1 -0
  396. package/lib/types/internal/{utils/TLVTags.d.ts → models/Tags.d.ts} +1 -1
  397. package/lib/types/internal/models/Tags.d.ts.map +1 -0
  398. package/lib/types/internal/models/Types.d.ts +10 -0
  399. package/lib/types/internal/models/Types.d.ts.map +1 -0
  400. package/lib/types/internal/use-cases/authentication/AuthenticateUseCase.d.ts +15 -2
  401. package/lib/types/internal/use-cases/authentication/AuthenticateUseCase.d.ts.map +1 -1
  402. package/lib/types/internal/use-cases/authentication/DecryptDataUseCase.d.ts +7 -0
  403. package/lib/types/internal/use-cases/authentication/DecryptDataUseCase.d.ts.map +1 -0
  404. package/lib/types/internal/use-cases/authentication/EncryptDataUseCase.d.ts +7 -0
  405. package/lib/types/internal/use-cases/authentication/EncryptDataUseCase.d.ts.map +1 -0
  406. package/lib/types/internal/use-cases/di/useCasesModule.d.ts.map +1 -1
  407. package/lib/types/internal/use-cases/di/useCasesTypes.d.ts +2 -0
  408. package/lib/types/internal/use-cases/di/useCasesTypes.d.ts.map +1 -1
  409. package/lib/types/internal/utils/LKRPBlock.d.ts +2 -2
  410. package/lib/types/internal/utils/LKRPBlock.d.ts.map +1 -1
  411. package/lib/types/internal/utils/LKRPBlockStream.d.ts +8 -8
  412. package/lib/types/internal/utils/LKRPBlockStream.d.ts.map +1 -1
  413. package/lib/types/internal/utils/LKRPCommand.d.ts +4 -3
  414. package/lib/types/internal/utils/LKRPCommand.d.ts.map +1 -1
  415. package/lib/types/internal/utils/TLVParser.d.ts +4 -3
  416. package/lib/types/internal/utils/TLVParser.d.ts.map +1 -1
  417. package/lib/types/internal/utils/Trustchain.d.ts +14 -0
  418. package/lib/types/internal/utils/Trustchain.d.ts.map +1 -0
  419. package/lib/types/internal/utils/required.d.ts +1 -1
  420. package/lib/types/internal/utils/required.d.ts.map +1 -1
  421. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  422. package/package.json +5 -4
  423. package/lib/cjs/api/app-binder/Errors.js +0 -2
  424. package/lib/cjs/api/app-binder/Errors.js.map +0 -7
  425. package/lib/cjs/api/app-binder/GetAppNameCommandTypes.js +0 -2
  426. package/lib/cjs/api/app-binder/GetAppNameCommandTypes.js.map +0 -7
  427. package/lib/cjs/api/app-binder/GetSeedIdCommandTypes.js +0 -2
  428. package/lib/cjs/api/app-binder/GetSeedIdCommandTypes.js.map +0 -7
  429. package/lib/cjs/api/app-binder/InitCommandTypes.js +0 -2
  430. package/lib/cjs/api/app-binder/InitCommandTypes.js.map +0 -7
  431. package/lib/cjs/api/app-binder/KeypairFromBytes.js +0 -2
  432. package/lib/cjs/api/app-binder/KeypairFromBytes.js.map +0 -7
  433. package/lib/cjs/api/app-binder/LKRPTypes.js +0 -2
  434. package/lib/cjs/api/app-binder/LKRPTypes.js.map +0 -7
  435. package/lib/cjs/api/app-binder/ParseStreamBlockCommandCommandTypes.js +0 -2
  436. package/lib/cjs/api/app-binder/ParseStreamBlockCommandCommandTypes.js.map +0 -7
  437. package/lib/cjs/api/app-binder/ParseStreamBlockHeaderCommandTypes.js +0 -2
  438. package/lib/cjs/api/app-binder/ParseStreamBlockHeaderCommandTypes.js.map +0 -7
  439. package/lib/cjs/api/app-binder/ParseStreamBlockSignatureTypes.js +0 -2
  440. package/lib/cjs/api/app-binder/ParseStreamBlockSignatureTypes.js.map +0 -7
  441. package/lib/cjs/api/app-binder/SetTrustedMemberTypes.js +0 -2
  442. package/lib/cjs/api/app-binder/SetTrustedMemberTypes.js.map +0 -7
  443. package/lib/cjs/api/app-binder/SignBlockCommandTypes.js +0 -2
  444. package/lib/cjs/api/app-binder/SignBlockCommandTypes.js.map +0 -7
  445. package/lib/cjs/api/app-binder/SignBlockHeaderCommandTypes.js +0 -2
  446. package/lib/cjs/api/app-binder/SignBlockHeaderCommandTypes.js.map +0 -7
  447. package/lib/cjs/api/app-binder/SignBlockSignatureCommandTypes.js +0 -2
  448. package/lib/cjs/api/app-binder/SignBlockSignatureCommandTypes.js.map +0 -7
  449. package/lib/cjs/api/app-binder/SignBlockSingleCommandTypes.js +0 -2
  450. package/lib/cjs/api/app-binder/SignBlockSingleCommandTypes.js.map +0 -7
  451. package/lib/cjs/internal/app-binder/device-action/AuthenticateDeviceAction.js +0 -2
  452. package/lib/cjs/internal/app-binder/device-action/AuthenticateDeviceAction.js.map +0 -7
  453. package/lib/cjs/internal/utils/TLVBuilder.js +0 -2
  454. package/lib/cjs/internal/utils/TLVBuilder.js.map +0 -7
  455. package/lib/cjs/internal/utils/crypto.js +0 -2
  456. package/lib/cjs/internal/utils/crypto.js.map +0 -7
  457. package/lib/cjs/internal/utils/hex.js +0 -2
  458. package/lib/cjs/internal/utils/hex.js.map +0 -7
  459. package/lib/cjs/internal/utils/types.js +0 -2
  460. package/lib/cjs/internal/utils/types.js.map +0 -7
  461. package/lib/esm/api/app-binder/Errors.js +0 -2
  462. package/lib/esm/api/app-binder/Errors.js.map +0 -7
  463. package/lib/esm/api/app-binder/GetAppNameCommandTypes.js +0 -1
  464. package/lib/esm/api/app-binder/GetSeedIdCommandTypes.js +0 -1
  465. package/lib/esm/api/app-binder/InitCommandTypes.js +0 -1
  466. package/lib/esm/api/app-binder/KeypairFromBytes.js +0 -2
  467. package/lib/esm/api/app-binder/KeypairFromBytes.js.map +0 -7
  468. package/lib/esm/api/app-binder/LKRPTypes.js +0 -2
  469. package/lib/esm/api/app-binder/LKRPTypes.js.map +0 -7
  470. package/lib/esm/api/app-binder/ParseStreamBlockCommandCommandTypes.js +0 -1
  471. package/lib/esm/api/app-binder/ParseStreamBlockHeaderCommandTypes.js +0 -1
  472. package/lib/esm/api/app-binder/ParseStreamBlockSignatureTypes.js +0 -1
  473. package/lib/esm/api/app-binder/SetTrustedMemberTypes.js +0 -1
  474. package/lib/esm/api/app-binder/SetTrustedMemberTypes.js.map +0 -7
  475. package/lib/esm/api/app-binder/SignBlockCommandTypes.js +0 -1
  476. package/lib/esm/api/app-binder/SignBlockCommandTypes.js.map +0 -7
  477. package/lib/esm/api/app-binder/SignBlockHeaderCommandTypes.js +0 -1
  478. package/lib/esm/api/app-binder/SignBlockHeaderCommandTypes.js.map +0 -7
  479. package/lib/esm/api/app-binder/SignBlockSignatureCommandTypes.js +0 -1
  480. package/lib/esm/api/app-binder/SignBlockSignatureCommandTypes.js.map +0 -7
  481. package/lib/esm/api/app-binder/SignBlockSingleCommandTypes.js +0 -1
  482. package/lib/esm/api/app-binder/SignBlockSingleCommandTypes.js.map +0 -7
  483. package/lib/esm/internal/app-binder/device-action/AuthenticateDeviceAction.js +0 -2
  484. package/lib/esm/internal/app-binder/device-action/AuthenticateDeviceAction.js.map +0 -7
  485. package/lib/esm/internal/utils/TLVBuilder.js +0 -2
  486. package/lib/esm/internal/utils/TLVBuilder.js.map +0 -7
  487. package/lib/esm/internal/utils/crypto.js +0 -2
  488. package/lib/esm/internal/utils/crypto.js.map +0 -7
  489. package/lib/esm/internal/utils/hex.js +0 -2
  490. package/lib/esm/internal/utils/hex.js.map +0 -7
  491. package/lib/esm/internal/utils/types.js +0 -1
  492. package/lib/esm/internal/utils/types.js.map +0 -7
  493. package/lib/types/api/app-binder/Errors.d.ts +0 -27
  494. package/lib/types/api/app-binder/Errors.d.ts.map +0 -1
  495. package/lib/types/api/app-binder/GetAppNameCommandTypes.d.ts +0 -5
  496. package/lib/types/api/app-binder/GetAppNameCommandTypes.d.ts.map +0 -1
  497. package/lib/types/api/app-binder/GetSeedIdCommandTypes.d.ts +0 -14
  498. package/lib/types/api/app-binder/GetSeedIdCommandTypes.d.ts.map +0 -1
  499. package/lib/types/api/app-binder/InitCommandTypes.d.ts +0 -5
  500. package/lib/types/api/app-binder/InitCommandTypes.d.ts.map +0 -1
  501. package/lib/types/api/app-binder/KeypairFromBytes.d.ts +0 -11
  502. package/lib/types/api/app-binder/KeypairFromBytes.d.ts.map +0 -1
  503. package/lib/types/api/app-binder/LKRPTypes.d.ts.map +0 -1
  504. package/lib/types/api/app-binder/ParseStreamBlockCommandCommandTypes.d.ts +0 -6
  505. package/lib/types/api/app-binder/ParseStreamBlockCommandCommandTypes.d.ts.map +0 -1
  506. package/lib/types/api/app-binder/ParseStreamBlockHeaderCommandTypes.d.ts +0 -5
  507. package/lib/types/api/app-binder/ParseStreamBlockHeaderCommandTypes.d.ts.map +0 -1
  508. package/lib/types/api/app-binder/ParseStreamBlockSignatureTypes.d.ts +0 -5
  509. package/lib/types/api/app-binder/ParseStreamBlockSignatureTypes.d.ts.map +0 -1
  510. package/lib/types/api/app-binder/SetTrustedMemberTypes.d.ts +0 -6
  511. package/lib/types/api/app-binder/SetTrustedMemberTypes.d.ts.map +0 -1
  512. package/lib/types/api/app-binder/SignBlockCommandTypes.d.ts +0 -9
  513. package/lib/types/api/app-binder/SignBlockCommandTypes.d.ts.map +0 -1
  514. package/lib/types/api/app-binder/SignBlockHeaderCommandTypes.d.ts +0 -5
  515. package/lib/types/api/app-binder/SignBlockHeaderCommandTypes.d.ts.map +0 -1
  516. package/lib/types/api/app-binder/SignBlockSignatureCommandTypes.d.ts +0 -6
  517. package/lib/types/api/app-binder/SignBlockSignatureCommandTypes.d.ts.map +0 -1
  518. package/lib/types/api/app-binder/SignBlockSingleCommandTypes.d.ts +0 -5
  519. package/lib/types/api/app-binder/SignBlockSingleCommandTypes.d.ts.map +0 -1
  520. package/lib/types/internal/app-binder/device-action/AuthenticateDeviceAction.d.ts +0 -42
  521. package/lib/types/internal/app-binder/device-action/AuthenticateDeviceAction.d.ts.map +0 -1
  522. package/lib/types/internal/utils/TLVBuilder.d.ts +0 -15
  523. package/lib/types/internal/utils/TLVBuilder.d.ts.map +0 -1
  524. package/lib/types/internal/utils/TLVTags.d.ts.map +0 -1
  525. package/lib/types/internal/utils/crypto.d.ts +0 -19
  526. package/lib/types/internal/utils/crypto.d.ts.map +0 -1
  527. package/lib/types/internal/utils/hex.d.ts +0 -3
  528. package/lib/types/internal/utils/hex.d.ts.map +0 -1
  529. package/lib/types/internal/utils/types.d.ts.map +0 -1
  530. /package/lib/esm/api/{app-binder/GetAppNameCommandTypes.js.map → model/JWT.js.map} +0 -0
  531. /package/lib/esm/{api/app-binder/GetSeedIdCommandTypes.js.map → internal/app-binder/device-action/models/AuthenticateWithDeviceDeviceActionTypes.js.map} +0 -0
  532. /package/lib/esm/{api/app-binder/InitCommandTypes.js.map → internal/app-binder/device-action/models/AuthenticateWithKeypairDeviceActionTypes.js.map} +0 -0
  533. /package/lib/esm/{api/app-binder/ParseStreamBlockCommandCommandTypes.js.map → internal/models/LKRPBlockTypes.js.map} +0 -0
  534. /package/lib/esm/{api/app-binder/ParseStreamBlockHeaderCommandTypes.js.map → internal/models/LKRPCommandTypes.js.map} +0 -0
  535. /package/lib/esm/{api/app-binder/ParseStreamBlockSignatureTypes.js.map → internal/models/Types.js.map} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/device-trusted-app-kit-ledger-keyring-protocol",
3
- "version": "0.0.0-rn-ble-pairing-removed-while-reconnecting-20250807094338",
3
+ "version": "0.0.0-transaction-unfunded-20250917151052",
4
4
  "license": "Apache-2.0",
5
5
  "private": false,
6
6
  "exports": {
@@ -20,14 +20,15 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "@noble/ciphers": "^1.3.0",
23
+ "@noble/curves": "^1.9.7",
23
24
  "@noble/hashes": "^1.8.0",
24
- "@noble/secp256k1": "^2.3.0",
25
25
  "inversify": "7.5.1",
26
26
  "purify-ts": "2.1.0",
27
27
  "reflect-metadata": "0.2.2",
28
+ "rxjs": "7.8.2",
28
29
  "xstate": "5.19.2",
29
- "@ledgerhq/device-management-kit": "0.0.0-rn-ble-pairing-removed-while-reconnecting-20250807094338",
30
- "@ledgerhq/signer-utils": "0.0.0-rn-ble-pairing-removed-while-reconnecting-20250807094338"
30
+ "@ledgerhq/device-management-kit": "0.0.0-transaction-unfunded-20250917151052",
31
+ "@ledgerhq/signer-utils": "0.0.0-transaction-unfunded-20250917151052"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@ledgerhq/eslint-config-dsdk": "0.0.2",
@@ -1,2 +0,0 @@
1
- "use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var l=(o,r)=>{for(var e in r)s(o,e,{get:r[e],enumerable:!0})},p=(o,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of c(r))!i.call(o,n)&&n!==e&&s(o,n,{get:()=>r[n],enumerable:!(a=u(r,n))||a.enumerable});return o};var P=o=>p(s({},"__esModule",{value:!0}),o);var g={};l(g,{LKRPHttpRequestError:()=>d,LKRPMissingDataError:()=>K,LKRPParsingError:()=>x,LKRPUnauthorizedError:()=>R,LKRPUnhandledState:()=>L});module.exports=P(g);var t=require("@ledgerhq/device-management-kit");class d extends t.GeneralDmkError{constructor(e){super(e);this.err=e}_tag="LKRPHttpRequestError"}class R extends d{constructor(e){super(e);this.err=e}_tag="LKRPUnauthorizedError"}class x extends t.GeneralDmkError{constructor(e){super(e);this.err=e}_tag="LKRPParsingError"}class K extends t.GeneralDmkError{constructor(e){super(e);this.err=e}_tag="LKRPMissingDataError"}class L extends t.GeneralDmkError{constructor(e){super(e);this.err=e}_tag="LKRPUnhandledState"}0&&(module.exports={LKRPHttpRequestError,LKRPMissingDataError,LKRPParsingError,LKRPUnauthorizedError,LKRPUnhandledState});
2
- //# sourceMappingURL=Errors.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/Errors.ts"],
4
- "sourcesContent": ["import { GeneralDmkError } from \"@ledgerhq/device-management-kit\";\n\nexport class LKRPHttpRequestError extends GeneralDmkError {\n override _tag = \"LKRPHttpRequestError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPUnauthorizedError extends LKRPHttpRequestError {\n override _tag = \"LKRPUnauthorizedError\";\n constructor(override err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPParsingError extends GeneralDmkError {\n override readonly _tag = \"LKRPParsingError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPMissingDataError extends GeneralDmkError {\n override readonly _tag = \"LKRPMissingDataError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPUnhandledState extends GeneralDmkError {\n override readonly _tag = \"LKRPUnhandledState\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,yBAAAC,EAAA,qBAAAC,EAAA,0BAAAC,EAAA,uBAAAC,IAAA,eAAAC,EAAAP,GAAA,IAAAQ,EAAgC,2CAEzB,MAAMN,UAA6B,iBAAgB,CAExD,YAAqBO,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHS,KAAO,sBAIlB,CAEO,MAAMJ,UAA8BH,CAAqB,CAE9D,YAAqBO,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHS,KAAO,uBAIlB,CAEO,MAAML,UAAyB,iBAAgB,CAEpD,YAAqBK,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,kBAI3B,CAEO,MAAMN,UAA6B,iBAAgB,CAExD,YAAqBM,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,sBAI3B,CAEO,MAAMH,UAA2B,iBAAgB,CAEtD,YAAqBG,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,oBAI3B",
6
- "names": ["Errors_exports", "__export", "LKRPHttpRequestError", "LKRPMissingDataError", "LKRPParsingError", "LKRPUnauthorizedError", "LKRPUnhandledState", "__toCommonJS", "import_device_management_kit", "err"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var t=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var s=(p,e,a,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of d(e))!r.call(p,n)&&n!==a&&t(p,n,{get:()=>e[n],enumerable:!(m=o(e,n))||m.enumerable});return p};var y=p=>s(t({},"__esModule",{value:!0}),p);var A={};module.exports=y(A);
2
- //# sourceMappingURL=GetAppNameCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/GetAppNameCommandTypes.ts"],
4
- "sourcesContent": ["export type GetAppNameCommandResponse = {\n readonly name: string;\n};\n\nexport type GetAppNameCommandArgs = undefined;\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["GetAppNameCommandTypes_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var d=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var s=(n,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of l(e))!i.call(n,r)&&r!==o&&d(n,r,{get:()=>e[r],enumerable:!(t=a(e,r))||t.enumerable});return n};var y=n=>s(d({},"__esModule",{value:!0}),n);var g={};module.exports=y(g);
2
- //# sourceMappingURL=GetSeedIdCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/GetSeedIdCommandTypes.ts"],
4
- "sourcesContent": ["export type GetSeedIdCommandResponse = {\n readonly credential: {\n readonly version: number;\n readonly curveId: number;\n readonly signAlgorithm: number;\n readonly publicKey: string;\n };\n readonly signature: string;\n readonly attestation: string;\n};\n\nexport type GetSeedIdCommandArgs = {\n readonly challengeTLV: string;\n};\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["GetSeedIdCommandTypes_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var p=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var a=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of m(e))!y.call(t,n)&&n!==i&&p(t,n,{get:()=>e[n],enumerable:!(o=r(e,n))||o.enumerable});return t};var d=t=>a(p({},"__esModule",{value:!0}),t);var s={};module.exports=d(s);
2
- //# sourceMappingURL=InitCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/InitCommandTypes.ts"],
4
- "sourcesContent": ["export type InitCommandResponse = void;\n\nexport type InitCommandArgs = {\n publicKey: Uint8Array;\n};\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["InitCommandTypes_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var u=(t,r)=>{for(var e in r)n(t,e,{get:r[e],enumerable:!0})},K=(t,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let y of c(r))!m.call(t,y)&&y!==e&&n(t,y,{get:()=>r[y],enumerable:!(a=s(r,y))||a.enumerable});return t};var l=t=>K(n({},"__esModule",{value:!0}),t);var b={};u(b,{KeypairFromBytes:()=>U});module.exports=l(b);var i=require("@noble/secp256k1"),o=require("../../internal/utils/crypto"),p=require("../../internal/utils/hex");class U{constructor(r,e=(0,i.getPublicKey)(r)){this.privateKey=r;this.publicKey=e}pubKeyToU8a(){return this.publicKey}pubKeyToHex(){return(0,p.bytesToHex)(this.publicKey)}async sign(r){const{r:e,s:a}=await(0,i.signAsync)(r,this.privateKey);return o.CryptoUtils.derEncode(e,a)}ecdh(r,e=!0){return(0,i.getSharedSecret)(this.privateKey,r,e)}}0&&(module.exports={KeypairFromBytes});
2
- //# sourceMappingURL=KeypairFromBytes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/KeypairFromBytes.ts"],
4
- "sourcesContent": ["import { getPublicKey, getSharedSecret, signAsync } from \"@noble/secp256k1\";\n\nimport { type Keypair } from \"@api/index\";\nimport { CryptoUtils } from \"@internal/utils/crypto\";\nimport { bytesToHex } from \"@internal/utils/hex\";\n\nexport class KeypairFromBytes implements Keypair {\n constructor(\n private readonly privateKey: Uint8Array,\n private readonly publicKey = getPublicKey(privateKey),\n ) {}\n\n pubKeyToU8a(): Uint8Array {\n return this.publicKey;\n }\n\n pubKeyToHex(): string {\n return bytesToHex(this.publicKey);\n }\n\n async sign(message: Uint8Array): Promise<Uint8Array> {\n const { r, s } = await signAsync(message, this.privateKey);\n return CryptoUtils.derEncode(r, s);\n }\n\n ecdh(publicKey: Uint8Array, isCompressed = true): Uint8Array {\n return getSharedSecret(this.privateKey, publicKey, isCompressed);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyD,4BAGzDC,EAA4B,kCAC5BC,EAA2B,+BAEpB,MAAMJ,CAAoC,CAC/C,YACmBK,EACAC,KAAY,gBAAaD,CAAU,EACpD,CAFiB,gBAAAA,EACA,eAAAC,CAChB,CAEH,aAA0B,CACxB,OAAO,KAAK,SACd,CAEA,aAAsB,CACpB,SAAO,cAAW,KAAK,SAAS,CAClC,CAEA,MAAM,KAAKC,EAA0C,CACnD,KAAM,CAAE,EAAAC,EAAG,EAAAC,CAAE,EAAI,QAAM,aAAUF,EAAS,KAAK,UAAU,EACzD,OAAO,cAAY,UAAUC,EAAGC,CAAC,CACnC,CAEA,KAAKH,EAAuBI,EAAe,GAAkB,CAC3D,SAAO,mBAAgB,KAAK,WAAYJ,EAAWI,CAAY,CACjE,CACF",
6
- "names": ["KeypairFromBytes_exports", "__export", "KeypairFromBytes", "__toCommonJS", "import_secp256k1", "import_crypto", "import_hex", "privateKey", "publicKey", "message", "r", "s", "isCompressed"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var p=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var c=(a,r)=>{for(var e in r)p(a,e,{get:r[e],enumerable:!0})},U=(a,r,e,y)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of n(r))!g.call(a,t)&&t!==e&&p(a,t,{get:()=>r[t],enumerable:!(y=A(r,t))||y.enumerable});return a};var u=a=>U(p({},"__esModule",{value:!0}),a);var x={};c(x,{Permissions:()=>f});module.exports=u(x);var f=(t=>(t[t.OWNER=4294967295]="OWNER",t[t.CAN_ENCRYPT=1]="CAN_ENCRYPT",t[t.CAN_DERIVE=2]="CAN_DERIVE",t[t.CAN_ADD_BLOCK=4]="CAN_ADD_BLOCK",t))(f||{});0&&(module.exports={Permissions});
2
- //# sourceMappingURL=LKRPTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/LKRPTypes.ts"],
4
- "sourcesContent": ["export interface Keypair {\n pubKeyToU8a(): Uint8Array;\n pubKeyToHex(): string;\n sign(message: Uint8Array): Promise<Uint8Array>;\n ecdh(publicKey: Uint8Array): Uint8Array;\n}\n\nexport type JWT = {\n access_token: string;\n permissions: {\n [trustchainId: string]: {\n [path: string]: string[];\n };\n };\n};\n\n/**\n * https://ledgerhq.atlassian.net/wiki/spaces/TA/pages/5865144361/ARCH+LKRP+-+v2+specifications#Member-permissions\n */\nexport enum Permissions {\n OWNER = 0xffffffff, // Owners of the stream have access to everything\n CAN_ENCRYPT = 1, // The member can have access to the stream private key\n CAN_DERIVE = 1 << 1, // The member can have access to the stream chain code (if a member have access to the private key and the chain code it is able to derive sub-streams)\n CAN_ADD_BLOCK = 1 << 2, // The member is authorized to issue blocks in the current stream\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GAmBO,IAAKE,OACVA,IAAA,MAAQ,YAAR,QACAA,IAAA,YAAc,GAAd,cACAA,IAAA,WAAa,GAAb,aACAA,IAAA,cAAgB,GAAhB,gBAJUA,OAAA",
6
- "names": ["LKRPTypes_exports", "__export", "Permissions", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var d=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of p(e))!s.call(r,a)&&a!==t&&o(r,a,{get:()=>e[a],enumerable:!(n=m(e,a))||n.enumerable});return r};var i=r=>d(o({},"__esModule",{value:!0}),r);var y={};module.exports=i(y);
2
- //# sourceMappingURL=ParseStreamBlockCommandCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/ParseStreamBlockCommandCommandTypes.ts"],
4
- "sourcesContent": ["export type ParseSingleCommandArgs = {\n command: Uint8Array;\n outputTrustedParam?: boolean;\n};\n\nexport type ParseSingleCommandResponse = Uint8Array;\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["ParseStreamBlockCommandCommandTypes_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var t=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var m=(r,e,d,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of p(e))!s.call(r,a)&&a!==d&&t(r,a,{get:()=>e[a],enumerable:!(o=n(e,a))||o.enumerable});return r};var y=r=>m(t({},"__esModule",{value:!0}),r);var A={};module.exports=y(A);
2
- //# sourceMappingURL=ParseStreamBlockHeaderCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/ParseStreamBlockHeaderCommandTypes.ts"],
4
- "sourcesContent": ["export type ParseBlockHeaderCommandResponse = Uint8Array;\n\nexport type ParseBlockHeaderCommandArgs = {\n header: Uint8Array;\n};\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["ParseStreamBlockHeaderCommandTypes_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var g=(e,r,o,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of i(r))!p.call(e,a)&&a!==o&&n(e,a,{get:()=>r[a],enumerable:!(t=s(r,a))||t.enumerable});return e};var m=e=>g(n({},"__esModule",{value:!0}),e);var y={};module.exports=m(y);
2
- //# sourceMappingURL=ParseStreamBlockSignatureTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/ParseStreamBlockSignatureTypes.ts"],
4
- "sourcesContent": ["export type ParseBlockSignatureCommandResponse = Uint8Array;\n\nexport type ParseBlockSignatureCommandArgs = { signature: Uint8Array };\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["ParseStreamBlockSignatureTypes_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var o=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var p=(r,e,d,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!y.call(r,t)&&t!==d&&o(r,t,{get:()=>e[t],enumerable:!(m=n(e,t))||m.enumerable});return r};var s=r=>p(o({},"__esModule",{value:!0}),r);var i={};module.exports=s(i);
2
- //# sourceMappingURL=SetTrustedMemberTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/SetTrustedMemberTypes.ts"],
4
- "sourcesContent": ["export type SetTrustedMemberCommandResponse = void;\n\nexport type SetTrustedMemberCommandArgs = {\n readonly iv: Uint8Array;\n readonly memberTlv: Uint8Array;\n};\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["SetTrustedMemberTypes_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var p=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var l=(e,r,y,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of d(r))!n.call(e,o)&&o!==y&&p(e,o,{get:()=>r[o],enumerable:!(t=a(r,o))||t.enumerable});return e};var m=e=>l(p({},"__esModule",{value:!0}),e);var s={};module.exports=m(s);
2
- //# sourceMappingURL=SignBlockCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/SignBlockCommandTypes.ts"],
4
- "sourcesContent": ["import { type TrustedProperty } from \"@internal/externalTypes\";\n\nexport type SignBlockCommandResponse = {\n readonly trustedProperty: Partial<TrustedProperty>;\n};\n\nexport type SignBlockCommandArgs = {\n readonly p1: 0x00 | 0x01 | 0x02;\n readonly payload: Uint8Array;\n};\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["SignBlockCommandTypes_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var o=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of i(e))!m.call(r,a)&&a!==t&&o(r,a,{get:()=>e[a],enumerable:!(n=d(e,a))||n.enumerable});return r};var c=r=>p(o({},"__esModule",{value:!0}),r);var g={};module.exports=c(g);
2
- //# sourceMappingURL=SignBlockHeaderCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/SignBlockHeaderCommandTypes.ts"],
4
- "sourcesContent": ["export interface SignBlockHeaderCommandArgs {\n header: Uint8Array;\n}\n\nexport type SignBlockHeaderCommandResponse = Uint8Array;\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["SignBlockHeaderCommandTypes_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var c=(n,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of g(e))!s.call(n,r)&&r!==o&&t(n,r,{get:()=>e[r],enumerable:!(i=a(e,r))||i.enumerable});return n};var S=n=>c(t({},"__esModule",{value:!0}),n);var d={};module.exports=S(d);
2
- //# sourceMappingURL=SignBlockSignatureCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/SignBlockSignatureCommandTypes.ts"],
4
- "sourcesContent": ["export type SignBlockSignatureCommandArgs = Record<string, never>;\n\nexport interface SignBlockSignatureCommandResponse {\n signature: Uint8Array;\n deviceSessionKey: Uint8Array;\n}\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["SignBlockSignatureCommandTypes_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var c=(e,n,a,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of t(n))!g.call(e,o)&&o!==a&&i(e,o,{get:()=>n[o],enumerable:!(r=m(n,o))||r.enumerable});return e};var l=e=>c(i({},"__esModule",{value:!0}),e);var p={};module.exports=l(p);
2
- //# sourceMappingURL=SignBlockSingleCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/SignBlockSingleCommandTypes.ts"],
4
- "sourcesContent": ["export interface SignBlockSingleCommandArgs {\n command: Uint8Array;\n}\n\nexport type SignBlockSingleCommandResponse = Uint8Array;\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["SignBlockSingleCommandTypes_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var y=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var v=(p,i)=>{for(var n in i)y(p,n,{get:i[n],enumerable:!0})},M=(p,i,n,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of I(i))!f.call(p,a)&&a!==n&&y(p,a,{get:()=>i[a],enumerable:!(r=k(i,a))||r.enumerable});return p};var w=p=>M(y({},"__esModule",{value:!0}),p);var P={};v(P,{AuthenticateDeviceAction:()=>K});module.exports=w(P);var o=require("@ledgerhq/device-management-kit"),s=require("purify-ts"),c=require("xstate"),A=require("../../../api/app-binder/Errors"),g=require("../../app-binder/task/SignChallengeWithDeviceTask"),T=require("../../app-binder/task/SignChallengeWithKeypairTask"),m=require("../../utils/eitherSeqRecord"),E=require("../../utils/LKRPBlockStream"),u=require("../../utils/required"),h=require("./utils/raiseAndAssign"),S=require("./AddToTrustchainDeviceAction");const D="Ledger Sync";class K extends o.XStateDeviceAction{makeStateMachine(i){const{deviceAuth:n,keypairAuth:r,getTrustchain:a,extractEncryptionKey:d}=this.extractDependencies(i);return(0,c.setup)({types:{input:{},context:{},output:{}},actors:{openAppStateMachine:new o.OpenAppDeviceAction({input:{appName:D}}).makeStateMachine(i),deviceAuth:(0,c.fromPromise)(n),keypairAuth:(0,c.fromPromise)(r),getTrustchain:(0,c.fromPromise)(a),addToTrustchainStateMachine:new S.AddToTrustchainDeviceAction({input:(0,s.Left)(new A.LKRPMissingDataError("Missing input for GetEncryptionKey"))}).makeStateMachine(i),extractEncryptionKey:(0,c.fromPromise)(d)},actions:{assignErrorFromEvent:(0,h.raiseAndAssign)(({event:t})=>(0,s.Left)(new o.UnknownDAError(String(t.error))))},guards:{hasNoTrustchainId:({context:t})=>!t.input.trustchainId,hasNoJwt:({context:t})=>!t.input.jwt,isTrustchainMember:({context:t})=>t._internalState.toMaybe().map(e=>e.wasAddedToTrustchain||e.applicationStream?.hasMember(t.input.keypair.pubKeyToHex())).extract()??!1}}).createMachine({id:"AuthenticateDeviceAction",context:({input:t})=>({input:t,intermediateValue:{requiredUserInteraction:o.UserInteractionRequired.None},_internalState:(0,s.Right)({trustchainId:null,jwt:null,trustchain:null,applicationStream:null,encryptionKey:null,wasAddedToTrustchain:!1})}),initial:"CheckCredentials",states:{CheckCredentials:{always:[{target:"DeviceAuth",guard:"hasNoTrustchainId"},{target:"KeypairAuth",guard:"hasNoJwt"},{target:"GetTrustchain"}]},KeypairAuth:{on:{success:"GetTrustchain",invalidCredentials:"DeviceAuth",error:"Error"},invoke:{id:"keypairAuth",src:"keypairAuth",input:({context:t})=>({lkrpDataSource:t.input.lkrpDataSource,keypair:t.input.keypair,trustchainId:(0,u.required)(t.input.trustchainId,"Missing Trustchain ID in the input")}),onError:{actions:"assignErrorFromEvent"},onDone:{actions:(0,h.raiseAndAssign)(({event:t})=>t.output.map(({jwt:e})=>({raise:"success",assign:{jwt:e}})).chainLeft(e=>e instanceof A.LKRPUnauthorizedError?(0,s.Right)({raise:"invalidCredentials"}):(0,s.Left)(e)))}}},DeviceAuth:{on:{success:"GetTrustchain",error:"Error"},initial:"OpenApp",states:{OpenApp:{on:{success:"Auth"},invoke:{id:"openApp",src:"openAppStateMachine",input:{appName:D},onError:{actions:"assignErrorFromEvent"},onDone:{actions:(0,h.raiseAndAssign)(({event:t})=>t.output.map(()=>({raise:"success"})))}}},Auth:{entry:(0,c.assign)({intermediateValue:{requiredUserInteraction:"connect-ledger-sync"}}),exit:(0,c.assign)({intermediateValue:{requiredUserInteraction:o.UserInteractionRequired.None}}),invoke:{id:"deviceAuth",src:"deviceAuth",input:({context:t})=>t.input,onError:{actions:"assignErrorFromEvent"},onDone:{actions:(0,h.raiseAndAssign)(({event:t})=>t.output.chain(e=>e.trustchainId.caseOf({Nothing:()=>(0,s.Left)(new A.LKRPUnhandledState("The trustchain is empty")),Just:l=>(0,s.Right)({raise:"success",assign:{jwt:e.jwt,trustchainId:l}})})))}}}}},GetTrustchain:{on:{success:"CheckIsMembers",invalidCredentials:"KeypairAuth",error:"Error"},invoke:{id:"getTrustchain",src:"getTrustchain",input:({context:t})=>t._internalState.chain(e=>(0,m.eitherSeqRecord)({lkrpDataSource:t.input.lkrpDataSource,applicationId:t.input.applicationId,trustchainId:()=>(0,u.required)(e.trustchainId??t.input.trustchainId,"Missing Trustchain ID in the input for GetTrustchain"),jwt:()=>(0,u.required)(e.jwt??t.input.jwt,"Missing JWT in the input for GetTrustchain")})),onError:{actions:"assignErrorFromEvent"},onDone:{actions:(0,h.raiseAndAssign)(({event:t})=>t.output.map(({trustchain:e,applicationStream:l})=>({raise:"success",assign:{trustchain:e,applicationStream:l}})))}}},CheckIsMembers:{always:[{target:"ExtractEncryptionKey",guard:"isTrustchainMember"},{target:"AddToTrustchain"}]},AddToTrustchain:{on:{success:"GetTrustchain",error:"Error"},invoke:{id:"AddToTrustchain",src:"addToTrustchainStateMachine",input:({context:t})=>t._internalState.mapLeft(()=>new A.LKRPMissingDataError("Missing data in the input for AddToTrustchain")).chain(e=>(0,m.eitherSeqRecord)({lkrpDataSource:t.input.lkrpDataSource,keypair:t.input.keypair,clientName:t.input.clientName,permissions:t.input.permissions,jwt:()=>(0,u.required)(e.jwt??t.input.jwt,"Missing JWT in the input for AddToTrustchain"),trustchainId:()=>(0,u.required)(e.trustchainId??t.input.trustchainId,"Missing Trustchain ID in the input for GetTrustchain"),trustchain:()=>(0,u.required)(e.trustchain,"Missing Trustchain in the input for AddToTrustchain"),applicationStream:()=>(0,u.required)(e.applicationStream,"Missing application stream in the input for AddToTrustchain")})),onError:{actions:"assignErrorFromEvent"},onDone:{actions:(0,h.raiseAndAssign)(({event:t})=>t.output.map(()=>({raise:"success",assign:{wasAddedToTrustchain:!0}})))}}},ExtractEncryptionKey:{on:{success:"Success",error:"Error"},invoke:{id:"ExtractEncryptionKey",src:"extractEncryptionKey",input:({context:t})=>t._internalState.chain(e=>(0,u.required)(e.applicationStream,"Missing application stream").map(l=>({applicationStream:l,keypair:t.input.keypair}))),onError:{actions:"assignErrorFromEvent"},onDone:{actions:(0,h.raiseAndAssign)(({event:t})=>t.output.map(e=>({raise:"success",assign:{encryptionKey:e}})))}}},Success:{type:"final"},Error:{type:"final"}},output:({context:t})=>t._internalState.chain(e=>(0,m.eitherSeqRecord)({trustchainId:()=>(0,u.required)(e.trustchainId??t.input.trustchainId,"Missing Trustchain ID in the output"),jwt:()=>(0,u.required)(e.jwt??t.input.jwt,"Missing JWT in the output"),applicationPath:()=>(0,u.required)(e.applicationStream?.getPath().extract(),"Missing application path in the output"),encryptionKey:()=>(0,u.required)(e.encryptionKey,"Missing encryption key in the output")}))})}extractDependencies(i){return{deviceAuth:n=>this.auth(n.input.lkrpDataSource,new g.SignChallengeWithDeviceTask(i)).run(),keypairAuth:n=>{const{lkrpDataSource:r,keypair:a}=n.input;return s.EitherAsync.liftEither(n.input.trustchainId).chain(d=>this.auth(r,new T.SignChallengeWithKeypairTask(a,d))).run()},getTrustchain:n=>s.EitherAsync.liftEither(n.input).chain(({applicationId:r,lkrpDataSource:a,trustchainId:d,jwt:t})=>a.getTrustchainById(d,t).map(e=>({trustchain:e,applicationStream:e[`m/${r}'`]??E.LKRPBlockStream.fromPath(`m/0'/${r}'/0'`)}))).run(),extractEncryptionKey:async n=>Promise.resolve(n.input.chain(({applicationStream:r,keypair:a})=>r.getPublishedKey(a).toEither(new o.UnknownDAError("There is no encryption key for the current member in the application stream."))).map(r=>r.privateKey))}}auth(i,n){return i.getChallenge().chain(r=>n.run(r)).chain(r=>i.authenticate(r))}}0&&(module.exports={AuthenticateDeviceAction});
2
- //# sourceMappingURL=AuthenticateDeviceAction.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/internal/app-binder/device-action/AuthenticateDeviceAction.ts"],
4
- "sourcesContent": ["import {\n type DeviceActionStateMachine,\n type InternalApi,\n OpenAppDeviceAction,\n type StateMachineTypes,\n UnknownDAError,\n UserInteractionRequired,\n XStateDeviceAction,\n} from \"@ledgerhq/device-management-kit\";\nimport { type Either, EitherAsync, Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport {\n type AuthenticateDAError,\n type AuthenticateDAInput,\n type AuthenticateDAIntermediateValue,\n type AuthenticateDAInternalState,\n type AuthenticateDAOutput,\n} from \"@api/app-binder/AuthenticateDeviceActionTypes\";\nimport {\n LKRPMissingDataError,\n LKRPUnauthorizedError,\n LKRPUnhandledState,\n} from \"@api/app-binder/Errors\";\nimport { type Keypair } from \"@api/app-binder/LKRPTypes\";\nimport { type JWT } from \"@api/index\";\nimport { SignChallengeWithDeviceTask } from \"@internal/app-binder/task/SignChallengeWithDeviceTask\";\nimport { SignChallengeWithKeypairTask } from \"@internal/app-binder/task/SignChallengeWithKeypairTask\";\nimport {\n type AuthenticationPayload,\n type Challenge,\n type LKRPDataSource,\n} from \"@internal/lkrp-datasource/data/LKRPDataSource\";\nimport { eitherSeqRecord } from \"@internal/utils/eitherSeqRecord\";\nimport { LKRPBlockStream } from \"@internal/utils/LKRPBlockStream\";\nimport { required } from \"@internal/utils/required\";\n\nimport { raiseAndAssign } from \"./utils/raiseAndAssign\";\nimport { AddToTrustchainDeviceAction } from \"./AddToTrustchainDeviceAction\";\n\nconst APP_NAME = \"Ledger Sync\";\n\nexport class AuthenticateDeviceAction extends XStateDeviceAction<\n AuthenticateDAOutput,\n AuthenticateDAInput,\n AuthenticateDAError,\n AuthenticateDAIntermediateValue,\n AuthenticateDAInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n AuthenticateDAOutput,\n AuthenticateDAInput,\n AuthenticateDAError,\n AuthenticateDAIntermediateValue,\n AuthenticateDAInternalState\n > {\n type types = StateMachineTypes<\n AuthenticateDAOutput,\n AuthenticateDAInput,\n AuthenticateDAError,\n AuthenticateDAIntermediateValue,\n AuthenticateDAInternalState\n >;\n\n const { deviceAuth, keypairAuth, getTrustchain, extractEncryptionKey } =\n this.extractDependencies(internalApi);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n\n actors: {\n openAppStateMachine: new OpenAppDeviceAction({\n input: { appName: APP_NAME },\n }).makeStateMachine(internalApi),\n\n deviceAuth: fromPromise(deviceAuth),\n keypairAuth: fromPromise(keypairAuth),\n\n getTrustchain: fromPromise(getTrustchain),\n\n addToTrustchainStateMachine: new AddToTrustchainDeviceAction({\n input: Left(\n new LKRPMissingDataError(\"Missing input for GetEncryptionKey\"),\n ),\n }).makeStateMachine(internalApi),\n\n extractEncryptionKey: fromPromise(extractEncryptionKey),\n },\n\n actions: {\n assignErrorFromEvent: raiseAndAssign(\n ({ event }) =>\n Left(\n new UnknownDAError(String((event as { error?: unknown }).error)),\n ), // NOTE: it should never happen, the error is not typed anymore here\n ),\n },\n\n guards: {\n hasNoTrustchainId: ({ context }) => !context.input.trustchainId,\n hasNoJwt: ({ context }) => !context.input.jwt,\n isTrustchainMember: ({ context }) =>\n context._internalState\n .toMaybe()\n .map(\n (state) =>\n state.wasAddedToTrustchain ||\n state.applicationStream?.hasMember(\n context.input.keypair.pubKeyToHex(),\n ),\n )\n .extract() ?? false,\n },\n }).createMachine({\n /** @xstate-layout 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-S-AQzrICE+phjxgmoQUeA5QInP0MbneRuY-Q4vmlMQIEwwiOErKRLw+Yxg0VLJEAGYpwn7UZXUvYBxu4Tjpf3X2Cttrsp6Cpbl7kKy8i8D6d0VgTA1lqvmJee0n4MyZbGK8-Yljorga5dkPoR7OnmkGCp4dBjhEeODTVjp2GzChbDdGWBbVKsQA6poq5Vzg1mO6fx-LdXCudN9dyJM6zRRNqec10q4YDXsqZENudagFj8N4g50bQlxsGByAUcwLAxCZOXMwAbEpBvhhCAtu8RIUtVWEPo4ryqrQcIBfWLRfpgWCM2hEzcpn8w7Qoj0DExj0XxSTcqAL8aLlHhYRwTJd1HNNZmpO4zWBiM-j-SRCrYGhpem0A+1gGw0VmH8d12tvFNACNEfMdZgIQQPVBFePVJnpIJHOtxu5ZpRBaiYLyGztZlgprRJNURVFNr-XFKJuxzmXOuegW59zHnXEVKBtpM0Qx7kog4RwHp-pAq6K6fW4rKL6EnbsAAyshUaxHMWuksEK9R312j4xo0KFkBYmQ7JGN0cwLHWCnMdlx56HJ6IshLNtcC3ogz9MMOECwxYnTAn3fEIAA */\n\n id: \"AuthenticateDeviceAction\",\n context: ({ input }): types[\"context\"] => ({\n input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: Right({\n trustchainId: null,\n jwt: null,\n trustchain: null,\n applicationStream: null,\n encryptionKey: null,\n wasAddedToTrustchain: false,\n }),\n }),\n\n initial: \"CheckCredentials\",\n states: {\n CheckCredentials: {\n always: [\n { target: \"DeviceAuth\", guard: \"hasNoTrustchainId\" },\n { target: \"KeypairAuth\", guard: \"hasNoJwt\" },\n { target: \"GetTrustchain\" },\n ],\n },\n\n KeypairAuth: {\n on: {\n success: \"GetTrustchain\",\n invalidCredentials: \"DeviceAuth\",\n error: \"Error\",\n },\n invoke: {\n id: \"keypairAuth\",\n src: \"keypairAuth\",\n input: ({ context }) => ({\n lkrpDataSource: context.input.lkrpDataSource,\n keypair: context.input.keypair,\n trustchainId: required(\n context.input.trustchainId,\n \"Missing Trustchain ID in the input\",\n ),\n }),\n onError: { actions: \"assignErrorFromEvent\" },\n onDone: {\n actions: raiseAndAssign(({ event }) =>\n event.output\n .map(({ jwt }) => ({\n raise: \"success\",\n assign: { jwt },\n }))\n .chainLeft((error) =>\n error instanceof LKRPUnauthorizedError\n ? Right({ raise: \"invalidCredentials\" })\n : Left(error),\n ),\n ),\n },\n },\n },\n\n DeviceAuth: {\n on: { success: \"GetTrustchain\", error: \"Error\" },\n initial: \"OpenApp\",\n states: {\n OpenApp: {\n // TODO snapshot for intermediateValue\n on: { success: \"Auth\" },\n invoke: {\n id: \"openApp\",\n src: \"openAppStateMachine\",\n input: { appName: APP_NAME },\n onError: { actions: \"assignErrorFromEvent\" },\n onDone: {\n actions: raiseAndAssign(({ event }) =>\n event.output.map(() => ({ raise: \"success\" })),\n ),\n },\n },\n },\n\n Auth: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: \"connect-ledger-sync\",\n },\n }),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n }),\n invoke: {\n id: \"deviceAuth\",\n src: \"deviceAuth\",\n input: ({ context }) => context.input,\n onError: { actions: \"assignErrorFromEvent\" },\n onDone: {\n actions: raiseAndAssign(({ event }) =>\n event.output.chain((payload) =>\n payload.trustchainId.caseOf({\n Nothing: () =>\n Left(\n new LKRPUnhandledState(\"The trustchain is empty\"),\n ),\n Just: (trustchainId) =>\n Right({\n raise: \"success\",\n assign: { jwt: payload.jwt, trustchainId },\n }),\n }),\n ),\n ),\n },\n },\n },\n },\n },\n\n GetTrustchain: {\n on: {\n success: \"CheckIsMembers\",\n invalidCredentials: \"KeypairAuth\",\n error: \"Error\",\n },\n invoke: {\n id: \"getTrustchain\",\n src: \"getTrustchain\",\n input: ({ context }) =>\n context._internalState.chain((state) =>\n eitherSeqRecord({\n lkrpDataSource: context.input.lkrpDataSource,\n applicationId: context.input.applicationId,\n trustchainId: () =>\n required(\n state.trustchainId ?? context.input.trustchainId,\n \"Missing Trustchain ID in the input for GetTrustchain\",\n ),\n jwt: () =>\n required(\n state.jwt ?? context.input.jwt,\n \"Missing JWT in the input for GetTrustchain\",\n ),\n }),\n ),\n onError: { actions: \"assignErrorFromEvent\" },\n onDone: {\n actions: raiseAndAssign(({ event }) =>\n event.output.map(({ trustchain, applicationStream }) => ({\n raise: \"success\",\n assign: { trustchain, applicationStream },\n })),\n ),\n },\n },\n },\n\n CheckIsMembers: {\n always: [\n { target: \"ExtractEncryptionKey\", guard: \"isTrustchainMember\" },\n { target: \"AddToTrustchain\" },\n ],\n },\n\n AddToTrustchain: {\n // TODO snapshot for intermediateValue\n on: {\n success: \"GetTrustchain\",\n error: \"Error\",\n },\n invoke: {\n id: \"AddToTrustchain\",\n src: \"addToTrustchainStateMachine\",\n input: ({ context }) =>\n context._internalState\n .mapLeft(\n () =>\n new LKRPMissingDataError(\n \"Missing data in the input for AddToTrustchain\",\n ),\n )\n .chain((state) =>\n eitherSeqRecord({\n lkrpDataSource: context.input.lkrpDataSource,\n keypair: context.input.keypair,\n clientName: context.input.clientName,\n permissions: context.input.permissions,\n jwt: () =>\n required(\n state.jwt ?? context.input.jwt,\n \"Missing JWT in the input for AddToTrustchain\",\n ),\n trustchainId: () =>\n required(\n state.trustchainId ?? context.input.trustchainId,\n \"Missing Trustchain ID in the input for GetTrustchain\",\n ),\n trustchain: () =>\n required(\n state.trustchain,\n \"Missing Trustchain in the input for AddToTrustchain\",\n ),\n applicationStream: () =>\n required(\n state.applicationStream,\n \"Missing application stream in the input for AddToTrustchain\",\n ),\n }),\n ),\n onError: { actions: \"assignErrorFromEvent\" },\n onDone: {\n actions: raiseAndAssign(({ event }) =>\n event.output.map(() => ({\n raise: \"success\",\n assign: { wasAddedToTrustchain: true },\n })),\n ),\n },\n },\n },\n\n ExtractEncryptionKey: {\n on: { success: \"Success\", error: \"Error\" },\n invoke: {\n id: \"ExtractEncryptionKey\",\n src: \"extractEncryptionKey\",\n input: ({ context }) =>\n context._internalState.chain((state) =>\n required(\n state.applicationStream,\n \"Missing application stream\",\n ).map((applicationStream) => ({\n applicationStream,\n keypair: context.input.keypair,\n })),\n ),\n onError: { actions: \"assignErrorFromEvent\" },\n onDone: {\n actions: raiseAndAssign(({ event }) =>\n event.output.map((encryptionKey) => ({\n raise: \"success\",\n assign: { encryptionKey },\n })),\n ),\n },\n },\n },\n\n Success: { type: \"final\" },\n\n Error: { type: \"final\" },\n },\n\n output: ({ context }) =>\n context._internalState.chain((state) =>\n eitherSeqRecord({\n trustchainId: () =>\n required(\n state.trustchainId ?? context.input.trustchainId,\n \"Missing Trustchain ID in the output\",\n ),\n jwt: () =>\n required(\n state.jwt ?? context.input.jwt,\n \"Missing JWT in the output\",\n ),\n applicationPath: () =>\n required(\n state.applicationStream?.getPath().extract(),\n \"Missing application path in the output\",\n ),\n encryptionKey: () =>\n required(\n state.encryptionKey,\n \"Missing encryption key in the output\",\n ),\n }),\n ),\n });\n }\n\n extractDependencies(internalApi: InternalApi) {\n return {\n deviceAuth: (args: { input: { lkrpDataSource: LKRPDataSource } }) =>\n this.auth(\n args.input.lkrpDataSource,\n new SignChallengeWithDeviceTask(internalApi),\n ).run(),\n\n keypairAuth: (args: {\n input: Pick<AuthenticateDAInput, \"lkrpDataSource\" | \"keypair\"> & {\n trustchainId: Either<LKRPMissingDataError, string>;\n };\n }) => {\n const { lkrpDataSource, keypair } = args.input;\n return EitherAsync.liftEither(args.input.trustchainId)\n .chain((trustchainId) =>\n this.auth(\n lkrpDataSource,\n new SignChallengeWithKeypairTask(keypair, trustchainId),\n ),\n )\n .run();\n },\n\n getTrustchain: (args: {\n input: Either<\n AuthenticateDAError,\n {\n applicationId: number;\n lkrpDataSource: LKRPDataSource;\n trustchainId: string;\n jwt: JWT;\n }\n >;\n }) =>\n EitherAsync.liftEither(args.input)\n .chain(({ applicationId, lkrpDataSource, trustchainId, jwt }) =>\n lkrpDataSource\n .getTrustchainById(trustchainId, jwt)\n .map((trustchain) => ({\n trustchain,\n applicationStream:\n trustchain[`m/${applicationId}'`] ??\n LKRPBlockStream.fromPath(`m/0'/${applicationId}'/0'`),\n })),\n )\n .run(),\n\n extractEncryptionKey: async (args: {\n input: Either<\n AuthenticateDAError,\n {\n applicationStream: LKRPBlockStream;\n keypair: Keypair;\n }\n >;\n }) => {\n // TODO additional derivations should be supported:\n // https://github.com/LedgerHQ/ledger-live/blob/develop/libs/hw-ledger-key-ring-protocol/src/Device.ts#L216...L226\n // Probably not needed for Ledger Sync\n return Promise.resolve(\n args.input\n .chain(({ applicationStream, keypair }) =>\n applicationStream\n .getPublishedKey(keypair)\n .toEither(\n new UnknownDAError(\n \"There is no encryption key for the current member in the application stream.\",\n ),\n ),\n )\n .map((key) => key.privateKey),\n );\n },\n };\n }\n\n private auth(\n lkrpDataSource: LKRPDataSource,\n signerTask: {\n run: (\n challenge: Challenge,\n ) => PromiseLike<Either<AuthenticateDAError, AuthenticationPayload>>;\n },\n ) {\n return lkrpDataSource\n .getChallenge()\n .chain((challenge) => signerTask.run(challenge))\n .chain((payload) => lkrpDataSource.authenticate(payload));\n }\n}\n"],
5
- "mappings": "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",
6
- "names": ["AuthenticateDeviceAction_exports", "__export", "AuthenticateDeviceAction", "__toCommonJS", "import_device_management_kit", "import_purify_ts", "import_xstate", "import_Errors", "import_SignChallengeWithDeviceTask", "import_SignChallengeWithKeypairTask", "import_eitherSeqRecord", "import_LKRPBlockStream", "import_required", "import_raiseAndAssign", "import_AddToTrustchainDeviceAction", "APP_NAME", "internalApi", "deviceAuth", "keypairAuth", "getTrustchain", "extractEncryptionKey", "event", "context", "state", "input", "jwt", "error", "payload", "trustchainId", "trustchain", "applicationStream", "encryptionKey", "args", "lkrpDataSource", "keypair", "applicationId", "key", "signerTask", "challenge"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var d=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var y=(e,r)=>{for(var t in r)d(e,t,{get:r[t],enumerable:!0})},U=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of u(r))!h.call(e,a)&&a!==t&&d(e,a,{get:()=>r[a],enumerable:!(n=s(r,a))||n.enumerable});return e};var b=e=>U(d({},"__esModule",{value:!0}),e);var l={};y(l,{TLVBuilder:()=>A});module.exports=b(l);var i=require("../utils/TLVTags");class A{items=[];addNull(){return this.add(i.GeneralTags.Null,[])}addInt(r,t){const n=new DataView(new ArrayBuffer(t));switch(t){case 1:n.setUint8(0,r);break;case 2:n.setUint16(0,r);break;case 4:n.setUint32(0,r);break}return this.add(i.GeneralTags.Int,new Uint8Array(n.buffer))}addHash(r){return this.add(i.GeneralTags.Hash,r)}addSignature(r){return this.add(i.GeneralTags.Signature,r)}addString(r){return this.add(i.GeneralTags.String,new TextEncoder().encode(r))}addBytes(r){return this.add(i.GeneralTags.Bytes,r)}addPublicKey(r){return this.add(i.GeneralTags.PublicKey,r)}build(){return new Uint8Array(this.items.flatMap(r=>[...r]))}with(r){return r(this),this}push(r){return this.items.push(r),this}add(r,t){return this.items.push(new Uint8Array([r,t.length,...t])),this}}0&&(module.exports={TLVBuilder});
2
- //# sourceMappingURL=TLVBuilder.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/internal/utils/TLVBuilder.ts"],
4
- "sourcesContent": ["import { GeneralTags } from \"@internal/utils/TLVTags\";\n\nexport class TLVBuilder {\n private items: Uint8Array[] = [];\n\n addNull() {\n return this.add(GeneralTags.Null, []);\n }\n\n addInt(value: number, length: 1 | 2 | 4) {\n const view = new DataView(new ArrayBuffer(length));\n switch (length) {\n case 1:\n view.setUint8(0, value);\n break;\n case 2:\n view.setUint16(0, value);\n break;\n case 4:\n view.setUint32(0, value);\n break;\n }\n return this.add(GeneralTags.Int, new Uint8Array(view.buffer));\n }\n\n addHash(value: Uint8Array) {\n return this.add(GeneralTags.Hash, value);\n }\n\n addSignature(value: Uint8Array) {\n return this.add(GeneralTags.Signature, value);\n }\n\n addString(value: string) {\n return this.add(GeneralTags.String, new TextEncoder().encode(value));\n }\n\n addBytes(value: Uint8Array | number[]) {\n return this.add(GeneralTags.Bytes, value);\n }\n\n addPublicKey(value: Uint8Array) {\n return this.add(GeneralTags.PublicKey, value);\n }\n\n build(): Uint8Array {\n return new Uint8Array(this.items.flatMap((item) => [...item]));\n }\n\n with(fn: (builder: TLVBuilder) => void): TLVBuilder {\n fn(this);\n return this;\n }\n\n push(item: Uint8Array) {\n this.items.push(item);\n return this;\n }\n\n private add(type: number, value: Uint8Array | number[]) {\n this.items.push(new Uint8Array([type, value.length, ...value]));\n return this;\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,mCAErB,MAAMF,CAAW,CACd,MAAsB,CAAC,EAE/B,SAAU,CACR,OAAO,KAAK,IAAI,cAAY,KAAM,CAAC,CAAC,CACtC,CAEA,OAAOG,EAAeC,EAAmB,CACvC,MAAMC,EAAO,IAAI,SAAS,IAAI,YAAYD,CAAM,CAAC,EACjD,OAAQA,EAAQ,CACd,IAAK,GACHC,EAAK,SAAS,EAAGF,CAAK,EACtB,MACF,IAAK,GACHE,EAAK,UAAU,EAAGF,CAAK,EACvB,MACF,IAAK,GACHE,EAAK,UAAU,EAAGF,CAAK,EACvB,KACJ,CACA,OAAO,KAAK,IAAI,cAAY,IAAK,IAAI,WAAWE,EAAK,MAAM,CAAC,CAC9D,CAEA,QAAQF,EAAmB,CACzB,OAAO,KAAK,IAAI,cAAY,KAAMA,CAAK,CACzC,CAEA,aAAaA,EAAmB,CAC9B,OAAO,KAAK,IAAI,cAAY,UAAWA,CAAK,CAC9C,CAEA,UAAUA,EAAe,CACvB,OAAO,KAAK,IAAI,cAAY,OAAQ,IAAI,YAAY,EAAE,OAAOA,CAAK,CAAC,CACrE,CAEA,SAASA,EAA8B,CACrC,OAAO,KAAK,IAAI,cAAY,MAAOA,CAAK,CAC1C,CAEA,aAAaA,EAAmB,CAC9B,OAAO,KAAK,IAAI,cAAY,UAAWA,CAAK,CAC9C,CAEA,OAAoB,CAClB,OAAO,IAAI,WAAW,KAAK,MAAM,QAASG,GAAS,CAAC,GAAGA,CAAI,CAAC,CAAC,CAC/D,CAEA,KAAKC,EAA+C,CAClD,OAAAA,EAAG,IAAI,EACA,IACT,CAEA,KAAKD,EAAkB,CACrB,YAAK,MAAM,KAAKA,CAAI,EACb,IACT,CAEQ,IAAIE,EAAcL,EAA8B,CACtD,YAAK,MAAM,KAAK,IAAI,WAAW,CAACK,EAAML,EAAM,OAAQ,GAAGA,CAAK,CAAC,CAAC,EACvD,IACT,CACF",
6
- "names": ["TLVBuilder_exports", "__export", "TLVBuilder", "__toCommonJS", "import_TLVTags", "value", "length", "view", "item", "fn", "type"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(e,r)=>{for(var t in r)a(e,t,{get:r[t],enumerable:!0})},u=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of g(r))!d.call(e,i)&&i!==t&&a(e,i,{get:()=>r[i],enumerable:!(n=h(r,i))||n.enumerable});return e};var f=e=>u(a({},"__esModule",{value:!0}),e);var b={};l(b,{AES_BLOCK_SIZE:()=>s,CryptoUtils:()=>B});module.exports=f(b);var c=require("@noble/ciphers/aes"),m=require("@noble/ciphers/webcrypto"),p=require("@noble/hashes/hmac"),y=require("@noble/hashes/sha256"),o=require("@noble/secp256k1"),A=require("../../api/app-binder/KeypairFromBytes");const s=16;class B{static randomBytes(r){return(0,m.randomBytes)(r)}static randomKeypair(){return new A.KeypairFromBytes(o.utils.randomPrivateKey())}static encrypt(r,t,n){return(0,c.gcm)(r,t.slice(0,s)).encrypt(n)}static decrypt(r,t,n){return(0,c.gcm)(r,t.slice(0,s)).decrypt(n)}static hash(r){return(0,y.sha256)(r)}static hmac(r,t){return(0,p.hmac)(y.sha256,r,t)}static derEncode(r,t){const n=this.encodeSigComponent(r),i=this.encodeSigComponent(t),U=n.length+i.length;return Uint8Array.from([48,U,...n,...i])}static encodeSigComponent(r){const t=o.etc.numberToBytesBE(r),n=t[0]&&t[0]>=128?[0]:[],i=t.length+n.length;return Uint8Array.from([2,i,...n,...t])}}0&&(module.exports={AES_BLOCK_SIZE,CryptoUtils});
2
- //# sourceMappingURL=crypto.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/internal/utils/crypto.ts"],
4
- "sourcesContent": ["import { gcm } from \"@noble/ciphers/aes\";\nimport { randomBytes } from \"@noble/ciphers/webcrypto\";\nimport { hmac } from \"@noble/hashes/hmac\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport { etc, utils } from \"@noble/secp256k1\";\n\nimport { KeypairFromBytes } from \"@api/app-binder/KeypairFromBytes\";\nimport { type Keypair } from \"@api/index\";\n\nexport const AES_BLOCK_SIZE = 16;\n\nexport class CryptoUtils {\n static randomBytes(len: number): Uint8Array {\n return randomBytes(len);\n }\n\n static randomKeypair(): Keypair {\n return new KeypairFromBytes(utils.randomPrivateKey());\n }\n\n static encrypt(\n key: Uint8Array,\n iv: Uint8Array,\n cleartext: Uint8Array,\n ): Uint8Array {\n const cipher = gcm(key, iv.slice(0, AES_BLOCK_SIZE));\n return cipher.encrypt(cleartext);\n }\n\n static decrypt(\n key: Uint8Array,\n iv: Uint8Array,\n ciphertext: Uint8Array,\n ): Uint8Array {\n const cipher = gcm(key, iv.slice(0, AES_BLOCK_SIZE));\n return cipher.decrypt(ciphertext);\n }\n\n static hash(bytes: Uint8Array): Uint8Array {\n return sha256(bytes);\n }\n\n static hmac(key: Uint8Array, message: Uint8Array): Uint8Array {\n return hmac(sha256, key, message);\n }\n\n /**\n * DER specification: https://ledgerhq.atlassian.net/wiki/spaces/TrustServices/pages/3843719348/LNS+Arch+Common+Fields+for+Nano+certificates+and+descriptors#DER-Encoding-spec\n * See: https://ledgerhq.atlassian.net/wiki/spaces/TrustServices/pages/3736863735/LNS+Arch+Nano+Trusted+Names+Descriptor+Format+APIs\n * signature(r,s) = 0x30 & var(L,u8(~)) & sized(8*L, sig_components(r,s)); # DER encoding of the two 32 bytes signature components r & s\n * sig_components(r,s) = 0x02 & var(Lr,u8(~)) & sized(8*Lr, r) & 0x02 & var(Ls,u8(~)) & sized(8*Ls, s);\n */\n public static derEncode(r: bigint, s: bigint): Uint8Array {\n const rBytes = this.encodeSigComponent(r);\n const sBytes = this.encodeSigComponent(s);\n const length = rBytes.length + sBytes.length;\n return Uint8Array.from([0x30, length, ...rBytes, ...sBytes]);\n }\n\n private static encodeSigComponent(number: bigint): Uint8Array {\n const bytes = etc.numberToBytesBE(number);\n const padding = bytes[0] && bytes[0] >= 0x80 ? [0x00] : []; // Add padding if the first byte is >= 0x80 to ensure positive encoding\n const length = bytes.length + padding.length;\n return Uint8Array.from([0x02, length, ...padding, ...bytes]);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,gBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAoB,8BACpBC,EAA4B,oCAC5BC,EAAqB,8BACrBC,EAAuB,gCACvBC,EAA2B,4BAE3BC,EAAiC,4CAG1B,MAAMR,EAAiB,GAEvB,MAAMC,CAAY,CACvB,OAAO,YAAYQ,EAAyB,CAC1C,SAAO,eAAYA,CAAG,CACxB,CAEA,OAAO,eAAyB,CAC9B,OAAO,IAAI,mBAAiB,QAAM,iBAAiB,CAAC,CACtD,CAEA,OAAO,QACLC,EACAC,EACAC,EACY,CAEZ,SADe,OAAIF,EAAKC,EAAG,MAAM,EAAGX,CAAc,CAAC,EACrC,QAAQY,CAAS,CACjC,CAEA,OAAO,QACLF,EACAC,EACAE,EACY,CAEZ,SADe,OAAIH,EAAKC,EAAG,MAAM,EAAGX,CAAc,CAAC,EACrC,QAAQa,CAAU,CAClC,CAEA,OAAO,KAAKC,EAA+B,CACzC,SAAO,UAAOA,CAAK,CACrB,CAEA,OAAO,KAAKJ,EAAiBK,EAAiC,CAC5D,SAAO,QAAK,SAAQL,EAAKK,CAAO,CAClC,CAQA,OAAc,UAAU,EAAWC,EAAuB,CACxD,MAAMC,EAAS,KAAK,mBAAmB,CAAC,EAClCC,EAAS,KAAK,mBAAmBF,CAAC,EAClCG,EAASF,EAAO,OAASC,EAAO,OACtC,OAAO,WAAW,KAAK,CAAC,GAAMC,EAAQ,GAAGF,EAAQ,GAAGC,CAAM,CAAC,CAC7D,CAEA,OAAe,mBAAmBE,EAA4B,CAC5D,MAAMN,EAAQ,MAAI,gBAAgBM,CAAM,EAClCC,EAAUP,EAAM,CAAC,GAAKA,EAAM,CAAC,GAAK,IAAO,CAAC,CAAI,EAAI,CAAC,EACnDK,EAASL,EAAM,OAASO,EAAQ,OACtC,OAAO,WAAW,KAAK,CAAC,EAAMF,EAAQ,GAAGE,EAAS,GAAGP,CAAK,CAAC,CAC7D,CACF",
6
- "names": ["crypto_exports", "__export", "AES_BLOCK_SIZE", "CryptoUtils", "__toCommonJS", "import_aes", "import_webcrypto", "import_hmac", "import_sha256", "import_secp256k1", "import_KeypairFromBytes", "len", "key", "iv", "cleartext", "ciphertext", "bytes", "message", "s", "rBytes", "sBytes", "length", "number", "padding"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var y=(r,t)=>{for(var n in t)o(r,n,{get:t[n],enumerable:!0})},s=(r,t,n,f)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of u(t))!x.call(r,e)&&e!==n&&o(r,e,{get:()=>t[e],enumerable:!(f=i(t,e))||f.enumerable});return r};var a=r=>s(o({},"__esModule",{value:!0}),r);var m={};y(m,{bytesToHex:()=>h,hexToBytes:()=>g});module.exports=a(m);function g(r){return Uint8Array.from(Buffer.from(r,"hex"))}function h(r){return Buffer.from(r).toString("hex")}0&&(module.exports={bytesToHex,hexToBytes});
2
- //# sourceMappingURL=hex.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/internal/utils/hex.ts"],
4
- "sourcesContent": ["export function hexToBytes(hex: string): Uint8Array {\n return Uint8Array.from(Buffer.from(hex, \"hex\"));\n}\n\nexport function bytesToHex(bytes: Uint8Array): string {\n return Buffer.from(bytes).toString(\"hex\");\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,eAAAC,IAAA,eAAAC,EAAAJ,GAAO,SAASG,EAAWE,EAAyB,CAClD,OAAO,WAAW,KAAK,OAAO,KAAKA,EAAK,KAAK,CAAC,CAChD,CAEO,SAASH,EAAWI,EAA2B,CACpD,OAAO,OAAO,KAAKA,CAAK,EAAE,SAAS,KAAK,CAC1C",
6
- "names": ["hex_exports", "__export", "bytesToHex", "hexToBytes", "__toCommonJS", "hex", "bytes"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var a=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var m=(r,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of p(e))!d.call(r,t)&&t!==n&&a(r,t,{get:()=>e[t],enumerable:!(i=y(e,t))||i.enumerable});return r};var o=r=>m(a({},"__esModule",{value:!0}),r);var s={};module.exports=o(s);
2
- //# sourceMappingURL=types.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/internal/utils/types.ts"],
4
- "sourcesContent": ["import { type LKRPBlockStream } from \"./LKRPBlockStream\";\nimport { type LKRPCommand } from \"./LKRPCommand\";\nimport { type CommandTags } from \"./TLVTags\";\n\nexport type Trustchain = {\n [path: string]: LKRPBlockStream;\n};\n\nexport type PublishedKey = {\n privateKey: Uint8Array;\n chainCode: Uint8Array;\n};\n\nexport type EncryptedPublishedKey = {\n encryptedXpriv: Uint8Array;\n initializationVector: Uint8Array;\n ephemeralPublicKey: Uint8Array;\n};\n\nexport type LKRPBlockData = {\n parent: string;\n issuer: Uint8Array;\n commands: LKRPCommand[];\n signature: Uint8Array;\n};\n\nexport type LKRPBlockParsedData = LKRPBlockData & { header: Uint8Array };\n\nexport type LKRPCommandData = Seed | AddMember | PublishKey | Derive;\n\ntype Seed = {\n type: CommandTags.Seed;\n topic: Uint8Array;\n protocolVersion: number;\n groupKey: Uint8Array;\n initializationVector: Uint8Array;\n encryptedXpriv: Uint8Array;\n ephemeralPublicKey: Uint8Array;\n};\n\ntype AddMember = {\n type: CommandTags.AddMember;\n name: string;\n publicKey: Uint8Array;\n permissions: number;\n};\n\ntype PublishKey = {\n type: CommandTags.PublishKey;\n initializationVector: Uint8Array;\n encryptedXpriv: Uint8Array;\n recipient: Uint8Array;\n ephemeralPublicKey: Uint8Array;\n};\n\ntype Derive = {\n type: CommandTags.Derive;\n path: string;\n groupKey: Uint8Array;\n initializationVector: Uint8Array;\n encryptedXpriv: Uint8Array;\n ephemeralPublicKey: Uint8Array;\n};\n\nexport type UnsignedCommandData =\n | AddMemberUnsignedData\n | PublishKeyUnsignedData\n | DeriveUnsignedData;\n\nexport type AddMemberUnsignedData = AddMember;\ntype PublishKeyUnsignedData = Pick<PublishKey, \"type\" | \"recipient\">;\ntype DeriveUnsignedData = Pick<Derive, \"type\" | \"path\">;\n\nexport type ParsedTrustedProperties = {\n iv: Uint8Array;\n issuer: Uint8Array;\n xpriv: Uint8Array;\n ephemeralPublicKey: Uint8Array;\n commandIv: Uint8Array;\n groupKey: Uint8Array;\n newMember: Uint8Array;\n};\n\nexport type EncryptedCommand =\n | EncryptedDeriveCommand\n | AddMemberUnsignedData\n | EncryptedPublishKeyCommand;\n\nexport type EncryptedDeriveCommand = DeriveUnsignedData &\n Pick<\n ParsedTrustedProperties,\n \"iv\" | \"xpriv\" | \"ephemeralPublicKey\" | \"commandIv\" | \"groupKey\"\n >;\nexport type EncryptedPublishKeyCommand = PublishKeyUnsignedData &\n Pick<\n ParsedTrustedProperties,\n \"iv\" | \"xpriv\" | \"ephemeralPublicKey\" | \"commandIv\"\n >;\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["types_exports", "__toCommonJS"]
7
- }
@@ -1,2 +0,0 @@
1
- import{GeneralDmkError as n}from"@ledgerhq/device-management-kit";class t extends n{constructor(r){super(r);this.err=r}_tag="LKRPHttpRequestError"}class a extends t{constructor(r){super(r);this.err=r}_tag="LKRPUnauthorizedError"}class d extends n{constructor(r){super(r);this.err=r}_tag="LKRPParsingError"}class u extends n{constructor(r){super(r);this.err=r}_tag="LKRPMissingDataError"}class c extends n{constructor(r){super(r);this.err=r}_tag="LKRPUnhandledState"}export{t as LKRPHttpRequestError,u as LKRPMissingDataError,d as LKRPParsingError,a as LKRPUnauthorizedError,c as LKRPUnhandledState};
2
- //# sourceMappingURL=Errors.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/Errors.ts"],
4
- "sourcesContent": ["import { GeneralDmkError } from \"@ledgerhq/device-management-kit\";\n\nexport class LKRPHttpRequestError extends GeneralDmkError {\n override _tag = \"LKRPHttpRequestError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPUnauthorizedError extends LKRPHttpRequestError {\n override _tag = \"LKRPUnauthorizedError\";\n constructor(override err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPParsingError extends GeneralDmkError {\n override readonly _tag = \"LKRPParsingError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPMissingDataError extends GeneralDmkError {\n override readonly _tag = \"LKRPMissingDataError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPUnhandledState extends GeneralDmkError {\n override readonly _tag = \"LKRPUnhandledState\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,MAAuB,kCAEzB,MAAMC,UAA6BD,CAAgB,CAExD,YAAqBE,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHS,KAAO,sBAIlB,CAEO,MAAMC,UAA8BF,CAAqB,CAE9D,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHS,KAAO,uBAIlB,CAEO,MAAME,UAAyBJ,CAAgB,CAEpD,YAAqBE,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,kBAI3B,CAEO,MAAMG,UAA6BL,CAAgB,CAExD,YAAqBE,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,sBAI3B,CAEO,MAAMI,UAA2BN,CAAgB,CAEtD,YAAqBE,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,oBAI3B",
6
- "names": ["GeneralDmkError", "LKRPHttpRequestError", "err", "LKRPUnauthorizedError", "LKRPParsingError", "LKRPMissingDataError", "LKRPUnhandledState"]
7
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=GetAppNameCommandTypes.js.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=GetSeedIdCommandTypes.js.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=InitCommandTypes.js.map
@@ -1,2 +0,0 @@
1
- import{getPublicKey as i,getSharedSecret as y,signAsync as a}from"@noble/secp256k1";import{CryptoUtils as n}from"../../internal/utils/crypto";import{bytesToHex as o}from"../../internal/utils/hex";class u{constructor(r,e=i(r)){this.privateKey=r;this.publicKey=e}pubKeyToU8a(){return this.publicKey}pubKeyToHex(){return o(this.publicKey)}async sign(r){const{r:e,s:t}=await a(r,this.privateKey);return n.derEncode(e,t)}ecdh(r,e=!0){return y(this.privateKey,r,e)}}export{u as KeypairFromBytes};
2
- //# sourceMappingURL=KeypairFromBytes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/KeypairFromBytes.ts"],
4
- "sourcesContent": ["import { getPublicKey, getSharedSecret, signAsync } from \"@noble/secp256k1\";\n\nimport { type Keypair } from \"@api/index\";\nimport { CryptoUtils } from \"@internal/utils/crypto\";\nimport { bytesToHex } from \"@internal/utils/hex\";\n\nexport class KeypairFromBytes implements Keypair {\n constructor(\n private readonly privateKey: Uint8Array,\n private readonly publicKey = getPublicKey(privateKey),\n ) {}\n\n pubKeyToU8a(): Uint8Array {\n return this.publicKey;\n }\n\n pubKeyToHex(): string {\n return bytesToHex(this.publicKey);\n }\n\n async sign(message: Uint8Array): Promise<Uint8Array> {\n const { r, s } = await signAsync(message, this.privateKey);\n return CryptoUtils.derEncode(r, s);\n }\n\n ecdh(publicKey: Uint8Array, isCompressed = true): Uint8Array {\n return getSharedSecret(this.privateKey, publicKey, isCompressed);\n }\n}\n"],
5
- "mappings": "AAAA,OAAS,gBAAAA,EAAc,mBAAAC,EAAiB,aAAAC,MAAiB,mBAGzD,OAAS,eAAAC,MAAmB,yBAC5B,OAAS,cAAAC,MAAkB,sBAEpB,MAAMC,CAAoC,CAC/C,YACmBC,EACAC,EAAYP,EAAaM,CAAU,EACpD,CAFiB,gBAAAA,EACA,eAAAC,CAChB,CAEH,aAA0B,CACxB,OAAO,KAAK,SACd,CAEA,aAAsB,CACpB,OAAOH,EAAW,KAAK,SAAS,CAClC,CAEA,MAAM,KAAKI,EAA0C,CACnD,KAAM,CAAE,EAAAC,EAAG,EAAAC,CAAE,EAAI,MAAMR,EAAUM,EAAS,KAAK,UAAU,EACzD,OAAOL,EAAY,UAAUM,EAAGC,CAAC,CACnC,CAEA,KAAKH,EAAuBI,EAAe,GAAkB,CAC3D,OAAOV,EAAgB,KAAK,WAAYM,EAAWI,CAAY,CACjE,CACF",
6
- "names": ["getPublicKey", "getSharedSecret", "signAsync", "CryptoUtils", "bytesToHex", "KeypairFromBytes", "privateKey", "publicKey", "message", "r", "s", "isCompressed"]
7
- }
@@ -1,2 +0,0 @@
1
- var r=(t=>(t[t.OWNER=4294967295]="OWNER",t[t.CAN_ENCRYPT=1]="CAN_ENCRYPT",t[t.CAN_DERIVE=2]="CAN_DERIVE",t[t.CAN_ADD_BLOCK=4]="CAN_ADD_BLOCK",t))(r||{});export{r as Permissions};
2
- //# sourceMappingURL=LKRPTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/api/app-binder/LKRPTypes.ts"],
4
- "sourcesContent": ["export interface Keypair {\n pubKeyToU8a(): Uint8Array;\n pubKeyToHex(): string;\n sign(message: Uint8Array): Promise<Uint8Array>;\n ecdh(publicKey: Uint8Array): Uint8Array;\n}\n\nexport type JWT = {\n access_token: string;\n permissions: {\n [trustchainId: string]: {\n [path: string]: string[];\n };\n };\n};\n\n/**\n * https://ledgerhq.atlassian.net/wiki/spaces/TA/pages/5865144361/ARCH+LKRP+-+v2+specifications#Member-permissions\n */\nexport enum Permissions {\n OWNER = 0xffffffff, // Owners of the stream have access to everything\n CAN_ENCRYPT = 1, // The member can have access to the stream private key\n CAN_DERIVE = 1 << 1, // The member can have access to the stream chain code (if a member have access to the private key and the chain code it is able to derive sub-streams)\n CAN_ADD_BLOCK = 1 << 2, // The member is authorized to issue blocks in the current stream\n}\n"],
5
- "mappings": "AAmBO,IAAKA,OACVA,IAAA,MAAQ,YAAR,QACAA,IAAA,YAAc,GAAd,cACAA,IAAA,WAAa,GAAb,aACAA,IAAA,cAAgB,GAAhB,gBAJUA,OAAA",
6
- "names": ["Permissions"]
7
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=ParseStreamBlockCommandCommandTypes.js.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=ParseStreamBlockHeaderCommandTypes.js.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=ParseStreamBlockSignatureTypes.js.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=SetTrustedMemberTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=SignBlockCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=SignBlockHeaderCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=SignBlockSignatureCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=SignBlockSingleCommandTypes.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- import{OpenAppDeviceAction as E,UnknownDAError as l,UserInteractionRequired as m,XStateDeviceAction as S}from"@ledgerhq/device-management-kit";import{EitherAsync as y,Left as p,Right as A}from"purify-ts";import{assign as D,fromPromise as h,setup as k}from"xstate";import{LKRPMissingDataError as g,LKRPUnauthorizedError as I,LKRPUnhandledState as f}from"../../../api/app-binder/Errors";import{SignChallengeWithDeviceTask as v}from"../../app-binder/task/SignChallengeWithDeviceTask";import{SignChallengeWithKeypairTask as M}from"../../app-binder/task/SignChallengeWithKeypairTask";import{eitherSeqRecord as d}from"../../utils/eitherSeqRecord";import{LKRPBlockStream as w}from"../../utils/LKRPBlockStream";import{required as r}from"../../utils/required";import{raiseAndAssign as s}from"./utils/raiseAndAssign";import{AddToTrustchainDeviceAction as K}from"./AddToTrustchainDeviceAction";const T="Ledger Sync";class V extends S{makeStateMachine(a){const{deviceAuth:n,keypairAuth:i,getTrustchain:u,extractEncryptionKey:c}=this.extractDependencies(a);return k({types:{input:{},context:{},output:{}},actors:{openAppStateMachine:new E({input:{appName:T}}).makeStateMachine(a),deviceAuth:h(n),keypairAuth:h(i),getTrustchain:h(u),addToTrustchainStateMachine:new K({input:p(new g("Missing input for GetEncryptionKey"))}).makeStateMachine(a),extractEncryptionKey:h(c)},actions:{assignErrorFromEvent:s(({event:t})=>p(new l(String(t.error))))},guards:{hasNoTrustchainId:({context:t})=>!t.input.trustchainId,hasNoJwt:({context:t})=>!t.input.jwt,isTrustchainMember:({context:t})=>t._internalState.toMaybe().map(e=>e.wasAddedToTrustchain||e.applicationStream?.hasMember(t.input.keypair.pubKeyToHex())).extract()??!1}}).createMachine({id:"AuthenticateDeviceAction",context:({input:t})=>({input:t,intermediateValue:{requiredUserInteraction:m.None},_internalState:A({trustchainId:null,jwt:null,trustchain:null,applicationStream:null,encryptionKey:null,wasAddedToTrustchain:!1})}),initial:"CheckCredentials",states:{CheckCredentials:{always:[{target:"DeviceAuth",guard:"hasNoTrustchainId"},{target:"KeypairAuth",guard:"hasNoJwt"},{target:"GetTrustchain"}]},KeypairAuth:{on:{success:"GetTrustchain",invalidCredentials:"DeviceAuth",error:"Error"},invoke:{id:"keypairAuth",src:"keypairAuth",input:({context:t})=>({lkrpDataSource:t.input.lkrpDataSource,keypair:t.input.keypair,trustchainId:r(t.input.trustchainId,"Missing Trustchain ID in the input")}),onError:{actions:"assignErrorFromEvent"},onDone:{actions:s(({event:t})=>t.output.map(({jwt:e})=>({raise:"success",assign:{jwt:e}})).chainLeft(e=>e instanceof I?A({raise:"invalidCredentials"}):p(e)))}}},DeviceAuth:{on:{success:"GetTrustchain",error:"Error"},initial:"OpenApp",states:{OpenApp:{on:{success:"Auth"},invoke:{id:"openApp",src:"openAppStateMachine",input:{appName:T},onError:{actions:"assignErrorFromEvent"},onDone:{actions:s(({event:t})=>t.output.map(()=>({raise:"success"})))}}},Auth:{entry:D({intermediateValue:{requiredUserInteraction:"connect-ledger-sync"}}),exit:D({intermediateValue:{requiredUserInteraction:m.None}}),invoke:{id:"deviceAuth",src:"deviceAuth",input:({context:t})=>t.input,onError:{actions:"assignErrorFromEvent"},onDone:{actions:s(({event:t})=>t.output.chain(e=>e.trustchainId.caseOf({Nothing:()=>p(new f("The trustchain is empty")),Just:o=>A({raise:"success",assign:{jwt:e.jwt,trustchainId:o}})})))}}}}},GetTrustchain:{on:{success:"CheckIsMembers",invalidCredentials:"KeypairAuth",error:"Error"},invoke:{id:"getTrustchain",src:"getTrustchain",input:({context:t})=>t._internalState.chain(e=>d({lkrpDataSource:t.input.lkrpDataSource,applicationId:t.input.applicationId,trustchainId:()=>r(e.trustchainId??t.input.trustchainId,"Missing Trustchain ID in the input for GetTrustchain"),jwt:()=>r(e.jwt??t.input.jwt,"Missing JWT in the input for GetTrustchain")})),onError:{actions:"assignErrorFromEvent"},onDone:{actions:s(({event:t})=>t.output.map(({trustchain:e,applicationStream:o})=>({raise:"success",assign:{trustchain:e,applicationStream:o}})))}}},CheckIsMembers:{always:[{target:"ExtractEncryptionKey",guard:"isTrustchainMember"},{target:"AddToTrustchain"}]},AddToTrustchain:{on:{success:"GetTrustchain",error:"Error"},invoke:{id:"AddToTrustchain",src:"addToTrustchainStateMachine",input:({context:t})=>t._internalState.mapLeft(()=>new g("Missing data in the input for AddToTrustchain")).chain(e=>d({lkrpDataSource:t.input.lkrpDataSource,keypair:t.input.keypair,clientName:t.input.clientName,permissions:t.input.permissions,jwt:()=>r(e.jwt??t.input.jwt,"Missing JWT in the input for AddToTrustchain"),trustchainId:()=>r(e.trustchainId??t.input.trustchainId,"Missing Trustchain ID in the input for GetTrustchain"),trustchain:()=>r(e.trustchain,"Missing Trustchain in the input for AddToTrustchain"),applicationStream:()=>r(e.applicationStream,"Missing application stream in the input for AddToTrustchain")})),onError:{actions:"assignErrorFromEvent"},onDone:{actions:s(({event:t})=>t.output.map(()=>({raise:"success",assign:{wasAddedToTrustchain:!0}})))}}},ExtractEncryptionKey:{on:{success:"Success",error:"Error"},invoke:{id:"ExtractEncryptionKey",src:"extractEncryptionKey",input:({context:t})=>t._internalState.chain(e=>r(e.applicationStream,"Missing application stream").map(o=>({applicationStream:o,keypair:t.input.keypair}))),onError:{actions:"assignErrorFromEvent"},onDone:{actions:s(({event:t})=>t.output.map(e=>({raise:"success",assign:{encryptionKey:e}})))}}},Success:{type:"final"},Error:{type:"final"}},output:({context:t})=>t._internalState.chain(e=>d({trustchainId:()=>r(e.trustchainId??t.input.trustchainId,"Missing Trustchain ID in the output"),jwt:()=>r(e.jwt??t.input.jwt,"Missing JWT in the output"),applicationPath:()=>r(e.applicationStream?.getPath().extract(),"Missing application path in the output"),encryptionKey:()=>r(e.encryptionKey,"Missing encryption key in the output")}))})}extractDependencies(a){return{deviceAuth:n=>this.auth(n.input.lkrpDataSource,new v(a)).run(),keypairAuth:n=>{const{lkrpDataSource:i,keypair:u}=n.input;return y.liftEither(n.input.trustchainId).chain(c=>this.auth(i,new M(u,c))).run()},getTrustchain:n=>y.liftEither(n.input).chain(({applicationId:i,lkrpDataSource:u,trustchainId:c,jwt:t})=>u.getTrustchainById(c,t).map(e=>({trustchain:e,applicationStream:e[`m/${i}'`]??w.fromPath(`m/0'/${i}'/0'`)}))).run(),extractEncryptionKey:async n=>Promise.resolve(n.input.chain(({applicationStream:i,keypair:u})=>i.getPublishedKey(u).toEither(new l("There is no encryption key for the current member in the application stream."))).map(i=>i.privateKey))}}auth(a,n){return a.getChallenge().chain(i=>n.run(i)).chain(i=>a.authenticate(i))}}export{V as AuthenticateDeviceAction};
2
- //# sourceMappingURL=AuthenticateDeviceAction.js.map