@ledgerhq/device-signer-kit-aleo 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/lib/cjs/api/SignerAleo.js +1 -1
  2. package/lib/cjs/api/SignerAleo.js.map +1 -1
  3. package/lib/cjs/api/app-binder/GetTvkDeviceActionTypes.js +2 -0
  4. package/lib/cjs/api/app-binder/GetTvkDeviceActionTypes.js.map +7 -0
  5. package/lib/cjs/api/app-binder/SignNestedCallDeviceActionTypes.js +2 -0
  6. package/lib/cjs/api/app-binder/SignNestedCallDeviceActionTypes.js.map +7 -0
  7. package/lib/cjs/api/index.js +1 -1
  8. package/lib/cjs/api/index.js.map +2 -2
  9. package/lib/cjs/api/model/GetTvkOptions.js +2 -0
  10. package/lib/cjs/api/model/GetTvkOptions.js.map +7 -0
  11. package/lib/cjs/internal/DefaultSignerAleo.js +1 -1
  12. package/lib/cjs/internal/DefaultSignerAleo.js.map +3 -3
  13. package/lib/cjs/internal/app-binder/AleoAppBinder.js +1 -1
  14. package/lib/cjs/internal/app-binder/AleoAppBinder.js.map +3 -3
  15. package/lib/cjs/internal/app-binder/command/GetTvkCommand.js +2 -0
  16. package/lib/cjs/internal/app-binder/command/GetTvkCommand.js.map +7 -0
  17. package/lib/cjs/internal/app-binder/command/GetTvkCommand.test.js +2 -0
  18. package/lib/cjs/internal/app-binder/command/GetTvkCommand.test.js.map +7 -0
  19. package/lib/cjs/internal/app-binder/command/SignNestedCallCommand.js +2 -0
  20. package/lib/cjs/internal/app-binder/command/SignNestedCallCommand.js.map +7 -0
  21. package/lib/cjs/internal/app-binder/command/SignNestedCallCommand.test.js +2 -0
  22. package/lib/cjs/internal/app-binder/command/SignNestedCallCommand.test.js.map +7 -0
  23. package/lib/cjs/internal/app-binder/command/utils/aleoApplicationErrors.js +1 -1
  24. package/lib/cjs/internal/app-binder/command/utils/aleoApplicationErrors.js.map +2 -2
  25. package/lib/cjs/internal/app-binder/command/utils/aleoApplicationErrors.test.js +1 -1
  26. package/lib/cjs/internal/app-binder/command/utils/aleoApplicationErrors.test.js.map +2 -2
  27. package/lib/cjs/internal/app-binder/command/utils/apduHeaderUtils.js +1 -1
  28. package/lib/cjs/internal/app-binder/command/utils/apduHeaderUtils.js.map +3 -3
  29. package/lib/cjs/internal/app-binder/task/SignFeeIntentTask.js +1 -1
  30. package/lib/cjs/internal/app-binder/task/SignFeeIntentTask.js.map +3 -3
  31. package/lib/cjs/internal/app-binder/task/SignNestedCallTask.js +2 -0
  32. package/lib/cjs/internal/app-binder/task/SignNestedCallTask.js.map +7 -0
  33. package/lib/cjs/internal/app-binder/task/SignNestedCallTask.test.js +2 -0
  34. package/lib/cjs/internal/app-binder/task/SignNestedCallTask.test.js.map +7 -0
  35. package/lib/cjs/internal/app-binder/task/SignRootIntentTask.js +1 -1
  36. package/lib/cjs/internal/app-binder/task/SignRootIntentTask.js.map +3 -3
  37. package/lib/cjs/internal/use-cases/address/GetTvkUseCase.js +2 -0
  38. package/lib/cjs/internal/use-cases/address/GetTvkUseCase.js.map +7 -0
  39. package/lib/cjs/internal/use-cases/address/di/addressModule.js +1 -1
  40. package/lib/cjs/internal/use-cases/address/di/addressModule.js.map +3 -3
  41. package/lib/cjs/internal/use-cases/address/di/addressTypes.js +1 -1
  42. package/lib/cjs/internal/use-cases/address/di/addressTypes.js.map +2 -2
  43. package/lib/cjs/internal/use-cases/transaction/SignNestedCallUseCase.js +2 -0
  44. package/lib/cjs/internal/use-cases/transaction/SignNestedCallUseCase.js.map +7 -0
  45. package/lib/cjs/internal/use-cases/transaction/di/transactionModule.js +1 -1
  46. package/lib/cjs/internal/use-cases/transaction/di/transactionModule.js.map +3 -3
  47. package/lib/cjs/internal/use-cases/transaction/di/transactionTypes.js +1 -1
  48. package/lib/cjs/internal/use-cases/transaction/di/transactionTypes.js.map +2 -2
  49. package/lib/cjs/package.json +5 -5
  50. package/lib/esm/api/app-binder/GetTvkDeviceActionTypes.js +1 -0
  51. package/lib/esm/api/app-binder/GetTvkDeviceActionTypes.js.map +7 -0
  52. package/lib/esm/api/app-binder/SignNestedCallDeviceActionTypes.js +1 -0
  53. package/lib/esm/api/app-binder/SignNestedCallDeviceActionTypes.js.map +7 -0
  54. package/lib/esm/api/index.js.map +2 -2
  55. package/lib/esm/api/model/GetTvkOptions.js +1 -0
  56. package/lib/esm/api/model/GetTvkOptions.js.map +7 -0
  57. package/lib/esm/internal/DefaultSignerAleo.js +1 -1
  58. package/lib/esm/internal/DefaultSignerAleo.js.map +3 -3
  59. package/lib/esm/internal/app-binder/AleoAppBinder.js +1 -1
  60. package/lib/esm/internal/app-binder/AleoAppBinder.js.map +3 -3
  61. package/lib/esm/internal/app-binder/command/GetTvkCommand.js +2 -0
  62. package/lib/esm/internal/app-binder/command/GetTvkCommand.js.map +7 -0
  63. package/lib/esm/internal/app-binder/command/GetTvkCommand.test.js +2 -0
  64. package/lib/esm/internal/app-binder/command/GetTvkCommand.test.js.map +7 -0
  65. package/lib/esm/internal/app-binder/command/SignNestedCallCommand.js +2 -0
  66. package/lib/esm/internal/app-binder/command/SignNestedCallCommand.js.map +7 -0
  67. package/lib/esm/internal/app-binder/command/SignNestedCallCommand.test.js +2 -0
  68. package/lib/esm/internal/app-binder/command/SignNestedCallCommand.test.js.map +7 -0
  69. package/lib/esm/internal/app-binder/command/utils/aleoApplicationErrors.js +1 -1
  70. package/lib/esm/internal/app-binder/command/utils/aleoApplicationErrors.js.map +2 -2
  71. package/lib/esm/internal/app-binder/command/utils/aleoApplicationErrors.test.js +1 -1
  72. package/lib/esm/internal/app-binder/command/utils/aleoApplicationErrors.test.js.map +2 -2
  73. package/lib/esm/internal/app-binder/command/utils/apduHeaderUtils.js +1 -1
  74. package/lib/esm/internal/app-binder/command/utils/apduHeaderUtils.js.map +3 -3
  75. package/lib/esm/internal/app-binder/task/SignFeeIntentTask.js +1 -1
  76. package/lib/esm/internal/app-binder/task/SignFeeIntentTask.js.map +3 -3
  77. package/lib/esm/internal/app-binder/task/SignNestedCallTask.js +2 -0
  78. package/lib/esm/internal/app-binder/task/SignNestedCallTask.js.map +7 -0
  79. package/lib/esm/internal/app-binder/task/SignNestedCallTask.test.js +2 -0
  80. package/lib/esm/internal/app-binder/task/SignNestedCallTask.test.js.map +7 -0
  81. package/lib/esm/internal/app-binder/task/SignRootIntentTask.js +1 -1
  82. package/lib/esm/internal/app-binder/task/SignRootIntentTask.js.map +3 -3
  83. package/lib/esm/internal/use-cases/address/GetTvkUseCase.js +2 -0
  84. package/lib/esm/internal/use-cases/address/GetTvkUseCase.js.map +7 -0
  85. package/lib/esm/internal/use-cases/address/di/addressModule.js +1 -1
  86. package/lib/esm/internal/use-cases/address/di/addressModule.js.map +3 -3
  87. package/lib/esm/internal/use-cases/address/di/addressTypes.js +1 -1
  88. package/lib/esm/internal/use-cases/address/di/addressTypes.js.map +2 -2
  89. package/lib/esm/internal/use-cases/transaction/SignNestedCallUseCase.js +2 -0
  90. package/lib/esm/internal/use-cases/transaction/SignNestedCallUseCase.js.map +7 -0
  91. package/lib/esm/internal/use-cases/transaction/di/transactionModule.js +1 -1
  92. package/lib/esm/internal/use-cases/transaction/di/transactionModule.js.map +3 -3
  93. package/lib/esm/internal/use-cases/transaction/di/transactionTypes.js +1 -1
  94. package/lib/esm/internal/use-cases/transaction/di/transactionTypes.js.map +2 -2
  95. package/lib/esm/package.json +5 -5
  96. package/lib/types/api/SignerAleo.d.ts +5 -0
  97. package/lib/types/api/SignerAleo.d.ts.map +1 -1
  98. package/lib/types/api/app-binder/GetTvkDeviceActionTypes.d.ts +10 -0
  99. package/lib/types/api/app-binder/GetTvkDeviceActionTypes.d.ts.map +1 -0
  100. package/lib/types/api/app-binder/SignNestedCallDeviceActionTypes.d.ts +12 -0
  101. package/lib/types/api/app-binder/SignNestedCallDeviceActionTypes.d.ts.map +1 -0
  102. package/lib/types/api/index.d.ts +3 -0
  103. package/lib/types/api/index.d.ts.map +1 -1
  104. package/lib/types/api/model/GetTvkOptions.d.ts +5 -0
  105. package/lib/types/api/model/GetTvkOptions.d.ts.map +1 -0
  106. package/lib/types/internal/DefaultSignerAleo.d.ts +5 -0
  107. package/lib/types/internal/DefaultSignerAleo.d.ts.map +1 -1
  108. package/lib/types/internal/app-binder/AleoAppBinder.d.ts +11 -0
  109. package/lib/types/internal/app-binder/AleoAppBinder.d.ts.map +1 -1
  110. package/lib/types/internal/app-binder/command/GetTvkCommand.d.ts +19 -0
  111. package/lib/types/internal/app-binder/command/GetTvkCommand.d.ts.map +1 -0
  112. package/lib/types/internal/app-binder/command/GetTvkCommand.test.d.ts +2 -0
  113. package/lib/types/internal/app-binder/command/GetTvkCommand.test.d.ts.map +1 -0
  114. package/lib/types/internal/app-binder/command/SignNestedCallCommand.d.ts +22 -0
  115. package/lib/types/internal/app-binder/command/SignNestedCallCommand.d.ts.map +1 -0
  116. package/lib/types/internal/app-binder/command/SignNestedCallCommand.test.d.ts +2 -0
  117. package/lib/types/internal/app-binder/command/SignNestedCallCommand.test.d.ts.map +1 -0
  118. package/lib/types/internal/app-binder/command/utils/aleoApplicationErrors.d.ts +1 -1
  119. package/lib/types/internal/app-binder/command/utils/aleoApplicationErrors.d.ts.map +1 -1
  120. package/lib/types/internal/app-binder/command/utils/apduHeaderUtils.d.ts +8 -0
  121. package/lib/types/internal/app-binder/command/utils/apduHeaderUtils.d.ts.map +1 -1
  122. package/lib/types/internal/app-binder/task/SignFeeIntentTask.d.ts.map +1 -1
  123. package/lib/types/internal/app-binder/task/SignNestedCallTask.d.ts +13 -0
  124. package/lib/types/internal/app-binder/task/SignNestedCallTask.d.ts.map +1 -0
  125. package/lib/types/internal/app-binder/task/SignNestedCallTask.test.d.ts +2 -0
  126. package/lib/types/internal/app-binder/task/SignNestedCallTask.test.d.ts.map +1 -0
  127. package/lib/types/internal/app-binder/task/SignRootIntentTask.d.ts.map +1 -1
  128. package/lib/types/internal/use-cases/address/GetTvkUseCase.d.ts +9 -0
  129. package/lib/types/internal/use-cases/address/GetTvkUseCase.d.ts.map +1 -0
  130. package/lib/types/internal/use-cases/address/di/addressModule.d.ts.map +1 -1
  131. package/lib/types/internal/use-cases/address/di/addressTypes.d.ts +1 -0
  132. package/lib/types/internal/use-cases/address/di/addressTypes.d.ts.map +1 -1
  133. package/lib/types/internal/use-cases/transaction/SignNestedCallUseCase.d.ts +9 -0
  134. package/lib/types/internal/use-cases/transaction/SignNestedCallUseCase.d.ts.map +1 -0
  135. package/lib/types/internal/use-cases/transaction/di/transactionModule.d.ts.map +1 -1
  136. package/lib/types/internal/use-cases/transaction/di/transactionTypes.d.ts +1 -0
  137. package/lib/types/internal/use-cases/transaction/di/transactionTypes.d.ts.map +1 -1
  138. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  139. package/package.json +11 -11
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var A=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of s(t))!y.call(e,n)&&n!==i&&r(e,n,{get:()=>t[n],enumerable:!(o=p(t,n))||o.enumerable});return e};var g=e=>A(r({},"__esModule",{value:!0}),e);var a={};module.exports=g(a);
1
+ "use strict";var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var A=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of s(t))!y.call(e,n)&&n!==i&&r(e,n,{get:()=>t[n],enumerable:!(o=p(t,n))||o.enumerable});return e};var a=e=>A(r({},"__esModule",{value:!0}),e);var T={};module.exports=a(T);
2
2
  //# sourceMappingURL=SignerAleo.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/SignerAleo.ts"],
4
- "sourcesContent": ["import { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { type AddressOptions } from \"@api/model/AddressOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\n\nexport interface SignerAleo {\n getAppConfig: () => GetAppConfigDAReturnType;\n\n getAddress: (\n derivationPath: string,\n options?: AddressOptions,\n ) => GetAddressDAReturnType;\n\n getViewKey: (\n derivationPath: string,\n options?: AddressOptions,\n ) => GetViewKeyDAReturnType;\n\n signRootIntent: (\n derivationPath: string,\n rootIntent: Uint8Array,\n options?: TransactionOptions,\n ) => SignRootIntentDAReturnType;\n\n signFeeIntent: (\n feeIntent: Uint8Array,\n options?: TransactionOptions,\n ) => SignFeeIntentDAReturnType;\n}\n"],
4
+ "sourcesContent": ["import { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetTvkDAReturnType } from \"@api/app-binder/GetTvkDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignNestedCallDAReturnType } from \"@api/app-binder/SignNestedCallDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { type AddressOptions } from \"@api/model/AddressOptions\";\nimport { type GetTvkOptions } from \"@api/model/GetTvkOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\n\nexport interface SignerAleo {\n getAppConfig: () => GetAppConfigDAReturnType;\n\n getAddress: (\n derivationPath: string,\n options?: AddressOptions,\n ) => GetAddressDAReturnType;\n\n getViewKey: (\n derivationPath: string,\n options?: AddressOptions,\n ) => GetViewKeyDAReturnType;\n\n getTvk: (\n derivationPath: string,\n options?: GetTvkOptions,\n ) => GetTvkDAReturnType;\n\n signRootIntent: (\n derivationPath: string,\n rootIntent: Uint8Array,\n options?: TransactionOptions,\n ) => SignRootIntentDAReturnType;\n\n signNestedCall: (\n nestedCallRequest: Uint8Array,\n options?: TransactionOptions,\n ) => SignNestedCallDAReturnType;\n\n signFeeIntent: (\n feeIntent: Uint8Array,\n options?: TransactionOptions,\n ) => SignFeeIntentDAReturnType;\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["SignerAleo_exports", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var d=(t,e,n,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of A(e))!u.call(t,r)&&r!==n&&o(t,r,{get:()=>e[r],enumerable:!(p=m(e,r))||p.enumerable});return t};var a=t=>d(o({},"__esModule",{value:!0}),t);var i={};module.exports=a(i);
2
+ //# sourceMappingURL=GetTvkDeviceActionTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/api/app-binder/GetTvkDeviceActionTypes.ts"],
4
+ "sourcesContent": ["import {\n type CommandErrorResult,\n type ExecuteDeviceActionReturnType,\n type OpenAppDAError,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type GetTvkCommandResponse } from \"@internal/app-binder/command/GetTvkCommand\";\nimport { type AleoErrorCodes } from \"@internal/app-binder/command/utils/aleoApplicationErrors\";\n\ntype GetTvkDAUserInteractionRequired = UserInteractionRequired.None;\n\nexport type GetTvkDAOutput = SendCommandInAppDAOutput<GetTvkCommandResponse>;\n\nexport type GetTvkDAError =\n | OpenAppDAError\n | CommandErrorResult<AleoErrorCodes>[\"error\"];\n\nexport type GetTvkDAIntermediateValue =\n SendCommandInAppDAIntermediateValue<GetTvkDAUserInteractionRequired>;\n\nexport type GetTvkDAReturnType = ExecuteDeviceActionReturnType<\n GetTvkDAOutput,\n GetTvkDAError,\n GetTvkDAIntermediateValue\n>;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["GetTvkDeviceActionTypes_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var d=(t,e,p,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of l(e))!a.call(t,r)&&r!==p&&o(t,r,{get:()=>e[r],enumerable:!(n=i(e,r))||n.enumerable});return t};var s=t=>d(o({},"__esModule",{value:!0}),t);var A={};module.exports=s(A);
2
+ //# sourceMappingURL=SignNestedCallDeviceActionTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/api/app-binder/SignNestedCallDeviceActionTypes.ts"],
4
+ "sourcesContent": ["import {\n type CommandErrorResult,\n type ExecuteDeviceActionReturnType,\n type OpenAppDAError,\n type OpenAppDARequiredInteraction,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type SignNestedCallCommandResponse } from \"@internal/app-binder/command/SignNestedCallCommand\";\nimport { type AleoErrorCodes } from \"@internal/app-binder/command/utils/aleoApplicationErrors\";\n\nexport type SignNestedCallDAOutput = SignNestedCallCommandResponse;\n\nexport type SignNestedCallDAError =\n | OpenAppDAError\n | CommandErrorResult<AleoErrorCodes>[\"error\"];\n\ntype SignNestedCallDARequiredInteraction =\n | OpenAppDARequiredInteraction\n | UserInteractionRequired.None;\n\nexport type SignNestedCallDAIntermediateValue = {\n requiredUserInteraction: SignNestedCallDARequiredInteraction;\n};\n\nexport type SignNestedCallDAReturnType = ExecuteDeviceActionReturnType<\n SignNestedCallDAOutput,\n SignNestedCallDAError,\n SignNestedCallDAIntermediateValue\n>;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SignNestedCallDeviceActionTypes_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var o=(n,e,i,A)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of d(e))!u.call(n,r)&&r!==i&&a(n,r,{get:()=>e[r],enumerable:!(A=D(e,r))||A.enumerable});return n},p=(n,e,i)=>(o(n,e,"default"),i&&o(i,e,"default"));var y=n=>o(a({},"__esModule",{value:!0}),n);var t={};module.exports=y(t);p(t,require("./SignerAleo"),module.exports);p(t,require("./SignerAleoBuilder"),module.exports);0&&(module.exports={...require("./SignerAleo"),...require("./SignerAleoBuilder")});
1
+ "use strict";var a=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var o=(r,e,n,A)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of d(e))!u.call(r,i)&&i!==n&&a(r,i,{get:()=>e[i],enumerable:!(A=D(e,i))||A.enumerable});return r},p=(r,e,n)=>(o(r,e,"default"),n&&o(n,e,"default"));var s=r=>o(a({},"__esModule",{value:!0}),r);var t={};module.exports=s(t);p(t,require("./SignerAleo"),module.exports);p(t,require("./SignerAleoBuilder"),module.exports);0&&(module.exports={...require("./SignerAleo"),...require("./SignerAleoBuilder")});
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/index.ts"],
4
- "sourcesContent": ["export type {\n GetAddressDAError,\n GetAddressDAIntermediateValue,\n GetAddressDAOutput,\n} from \"@api/app-binder/GetAddressDeviceActionTypes\";\nexport type {\n GetAppConfigDAError,\n GetAppConfigDAIntermediateValue,\n GetAppConfigDAOutput,\n} from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nexport type {\n GetViewKeyDAError,\n GetViewKeyDAIntermediateValue,\n GetViewKeyDAOutput,\n} from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nexport type {\n SignFeeIntentDAError,\n SignFeeIntentDAIntermediateValue,\n SignFeeIntentDAOutput,\n} from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nexport type {\n SignRootIntentDAError,\n SignRootIntentDAIntermediateValue,\n SignRootIntentDAOutput,\n} from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nexport * from \"@api/SignerAleo\";\nexport * from \"@api/SignerAleoBuilder\";\n// Export other types as needed\n"],
5
- "mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAyBAE,EAAAF,EAAc,2BAzBd,gBA0BAE,EAAAF,EAAc,kCA1Bd",
4
+ "sourcesContent": ["export type {\n GetAddressDAError,\n GetAddressDAIntermediateValue,\n GetAddressDAOutput,\n} from \"@api/app-binder/GetAddressDeviceActionTypes\";\nexport type {\n GetAppConfigDAError,\n GetAppConfigDAIntermediateValue,\n GetAppConfigDAOutput,\n} from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nexport type {\n GetTvkDAError,\n GetTvkDAIntermediateValue,\n GetTvkDAOutput,\n GetTvkDAReturnType,\n} from \"@api/app-binder/GetTvkDeviceActionTypes\";\nexport type {\n GetViewKeyDAError,\n GetViewKeyDAIntermediateValue,\n GetViewKeyDAOutput,\n} from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nexport type {\n SignFeeIntentDAError,\n SignFeeIntentDAIntermediateValue,\n SignFeeIntentDAOutput,\n} from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nexport type {\n SignNestedCallDAError,\n SignNestedCallDAIntermediateValue,\n SignNestedCallDAOutput,\n} from \"@api/app-binder/SignNestedCallDeviceActionTypes\";\nexport type {\n SignRootIntentDAError,\n SignRootIntentDAIntermediateValue,\n SignRootIntentDAOutput,\n} from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nexport type { GetTvkOptions } from \"@api/model/GetTvkOptions\";\nexport * from \"@api/SignerAleo\";\nexport * from \"@api/SignerAleoBuilder\";\n// Export other types as needed\n"],
5
+ "mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAqCAE,EAAAF,EAAc,2BArCd,gBAsCAE,EAAAF,EAAc,kCAtCd",
6
6
  "names": ["api_exports", "__toCommonJS", "__reExport"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(n,e,i,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of s(e))!a.call(n,p)&&p!==i&&o(n,p,{get:()=>e[p],enumerable:!(t=r(e,p))||t.enumerable});return n};var k=n=>b(o({},"__esModule",{value:!0}),n);var x={};module.exports=k(x);
2
+ //# sourceMappingURL=GetTvkOptions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/api/model/GetTvkOptions.ts"],
4
+ "sourcesContent": ["export type GetTvkOptions = {\n transitionIndex?: number;\n skipOpenApp?: boolean;\n};\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["GetTvkOptions_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var f=(n,e)=>{for(var t in e)i(n,t,{get:e[t],enumerable:!0})},c=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!A.call(n,r)&&r!==t&&i(n,r,{get:()=>e[r],enumerable:!(o=g(e,r))||o.enumerable});return n};var u=n=>c(i({},"__esModule",{value:!0}),n);var d={};f(d,{DefaultSignerAleo:()=>C});module.exports=u(d);var a=require("./di"),s=require("./use-cases/address/di/addressTypes"),m=require("./use-cases/config/di/configTypes"),p=require("./use-cases/transaction/di/transactionTypes");class C{_container;constructor({dmk:e,sessionId:t}){this._container=(0,a.makeContainer)({dmk:e,sessionId:t})}getAppConfig(){return this._container.get(m.configTypes.GetAppConfigUseCase).execute()}getAddress(e,t){return this._container.get(s.addressTypes.GetAddressUseCase).execute(e,t)}getViewKey(e,t){return this._container.get(s.addressTypes.GetViewKeyUseCase).execute(e,t)}signRootIntent(e,t,o){return this._container.get(p.transactionTypes.SignRootIntentUseCase).execute(e,t,o)}signFeeIntent(e,t){return this._container.get(p.transactionTypes.SignFeeIntentUseCase).execute(e,t)}}0&&(module.exports={DefaultSignerAleo});
1
+ "use strict";var p=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var C=(n,e)=>{for(var t in e)p(n,t,{get:e[t],enumerable:!0})},f=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!A.call(n,r)&&r!==t&&p(n,r,{get:()=>e[r],enumerable:!(s=g(e,r))||s.enumerable});return n};var u=n=>f(p({},"__esModule",{value:!0}),n);var d={};C(d,{DefaultSignerAleo:()=>c});module.exports=u(d);var a=require("./di"),i=require("./use-cases/address/di/addressTypes"),m=require("./use-cases/config/di/configTypes"),o=require("./use-cases/transaction/di/transactionTypes");class c{_container;constructor({dmk:e,sessionId:t}){this._container=(0,a.makeContainer)({dmk:e,sessionId:t})}getAppConfig(){return this._container.get(m.configTypes.GetAppConfigUseCase).execute()}getAddress(e,t){return this._container.get(i.addressTypes.GetAddressUseCase).execute(e,t)}getViewKey(e,t){return this._container.get(i.addressTypes.GetViewKeyUseCase).execute(e,t)}getTvk(e,t){return this._container.get(i.addressTypes.GetTvkUseCase).execute(e,t)}signRootIntent(e,t,s){return this._container.get(o.transactionTypes.SignRootIntentUseCase).execute(e,t,s)}signNestedCall(e,t){return this._container.get(o.transactionTypes.SignNestedCallUseCase).execute(e,t)}signFeeIntent(e,t){return this._container.get(o.transactionTypes.SignFeeIntentUseCase).execute(e,t)}}0&&(module.exports={DefaultSignerAleo});
2
2
  //# sourceMappingURL=DefaultSignerAleo.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/internal/DefaultSignerAleo.ts"],
4
- "sourcesContent": ["import {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { type Container } from \"inversify\";\n\nimport { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { type AddressOptions } from \"@api/model/AddressOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\nimport { type SignerAleo } from \"@api/SignerAleo\";\nimport { makeContainer } from \"@internal/di\";\nimport { addressTypes } from \"@internal/use-cases/address/di/addressTypes\";\nimport { type GetAddressUseCase } from \"@internal/use-cases/address/GetAddressUseCase\";\nimport { type GetViewKeyUseCase } from \"@internal/use-cases/address/GetViewKeyUseCase\";\nimport { configTypes } from \"@internal/use-cases/config/di/configTypes\";\nimport { type GetAppConfigUseCase } from \"@internal/use-cases/config/GetAppConfigUseCase\";\nimport { transactionTypes } from \"@internal/use-cases/transaction/di/transactionTypes\";\nimport { type SignFeeIntentUseCase } from \"@internal/use-cases/transaction/SignFeeIntentUseCase\";\nimport { type SignRootIntentUseCase } from \"@internal/use-cases/transaction/SignRootIntentUseCase\";\n\ntype DefaultSignerAleoConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n};\n\nexport class DefaultSignerAleo implements SignerAleo {\n private readonly _container: Container;\n\n constructor({ dmk, sessionId }: DefaultSignerAleoConstructorArgs) {\n this._container = makeContainer({ dmk, sessionId });\n }\n\n getAppConfig(): GetAppConfigDAReturnType {\n return this._container\n .get<GetAppConfigUseCase>(configTypes.GetAppConfigUseCase)\n .execute();\n }\n\n getAddress(\n derivationPath: string,\n options?: AddressOptions,\n ): GetAddressDAReturnType {\n return this._container\n .get<GetAddressUseCase>(addressTypes.GetAddressUseCase)\n .execute(derivationPath, options);\n }\n\n getViewKey(\n derivationPath: string,\n options?: AddressOptions,\n ): GetViewKeyDAReturnType {\n return this._container\n .get<GetViewKeyUseCase>(addressTypes.GetViewKeyUseCase)\n .execute(derivationPath, options);\n }\n\n signRootIntent(\n derivationPath: string,\n rootIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignRootIntentDAReturnType {\n return this._container\n .get<SignRootIntentUseCase>(transactionTypes.SignRootIntentUseCase)\n .execute(derivationPath, rootIntent, options);\n }\n\n signFeeIntent(\n feeIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignFeeIntentDAReturnType {\n return this._container\n .get<SignFeeIntentUseCase>(transactionTypes.SignFeeIntentUseCase)\n .execute(feeIntent, options);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAcA,IAAAI,EAA8B,wBAC9BC,EAA6B,uDAG7BC,EAA4B,qDAE5BC,EAAiC,+DAS1B,MAAML,CAAwC,CAClC,WAEjB,YAAY,CAAE,IAAAM,EAAK,UAAAC,CAAU,EAAqC,CAChE,KAAK,cAAa,iBAAc,CAAE,IAAAD,EAAK,UAAAC,CAAU,CAAC,CACpD,CAEA,cAAyC,CACvC,OAAO,KAAK,WACT,IAAyB,cAAY,mBAAmB,EACxD,QAAQ,CACb,CAEA,WACEC,EACAC,EACwB,CACxB,OAAO,KAAK,WACT,IAAuB,eAAa,iBAAiB,EACrD,QAAQD,EAAgBC,CAAO,CACpC,CAEA,WACED,EACAC,EACwB,CACxB,OAAO,KAAK,WACT,IAAuB,eAAa,iBAAiB,EACrD,QAAQD,EAAgBC,CAAO,CACpC,CAEA,eACED,EACAE,EACAD,EAC4B,CAC5B,OAAO,KAAK,WACT,IAA2B,mBAAiB,qBAAqB,EACjE,QAAQD,EAAgBE,EAAYD,CAAO,CAChD,CAEA,cACEE,EACAF,EAC2B,CAC3B,OAAO,KAAK,WACT,IAA0B,mBAAiB,oBAAoB,EAC/D,QAAQE,EAAWF,CAAO,CAC/B,CACF",
6
- "names": ["DefaultSignerAleo_exports", "__export", "DefaultSignerAleo", "__toCommonJS", "import_di", "import_addressTypes", "import_configTypes", "import_transactionTypes", "dmk", "sessionId", "derivationPath", "options", "rootIntent", "feeIntent"]
4
+ "sourcesContent": ["import {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { type Container } from \"inversify\";\n\nimport { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetTvkDAReturnType } from \"@api/app-binder/GetTvkDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignNestedCallDAReturnType } from \"@api/app-binder/SignNestedCallDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { type AddressOptions } from \"@api/model/AddressOptions\";\nimport { type GetTvkOptions } from \"@api/model/GetTvkOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\nimport { type SignerAleo } from \"@api/SignerAleo\";\nimport { makeContainer } from \"@internal/di\";\nimport { addressTypes } from \"@internal/use-cases/address/di/addressTypes\";\nimport { type GetAddressUseCase } from \"@internal/use-cases/address/GetAddressUseCase\";\nimport { type GetTvkUseCase } from \"@internal/use-cases/address/GetTvkUseCase\";\nimport { type GetViewKeyUseCase } from \"@internal/use-cases/address/GetViewKeyUseCase\";\nimport { configTypes } from \"@internal/use-cases/config/di/configTypes\";\nimport { type GetAppConfigUseCase } from \"@internal/use-cases/config/GetAppConfigUseCase\";\nimport { transactionTypes } from \"@internal/use-cases/transaction/di/transactionTypes\";\nimport { type SignFeeIntentUseCase } from \"@internal/use-cases/transaction/SignFeeIntentUseCase\";\nimport { type SignNestedCallUseCase } from \"@internal/use-cases/transaction/SignNestedCallUseCase\";\nimport { type SignRootIntentUseCase } from \"@internal/use-cases/transaction/SignRootIntentUseCase\";\n\ntype DefaultSignerAleoConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n};\n\nexport class DefaultSignerAleo implements SignerAleo {\n private readonly _container: Container;\n\n constructor({ dmk, sessionId }: DefaultSignerAleoConstructorArgs) {\n this._container = makeContainer({ dmk, sessionId });\n }\n\n getAppConfig(): GetAppConfigDAReturnType {\n return this._container\n .get<GetAppConfigUseCase>(configTypes.GetAppConfigUseCase)\n .execute();\n }\n\n getAddress(\n derivationPath: string,\n options?: AddressOptions,\n ): GetAddressDAReturnType {\n return this._container\n .get<GetAddressUseCase>(addressTypes.GetAddressUseCase)\n .execute(derivationPath, options);\n }\n\n getViewKey(\n derivationPath: string,\n options?: AddressOptions,\n ): GetViewKeyDAReturnType {\n return this._container\n .get<GetViewKeyUseCase>(addressTypes.GetViewKeyUseCase)\n .execute(derivationPath, options);\n }\n\n getTvk(derivationPath: string, options?: GetTvkOptions): GetTvkDAReturnType {\n return this._container\n .get<GetTvkUseCase>(addressTypes.GetTvkUseCase)\n .execute(derivationPath, options);\n }\n\n signRootIntent(\n derivationPath: string,\n rootIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignRootIntentDAReturnType {\n return this._container\n .get<SignRootIntentUseCase>(transactionTypes.SignRootIntentUseCase)\n .execute(derivationPath, rootIntent, options);\n }\n\n signNestedCall(\n nestedCallRequest: Uint8Array,\n options?: TransactionOptions,\n ): SignNestedCallDAReturnType {\n return this._container\n .get<SignNestedCallUseCase>(transactionTypes.SignNestedCallUseCase)\n .execute(nestedCallRequest, options);\n }\n\n signFeeIntent(\n feeIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignFeeIntentDAReturnType {\n return this._container\n .get<SignFeeIntentUseCase>(transactionTypes.SignFeeIntentUseCase)\n .execute(feeIntent, options);\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAiBA,IAAAI,EAA8B,wBAC9BC,EAA6B,uDAI7BC,EAA4B,qDAE5BC,EAAiC,+DAU1B,MAAML,CAAwC,CAClC,WAEjB,YAAY,CAAE,IAAAM,EAAK,UAAAC,CAAU,EAAqC,CAChE,KAAK,cAAa,iBAAc,CAAE,IAAAD,EAAK,UAAAC,CAAU,CAAC,CACpD,CAEA,cAAyC,CACvC,OAAO,KAAK,WACT,IAAyB,cAAY,mBAAmB,EACxD,QAAQ,CACb,CAEA,WACEC,EACAC,EACwB,CACxB,OAAO,KAAK,WACT,IAAuB,eAAa,iBAAiB,EACrD,QAAQD,EAAgBC,CAAO,CACpC,CAEA,WACED,EACAC,EACwB,CACxB,OAAO,KAAK,WACT,IAAuB,eAAa,iBAAiB,EACrD,QAAQD,EAAgBC,CAAO,CACpC,CAEA,OAAOD,EAAwBC,EAA6C,CAC1E,OAAO,KAAK,WACT,IAAmB,eAAa,aAAa,EAC7C,QAAQD,EAAgBC,CAAO,CACpC,CAEA,eACED,EACAE,EACAD,EAC4B,CAC5B,OAAO,KAAK,WACT,IAA2B,mBAAiB,qBAAqB,EACjE,QAAQD,EAAgBE,EAAYD,CAAO,CAChD,CAEA,eACEE,EACAF,EAC4B,CAC5B,OAAO,KAAK,WACT,IAA2B,mBAAiB,qBAAqB,EACjE,QAAQE,EAAmBF,CAAO,CACvC,CAEA,cACEG,EACAH,EAC2B,CAC3B,OAAO,KAAK,WACT,IAA0B,mBAAiB,oBAAoB,EAC/D,QAAQG,EAAWH,CAAO,CAC/B,CACF",
6
+ "names": ["DefaultSignerAleo_exports", "__export", "DefaultSignerAleo", "__toCommonJS", "import_di", "import_addressTypes", "import_configTypes", "import_transactionTypes", "dmk", "sessionId", "derivationPath", "options", "rootIntent", "nestedCallRequest", "feeIntent"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var T=(i,e)=>{for(var n in e)c(i,n,{get:e[n],enumerable:!0})},R=(i,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of O(e))!g.call(i,p)&&p!==n&&c(i,p,{get:()=>e[p],enumerable:!(o=u(e,p))||o.enumerable});return i};var w=i=>R(c({},"__esModule",{value:!0}),i),k=(i,e,n,o)=>{for(var p=o>1?void 0:o?u(e,n):e,a=i.length-1,d;a>=0;a--)(d=i[a])&&(p=(o?d(e,n,p):d(p))||p);return o&&p&&c(e,n,p),p},A=(i,e)=>(n,o)=>e(n,o,i);var S={};T(S,{AleoAppBinder:()=>s});module.exports=w(S);var t=require("@ledgerhq/device-management-kit"),m=require("inversify"),r=require("../app-binder/constants"),I=require("../externalTypes"),y=require("./command/GetAddressCommand"),v=require("./command/GetAppConfigCommand"),D=require("./command/GetViewKeyCommand"),f=require("./task/SignFeeIntentTask"),h=require("./task/SignRootIntentTask");let s=class{constructor(e,n){this.dmk=e;this.sessionId=n}getAppConfig(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new t.SendCommandInAppDeviceAction({input:{command:new v.GetAppConfigCommand,appName:r.APP_NAME,requiredUserInteraction:t.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp}})})}getAddress(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new t.SendCommandInAppDeviceAction({input:{command:new y.GetAddressCommand(e),appName:r.APP_NAME,requiredUserInteraction:e.checkOnDevice?t.UserInteractionRequired.VerifyAddress:t.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp}})})}getViewKey(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new t.SendCommandInAppDeviceAction({input:{command:new D.GetViewKeyCommand(e),appName:r.APP_NAME,requiredUserInteraction:t.UserInteractionRequired.VerifyAddress,skipOpenApp:e.skipOpenApp}})})}signRootIntent(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new t.CallTaskInAppDeviceAction({input:{task:n=>new h.SignRootIntentTask(n,{derivationPath:e.derivationPath,rootIntent:e.rootIntent}).run(),appName:r.APP_NAME,requiredUserInteraction:t.UserInteractionRequired.SignTransaction,skipOpenApp:e.skipOpenApp}})})}signFeeIntent(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new t.CallTaskInAppDeviceAction({input:{task:n=>new f.SignFeeIntentTask(n,{feeIntent:e.feeIntent}).run(),appName:r.APP_NAME,requiredUserInteraction:t.UserInteractionRequired.SignTransaction,skipOpenApp:e.skipOpenApp}})})}};s=k([(0,m.injectable)(),A(0,(0,m.inject)(I.externalTypes.Dmk)),A(1,(0,m.inject)(I.externalTypes.SessionId))],s);0&&(module.exports={AleoAppBinder});
1
+ "use strict";var d=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var g=(i,e)=>{for(var t in e)d(i,t,{get:e[t],enumerable:!0})},w=(i,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of h(e))!R.call(i,p)&&p!==t&&d(i,p,{get:()=>e[p],enumerable:!(o=k(e,p))||o.enumerable});return i};var C=i=>w(d({},"__esModule",{value:!0}),i),I=(i,e,t,o)=>{for(var p=o>1?void 0:o?k(e,t):e,m=i.length-1,c;m>=0;m--)(c=i[m])&&(p=(o?c(e,t,p):c(p))||p);return o&&p&&d(e,t,p),p},A=(i,e)=>(t,o)=>e(t,o,i);var N={};g(N,{AleoAppBinder:()=>r});module.exports=C(N);var n=require("@ledgerhq/device-management-kit"),a=require("inversify"),s=require("../app-binder/constants"),u=require("../externalTypes"),v=require("./command/GetAddressCommand"),y=require("./command/GetAppConfigCommand"),D=require("./command/GetTvkCommand"),f=require("./command/GetViewKeyCommand"),T=require("./task/SignFeeIntentTask"),l=require("./task/SignNestedCallTask"),O=require("./task/SignRootIntentTask");let r=class{constructor(e,t){this.dmk=e;this.sessionId=t}getAppConfig(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new n.SendCommandInAppDeviceAction({input:{command:new y.GetAppConfigCommand,appName:s.APP_NAME,requiredUserInteraction:n.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp}})})}getAddress(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new n.SendCommandInAppDeviceAction({input:{command:new v.GetAddressCommand(e),appName:s.APP_NAME,requiredUserInteraction:e.checkOnDevice?n.UserInteractionRequired.VerifyAddress:n.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp}})})}getTvk(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new n.SendCommandInAppDeviceAction({input:{command:new D.GetTvkCommand(e),appName:s.APP_NAME,requiredUserInteraction:n.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp}})})}getViewKey(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new n.SendCommandInAppDeviceAction({input:{command:new f.GetViewKeyCommand(e),appName:s.APP_NAME,requiredUserInteraction:n.UserInteractionRequired.VerifyAddress,skipOpenApp:e.skipOpenApp}})})}signRootIntent(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new n.CallTaskInAppDeviceAction({input:{task:t=>new O.SignRootIntentTask(t,{derivationPath:e.derivationPath,rootIntent:e.rootIntent}).run(),appName:s.APP_NAME,requiredUserInteraction:n.UserInteractionRequired.SignTransaction,skipOpenApp:e.skipOpenApp}})})}signNestedCall(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new n.CallTaskInAppDeviceAction({input:{task:t=>new l.SignNestedCallTask(t,{nestedCallRequest:e.nestedCallRequest}).run(),appName:s.APP_NAME,requiredUserInteraction:n.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp}})})}signFeeIntent(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new n.CallTaskInAppDeviceAction({input:{task:t=>new T.SignFeeIntentTask(t,{feeIntent:e.feeIntent}).run(),appName:s.APP_NAME,requiredUserInteraction:n.UserInteractionRequired.SignTransaction,skipOpenApp:e.skipOpenApp}})})}};r=I([(0,a.injectable)(),A(0,(0,a.inject)(u.externalTypes.Dmk)),A(1,(0,a.inject)(u.externalTypes.SessionId))],r);0&&(module.exports={AleoAppBinder});
2
2
  //# sourceMappingURL=AleoAppBinder.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/internal/app-binder/AleoAppBinder.ts"],
4
- "sourcesContent": ["import {\n CallTaskInAppDeviceAction,\n type DeviceManagementKit,\n type DeviceSessionId,\n SendCommandInAppDeviceAction,\n UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { APP_NAME } from \"@internal/app-binder/constants\";\nimport { externalTypes } from \"@internal/externalTypes\";\n\nimport { GetAddressCommand } from \"./command/GetAddressCommand\";\nimport { GetAppConfigCommand } from \"./command/GetAppConfigCommand\";\nimport { GetViewKeyCommand } from \"./command/GetViewKeyCommand\";\nimport { SignFeeIntentTask } from \"./task/SignFeeIntentTask\";\nimport { SignRootIntentTask } from \"./task/SignRootIntentTask\";\n\n@injectable()\nexport class AleoAppBinder {\n constructor(\n @inject(externalTypes.Dmk) private dmk: DeviceManagementKit,\n @inject(externalTypes.SessionId) private sessionId: DeviceSessionId,\n ) {}\n\n getAppConfig(args: { skipOpenApp: boolean }): GetAppConfigDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAppConfigCommand(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n getAddress(args: {\n derivationPath: string;\n checkOnDevice: boolean;\n skipOpenApp: boolean;\n }): GetAddressDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAddressCommand(args),\n appName: APP_NAME,\n requiredUserInteraction: args.checkOnDevice\n ? UserInteractionRequired.VerifyAddress\n : UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n getViewKey(args: {\n derivationPath: string;\n skipOpenApp: boolean;\n }): GetViewKeyDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetViewKeyCommand(args),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n signRootIntent(args: {\n derivationPath: string;\n rootIntent: Uint8Array;\n skipOpenApp: boolean;\n }): SignRootIntentDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: (internalApi) =>\n new SignRootIntentTask(internalApi, {\n derivationPath: args.derivationPath,\n rootIntent: args.rootIntent,\n }).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n signFeeIntent(args: {\n feeIntent: Uint8Array;\n skipOpenApp: boolean;\n }): SignFeeIntentDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: (internalApi) =>\n new SignFeeIntentTask(internalApi, {\n feeIntent: args.feeIntent,\n }).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAMO,2CACPC,EAAmC,qBAOnCC,EAAyB,0CACzBC,EAA8B,mCAE9BC,EAAkC,uCAClCC,EAAoC,yCACpCC,EAAkC,uCAClCC,EAAkC,oCAClCC,EAAmC,qCAG5B,IAAMC,EAAN,KAAoB,CACzB,YACqCC,EACMC,EACzC,CAFmC,SAAAD,EACM,eAAAC,CACxC,CAEH,aAAaC,EAA0D,CACrE,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,sBACb,QAAS,WACT,wBAAyB,0BAAwB,KACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,WAAWA,EAIgB,CACzB,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,oBAAkBA,CAAI,EACnC,QAAS,WACT,wBAAyBA,EAAK,cAC1B,0BAAwB,cACxB,0BAAwB,KAC5B,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,WAAWA,EAGgB,CACzB,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,oBAAkBA,CAAI,EACnC,QAAS,WACT,wBAAyB,0BAAwB,cACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,eAAeA,EAIgB,CAC7B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAOC,GACL,IAAI,qBAAmBA,EAAa,CAClC,eAAgBD,EAAK,eACrB,WAAYA,EAAK,UACnB,CAAC,EAAE,IAAI,EACT,QAAS,WACT,wBAAyB,0BAAwB,gBACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,cAAcA,EAGgB,CAC5B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAOC,GACL,IAAI,oBAAkBA,EAAa,CACjC,UAAWD,EAAK,SAClB,CAAC,EAAE,IAAI,EACT,QAAS,WACT,wBAAyB,0BAAwB,gBACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CACF,EAlGaH,EAANK,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,gBAAc,GAAG,GACxBA,EAAA,eAAO,gBAAc,SAAS,IAHtBN",
6
- "names": ["AleoAppBinder_exports", "__export", "AleoAppBinder", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_constants", "import_externalTypes", "import_GetAddressCommand", "import_GetAppConfigCommand", "import_GetViewKeyCommand", "import_SignFeeIntentTask", "import_SignRootIntentTask", "AleoAppBinder", "dmk", "sessionId", "args", "internalApi", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import {\n CallTaskInAppDeviceAction,\n type DeviceManagementKit,\n type DeviceSessionId,\n SendCommandInAppDeviceAction,\n UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetTvkDAReturnType } from \"@api/app-binder/GetTvkDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignNestedCallDAReturnType } from \"@api/app-binder/SignNestedCallDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { APP_NAME } from \"@internal/app-binder/constants\";\nimport { externalTypes } from \"@internal/externalTypes\";\n\nimport { GetAddressCommand } from \"./command/GetAddressCommand\";\nimport { GetAppConfigCommand } from \"./command/GetAppConfigCommand\";\nimport { GetTvkCommand } from \"./command/GetTvkCommand\";\nimport { GetViewKeyCommand } from \"./command/GetViewKeyCommand\";\nimport { SignFeeIntentTask } from \"./task/SignFeeIntentTask\";\nimport { SignNestedCallTask } from \"./task/SignNestedCallTask\";\nimport { SignRootIntentTask } from \"./task/SignRootIntentTask\";\n\n@injectable()\nexport class AleoAppBinder {\n constructor(\n @inject(externalTypes.Dmk) private dmk: DeviceManagementKit,\n @inject(externalTypes.SessionId) private sessionId: DeviceSessionId,\n ) {}\n\n getAppConfig(args: { skipOpenApp: boolean }): GetAppConfigDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAppConfigCommand(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n getAddress(args: {\n derivationPath: string;\n checkOnDevice: boolean;\n skipOpenApp: boolean;\n }): GetAddressDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAddressCommand(args),\n appName: APP_NAME,\n requiredUserInteraction: args.checkOnDevice\n ? UserInteractionRequired.VerifyAddress\n : UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n getTvk(args: {\n derivationPath: string;\n transitionIndex?: number;\n skipOpenApp: boolean;\n }): GetTvkDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetTvkCommand(args),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n getViewKey(args: {\n derivationPath: string;\n skipOpenApp: boolean;\n }): GetViewKeyDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetViewKeyCommand(args),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n signRootIntent(args: {\n derivationPath: string;\n rootIntent: Uint8Array;\n skipOpenApp: boolean;\n }): SignRootIntentDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: (internalApi) =>\n new SignRootIntentTask(internalApi, {\n derivationPath: args.derivationPath,\n rootIntent: args.rootIntent,\n }).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n signNestedCall(args: {\n nestedCallRequest: Uint8Array;\n skipOpenApp: boolean;\n }): SignNestedCallDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: (internalApi) =>\n new SignNestedCallTask(internalApi, {\n nestedCallRequest: args.nestedCallRequest,\n }).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n signFeeIntent(args: {\n feeIntent: Uint8Array;\n skipOpenApp: boolean;\n }): SignFeeIntentDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: (internalApi) =>\n new SignFeeIntentTask(internalApi, {\n feeIntent: args.feeIntent,\n }).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAMO,2CACPC,EAAmC,qBASnCC,EAAyB,0CACzBC,EAA8B,mCAE9BC,EAAkC,uCAClCC,EAAoC,yCACpCC,EAA8B,mCAC9BC,EAAkC,uCAClCC,EAAkC,oCAClCC,EAAmC,qCACnCC,EAAmC,qCAG5B,IAAMC,EAAN,KAAoB,CACzB,YACqCC,EACMC,EACzC,CAFmC,SAAAD,EACM,eAAAC,CACxC,CAEH,aAAaC,EAA0D,CACrE,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,sBACb,QAAS,WACT,wBAAyB,0BAAwB,KACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,WAAWA,EAIgB,CACzB,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,oBAAkBA,CAAI,EACnC,QAAS,WACT,wBAAyBA,EAAK,cAC1B,0BAAwB,cACxB,0BAAwB,KAC5B,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,OAAOA,EAIgB,CACrB,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,gBAAcA,CAAI,EAC/B,QAAS,WACT,wBAAyB,0BAAwB,KACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,WAAWA,EAGgB,CACzB,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,oBAAkBA,CAAI,EACnC,QAAS,WACT,wBAAyB,0BAAwB,cACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,eAAeA,EAIgB,CAC7B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAOC,GACL,IAAI,qBAAmBA,EAAa,CAClC,eAAgBD,EAAK,eACrB,WAAYA,EAAK,UACnB,CAAC,EAAE,IAAI,EACT,QAAS,WACT,wBAAyB,0BAAwB,gBACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,eAAeA,EAGgB,CAC7B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAOC,GACL,IAAI,qBAAmBA,EAAa,CAClC,kBAAmBD,EAAK,iBAC1B,CAAC,EAAE,IAAI,EACT,QAAS,WACT,wBAAyB,0BAAwB,KACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,cAAcA,EAGgB,CAC5B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAOC,GACL,IAAI,oBAAkBA,EAAa,CACjC,UAAWD,EAAK,SAClB,CAAC,EAAE,IAAI,EACT,QAAS,WACT,wBAAyB,0BAAwB,gBACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CACF,EAxIaH,EAANK,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,gBAAc,GAAG,GACxBA,EAAA,eAAO,gBAAc,SAAS,IAHtBN",
6
+ "names": ["AleoAppBinder_exports", "__export", "AleoAppBinder", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_constants", "import_externalTypes", "import_GetAddressCommand", "import_GetAppConfigCommand", "import_GetTvkCommand", "import_GetViewKeyCommand", "import_SignFeeIntentTask", "import_SignNestedCallTask", "import_SignRootIntentTask", "AleoAppBinder", "dmk", "sessionId", "args", "internalApi", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var m=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var v=(a,e)=>{for(var n in e)m(a,n,{get:e[n],enumerable:!0})},C=(a,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of T(e))!g.call(a,t)&&t!==n&&m(a,t,{get:()=>e[t],enumerable:!(s=A(e,t))||s.enumerable});return a};var f=a=>C(m({},"__esModule",{value:!0}),a);var c={};v(c,{GetTvkCommand:()=>y});module.exports=f(c);var r=require("@ledgerhq/device-management-kit"),i=require("@ledgerhq/signer-utils"),l=require("purify-ts"),o=require("../../app-binder/command/utils/apduHeaderUtils"),d=require("./utils/aleoApplicationErrors");class y{name="getTvk";errorHelper=new i.CommandErrorHelper(d.ALEO_APP_ERRORS,d.AleoAppCommandErrorFactory);args;constructor(e){this.args=e}assertValidTransitionIndex(e){if(!Number.isInteger(e)||e<1||e>31)throw new r.InvalidResponseFormatError(`transitionIndex must be an integer in [1, 31], got ${e}`)}getApdu(){const{transitionIndex:e}=this.args,n=e!==void 0;e!==void 0&&this.assertValidTransitionIndex(e);const s={cla:o.ALEO_CLA,ins:o.INS.GET_TVK,p1:n?o.P1.GET_TVK_INDEXED:o.P1.GET_TVK_ROOT,p2:o.P2_DEFAULT},t=new r.ApduBuilder(s),p=i.DerivationPathUtils.splitPath(this.args.derivationPath);return t.add8BitUIntToData(p.length),p.forEach(u=>{t.add32BitUIntToData(u)}),e!==void 0&&t.add8BitUIntToData(e),t.build()}parseResponse(e){return l.Maybe.fromNullable(this.errorHelper.getError(e)).orDefaultLazy(()=>{const n=new r.ApduParser(e),s=n.extract8BitUInt();if(s===void 0)return(0,r.CommandResultFactory)({error:new r.InvalidResponseFormatError("Aleo TVK length is missing")});if(n.testMinimalLength(s)===!1)return(0,r.CommandResultFactory)({error:new r.InvalidResponseFormatError("TVK is missing")});const t=n.extractFieldByLength(s);return t===void 0?(0,r.CommandResultFactory)({error:new r.InvalidResponseFormatError("Unable to extract TVK")}):(0,r.CommandResultFactory)({data:{tvk:t}})})}}0&&(module.exports={GetTvkCommand});
2
+ //# sourceMappingURL=GetTvkCommand.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/GetTvkCommand.ts"],
4
+ "sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n ApduParser,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n InvalidResponseFormatError,\n} from \"@ledgerhq/device-management-kit\";\nimport {\n CommandErrorHelper,\n DerivationPathUtils,\n} from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ALEO_CLA,\n INS,\n P1,\n P2_DEFAULT,\n} from \"@internal/app-binder/command/utils/apduHeaderUtils\";\n\nimport {\n ALEO_APP_ERRORS,\n AleoAppCommandErrorFactory,\n type AleoErrorCodes,\n} from \"./utils/aleoApplicationErrors\";\n\nexport type GetTvkCommandArgs = {\n readonly derivationPath: string;\n readonly transitionIndex?: number;\n};\n\nexport type GetTvkCommandResponse = {\n readonly tvk: Uint8Array;\n};\n\nexport class GetTvkCommand\n implements Command<GetTvkCommandResponse, GetTvkCommandArgs, AleoErrorCodes>\n{\n readonly name = \"getTvk\";\n private readonly errorHelper = new CommandErrorHelper<\n GetTvkCommandResponse,\n AleoErrorCodes\n >(ALEO_APP_ERRORS, AleoAppCommandErrorFactory);\n\n private readonly args: GetTvkCommandArgs;\n\n constructor(args: GetTvkCommandArgs) {\n this.args = args;\n }\n\n private assertValidTransitionIndex(index: number): void {\n if (!Number.isInteger(index) || index < 1 || index > 31) {\n throw new InvalidResponseFormatError(\n `transitionIndex must be an integer in [1, 31], got ${index}`,\n );\n }\n }\n\n getApdu(): Apdu {\n const { transitionIndex } = this.args;\n const isIndexed = transitionIndex !== undefined;\n\n if (transitionIndex !== undefined) {\n this.assertValidTransitionIndex(transitionIndex);\n }\n\n const getTvkArgs: ApduBuilderArgs = {\n cla: ALEO_CLA,\n ins: INS.GET_TVK,\n p1: isIndexed ? P1.GET_TVK_INDEXED : P1.GET_TVK_ROOT,\n p2: P2_DEFAULT,\n };\n\n const builder = new ApduBuilder(getTvkArgs);\n const path = DerivationPathUtils.splitPath(this.args.derivationPath);\n\n builder.add8BitUIntToData(path.length);\n path.forEach((element) => {\n builder.add32BitUIntToData(element);\n });\n\n if (transitionIndex !== undefined) {\n builder.add8BitUIntToData(transitionIndex);\n }\n\n return builder.build();\n }\n\n parseResponse(\n response: ApduResponse,\n ): CommandResult<GetTvkCommandResponse, AleoErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(response),\n ).orDefaultLazy(() => {\n const parser = new ApduParser(response);\n\n const tvkLength = parser.extract8BitUInt();\n if (tvkLength === undefined) {\n return CommandResultFactory({\n error: new InvalidResponseFormatError(\"Aleo TVK length is missing\"),\n });\n }\n\n if (parser.testMinimalLength(tvkLength) === false) {\n return CommandResultFactory({\n error: new InvalidResponseFormatError(\"TVK is missing\"),\n });\n }\n\n const tvk = parser.extractFieldByLength(tvkLength);\n if (tvk === undefined) {\n return CommandResultFactory({\n error: new InvalidResponseFormatError(\"Unable to extract TVK\"),\n });\n }\n\n return CommandResultFactory({\n data: { tvk },\n });\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAUO,2CACPC,EAGO,kCACPC,EAAsB,qBAEtBC,EAKO,8DAEPC,EAIO,yCAWA,MAAMN,CAEb,CACW,KAAO,SACC,YAAc,IAAI,qBAGjC,kBAAiB,4BAA0B,EAE5B,KAEjB,YAAYO,EAAyB,CACnC,KAAK,KAAOA,CACd,CAEQ,2BAA2BC,EAAqB,CACtD,GAAI,CAAC,OAAO,UAAUA,CAAK,GAAKA,EAAQ,GAAKA,EAAQ,GACnD,MAAM,IAAI,6BACR,sDAAsDA,CAAK,EAC7D,CAEJ,CAEA,SAAgB,CACd,KAAM,CAAE,gBAAAC,CAAgB,EAAI,KAAK,KAC3BC,EAAYD,IAAoB,OAElCA,IAAoB,QACtB,KAAK,2BAA2BA,CAAe,EAGjD,MAAME,EAA8B,CAClC,IAAK,WACL,IAAK,MAAI,QACT,GAAID,EAAY,KAAG,gBAAkB,KAAG,aACxC,GAAI,YACN,EAEME,EAAU,IAAI,cAAYD,CAAU,EACpCE,EAAO,sBAAoB,UAAU,KAAK,KAAK,cAAc,EAEnE,OAAAD,EAAQ,kBAAkBC,EAAK,MAAM,EACrCA,EAAK,QAASC,GAAY,CACxBF,EAAQ,mBAAmBE,CAAO,CACpC,CAAC,EAEGL,IAAoB,QACtBG,EAAQ,kBAAkBH,CAAe,EAGpCG,EAAQ,MAAM,CACvB,CAEA,cACEG,EACsD,CACtD,OAAO,QAAM,aACX,KAAK,YAAY,SAASA,CAAQ,CACpC,EAAE,cAAc,IAAM,CACpB,MAAMC,EAAS,IAAI,aAAWD,CAAQ,EAEhCE,EAAYD,EAAO,gBAAgB,EACzC,GAAIC,IAAc,OAChB,SAAO,wBAAqB,CAC1B,MAAO,IAAI,6BAA2B,4BAA4B,CACpE,CAAC,EAGH,GAAID,EAAO,kBAAkBC,CAAS,IAAM,GAC1C,SAAO,wBAAqB,CAC1B,MAAO,IAAI,6BAA2B,gBAAgB,CACxD,CAAC,EAGH,MAAMC,EAAMF,EAAO,qBAAqBC,CAAS,EACjD,OAAIC,IAAQ,UACH,wBAAqB,CAC1B,MAAO,IAAI,6BAA2B,uBAAuB,CAC/D,CAAC,KAGI,wBAAqB,CAC1B,KAAM,CAAE,IAAAA,CAAI,CACd,CAAC,CACH,CAAC,CACH,CACF",
6
+ "names": ["GetTvkCommand_exports", "__export", "GetTvkCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_apduHeaderUtils", "import_aleoApplicationErrors", "args", "index", "transitionIndex", "isIndexed", "getTvkArgs", "builder", "path", "element", "response", "parser", "tvkLength", "tvk"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("@ledgerhq/device-management-kit"),o=require("./GetTvkCommand");const i=Uint8Array.from({length:32},()=>171),d=Uint8Array.from(Buffer.from("e00800000d038000002c800002ab00000000","hex")),m=Uint8Array.from(Buffer.from("e00801000e038000002c800002ab0000000005","hex")),p=Uint8Array.from(Buffer.concat([Buffer.from([32]),Buffer.from(i)])),u=new e.ApduResponse({statusCode:Uint8Array.from([144,0]),data:p});describe("GetTvkCommand",()=>{const s="44'/683'/0";describe("name",()=>{it("should be 'getTvk'",()=>{const r=new o.GetTvkCommand({derivationPath:s});expect(r.name).toBe("getTvk")})}),describe("getApdu",()=>{it("should return root TVK APDU (P1=0x00) when no transitionIndex",()=>{const r=new o.GetTvkCommand({derivationPath:s});expect(r.getApdu().getRawApdu()).toStrictEqual(d)}),it("should return indexed TVK APDU (P1=0x01) when transitionIndex provided",()=>{const r=new o.GetTvkCommand({derivationPath:s,transitionIndex:5});expect(r.getApdu().getRawApdu()).toStrictEqual(m)}),describe("should throw when transitionIndex is invalid",()=>{it.each([["zero",0],["negative",-1],["above max (32)",32],["above max (255)",255],["float",1.5],["NaN",NaN]])("%s",(r,t)=>{const n=new o.GetTvkCommand({derivationPath:s,transitionIndex:t});let a;try{n.getApdu()}catch(c){a=c}expect(a).toBeInstanceOf(e.InvalidResponseFormatError),expect(a.originalError.message).toMatch(/transitionIndex must be an integer in \[1, 31\]/)})})}),describe("parseResponse",()=>{it("should parse the response and return a Uint8Array tvk",()=>{const t=new o.GetTvkCommand({derivationPath:s}).parseResponse(u);expect(t).toStrictEqual((0,e.CommandResultFactory)({data:{tvk:i}}))}),describe("should return an error",()=>{it("when the response status is not successful",()=>{const r=new o.GetTvkCommand({derivationPath:s}),t=new e.ApduResponse({statusCode:Uint8Array.from([109,0]),data:new Uint8Array(0)});expect((0,e.isSuccessCommandResult)(r.parseResponse(t))).toBe(!1)}),it("when TVK length byte is missing",()=>{const r=new o.GetTvkCommand({derivationPath:s}),t=new e.ApduResponse({statusCode:Uint8Array.from([144,0]),data:new Uint8Array(0)}),n=r.parseResponse(t);if((0,e.isSuccessCommandResult)(n))throw new Error("Expected an error");expect(n.error).toBeInstanceOf(e.InvalidResponseFormatError),expect(n.error.originalError).toEqual(new Error("Aleo TVK length is missing"))}),it("when TVK data is missing (response too short)",()=>{const r=new o.GetTvkCommand({derivationPath:s}),t=new e.ApduResponse({statusCode:Uint8Array.from([144,0]),data:Uint8Array.from([32])}),n=r.parseResponse(t);if((0,e.isSuccessCommandResult)(n))throw new Error("Expected an error");expect(n.error).toBeInstanceOf(e.InvalidResponseFormatError),expect(n.error.originalError).toEqual(new Error("TVK is missing"))})})})});
2
+ //# sourceMappingURL=GetTvkCommand.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/GetTvkCommand.test.ts"],
4
+ "sourcesContent": ["import {\n ApduResponse,\n CommandResultFactory,\n InvalidResponseFormatError,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { GetTvkCommand } from \"./GetTvkCommand\";\n\nconst TVK_BYTES = Uint8Array.from({ length: 32 }, () => 0xab);\n\n// e0 08 00 00 0d 03 8000002c 800002ab 00000000\nconst GET_TVK_ROOT_APDU = Uint8Array.from(\n Buffer.from(\"e00800000d038000002c800002ab00000000\", \"hex\"),\n);\n\n// e0 08 01 00 0e 03 8000002c 800002ab 00000000 05\nconst GET_TVK_INDEXED_APDU = Uint8Array.from(\n Buffer.from(\"e00801000e038000002c800002ab0000000005\", \"hex\"),\n);\n\nconst RESPONSE_DATA = Uint8Array.from(\n Buffer.concat([Buffer.from([0x20]), Buffer.from(TVK_BYTES)]),\n);\n\nconst RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: RESPONSE_DATA,\n});\n\ndescribe(\"GetTvkCommand\", () => {\n const derivationPath = \"44'/683'/0\";\n\n describe(\"name\", () => {\n it(\"should be 'getTvk'\", () => {\n const command = new GetTvkCommand({ derivationPath });\n expect(command.name).toBe(\"getTvk\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should return root TVK APDU (P1=0x00) when no transitionIndex\", () => {\n const command = new GetTvkCommand({ derivationPath });\n expect(command.getApdu().getRawApdu()).toStrictEqual(GET_TVK_ROOT_APDU);\n });\n\n it(\"should return indexed TVK APDU (P1=0x01) when transitionIndex provided\", () => {\n const command = new GetTvkCommand({\n derivationPath,\n transitionIndex: 5,\n });\n expect(command.getApdu().getRawApdu()).toStrictEqual(\n GET_TVK_INDEXED_APDU,\n );\n });\n\n describe(\"should throw when transitionIndex is invalid\", () => {\n it.each([\n [\"zero\", 0],\n [\"negative\", -1],\n [\"above max (32)\", 32],\n [\"above max (255)\", 255],\n [\"float\", 1.5],\n [\"NaN\", NaN],\n ])(\"%s\", (_label, index) => {\n const command = new GetTvkCommand({\n derivationPath,\n transitionIndex: index,\n });\n let error: unknown;\n try {\n command.getApdu();\n } catch (e) {\n error = e;\n }\n expect(error).toBeInstanceOf(InvalidResponseFormatError);\n expect(\n (error as InvalidResponseFormatError).originalError.message,\n ).toMatch(/transitionIndex must be an integer in \\[1, 31\\]/);\n });\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should parse the response and return a Uint8Array tvk\", () => {\n const command = new GetTvkCommand({ derivationPath });\n const result = command.parseResponse(RESPONSE_GOOD);\n expect(result).toStrictEqual(\n CommandResultFactory({ data: { tvk: TVK_BYTES } }),\n );\n });\n\n describe(\"should return an error\", () => {\n it(\"when the response status is not successful\", () => {\n const command = new GetTvkCommand({ derivationPath });\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6d, 0x00]),\n data: new Uint8Array(0),\n });\n expect(isSuccessCommandResult(command.parseResponse(response))).toBe(\n false,\n );\n });\n\n it(\"when TVK length byte is missing\", () => {\n const command = new GetTvkCommand({ derivationPath });\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(0),\n });\n const result = command.parseResponse(response);\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n }\n expect(result.error).toBeInstanceOf(InvalidResponseFormatError);\n expect(result.error.originalError).toEqual(\n new Error(\"Aleo TVK length is missing\"),\n );\n });\n\n it(\"when TVK data is missing (response too short)\", () => {\n const command = new GetTvkCommand({ derivationPath });\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([0x20]), // length byte only, no TVK data\n });\n const result = command.parseResponse(response);\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n }\n expect(result.error).toBeInstanceOf(InvalidResponseFormatError);\n expect(result.error.originalError).toEqual(new Error(\"TVK is missing\"));\n });\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAKO,2CAEPC,EAA8B,2BAE9B,MAAMC,EAAY,WAAW,KAAK,CAAE,OAAQ,EAAG,EAAG,IAAM,GAAI,EAGtDC,EAAoB,WAAW,KACnC,OAAO,KAAK,uCAAwC,KAAK,CAC3D,EAGMC,EAAuB,WAAW,KACtC,OAAO,KAAK,yCAA0C,KAAK,CAC7D,EAEMC,EAAgB,WAAW,KAC/B,OAAO,OAAO,CAAC,OAAO,KAAK,CAAC,EAAI,CAAC,EAAG,OAAO,KAAKH,CAAS,CAAC,CAAC,CAC7D,EAEMI,EAAgB,IAAI,eAAa,CACrC,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAMD,CACR,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,MAAME,EAAiB,aAEvB,SAAS,OAAQ,IAAM,CACrB,GAAG,qBAAsB,IAAM,CAC7B,MAAMC,EAAU,IAAI,gBAAc,CAAE,eAAAD,CAAe,CAAC,EACpD,OAAOC,EAAQ,IAAI,EAAE,KAAK,QAAQ,CACpC,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,gEAAiE,IAAM,CACxE,MAAMA,EAAU,IAAI,gBAAc,CAAE,eAAAD,CAAe,CAAC,EACpD,OAAOC,EAAQ,QAAQ,EAAE,WAAW,CAAC,EAAE,cAAcL,CAAiB,CACxE,CAAC,EAED,GAAG,yEAA0E,IAAM,CACjF,MAAMK,EAAU,IAAI,gBAAc,CAChC,eAAAD,EACA,gBAAiB,CACnB,CAAC,EACD,OAAOC,EAAQ,QAAQ,EAAE,WAAW,CAAC,EAAE,cACrCJ,CACF,CACF,CAAC,EAED,SAAS,+CAAgD,IAAM,CAC7D,GAAG,KAAK,CACN,CAAC,OAAQ,CAAC,EACV,CAAC,WAAY,EAAE,EACf,CAAC,iBAAkB,EAAE,EACrB,CAAC,kBAAmB,GAAG,EACvB,CAAC,QAAS,GAAG,EACb,CAAC,MAAO,GAAG,CACb,CAAC,EAAE,KAAM,CAACK,EAAQC,IAAU,CAC1B,MAAMF,EAAU,IAAI,gBAAc,CAChC,eAAAD,EACA,gBAAiBG,CACnB,CAAC,EACD,IAAIC,EACJ,GAAI,CACFH,EAAQ,QAAQ,CAClB,OAASI,EAAG,CACVD,EAAQC,CACV,CACA,OAAOD,CAAK,EAAE,eAAe,4BAA0B,EACvD,OACGA,EAAqC,cAAc,OACtD,EAAE,QAAQ,iDAAiD,CAC7D,CAAC,CACH,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,wDAAyD,IAAM,CAEhE,MAAME,EADU,IAAI,gBAAc,CAAE,eAAAN,CAAe,CAAC,EAC7B,cAAcD,CAAa,EAClD,OAAOO,CAAM,EAAE,iBACb,wBAAqB,CAAE,KAAM,CAAE,IAAKX,CAAU,CAAE,CAAC,CACnD,CACF,CAAC,EAED,SAAS,yBAA0B,IAAM,CACvC,GAAG,6CAA8C,IAAM,CACrD,MAAMM,EAAU,IAAI,gBAAc,CAAE,eAAAD,CAAe,CAAC,EAC9CO,EAAW,IAAI,eAAa,CAChC,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAM,IAAI,WAAW,CAAC,CACxB,CAAC,EACD,UAAO,0BAAuBN,EAAQ,cAAcM,CAAQ,CAAC,CAAC,EAAE,KAC9D,EACF,CACF,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,MAAMN,EAAU,IAAI,gBAAc,CAAE,eAAAD,CAAe,CAAC,EAC9CO,EAAW,IAAI,eAAa,CAChC,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAM,IAAI,WAAW,CAAC,CACxB,CAAC,EACKD,EAASL,EAAQ,cAAcM,CAAQ,EAC7C,MAAI,0BAAuBD,CAAM,EAC/B,MAAM,IAAI,MAAM,mBAAmB,EAErC,OAAOA,EAAO,KAAK,EAAE,eAAe,4BAA0B,EAC9D,OAAOA,EAAO,MAAM,aAAa,EAAE,QACjC,IAAI,MAAM,4BAA4B,CACxC,CACF,CAAC,EAED,GAAG,gDAAiD,IAAM,CACxD,MAAML,EAAU,IAAI,gBAAc,CAAE,eAAAD,CAAe,CAAC,EAC9CO,EAAW,IAAI,eAAa,CAChC,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAM,WAAW,KAAK,CAAC,EAAI,CAAC,CAC9B,CAAC,EACKD,EAASL,EAAQ,cAAcM,CAAQ,EAC7C,MAAI,0BAAuBD,CAAM,EAC/B,MAAM,IAAI,MAAM,mBAAmB,EAErC,OAAOA,EAAO,KAAK,EAAE,eAAe,4BAA0B,EAC9D,OAAOA,EAAO,MAAM,aAAa,EAAE,QAAQ,IAAI,MAAM,gBAAgB,CAAC,CACxE,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_GetTvkCommand", "TVK_BYTES", "GET_TVK_ROOT_APDU", "GET_TVK_INDEXED_APDU", "RESPONSE_DATA", "RESPONSE_GOOD", "derivationPath", "command", "_label", "index", "error", "e", "result", "response"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var l=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(n,e)=>{for(var r in e)l(n,r,{get:e[r],enumerable:!0})},A=(n,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of C(e))!g.call(n,o)&&o!==r&&l(n,o,{get:()=>e[o],enumerable:!(s=i(e,o))||s.enumerable});return n};var N=n=>A(l({},"__esModule",{value:!0}),n);var S={};u(S,{SignNestedCallCommand:()=>y});module.exports=N(S);var a=require("@ledgerhq/device-management-kit"),m=require("@ledgerhq/signer-utils"),p=require("purify-ts"),t=require("../../app-binder/command/utils/apduHeaderUtils"),d=require("./utils/aleoApplicationErrors");class y{constructor(e){this.args=e}name="signNestedCall";errorHelper=new m.CommandErrorHelper(d.ALEO_APP_ERRORS,d.AleoAppCommandErrorFactory);getApdu(){const e={cla:t.ALEO_CLA,ins:t.INS.SIGN_INTENT,p1:t.P1.SIGN_MODE_NESTED_CALL,p2:this.args.isFirst?t.P2.FIRST_CHUNK:t.P2.NEXT_CHUNK},r=new a.ApduBuilder(e);return r.addBufferToData(this.args.chunkedData),r.build()}parseResponse(e){return p.Maybe.fromNullable(this.errorHelper.getError(e)).orDefaultLazy(()=>{const r=new a.ApduParser(e),s=r.getUnparsedRemainingLength(),o=r.extractFieldByLength(s);return o&&o.length>0?(0,a.CommandResultFactory)({data:{tlvSignature:r.encodeToHexaString(o)}}):(0,a.CommandResultFactory)({data:{tlvSignature:""}})})}}0&&(module.exports={SignNestedCallCommand});
2
+ //# sourceMappingURL=SignNestedCallCommand.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/SignNestedCallCommand.ts"],
4
+ "sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n ApduParser,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ALEO_CLA,\n INS,\n P1,\n P2,\n} from \"@internal/app-binder/command/utils/apduHeaderUtils\";\nimport { type AleoChunkableCommandArgs } from \"@internal/app-binder/task/AleoChunkableCommandArgs\";\n\nimport {\n ALEO_APP_ERRORS,\n AleoAppCommandErrorFactory,\n type AleoErrorCodes,\n} from \"./utils/aleoApplicationErrors\";\n\nexport type SignNestedCallCommandArgs = AleoChunkableCommandArgs;\n\nexport type SignNestedCallCommandResponse = {\n readonly tlvSignature: string;\n};\n\n/**\n * Command to sign a nested call in an Aleo transaction.\n * This command can be called multiple times after the root intent is signed.\n * The device uses tvk from the intent's signature response as 'root_tvk'.\n * On success, the device responds with TLV-encoded request signature data and a 0x9000 status code.\n */\nexport class SignNestedCallCommand\n implements\n Command<\n SignNestedCallCommandResponse,\n SignNestedCallCommandArgs,\n AleoErrorCodes\n >\n{\n readonly name = \"signNestedCall\";\n private readonly errorHelper = new CommandErrorHelper<\n SignNestedCallCommandResponse,\n AleoErrorCodes\n >(ALEO_APP_ERRORS, AleoAppCommandErrorFactory);\n\n constructor(private readonly args: SignNestedCallCommandArgs) {}\n\n getApdu(): Apdu {\n const signNestedCallArgs: ApduBuilderArgs = {\n cla: ALEO_CLA,\n ins: INS.SIGN_INTENT,\n p1: P1.SIGN_MODE_NESTED_CALL,\n p2: this.args.isFirst ? P2.FIRST_CHUNK : P2.NEXT_CHUNK,\n };\n\n const builder = new ApduBuilder(signNestedCallArgs);\n\n builder.addBufferToData(this.args.chunkedData);\n\n return builder.build();\n }\n\n parseResponse(\n response: ApduResponse,\n ): CommandResult<SignNestedCallCommandResponse, AleoErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(response),\n ).orDefaultLazy(() => {\n const parser = new ApduParser(response);\n\n const remainingLength = parser.getUnparsedRemainingLength();\n\n const data = parser.extractFieldByLength(remainingLength);\n\n if (data && data.length > 0) {\n return CommandResultFactory({\n data: {\n tlvSignature: parser.encodeToHexaString(data),\n },\n });\n }\n\n // for intermediate chunks, the device returns 0 bytes of data with 0x9000.\n return CommandResultFactory({\n data: {\n tlvSignature: \"\",\n },\n });\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EASO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAKO,8DAGPC,EAIO,yCAcA,MAAMN,CAOb,CAOE,YAA6BO,EAAiC,CAAjC,UAAAA,CAAkC,CANtD,KAAO,iBACC,YAAc,IAAI,qBAGjC,kBAAiB,4BAA0B,EAI7C,SAAgB,CACd,MAAMC,EAAsC,CAC1C,IAAK,WACL,IAAK,MAAI,YACT,GAAI,KAAG,sBACP,GAAI,KAAK,KAAK,QAAU,KAAG,YAAc,KAAG,UAC9C,EAEMC,EAAU,IAAI,cAAYD,CAAkB,EAElD,OAAAC,EAAQ,gBAAgB,KAAK,KAAK,WAAW,EAEtCA,EAAQ,MAAM,CACvB,CAEA,cACEC,EAC8D,CAC9D,OAAO,QAAM,aACX,KAAK,YAAY,SAASA,CAAQ,CACpC,EAAE,cAAc,IAAM,CACpB,MAAMC,EAAS,IAAI,aAAWD,CAAQ,EAEhCE,EAAkBD,EAAO,2BAA2B,EAEpDE,EAAOF,EAAO,qBAAqBC,CAAe,EAExD,OAAIC,GAAQA,EAAK,OAAS,KACjB,wBAAqB,CAC1B,KAAM,CACJ,aAAcF,EAAO,mBAAmBE,CAAI,CAC9C,CACF,CAAC,KAII,wBAAqB,CAC1B,KAAM,CACJ,aAAc,EAChB,CACF,CAAC,CACH,CAAC,CACH,CACF",
6
+ "names": ["SignNestedCallCommand_exports", "__export", "SignNestedCallCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_apduHeaderUtils", "import_aleoApplicationErrors", "args", "signNestedCallArgs", "builder", "response", "parser", "remainingLength", "data"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var r=require("@ledgerhq/device-management-kit"),t=require("../../app-binder/command/utils/apduHeaderUtils"),a=require("./SignNestedCallCommand");describe("SignNestedCallCommand",()=>{const n=new Uint8Array([5,6,7,8]),c=new Uint8Array(255).fill(36);describe("name",()=>{it("should be 'signNestedCall'",()=>{const s=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0});expect(s.name).toBe("signNestedCall")})}),describe("getApdu",()=>{it("should create correct APDU for the first chunk",()=>{const e=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0}).getApdu();expect(e.cla).toBe(t.ALEO_CLA),expect(e.ins).toBe(t.INS.SIGN_INTENT),expect(e.p1).toBe(t.P1.SIGN_MODE_NESTED_CALL),expect(e.p2).toBe(t.P2.FIRST_CHUNK),expect(e.data.length).toBe(n.length),expect(e.data).toEqual(n)}),it("should create correct APDU for subsequent chunks",()=>{const e=new a.SignNestedCallCommand({chunkedData:n,isFirst:!1}).getApdu();expect(e.cla).toBe(t.ALEO_CLA),expect(e.ins).toBe(t.INS.SIGN_INTENT),expect(e.p1).toBe(t.P1.SIGN_MODE_NESTED_CALL),expect(e.p2).toBe(t.P2.NEXT_CHUNK),expect(e.data.length).toBe(n.length),expect(e.data).toEqual(n)}),it("should create correct APDU for a long chunk (255 bytes)",()=>{const e=new a.SignNestedCallCommand({chunkedData:c,isFirst:!1}).getApdu();expect(e.cla).toBe(t.ALEO_CLA),expect(e.ins).toBe(t.INS.SIGN_INTENT),expect(e.p1).toBe(t.P1.SIGN_MODE_NESTED_CALL),expect(e.p2).toBe(t.P2.NEXT_CHUNK),expect(e.data.length).toBe(255),expect(e.data).toEqual(c)})}),describe("parseResponse",()=>{it("should return hexadecimal string for successful response",()=>{const s=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0}),e={statusCode:new Uint8Array([144,0]),data:new Uint8Array([1,2,3])},o=s.parseResponse(e);expect(o).toEqual((0,r.CommandResultFactory)({data:{tlvSignature:"010203"}}))}),it("should return empty signature for successful response without data (intermediate chunks)",()=>{const s=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0}),e={statusCode:new Uint8Array([144,0]),data:new Uint8Array([])},o=s.parseResponse(e);expect(o).toEqual((0,r.CommandResultFactory)({data:{tlvSignature:""}}))}),it("should handle user rejection",()=>{const s=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0}),e={statusCode:new Uint8Array([105,240]),data:new Uint8Array([])},o=s.parseResponse(e);expect((0,r.isSuccessCommandResult)(o)).toBe(!1),(0,r.isSuccessCommandResult)(o)||expect(o.error).toEqual(expect.objectContaining({_tag:"AleoAppCommandError",errorCode:"69f0",message:"Denied by user"}))}),it("should handle device error codes",()=>{const s=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0}),e={statusCode:new Uint8Array([176,8]),data:new Uint8Array([])},o=s.parseResponse(e);expect((0,r.isSuccessCommandResult)(o)).toBe(!1),(0,r.isSuccessCommandResult)(o)||expect(o.error).toEqual(expect.objectContaining({_tag:"AleoAppCommandError",errorCode:"b008",message:"Signature fail"}))})})});
2
+ //# sourceMappingURL=SignNestedCallCommand.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/SignNestedCallCommand.test.ts"],
4
+ "sourcesContent": ["import {\n type Apdu,\n type ApduResponse,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n ALEO_CLA,\n INS,\n P1,\n P2,\n} from \"@internal/app-binder/command/utils/apduHeaderUtils\";\n\nimport { SignNestedCallCommand } from \"./SignNestedCallCommand\";\n\ndescribe(\"SignNestedCallCommand\", () => {\n const mockChunkedData = new Uint8Array([0x05, 0x06, 0x07, 0x08]);\n const mockLongChunkedData = new Uint8Array(255).fill(0x24);\n\n describe(\"name\", () => {\n it(\"should be 'signNestedCall'\", () => {\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n expect(command.name).toBe(\"signNestedCall\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should create correct APDU for the first chunk\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n\n // When\n const apdu: Apdu = command.getApdu();\n\n // Then\n expect(apdu.cla).toBe(ALEO_CLA);\n expect(apdu.ins).toBe(INS.SIGN_INTENT);\n expect(apdu.p1).toBe(P1.SIGN_MODE_NESTED_CALL);\n expect(apdu.p2).toBe(P2.FIRST_CHUNK);\n\n expect(apdu.data.length).toBe(mockChunkedData.length);\n expect(apdu.data).toEqual(mockChunkedData);\n });\n\n it(\"should create correct APDU for subsequent chunks\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: false,\n });\n\n // When\n const apdu: Apdu = command.getApdu();\n\n // Then\n expect(apdu.cla).toBe(ALEO_CLA);\n expect(apdu.ins).toBe(INS.SIGN_INTENT);\n expect(apdu.p1).toBe(P1.SIGN_MODE_NESTED_CALL);\n expect(apdu.p2).toBe(P2.NEXT_CHUNK);\n\n expect(apdu.data.length).toBe(mockChunkedData.length);\n expect(apdu.data).toEqual(mockChunkedData);\n });\n\n it(\"should create correct APDU for a long chunk (255 bytes)\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockLongChunkedData,\n isFirst: false,\n });\n\n // When\n const apdu: Apdu = command.getApdu();\n\n // Then\n expect(apdu.cla).toBe(ALEO_CLA);\n expect(apdu.ins).toBe(INS.SIGN_INTENT);\n expect(apdu.p1).toBe(P1.SIGN_MODE_NESTED_CALL);\n expect(apdu.p2).toBe(P2.NEXT_CHUNK);\n\n expect(apdu.data.length).toBe(255);\n expect(apdu.data).toEqual(mockLongChunkedData);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return hexadecimal string for successful response\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n\n const response: ApduResponse = {\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array([0x01, 0x02, 0x03]),\n };\n\n // When\n const result = command.parseResponse(response);\n\n // Then\n expect(result).toEqual(\n CommandResultFactory({\n data: {\n tlvSignature: \"010203\",\n },\n }),\n );\n });\n\n it(\"should return empty signature for successful response without data (intermediate chunks)\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n\n const response: ApduResponse = {\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array([]),\n };\n\n // When\n const result = command.parseResponse(response);\n\n // Then\n expect(result).toEqual(\n CommandResultFactory({\n data: {\n tlvSignature: \"\",\n },\n }),\n );\n });\n\n it(\"should handle user rejection\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n\n const response: ApduResponse = {\n statusCode: new Uint8Array([0x69, 0xf0]),\n data: new Uint8Array([]),\n };\n\n // When\n const result = command.parseResponse(response);\n\n // Then\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n expect(result.error).toEqual(\n expect.objectContaining({\n _tag: \"AleoAppCommandError\",\n errorCode: \"69f0\",\n message: \"Denied by user\",\n }),\n );\n }\n });\n\n it(\"should handle device error codes\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n\n // Signature fail (0xb008)\n const response: ApduResponse = {\n statusCode: new Uint8Array([0xb0, 0x08]),\n data: new Uint8Array([]),\n };\n\n // When\n const result = command.parseResponse(response);\n\n // Then\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n expect(result.error).toEqual(\n expect.objectContaining({\n _tag: \"AleoAppCommandError\",\n errorCode: \"b008\",\n message: \"Signature fail\",\n }),\n );\n }\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAKO,2CAEPC,EAKO,8DAEPC,EAAsC,mCAEtC,SAAS,wBAAyB,IAAM,CACtC,MAAMC,EAAkB,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EACzDC,EAAsB,IAAI,WAAW,GAAG,EAAE,KAAK,EAAI,EAEzD,SAAS,OAAQ,IAAM,CACrB,GAAG,6BAA8B,IAAM,CACrC,MAAMC,EAAU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EACD,OAAOE,EAAQ,IAAI,EAAE,KAAK,gBAAgB,CAC5C,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAQzD,MAAMC,EANU,IAAI,wBAAsB,CACxC,YAAaH,EACb,QAAS,EACX,CAAC,EAG0B,QAAQ,EAGnC,OAAOG,EAAK,GAAG,EAAE,KAAK,UAAQ,EAC9B,OAAOA,EAAK,GAAG,EAAE,KAAK,MAAI,WAAW,EACrC,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,qBAAqB,EAC7C,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,WAAW,EAEnC,OAAOA,EAAK,KAAK,MAAM,EAAE,KAAKH,EAAgB,MAAM,EACpD,OAAOG,EAAK,IAAI,EAAE,QAAQH,CAAe,CAC3C,CAAC,EAED,GAAG,mDAAoD,IAAM,CAQ3D,MAAMG,EANU,IAAI,wBAAsB,CACxC,YAAaH,EACb,QAAS,EACX,CAAC,EAG0B,QAAQ,EAGnC,OAAOG,EAAK,GAAG,EAAE,KAAK,UAAQ,EAC9B,OAAOA,EAAK,GAAG,EAAE,KAAK,MAAI,WAAW,EACrC,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,qBAAqB,EAC7C,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,UAAU,EAElC,OAAOA,EAAK,KAAK,MAAM,EAAE,KAAKH,EAAgB,MAAM,EACpD,OAAOG,EAAK,IAAI,EAAE,QAAQH,CAAe,CAC3C,CAAC,EAED,GAAG,0DAA2D,IAAM,CAQlE,MAAMG,EANU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EAG0B,QAAQ,EAGnC,OAAOE,EAAK,GAAG,EAAE,KAAK,UAAQ,EAC9B,OAAOA,EAAK,GAAG,EAAE,KAAK,MAAI,WAAW,EACrC,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,qBAAqB,EAC7C,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,UAAU,EAElC,OAAOA,EAAK,KAAK,MAAM,EAAE,KAAK,GAAG,EACjC,OAAOA,EAAK,IAAI,EAAE,QAAQF,CAAmB,CAC/C,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,2DAA4D,IAAM,CAEnE,MAAMC,EAAU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EAEKI,EAAyB,CAC7B,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,EAAM,EAAM,CAAI,CAAC,CACzC,EAGMC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,OAAOC,CAAM,EAAE,WACb,wBAAqB,CACnB,KAAM,CACJ,aAAc,QAChB,CACF,CAAC,CACH,CACF,CAAC,EAED,GAAG,2FAA4F,IAAM,CAEnG,MAAMH,EAAU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EAEKI,EAAyB,CAC7B,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,EAGMC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,OAAOC,CAAM,EAAE,WACb,wBAAqB,CACnB,KAAM,CACJ,aAAc,EAChB,CACF,CAAC,CACH,CACF,CAAC,EAED,GAAG,+BAAgC,IAAM,CAEvC,MAAMH,EAAU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EAEKI,EAAyB,CAC7B,WAAY,IAAI,WAAW,CAAC,IAAM,GAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,EAGMC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAK,KAC5C,0BAAuBA,CAAM,GAChC,OAAOA,EAAO,KAAK,EAAE,QACnB,OAAO,iBAAiB,CACtB,KAAM,sBACN,UAAW,OACX,QAAS,gBACX,CAAC,CACH,CAEJ,CAAC,EAED,GAAG,mCAAoC,IAAM,CAE3C,MAAMH,EAAU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EAGKI,EAAyB,CAC7B,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,EAGMC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAK,KAC5C,0BAAuBA,CAAM,GAChC,OAAOA,EAAO,KAAK,EAAE,QACnB,OAAO,iBAAiB,CACtB,KAAM,sBACN,UAAW,OACX,QAAS,gBACX,CAAC,CACH,CAEJ,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_apduHeaderUtils", "import_SignNestedCallCommand", "mockChunkedData", "mockLongChunkedData", "command", "apdu", "response", "result"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var l=(o,e)=>{for(var s in e)a(o,s,{get:e[s],enumerable:!0})},p=(o,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of d(e))!i.call(o,r)&&r!==s&&a(o,r,{get:()=>e[r],enumerable:!(n=g(e,r))||n.enumerable});return o};var b=o=>p(a({},"__esModule",{value:!0}),o);var E={};l(E,{ALEO_APP_ERRORS:()=>c,AleoAppCommandError:()=>m,AleoAppCommandErrorFactory:()=>A});module.exports=b(E);var t=require("@ledgerhq/device-management-kit");const c={"69f0":{message:"Denied by user"},6985:{message:"Condition not satisfied"},"6a86":{message:"Incorrect P1 or P2"},"6a87":{message:"Wrong LC or length of APDU command less than 5"},"6d00":{message:"Unknown command with this INS"},"6e00":{message:"Instruction class is different than CLA"},b000:{message:"Wrong response length (buffer too small or too big)"},b001:{message:"Fail to display BIP32 path"},b002:{message:"Fail to display address"},b003:{message:"Fail to display amount"},b004:{message:"Wrong transaction length"},b005:{message:"Fail of transaction parsing"},b006:{message:"Fail of transaction hash"},b007:{message:"Bad state"},b008:{message:"Signature fail"},c000:{message:"Swap failure"}};class m extends t.DeviceExchangeError{constructor(e){super({tag:"AleoAppCommandError",...e})}}const A=o=>new m(o);0&&(module.exports={ALEO_APP_ERRORS,AleoAppCommandError,AleoAppCommandErrorFactory});
1
+ "use strict";var a=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var l=(r,e)=>{for(var s in e)a(r,s,{get:e[s],enumerable:!0})},p=(r,e,s,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!i.call(r,o)&&o!==s&&a(r,o,{get:()=>e[o],enumerable:!(t=g(e,o))||t.enumerable});return r};var b=r=>p(a({},"__esModule",{value:!0}),r);var E={};l(E,{ALEO_APP_ERRORS:()=>c,AleoAppCommandError:()=>m,AleoAppCommandErrorFactory:()=>A});module.exports=b(E);var n=require("@ledgerhq/device-management-kit");const c={"69f0":{message:"Denied by user"},6985:{message:"Condition not satisfied"},"6a80":{message:"Incorrect data"},"6a86":{message:"Incorrect P1 or P2"},"6a87":{message:"Wrong LC or length of APDU command less than 5"},"6d00":{message:"Unknown command with this INS"},"6e00":{message:"Instruction class is different than CLA"},b000:{message:"Wrong response length (buffer too small or too big)"},b001:{message:"Fail to display BIP32 path"},b002:{message:"Fail to display address"},b003:{message:"Fail to display amount"},b004:{message:"Wrong transaction length"},b005:{message:"Fail of transaction parsing"},b006:{message:"Fail of transaction hash"},b007:{message:"Bad state"},b008:{message:"Signature fail"},c000:{message:"Swap failure"}};class m extends n.DeviceExchangeError{constructor(e){super({tag:"AleoAppCommandError",...e})}}const A=r=>new m(r);0&&(module.exports={ALEO_APP_ERRORS,AleoAppCommandError,AleoAppCommandErrorFactory});
2
2
  //# sourceMappingURL=aleoApplicationErrors.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/app-binder/command/utils/aleoApplicationErrors.ts"],
4
- "sourcesContent": ["import {\n type CommandErrorArgs,\n type CommandErrors,\n DeviceExchangeError,\n} from \"@ledgerhq/device-management-kit\";\n\nexport type AleoErrorCodes =\n | \"69f0\"\n | \"6985\"\n | \"6a86\"\n | \"6a87\"\n | \"6d00\"\n | \"6e00\"\n | \"b000\"\n | \"b001\"\n | \"b002\"\n | \"b003\"\n | \"b004\"\n | \"b005\"\n | \"b006\"\n | \"b007\"\n | \"b008\"\n | \"c000\";\n\nexport const ALEO_APP_ERRORS: CommandErrors<AleoErrorCodes> = {\n \"69f0\": { message: \"Denied by user\" },\n \"6985\": { message: \"Condition not satisfied\" },\n \"6a86\": { message: \"Incorrect P1 or P2\" },\n \"6a87\": { message: \"Wrong LC or length of APDU command less than 5\" },\n \"6d00\": { message: \"Unknown command with this INS\" },\n \"6e00\": { message: \"Instruction class is different than CLA\" },\n b000: { message: \"Wrong response length (buffer too small or too big)\" },\n b001: { message: \"Fail to display BIP32 path\" },\n b002: { message: \"Fail to display address\" },\n b003: { message: \"Fail to display amount\" },\n b004: { message: \"Wrong transaction length\" },\n b005: { message: \"Fail of transaction parsing\" },\n b006: { message: \"Fail of transaction hash\" },\n b007: { message: \"Bad state\" },\n b008: { message: \"Signature fail\" },\n c000: { message: \"Swap failure\" },\n};\n\nexport class AleoAppCommandError extends DeviceExchangeError<AleoErrorCodes> {\n constructor(args: CommandErrorArgs<AleoErrorCodes>) {\n super({ tag: \"AleoAppCommandError\", ...args });\n }\n}\n\nexport const AleoAppCommandErrorFactory = (\n args: CommandErrorArgs<AleoErrorCodes>,\n) => new AleoAppCommandError(args);\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,wBAAAC,EAAA,+BAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAIO,2CAoBA,MAAMJ,EAAiD,CAC5D,OAAQ,CAAE,QAAS,gBAAiB,EACpC,KAAQ,CAAE,QAAS,yBAA0B,EAC7C,OAAQ,CAAE,QAAS,oBAAqB,EACxC,OAAQ,CAAE,QAAS,gDAAiD,EACpE,OAAQ,CAAE,QAAS,+BAAgC,EACnD,OAAQ,CAAE,QAAS,yCAA0C,EAC7D,KAAM,CAAE,QAAS,qDAAsD,EACvE,KAAM,CAAE,QAAS,4BAA6B,EAC9C,KAAM,CAAE,QAAS,yBAA0B,EAC3C,KAAM,CAAE,QAAS,wBAAyB,EAC1C,KAAM,CAAE,QAAS,0BAA2B,EAC5C,KAAM,CAAE,QAAS,6BAA8B,EAC/C,KAAM,CAAE,QAAS,0BAA2B,EAC5C,KAAM,CAAE,QAAS,WAAY,EAC7B,KAAM,CAAE,QAAS,gBAAiB,EAClC,KAAM,CAAE,QAAS,cAAe,CAClC,EAEO,MAAMC,UAA4B,qBAAoC,CAC3E,YAAYI,EAAwC,CAClD,MAAM,CAAE,IAAK,sBAAuB,GAAGA,CAAK,CAAC,CAC/C,CACF,CAEO,MAAMH,EACXG,GACG,IAAIJ,EAAoBI,CAAI",
4
+ "sourcesContent": ["import {\n type CommandErrorArgs,\n type CommandErrors,\n DeviceExchangeError,\n} from \"@ledgerhq/device-management-kit\";\n\nexport type AleoErrorCodes =\n | \"69f0\"\n | \"6985\"\n | \"6a80\"\n | \"6a86\"\n | \"6a87\"\n | \"6d00\"\n | \"6e00\"\n | \"b000\"\n | \"b001\"\n | \"b002\"\n | \"b003\"\n | \"b004\"\n | \"b005\"\n | \"b006\"\n | \"b007\"\n | \"b008\"\n | \"c000\";\n\nexport const ALEO_APP_ERRORS: CommandErrors<AleoErrorCodes> = {\n \"69f0\": { message: \"Denied by user\" },\n \"6985\": { message: \"Condition not satisfied\" },\n \"6a80\": { message: \"Incorrect data\" },\n \"6a86\": { message: \"Incorrect P1 or P2\" },\n \"6a87\": { message: \"Wrong LC or length of APDU command less than 5\" },\n \"6d00\": { message: \"Unknown command with this INS\" },\n \"6e00\": { message: \"Instruction class is different than CLA\" },\n b000: { message: \"Wrong response length (buffer too small or too big)\" },\n b001: { message: \"Fail to display BIP32 path\" },\n b002: { message: \"Fail to display address\" },\n b003: { message: \"Fail to display amount\" },\n b004: { message: \"Wrong transaction length\" },\n b005: { message: \"Fail of transaction parsing\" },\n b006: { message: \"Fail of transaction hash\" },\n b007: { message: \"Bad state\" },\n b008: { message: \"Signature fail\" },\n c000: { message: \"Swap failure\" },\n};\n\nexport class AleoAppCommandError extends DeviceExchangeError<AleoErrorCodes> {\n constructor(args: CommandErrorArgs<AleoErrorCodes>) {\n super({ tag: \"AleoAppCommandError\", ...args });\n }\n}\n\nexport const AleoAppCommandErrorFactory = (\n args: CommandErrorArgs<AleoErrorCodes>,\n) => new AleoAppCommandError(args);\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,wBAAAC,EAAA,+BAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAIO,2CAqBA,MAAMJ,EAAiD,CAC5D,OAAQ,CAAE,QAAS,gBAAiB,EACpC,KAAQ,CAAE,QAAS,yBAA0B,EAC7C,OAAQ,CAAE,QAAS,gBAAiB,EACpC,OAAQ,CAAE,QAAS,oBAAqB,EACxC,OAAQ,CAAE,QAAS,gDAAiD,EACpE,OAAQ,CAAE,QAAS,+BAAgC,EACnD,OAAQ,CAAE,QAAS,yCAA0C,EAC7D,KAAM,CAAE,QAAS,qDAAsD,EACvE,KAAM,CAAE,QAAS,4BAA6B,EAC9C,KAAM,CAAE,QAAS,yBAA0B,EAC3C,KAAM,CAAE,QAAS,wBAAyB,EAC1C,KAAM,CAAE,QAAS,0BAA2B,EAC5C,KAAM,CAAE,QAAS,6BAA8B,EAC/C,KAAM,CAAE,QAAS,0BAA2B,EAC5C,KAAM,CAAE,QAAS,WAAY,EAC7B,KAAM,CAAE,QAAS,gBAAiB,EAClC,KAAM,CAAE,QAAS,cAAe,CAClC,EAEO,MAAMC,UAA4B,qBAAoC,CAC3E,YAAYI,EAAwC,CAClD,MAAM,CAAE,IAAK,sBAAuB,GAAGA,CAAK,CAAC,CAC/C,CACF,CAEO,MAAMH,EACXG,GACG,IAAIJ,EAAoBI,CAAI",
6
6
  "names": ["aleoApplicationErrors_exports", "__export", "ALEO_APP_ERRORS", "AleoAppCommandError", "AleoAppCommandErrorFactory", "__toCommonJS", "import_device_management_kit", "args"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=require("@ledgerhq/device-management-kit"),e=require("vitest"),o=require("./aleoApplicationErrors");(0,e.describe)("AleoAppCommandError",()=>{(0,e.afterEach)(()=>{e.vi.resetAllMocks()}),(0,e.afterAll)(()=>{e.vi.resetModules()}),(0,e.it)("should be an instance of DeviceExchangeError",()=>{const r=new o.AleoAppCommandError({message:"Test error message",errorCode:"6985"});(0,e.expect)(r).toBeInstanceOf(n.DeviceExchangeError)}),(0,e.it)("should set the correct message when provided",()=>{const r="Custom error message",s=new o.AleoAppCommandError({message:r,errorCode:"6985"});(0,e.expect)(s.message).toBe(r)}),(0,e.it)("should set the correct customErrorCode",()=>{const r="6a86",s=new o.AleoAppCommandError({message:"Incorrect P1 or P2",errorCode:r});(0,e.expect)(s.errorCode).toBe(r)}),(0,e.it)("should correlate error codes with messages from aleoApplicationErrors",()=>{const r="6e00",s=o.ALEO_APP_ERRORS[r].message,t=new o.AleoAppCommandError({message:s,errorCode:r});(0,e.expect)(t.errorCode).toBe(r),(0,e.expect)(t.message).toBe(s),(0,e.expect)(t).toBeInstanceOf(n.DeviceExchangeError)}),(0,e.it)("should handle unknown error codes gracefully",()=>{const r="9999",s="Unknown error occurred",t=new o.AleoAppCommandError({message:s,errorCode:r});(0,e.expect)(t.errorCode).toBe(r),(0,e.expect)(t.message).toBe(s),(0,e.expect)(t).toBeInstanceOf(n.DeviceExchangeError)}),(0,e.describe)("AleoAppCommandErrorFactory",()=>{(0,e.it)("should create an instance of AleoAppCommandError",()=>{const r=(0,o.AleoAppCommandErrorFactory)({message:"Test error message",errorCode:"6985"});(0,e.expect)(r).toBeInstanceOf(o.AleoAppCommandError),(0,e.expect)(r.message).toBe("Test error message"),(0,e.expect)(r.errorCode).toBe("6985")})})});
1
+ "use strict";var a=require("@ledgerhq/device-management-kit"),e=require("vitest"),o=require("./aleoApplicationErrors");(0,e.describe)("AleoAppCommandError",()=>{(0,e.afterEach)(()=>{e.vi.resetAllMocks()}),(0,e.afterAll)(()=>{e.vi.resetModules()}),(0,e.it)("should be an instance of DeviceExchangeError",()=>{const r=new o.AleoAppCommandError({message:"Test error message",errorCode:"6985"});(0,e.expect)(r).toBeInstanceOf(a.DeviceExchangeError)}),(0,e.it)("should set the correct message when provided",()=>{const r="Custom error message",s=new o.AleoAppCommandError({message:r,errorCode:"6985"});(0,e.expect)(s.message).toBe(r)}),(0,e.it)("should set the correct customErrorCode",()=>{const r="6a86",s=new o.AleoAppCommandError({message:"Incorrect P1 or P2",errorCode:r});(0,e.expect)(s.errorCode).toBe(r)}),(0,e.it)("should correlate error codes with messages from aleoApplicationErrors",()=>{const r="6e00",s=o.ALEO_APP_ERRORS[r].message,t=new o.AleoAppCommandError({message:s,errorCode:r});(0,e.expect)(t.errorCode).toBe(r),(0,e.expect)(t.message).toBe(s),(0,e.expect)(t).toBeInstanceOf(a.DeviceExchangeError)}),(0,e.it)("should handle unknown error codes gracefully",()=>{const r="9999",s="Unknown error occurred",t=new o.AleoAppCommandError({message:s,errorCode:r});(0,e.expect)(t.errorCode).toBe(r),(0,e.expect)(t.message).toBe(s),(0,e.expect)(t).toBeInstanceOf(a.DeviceExchangeError)}),(0,e.describe)("6a80 - Incorrect data",()=>{(0,e.it)("should be defined in ALEO_APP_ERRORS with message 'Incorrect data'",()=>{(0,e.expect)(o.ALEO_APP_ERRORS["6a80"]).toBeDefined(),(0,e.expect)(o.ALEO_APP_ERRORS["6a80"].message).toBe("Incorrect data")}),(0,e.it)("should map error code 6a80 to 'Incorrect data' via AleoAppCommandError",()=>{const r="6a80",s=o.ALEO_APP_ERRORS[r].message,t=new o.AleoAppCommandError({message:s,errorCode:r});(0,e.expect)(t.errorCode).toBe("6a80"),(0,e.expect)(t.message).toBe("Incorrect data"),(0,e.expect)(t).toBeInstanceOf(a.DeviceExchangeError)}),(0,e.it)("should create a 6a80 error via AleoAppCommandErrorFactory",()=>{const r=(0,o.AleoAppCommandErrorFactory)({message:o.ALEO_APP_ERRORS["6a80"].message,errorCode:"6a80"});(0,e.expect)(r).toBeInstanceOf(o.AleoAppCommandError),(0,e.expect)(r.errorCode).toBe("6a80"),(0,e.expect)(r.message).toBe("Incorrect data")})}),(0,e.describe)("AleoAppCommandErrorFactory",()=>{(0,e.it)("should create an instance of AleoAppCommandError",()=>{const r=(0,o.AleoAppCommandErrorFactory)({message:"Test error message",errorCode:"6985"});(0,e.expect)(r).toBeInstanceOf(o.AleoAppCommandError),(0,e.expect)(r.message).toBe("Test error message"),(0,e.expect)(r.errorCode).toBe("6985")})})});
2
2
  //# sourceMappingURL=aleoApplicationErrors.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/app-binder/command/utils/aleoApplicationErrors.test.ts"],
4
- "sourcesContent": ["import { DeviceExchangeError } from \"@ledgerhq/device-management-kit\";\nimport { afterAll, afterEach, describe, expect, it, vi } from \"vitest\";\n\nimport {\n ALEO_APP_ERRORS,\n AleoAppCommandError,\n AleoAppCommandErrorFactory,\n type AleoErrorCodes,\n} from \"./aleoApplicationErrors\";\n\ndescribe(\"AleoAppCommandError\", () => {\n afterEach(() => {\n vi.resetAllMocks();\n });\n\n afterAll(() => {\n vi.resetModules();\n });\n\n it(\"should be an instance of DeviceExchangeError\", () => {\n const error = new AleoAppCommandError({\n message: \"Test error message\",\n errorCode: \"6985\",\n });\n\n expect(error).toBeInstanceOf(DeviceExchangeError);\n });\n\n it(\"should set the correct message when provided\", () => {\n const customMessage = \"Custom error message\";\n const error = new AleoAppCommandError({\n message: customMessage,\n errorCode: \"6985\",\n });\n\n expect(error.message).toBe(customMessage);\n });\n\n it(\"should set the correct customErrorCode\", () => {\n const errorCode: AleoErrorCodes = \"6a86\";\n const error = new AleoAppCommandError({\n message: \"Incorrect P1 or P2\",\n errorCode,\n });\n\n expect(error.errorCode).toBe(errorCode);\n });\n\n it(\"should correlate error codes with messages from aleoApplicationErrors\", () => {\n const errorCode: AleoErrorCodes = \"6e00\";\n const expectedMessage = ALEO_APP_ERRORS[errorCode].message;\n\n const error = new AleoAppCommandError({\n message: expectedMessage,\n errorCode,\n });\n\n expect(error.errorCode).toBe(errorCode);\n expect(error.message).toBe(expectedMessage);\n\n expect(error).toBeInstanceOf(DeviceExchangeError);\n });\n\n it(\"should handle unknown error codes gracefully\", () => {\n const unknownErrorCode = \"9999\" as AleoErrorCodes;\n const customMessage = \"Unknown error occurred\";\n\n const error = new AleoAppCommandError({\n message: customMessage,\n errorCode: unknownErrorCode,\n });\n\n expect(error.errorCode).toBe(unknownErrorCode);\n expect(error.message).toBe(customMessage);\n expect(error).toBeInstanceOf(DeviceExchangeError);\n });\n\n describe(\"AleoAppCommandErrorFactory\", () => {\n it(\"should create an instance of AleoAppCommandError\", () => {\n const error = AleoAppCommandErrorFactory({\n message: \"Test error message\",\n errorCode: \"6985\",\n });\n\n expect(error).toBeInstanceOf(AleoAppCommandError);\n expect(error.message).toBe(\"Test error message\");\n expect(error.errorCode).toBe(\"6985\");\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAAoC,2CACpCC,EAA8D,kBAE9DC,EAKO,sCAEP,YAAS,sBAAuB,IAAM,IACpC,aAAU,IAAM,CACd,KAAG,cAAc,CACnB,CAAC,KAED,YAAS,IAAM,CACb,KAAG,aAAa,CAClB,CAAC,KAED,MAAG,+CAAgD,IAAM,CACvD,MAAMC,EAAQ,IAAI,sBAAoB,CACpC,QAAS,qBACT,UAAW,MACb,CAAC,KAED,UAAOA,CAAK,EAAE,eAAe,qBAAmB,CAClD,CAAC,KAED,MAAG,+CAAgD,IAAM,CACvD,MAAMC,EAAgB,uBAChBD,EAAQ,IAAI,sBAAoB,CACpC,QAASC,EACT,UAAW,MACb,CAAC,KAED,UAAOD,EAAM,OAAO,EAAE,KAAKC,CAAa,CAC1C,CAAC,KAED,MAAG,yCAA0C,IAAM,CACjD,MAAMC,EAA4B,OAC5BF,EAAQ,IAAI,sBAAoB,CACpC,QAAS,qBACT,UAAAE,CACF,CAAC,KAED,UAAOF,EAAM,SAAS,EAAE,KAAKE,CAAS,CACxC,CAAC,KAED,MAAG,wEAAyE,IAAM,CAChF,MAAMA,EAA4B,OAC5BC,EAAkB,kBAAgBD,CAAS,EAAE,QAE7CF,EAAQ,IAAI,sBAAoB,CACpC,QAASG,EACT,UAAAD,CACF,CAAC,KAED,UAAOF,EAAM,SAAS,EAAE,KAAKE,CAAS,KACtC,UAAOF,EAAM,OAAO,EAAE,KAAKG,CAAe,KAE1C,UAAOH,CAAK,EAAE,eAAe,qBAAmB,CAClD,CAAC,KAED,MAAG,+CAAgD,IAAM,CACvD,MAAMI,EAAmB,OACnBH,EAAgB,yBAEhBD,EAAQ,IAAI,sBAAoB,CACpC,QAASC,EACT,UAAWG,CACb,CAAC,KAED,UAAOJ,EAAM,SAAS,EAAE,KAAKI,CAAgB,KAC7C,UAAOJ,EAAM,OAAO,EAAE,KAAKC,CAAa,KACxC,UAAOD,CAAK,EAAE,eAAe,qBAAmB,CAClD,CAAC,KAED,YAAS,6BAA8B,IAAM,IAC3C,MAAG,mDAAoD,IAAM,CAC3D,MAAMA,KAAQ,8BAA2B,CACvC,QAAS,qBACT,UAAW,MACb,CAAC,KAED,UAAOA,CAAK,EAAE,eAAe,qBAAmB,KAChD,UAAOA,EAAM,OAAO,EAAE,KAAK,oBAAoB,KAC/C,UAAOA,EAAM,SAAS,EAAE,KAAK,MAAM,CACrC,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { DeviceExchangeError } from \"@ledgerhq/device-management-kit\";\nimport { afterAll, afterEach, describe, expect, it, vi } from \"vitest\";\n\nimport {\n ALEO_APP_ERRORS,\n AleoAppCommandError,\n AleoAppCommandErrorFactory,\n type AleoErrorCodes,\n} from \"./aleoApplicationErrors\";\n\ndescribe(\"AleoAppCommandError\", () => {\n afterEach(() => {\n vi.resetAllMocks();\n });\n\n afterAll(() => {\n vi.resetModules();\n });\n\n it(\"should be an instance of DeviceExchangeError\", () => {\n const error = new AleoAppCommandError({\n message: \"Test error message\",\n errorCode: \"6985\",\n });\n\n expect(error).toBeInstanceOf(DeviceExchangeError);\n });\n\n it(\"should set the correct message when provided\", () => {\n const customMessage = \"Custom error message\";\n const error = new AleoAppCommandError({\n message: customMessage,\n errorCode: \"6985\",\n });\n\n expect(error.message).toBe(customMessage);\n });\n\n it(\"should set the correct customErrorCode\", () => {\n const errorCode: AleoErrorCodes = \"6a86\";\n const error = new AleoAppCommandError({\n message: \"Incorrect P1 or P2\",\n errorCode,\n });\n\n expect(error.errorCode).toBe(errorCode);\n });\n\n it(\"should correlate error codes with messages from aleoApplicationErrors\", () => {\n const errorCode: AleoErrorCodes = \"6e00\";\n const expectedMessage = ALEO_APP_ERRORS[errorCode].message;\n\n const error = new AleoAppCommandError({\n message: expectedMessage,\n errorCode,\n });\n\n expect(error.errorCode).toBe(errorCode);\n expect(error.message).toBe(expectedMessage);\n\n expect(error).toBeInstanceOf(DeviceExchangeError);\n });\n\n it(\"should handle unknown error codes gracefully\", () => {\n const unknownErrorCode = \"9999\" as AleoErrorCodes;\n const customMessage = \"Unknown error occurred\";\n\n const error = new AleoAppCommandError({\n message: customMessage,\n errorCode: unknownErrorCode,\n });\n\n expect(error.errorCode).toBe(unknownErrorCode);\n expect(error.message).toBe(customMessage);\n expect(error).toBeInstanceOf(DeviceExchangeError);\n });\n\n describe(\"6a80 - Incorrect data\", () => {\n it(\"should be defined in ALEO_APP_ERRORS with message 'Incorrect data'\", () => {\n expect(ALEO_APP_ERRORS[\"6a80\"]).toBeDefined();\n expect(ALEO_APP_ERRORS[\"6a80\"].message).toBe(\"Incorrect data\");\n });\n\n it(\"should map error code 6a80 to 'Incorrect data' via AleoAppCommandError\", () => {\n const errorCode: AleoErrorCodes = \"6a80\";\n const expectedMessage = ALEO_APP_ERRORS[errorCode].message;\n\n const error = new AleoAppCommandError({\n message: expectedMessage,\n errorCode,\n });\n\n expect(error.errorCode).toBe(\"6a80\");\n expect(error.message).toBe(\"Incorrect data\");\n expect(error).toBeInstanceOf(DeviceExchangeError);\n });\n\n it(\"should create a 6a80 error via AleoAppCommandErrorFactory\", () => {\n const error = AleoAppCommandErrorFactory({\n message: ALEO_APP_ERRORS[\"6a80\"].message,\n errorCode: \"6a80\",\n });\n\n expect(error).toBeInstanceOf(AleoAppCommandError);\n expect(error.errorCode).toBe(\"6a80\");\n expect(error.message).toBe(\"Incorrect data\");\n });\n });\n\n describe(\"AleoAppCommandErrorFactory\", () => {\n it(\"should create an instance of AleoAppCommandError\", () => {\n const error = AleoAppCommandErrorFactory({\n message: \"Test error message\",\n errorCode: \"6985\",\n });\n\n expect(error).toBeInstanceOf(AleoAppCommandError);\n expect(error.message).toBe(\"Test error message\");\n expect(error.errorCode).toBe(\"6985\");\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAoC,2CACpCC,EAA8D,kBAE9DC,EAKO,sCAEP,YAAS,sBAAuB,IAAM,IACpC,aAAU,IAAM,CACd,KAAG,cAAc,CACnB,CAAC,KAED,YAAS,IAAM,CACb,KAAG,aAAa,CAClB,CAAC,KAED,MAAG,+CAAgD,IAAM,CACvD,MAAMC,EAAQ,IAAI,sBAAoB,CACpC,QAAS,qBACT,UAAW,MACb,CAAC,KAED,UAAOA,CAAK,EAAE,eAAe,qBAAmB,CAClD,CAAC,KAED,MAAG,+CAAgD,IAAM,CACvD,MAAMC,EAAgB,uBAChBD,EAAQ,IAAI,sBAAoB,CACpC,QAASC,EACT,UAAW,MACb,CAAC,KAED,UAAOD,EAAM,OAAO,EAAE,KAAKC,CAAa,CAC1C,CAAC,KAED,MAAG,yCAA0C,IAAM,CACjD,MAAMC,EAA4B,OAC5BF,EAAQ,IAAI,sBAAoB,CACpC,QAAS,qBACT,UAAAE,CACF,CAAC,KAED,UAAOF,EAAM,SAAS,EAAE,KAAKE,CAAS,CACxC,CAAC,KAED,MAAG,wEAAyE,IAAM,CAChF,MAAMA,EAA4B,OAC5BC,EAAkB,kBAAgBD,CAAS,EAAE,QAE7CF,EAAQ,IAAI,sBAAoB,CACpC,QAASG,EACT,UAAAD,CACF,CAAC,KAED,UAAOF,EAAM,SAAS,EAAE,KAAKE,CAAS,KACtC,UAAOF,EAAM,OAAO,EAAE,KAAKG,CAAe,KAE1C,UAAOH,CAAK,EAAE,eAAe,qBAAmB,CAClD,CAAC,KAED,MAAG,+CAAgD,IAAM,CACvD,MAAMI,EAAmB,OACnBH,EAAgB,yBAEhBD,EAAQ,IAAI,sBAAoB,CACpC,QAASC,EACT,UAAWG,CACb,CAAC,KAED,UAAOJ,EAAM,SAAS,EAAE,KAAKI,CAAgB,KAC7C,UAAOJ,EAAM,OAAO,EAAE,KAAKC,CAAa,KACxC,UAAOD,CAAK,EAAE,eAAe,qBAAmB,CAClD,CAAC,KAED,YAAS,wBAAyB,IAAM,IACtC,MAAG,qEAAsE,IAAM,IAC7E,UAAO,kBAAgB,MAAM,CAAC,EAAE,YAAY,KAC5C,UAAO,kBAAgB,MAAM,EAAE,OAAO,EAAE,KAAK,gBAAgB,CAC/D,CAAC,KAED,MAAG,yEAA0E,IAAM,CACjF,MAAME,EAA4B,OAC5BC,EAAkB,kBAAgBD,CAAS,EAAE,QAE7CF,EAAQ,IAAI,sBAAoB,CACpC,QAASG,EACT,UAAAD,CACF,CAAC,KAED,UAAOF,EAAM,SAAS,EAAE,KAAK,MAAM,KACnC,UAAOA,EAAM,OAAO,EAAE,KAAK,gBAAgB,KAC3C,UAAOA,CAAK,EAAE,eAAe,qBAAmB,CAClD,CAAC,KAED,MAAG,4DAA6D,IAAM,CACpE,MAAMA,KAAQ,8BAA2B,CACvC,QAAS,kBAAgB,MAAM,EAAE,QACjC,UAAW,MACb,CAAC,KAED,UAAOA,CAAK,EAAE,eAAe,qBAAmB,KAChD,UAAOA,EAAM,SAAS,EAAE,KAAK,MAAM,KACnC,UAAOA,EAAM,OAAO,EAAE,KAAK,gBAAgB,CAC7C,CAAC,CACH,CAAC,KAED,YAAS,6BAA8B,IAAM,IAC3C,MAAG,mDAAoD,IAAM,CAC3D,MAAMA,KAAQ,8BAA2B,CACvC,QAAS,qBACT,UAAW,MACb,CAAC,KAED,UAAOA,CAAK,EAAE,eAAe,qBAAmB,KAChD,UAAOA,EAAM,OAAO,EAAE,KAAK,oBAAoB,KAC/C,UAAOA,EAAM,SAAS,EAAE,KAAK,MAAM,CACrC,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_device_management_kit", "import_vitest", "import_aleoApplicationErrors", "error", "customMessage", "errorCode", "expectedMessage", "unknownErrorCode"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var I=(_,E)=>{for(var o in E)s(_,o,{get:E[o],enumerable:!0})},S=(_,E,o,t)=>{if(E&&typeof E=="object"||typeof E=="function")for(let x of c(E))!n.call(_,x)&&x!==o&&s(_,x,{get:()=>E[x],enumerable:!(t=N(E,x))||t.enumerable});return _};var T=_=>S(s({},"__esModule",{value:!0}),_);var A={};I(A,{ALEO_CLA:()=>C,INS:()=>G,P1:()=>e,P2:()=>D,P2_DEFAULT:()=>O});module.exports=T(A);const C=224,O=0,D={FIRST_CHUNK:0,NEXT_CHUNK:1},G={GET_APP_VERSION:3,GET_ADDRESS:5,SIGN_INTENT:6,GET_VIEW_KEY:7},e={SIGN_MODE_ROOT:0,SIGN_MODE_NESTED_CALL:1,SIGN_MODE_FEE:2,CHECK_ON_DEVICE:1,NO_CHECK:0};0&&(module.exports={ALEO_CLA,INS,P1,P2,P2_DEFAULT});
1
+ "use strict";var N=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var D=(_,E)=>{for(var x in E)N(_,x,{get:E[x],enumerable:!0})},O=(_,E,x,o)=>{if(E&&typeof E=="object"||typeof E=="function")for(let T of t(E))!I.call(_,T)&&T!==x&&N(_,T,{get:()=>E[T],enumerable:!(o=s(E,T))||o.enumerable});return _};var A=_=>O(N({},"__esModule",{value:!0}),_);var K={};D(K,{ALEO_CLA:()=>G,APDU_SECTION_LENGTH:()=>H,INS:()=>n,P1:()=>C,P2:()=>c,P2_DEFAULT:()=>S});module.exports=A(K);const G=224,S=0,c={FIRST_CHUNK:0,NEXT_CHUNK:1},n={GET_APP_VERSION:3,GET_ADDRESS:5,SIGN_INTENT:6,GET_VIEW_KEY:7,GET_TVK:8},C={SIGN_MODE_ROOT:0,SIGN_MODE_NESTED_CALL:1,SIGN_MODE_FEE:2,CHECK_ON_DEVICE:1,NO_CHECK:0,GET_TVK_ROOT:0,GET_TVK_INDEXED:1},H={DATA_SIZE:2,DERIVATION_PATH_SEGMENT:4,DERIVATION_PATH_LENGTH:1};0&&(module.exports={ALEO_CLA,APDU_SECTION_LENGTH,INS,P1,P2,P2_DEFAULT});
2
2
  //# sourceMappingURL=apduHeaderUtils.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/app-binder/command/utils/apduHeaderUtils.ts"],
4
- "sourcesContent": ["export const ALEO_CLA = 0xe0 as const;\nexport const P2_DEFAULT = 0x00 as const;\n\nexport const P2 = {\n FIRST_CHUNK: 0x00,\n NEXT_CHUNK: 0x01,\n} as const;\n\nexport const INS = {\n GET_APP_VERSION: 0x03,\n GET_ADDRESS: 0x05,\n SIGN_INTENT: 0x06,\n GET_VIEW_KEY: 0x07,\n} as const;\n\nexport const P1 = {\n SIGN_MODE_ROOT: 0x00,\n SIGN_MODE_NESTED_CALL: 0x01,\n SIGN_MODE_FEE: 0x02,\n CHECK_ON_DEVICE: 0x01,\n NO_CHECK: 0x00,\n} as const;\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,QAAAC,EAAA,OAAAC,EAAA,OAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAP,GAAO,MAAME,EAAW,IACXI,EAAa,EAEbD,EAAK,CAChB,YAAa,EACb,WAAY,CACd,EAEaF,EAAM,CACjB,gBAAiB,EACjB,YAAa,EACb,YAAa,EACb,aAAc,CAChB,EAEaC,EAAK,CAChB,eAAgB,EAChB,sBAAuB,EACvB,cAAe,EACf,gBAAiB,EACjB,SAAU,CACZ",
6
- "names": ["apduHeaderUtils_exports", "__export", "ALEO_CLA", "INS", "P1", "P2", "P2_DEFAULT", "__toCommonJS"]
4
+ "sourcesContent": ["export const ALEO_CLA = 0xe0 as const;\nexport const P2_DEFAULT = 0x00 as const;\n\nexport const P2 = {\n FIRST_CHUNK: 0x00,\n NEXT_CHUNK: 0x01,\n} as const;\n\nexport const INS = {\n GET_APP_VERSION: 0x03,\n GET_ADDRESS: 0x05,\n SIGN_INTENT: 0x06,\n GET_VIEW_KEY: 0x07,\n GET_TVK: 0x08,\n} as const;\n\nexport const P1 = {\n SIGN_MODE_ROOT: 0x00,\n SIGN_MODE_NESTED_CALL: 0x01,\n SIGN_MODE_FEE: 0x02,\n CHECK_ON_DEVICE: 0x01,\n NO_CHECK: 0x00,\n GET_TVK_ROOT: 0x00,\n GET_TVK_INDEXED: 0x01,\n} as const;\n\nexport const APDU_SECTION_LENGTH = {\n DATA_SIZE: 2, // How many bytes are needed to store APDU data length\n DERIVATION_PATH_SEGMENT: 4,\n DERIVATION_PATH_LENGTH: 1, // Derivation path length is encoded on one byte\n} as const;\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,wBAAAC,EAAA,QAAAC,EAAA,OAAAC,EAAA,OAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAR,GAAO,MAAME,EAAW,IACXK,EAAa,EAEbD,EAAK,CAChB,YAAa,EACb,WAAY,CACd,EAEaF,EAAM,CACjB,gBAAiB,EACjB,YAAa,EACb,YAAa,EACb,aAAc,EACd,QAAS,CACX,EAEaC,EAAK,CAChB,eAAgB,EAChB,sBAAuB,EACvB,cAAe,EACf,gBAAiB,EACjB,SAAU,EACV,aAAc,EACd,gBAAiB,CACnB,EAEaF,EAAsB,CACjC,UAAW,EACX,wBAAyB,EACzB,uBAAwB,CAC1B",
6
+ "names": ["apduHeaderUtils_exports", "__export", "ALEO_CLA", "APDU_SECTION_LENGTH", "INS", "P1", "P2", "P2_DEFAULT", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},I=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of g(e))!l.call(t,o)&&o!==n&&a(t,o,{get:()=>e[o],enumerable:!(r=p(e,o))||r.enumerable});return t};var u=t=>I(a({},"__esModule",{value:!0}),t);var C={};y(C,{SignFeeIntentTask:()=>c});module.exports=u(C);var s=require("@ledgerhq/device-management-kit"),i=require("../../app-binder/command/SignFeeIntentCommand"),m=require("./SendAleoCommandInChunksTask");class c{constructor(e,n){this.api=e;this.args=n}async run(){const{feeIntent:e}=this.args,n=2+e.byteLength,r=new s.ByteArrayBuilder(n);r.add16BitUIntToData(e.byteLength),r.addBufferToData(e);const o=r.build();return new m.SendAleoCommandInChunksTask(this.api,{dataLength:e.byteLength,data:o,commandFactory:d=>new i.SignFeeIntentCommand(d)}).run()}}0&&(module.exports={SignFeeIntentTask});
1
+ "use strict";var a=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},u=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!I.call(t,o)&&o!==n&&a(t,o,{get:()=>e[o],enumerable:!(r=g(e,o))||r.enumerable});return t};var A=t=>u(a({},"__esModule",{value:!0}),t);var c={};y(c,{SignFeeIntentTask:()=>C});module.exports=A(c);var s=require("@ledgerhq/device-management-kit"),m=require("../../app-binder/command/SignFeeIntentCommand"),i=require("../../app-binder/command/utils/apduHeaderUtils"),d=require("./SendAleoCommandInChunksTask");class C{constructor(e,n){this.api=e;this.args=n}async run(){const{feeIntent:e}=this.args,n=i.APDU_SECTION_LENGTH.DATA_SIZE+e.byteLength,r=new s.ByteArrayBuilder(n);r.add16BitUIntToData(e.byteLength),r.addBufferToData(e);const o=r.build();return new d.SendAleoCommandInChunksTask(this.api,{dataLength:e.byteLength,data:o,commandFactory:p=>new m.SignFeeIntentCommand(p)}).run()}}0&&(module.exports={SignFeeIntentTask});
2
2
  //# sourceMappingURL=SignFeeIntentTask.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/task/SignFeeIntentTask.ts"],
4
- "sourcesContent": ["import {\n ByteArrayBuilder,\n type CommandResult,\n type InternalApi,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n SignFeeIntentCommand,\n type SignFeeIntentCommandResponse,\n} from \"@internal/app-binder/command/SignFeeIntentCommand\";\nimport { type AleoErrorCodes } from \"@internal/app-binder/command/utils/aleoApplicationErrors\";\n\nimport { SendAleoCommandInChunksTask } from \"./SendAleoCommandInChunksTask\";\n\nexport type SignFeeIntentTaskArgs = {\n feeIntent: Uint8Array;\n};\n\nexport class SignFeeIntentTask {\n constructor(\n private api: InternalApi,\n private args: SignFeeIntentTaskArgs,\n ) {}\n\n async run(): Promise<\n CommandResult<SignFeeIntentCommandResponse, AleoErrorCodes>\n > {\n const { feeIntent } = this.args;\n\n // Data length (2 bytes) + Fee intent data\n const totalLength = 2 + feeIntent.byteLength;\n\n const builder = new ByteArrayBuilder(totalLength);\n\n // Add intent length\n builder.add16BitUIntToData(feeIntent.byteLength);\n\n // Add the fee intent data\n builder.addBufferToData(feeIntent);\n\n const fullPayload = builder.build();\n\n return new SendAleoCommandInChunksTask<SignFeeIntentCommandResponse>(\n this.api,\n {\n dataLength: feeIntent.byteLength,\n data: fullPayload,\n commandFactory: (chunkArgs) => new SignFeeIntentCommand(chunkArgs),\n },\n ).run();\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CAEPC,EAGO,6DAGPC,EAA4C,yCAMrC,MAAMJ,CAAkB,CAC7B,YACUK,EACAC,EACR,CAFQ,SAAAD,EACA,UAAAC,CACP,CAEH,MAAM,KAEJ,CACA,KAAM,CAAE,UAAAC,CAAU,EAAI,KAAK,KAGrBC,EAAc,EAAID,EAAU,WAE5BE,EAAU,IAAI,mBAAiBD,CAAW,EAGhDC,EAAQ,mBAAmBF,EAAU,UAAU,EAG/CE,EAAQ,gBAAgBF,CAAS,EAEjC,MAAMG,EAAcD,EAAQ,MAAM,EAElC,OAAO,IAAI,8BACT,KAAK,IACL,CACE,WAAYF,EAAU,WACtB,KAAMG,EACN,eAAiBC,GAAc,IAAI,uBAAqBA,CAAS,CACnE,CACF,EAAE,IAAI,CACR,CACF",
6
- "names": ["SignFeeIntentTask_exports", "__export", "SignFeeIntentTask", "__toCommonJS", "import_device_management_kit", "import_SignFeeIntentCommand", "import_SendAleoCommandInChunksTask", "api", "args", "feeIntent", "totalLength", "builder", "fullPayload", "chunkArgs"]
4
+ "sourcesContent": ["import {\n ByteArrayBuilder,\n type CommandResult,\n type InternalApi,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n SignFeeIntentCommand,\n type SignFeeIntentCommandResponse,\n} from \"@internal/app-binder/command/SignFeeIntentCommand\";\nimport { type AleoErrorCodes } from \"@internal/app-binder/command/utils/aleoApplicationErrors\";\nimport { APDU_SECTION_LENGTH } from \"@internal/app-binder/command/utils/apduHeaderUtils\";\n\nimport { SendAleoCommandInChunksTask } from \"./SendAleoCommandInChunksTask\";\n\nexport type SignFeeIntentTaskArgs = {\n feeIntent: Uint8Array;\n};\n\nexport class SignFeeIntentTask {\n constructor(\n private api: InternalApi,\n private args: SignFeeIntentTaskArgs,\n ) {}\n\n async run(): Promise<\n CommandResult<SignFeeIntentCommandResponse, AleoErrorCodes>\n > {\n const { feeIntent } = this.args;\n\n // Data length (2 bytes) + Fee intent data\n const totalLength = APDU_SECTION_LENGTH.DATA_SIZE + feeIntent.byteLength;\n\n const builder = new ByteArrayBuilder(totalLength);\n\n // Add intent length\n builder.add16BitUIntToData(feeIntent.byteLength);\n\n // Add the fee intent data\n builder.addBufferToData(feeIntent);\n\n const fullPayload = builder.build();\n\n return new SendAleoCommandInChunksTask<SignFeeIntentCommandResponse>(\n this.api,\n {\n dataLength: feeIntent.byteLength,\n data: fullPayload,\n commandFactory: (chunkArgs) => new SignFeeIntentCommand(chunkArgs),\n },\n ).run();\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CAEPC,EAGO,6DAEPC,EAAoC,8DAEpCC,EAA4C,yCAMrC,MAAML,CAAkB,CAC7B,YACUM,EACAC,EACR,CAFQ,SAAAD,EACA,UAAAC,CACP,CAEH,MAAM,KAEJ,CACA,KAAM,CAAE,UAAAC,CAAU,EAAI,KAAK,KAGrBC,EAAc,sBAAoB,UAAYD,EAAU,WAExDE,EAAU,IAAI,mBAAiBD,CAAW,EAGhDC,EAAQ,mBAAmBF,EAAU,UAAU,EAG/CE,EAAQ,gBAAgBF,CAAS,EAEjC,MAAMG,EAAcD,EAAQ,MAAM,EAElC,OAAO,IAAI,8BACT,KAAK,IACL,CACE,WAAYF,EAAU,WACtB,KAAMG,EACN,eAAiBC,GAAc,IAAI,uBAAqBA,CAAS,CACnE,CACF,EAAE,IAAI,CACR,CACF",
6
+ "names": ["SignFeeIntentTask_exports", "__export", "SignFeeIntentTask", "__toCommonJS", "import_device_management_kit", "import_SignFeeIntentCommand", "import_apduHeaderUtils", "import_SendAleoCommandInChunksTask", "api", "args", "feeIntent", "totalLength", "builder", "fullPayload", "chunkArgs"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var a in e)r(t,a,{get:e[a],enumerable:!0})},u=(t,e,a,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of C(e))!g.call(t,n)&&n!==a&&r(t,n,{get:()=>e[n],enumerable:!(o=p(e,n))||o.enumerable});return t};var A=t=>u(r({},"__esModule",{value:!0}),t);var S={};y(S,{SignNestedCallTask:()=>c});module.exports=A(S);var s=require("@ledgerhq/device-management-kit"),l=require("../../app-binder/command/SignNestedCallCommand"),d=require("../../app-binder/command/utils/apduHeaderUtils"),m=require("./SendAleoCommandInChunksTask");class c{constructor(e,a){this.api=e;this.args=a}async run(){const{nestedCallRequest:e}=this.args,a=d.APDU_SECTION_LENGTH.DATA_SIZE+e.byteLength,o=new s.ByteArrayBuilder(a);o.add16BitUIntToData(e.byteLength),o.addBufferToData(e);const n=o.build();return new m.SendAleoCommandInChunksTask(this.api,{dataLength:e.byteLength,data:n,commandFactory:i=>new l.SignNestedCallCommand(i)}).run()}}0&&(module.exports={SignNestedCallTask});
2
+ //# sourceMappingURL=SignNestedCallTask.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/task/SignNestedCallTask.ts"],
4
+ "sourcesContent": ["import {\n ByteArrayBuilder,\n type CommandResult,\n type InternalApi,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n SignNestedCallCommand,\n type SignNestedCallCommandResponse,\n} from \"@internal/app-binder/command/SignNestedCallCommand\";\nimport { type AleoErrorCodes } from \"@internal/app-binder/command/utils/aleoApplicationErrors\";\nimport { APDU_SECTION_LENGTH } from \"@internal/app-binder/command/utils/apduHeaderUtils\";\n\nimport { SendAleoCommandInChunksTask } from \"./SendAleoCommandInChunksTask\";\n\nexport type SignNestedCallTaskArgs = {\n nestedCallRequest: Uint8Array;\n};\n\nexport class SignNestedCallTask {\n constructor(\n private readonly api: InternalApi,\n private readonly args: SignNestedCallTaskArgs,\n ) {}\n\n async run(): Promise<\n CommandResult<SignNestedCallCommandResponse, AleoErrorCodes>\n > {\n const { nestedCallRequest } = this.args;\n\n // Data length (2 bytes) + nested call request data\n const totalLength =\n APDU_SECTION_LENGTH.DATA_SIZE + nestedCallRequest.byteLength;\n\n const builder = new ByteArrayBuilder(totalLength);\n\n builder.add16BitUIntToData(nestedCallRequest.byteLength);\n\n builder.addBufferToData(nestedCallRequest);\n\n const fullPayload = builder.build();\n\n return new SendAleoCommandInChunksTask<SignNestedCallCommandResponse>(\n this.api,\n {\n dataLength: nestedCallRequest.byteLength,\n data: fullPayload,\n commandFactory: (chunkArgs) => new SignNestedCallCommand(chunkArgs),\n },\n ).run();\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CAEPC,EAGO,8DAEPC,EAAoC,8DAEpCC,EAA4C,yCAMrC,MAAML,CAAmB,CAC9B,YACmBM,EACAC,EACjB,CAFiB,SAAAD,EACA,UAAAC,CAChB,CAEH,MAAM,KAEJ,CACA,KAAM,CAAE,kBAAAC,CAAkB,EAAI,KAAK,KAG7BC,EACJ,sBAAoB,UAAYD,EAAkB,WAE9CE,EAAU,IAAI,mBAAiBD,CAAW,EAEhDC,EAAQ,mBAAmBF,EAAkB,UAAU,EAEvDE,EAAQ,gBAAgBF,CAAiB,EAEzC,MAAMG,EAAcD,EAAQ,MAAM,EAElC,OAAO,IAAI,8BACT,KAAK,IACL,CACE,WAAYF,EAAkB,WAC9B,KAAMG,EACN,eAAiBC,GAAc,IAAI,wBAAsBA,CAAS,CACpE,CACF,EAAE,IAAI,CACR,CACF",
6
+ "names": ["SignNestedCallTask_exports", "__export", "SignNestedCallTask", "__toCommonJS", "import_device_management_kit", "import_SignNestedCallCommand", "import_apduHeaderUtils", "import_SendAleoCommandInChunksTask", "api", "args", "nestedCallRequest", "totalLength", "builder", "fullPayload", "chunkArgs"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("@ledgerhq/device-management-kit"),u=require("../../app-binder/task/__test-utils__/makeInternalApi"),o=require("../../app-binder/task/SignNestedCallTask");describe("SignNestedCallTask",()=>{const t=(0,u.makeDeviceActionInternalApiMock)(),c={tlvSignature:"mock_signature"},d=(0,e.CommandResultFactory)({data:c}),m=(0,e.CommandResultFactory)({data:{tlvSignature:""}});beforeEach(()=>{vi.resetAllMocks()}),it("should send the nested call request in a single command",async()=>{const a=new Uint8Array([5,6,7,8]),n=new e.ByteArrayBuilder(2+a.length);n.add16BitUIntToData(a.length),n.addBufferToData(a);const s=n.build();t.sendCommand.mockResolvedValueOnce(d);const l=await new o.SignNestedCallTask(t,{nestedCallRequest:a}).run();expect(t.sendCommand).toHaveBeenCalledTimes(1),expect(t.sendCommand).toHaveBeenCalledWith(expect.objectContaining({args:{chunkedData:s,isFirst:!0}})),(0,e.isSuccessCommandResult)(l)?expect(l.data).toEqual(c):assert.fail("Expected success")}),it("should send the nested call request in multiple chunks",async()=>{const a=new Uint8Array(300).fill(36),n=new e.ByteArrayBuilder(2+a.length);n.add16BitUIntToData(a.length),n.addBufferToData(a);const s=n.build(),i=s.slice(0,e.APDU_MAX_PAYLOAD),l=s.slice(e.APDU_MAX_PAYLOAD);t.sendCommand.mockResolvedValueOnce(m).mockResolvedValueOnce(d);const r=await new o.SignNestedCallTask(t,{nestedCallRequest:a}).run();expect(t.sendCommand).toHaveBeenCalledTimes(2),expect(t.sendCommand).toHaveBeenNthCalledWith(1,expect.objectContaining({args:{chunkedData:i,isFirst:!0}})),expect(t.sendCommand).toHaveBeenNthCalledWith(2,expect.objectContaining({args:{chunkedData:l,isFirst:!1}})),(0,e.isSuccessCommandResult)(r)?expect(r.data).toEqual(c):assert.fail("Expected success")})});
2
+ //# sourceMappingURL=SignNestedCallTask.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/task/SignNestedCallTask.test.ts"],
4
+ "sourcesContent": ["import {\n APDU_MAX_PAYLOAD,\n ByteArrayBuilder,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/task/__test-utils__/makeInternalApi\";\nimport { SignNestedCallTask } from \"@internal/app-binder/task/SignNestedCallTask\";\n\ndescribe(\"SignNestedCallTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n const signature = { tlvSignature: \"mock_signature\" };\n const resultOk = CommandResultFactory({ data: signature });\n const resultEmpty = CommandResultFactory({ data: { tlvSignature: \"\" } });\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should send the nested call request in a single command\", async () => {\n // GIVEN\n const nestedCallRequest = new Uint8Array([0x05, 0x06, 0x07, 0x08]);\n\n const builder = new ByteArrayBuilder(2 + nestedCallRequest.length);\n builder.add16BitUIntToData(nestedCallRequest.length);\n builder.addBufferToData(nestedCallRequest);\n const expectedPayload = builder.build();\n\n apiMock.sendCommand.mockResolvedValueOnce(resultOk);\n\n const task = new SignNestedCallTask(apiMock, {\n nestedCallRequest,\n });\n\n // WHEN\n const result = await task.run();\n\n // THEN\n expect(apiMock.sendCommand).toHaveBeenCalledTimes(1);\n expect(apiMock.sendCommand).toHaveBeenCalledWith(\n expect.objectContaining({\n args: {\n chunkedData: expectedPayload,\n isFirst: true,\n },\n }),\n );\n\n if (isSuccessCommandResult(result)) {\n expect(result.data).toEqual(signature);\n } else {\n assert.fail(\"Expected success\");\n }\n });\n\n it(\"should send the nested call request in multiple chunks\", async () => {\n // GIVEN\n const nestedCallRequest = new Uint8Array(300).fill(0x24);\n\n const builder = new ByteArrayBuilder(2 + nestedCallRequest.length);\n builder.add16BitUIntToData(nestedCallRequest.length);\n builder.addBufferToData(nestedCallRequest);\n const fullPayload = builder.build();\n\n const chunk1 = fullPayload.slice(0, APDU_MAX_PAYLOAD);\n const chunk2 = fullPayload.slice(APDU_MAX_PAYLOAD);\n\n apiMock.sendCommand\n .mockResolvedValueOnce(resultEmpty)\n .mockResolvedValueOnce(resultOk);\n\n const task = new SignNestedCallTask(apiMock, {\n nestedCallRequest,\n });\n\n // WHEN\n const result = await task.run();\n\n // THEN\n expect(apiMock.sendCommand).toHaveBeenCalledTimes(2);\n\n expect(apiMock.sendCommand).toHaveBeenNthCalledWith(\n 1,\n expect.objectContaining({\n args: {\n chunkedData: chunk1,\n isFirst: true,\n },\n }),\n );\n\n expect(apiMock.sendCommand).toHaveBeenNthCalledWith(\n 2,\n expect.objectContaining({\n args: {\n chunkedData: chunk2,\n isFirst: false,\n },\n }),\n );\n\n if (isSuccessCommandResult(result)) {\n expect(result.data).toEqual(signature);\n } else {\n assert.fail(\"Expected success\");\n }\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAKO,2CAEPC,EAAgD,oEAChDC,EAAmC,wDAEnC,SAAS,qBAAsB,IAAM,CACnC,MAAMC,KAAU,mCAAgC,EAC1CC,EAAY,CAAE,aAAc,gBAAiB,EAC7CC,KAAW,wBAAqB,CAAE,KAAMD,CAAU,CAAC,EACnDE,KAAc,wBAAqB,CAAE,KAAM,CAAE,aAAc,EAAG,CAAE,CAAC,EAEvE,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAMC,EAAoB,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EAE3DC,EAAU,IAAI,mBAAiB,EAAID,EAAkB,MAAM,EACjEC,EAAQ,mBAAmBD,EAAkB,MAAM,EACnDC,EAAQ,gBAAgBD,CAAiB,EACzC,MAAME,EAAkBD,EAAQ,MAAM,EAEtCL,EAAQ,YAAY,sBAAsBE,CAAQ,EAOlD,MAAMK,EAAS,MALF,IAAI,qBAAmBP,EAAS,CAC3C,kBAAAI,CACF,CAAC,EAGyB,IAAI,EAG9B,OAAOJ,EAAQ,WAAW,EAAE,sBAAsB,CAAC,EACnD,OAAOA,EAAQ,WAAW,EAAE,qBAC1B,OAAO,iBAAiB,CACtB,KAAM,CACJ,YAAaM,EACb,QAAS,EACX,CACF,CAAC,CACH,KAEI,0BAAuBC,CAAM,EAC/B,OAAOA,EAAO,IAAI,EAAE,QAAQN,CAAS,EAErC,OAAO,KAAK,kBAAkB,CAElC,CAAC,EAED,GAAG,yDAA0D,SAAY,CAEvE,MAAMG,EAAoB,IAAI,WAAW,GAAG,EAAE,KAAK,EAAI,EAEjDC,EAAU,IAAI,mBAAiB,EAAID,EAAkB,MAAM,EACjEC,EAAQ,mBAAmBD,EAAkB,MAAM,EACnDC,EAAQ,gBAAgBD,CAAiB,EACzC,MAAMI,EAAcH,EAAQ,MAAM,EAE5BI,EAASD,EAAY,MAAM,EAAG,kBAAgB,EAC9CE,EAASF,EAAY,MAAM,kBAAgB,EAEjDR,EAAQ,YACL,sBAAsBG,CAAW,EACjC,sBAAsBD,CAAQ,EAOjC,MAAMK,EAAS,MALF,IAAI,qBAAmBP,EAAS,CAC3C,kBAAAI,CACF,CAAC,EAGyB,IAAI,EAG9B,OAAOJ,EAAQ,WAAW,EAAE,sBAAsB,CAAC,EAEnD,OAAOA,EAAQ,WAAW,EAAE,wBAC1B,EACA,OAAO,iBAAiB,CACtB,KAAM,CACJ,YAAaS,EACb,QAAS,EACX,CACF,CAAC,CACH,EAEA,OAAOT,EAAQ,WAAW,EAAE,wBAC1B,EACA,OAAO,iBAAiB,CACtB,KAAM,CACJ,YAAaU,EACb,QAAS,EACX,CACF,CAAC,CACH,KAEI,0BAAuBH,CAAM,EAC/B,OAAOA,EAAO,IAAI,EAAE,QAAQN,CAAS,EAErC,OAAO,KAAK,kBAAkB,CAElC,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_makeInternalApi", "import_SignNestedCallTask", "apiMock", "signature", "resultOk", "resultEmpty", "nestedCallRequest", "builder", "expectedPayload", "result", "fullPayload", "chunk1", "chunk2"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var c=(o,t)=>{for(var n in t)s(o,n,{get:t[n],enumerable:!0})},u=(o,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of I(t))!y.call(o,e)&&e!==n&&s(o,e,{get:()=>t[e],enumerable:!(a=h(t,e))||a.enumerable});return o};var R=o=>u(s({},"__esModule",{value:!0}),o);var f={};c(f,{SignRootIntentTask:()=>C});module.exports=R(f);var d=require("@ledgerhq/device-management-kit"),m=require("@ledgerhq/signer-utils"),p=require("../../app-binder/command/SignRootIntentCommand"),g=require("./SendAleoCommandInChunksTask");class C{constructor(t,n){this.api=t;this.args=n}async run(){const{derivationPath:t,rootIntent:n}=this.args,a=m.DerivationPathUtils.splitPath(t),e=1+a.length*4+2+n.byteLength,r=new d.ByteArrayBuilder(e);r.add8BitUIntToData(a.length),a.forEach(i=>{r.add32BitUIntToData(i)}),r.add16BitUIntToData(n.byteLength),r.addBufferToData(n);const l=r.build();return new g.SendAleoCommandInChunksTask(this.api,{dataLength:n.byteLength,data:l,commandFactory:i=>new p.SignRootIntentCommand(i)}).run()}}0&&(module.exports={SignRootIntentTask});
1
+ "use strict";var m=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var y=(o,t)=>{for(var n in t)m(o,n,{get:t[n],enumerable:!0})},R=(o,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of h(t))!A.call(o,e)&&e!==n&&m(o,e,{get:()=>t[e],enumerable:!(a=T(t,e))||a.enumerable});return o};var c=o=>R(m({},"__esModule",{value:!0}),o);var C={};y(C,{SignRootIntentTask:()=>u});module.exports=c(C);var d=require("@ledgerhq/device-management-kit"),p=require("@ledgerhq/signer-utils"),I=require("../../app-binder/command/SignRootIntentCommand"),i=require("../../app-binder/command/utils/apduHeaderUtils"),g=require("./SendAleoCommandInChunksTask");class u{constructor(t,n){this.api=t;this.args=n}async run(){const{derivationPath:t,rootIntent:n}=this.args,a=p.DerivationPathUtils.splitPath(t),e=i.APDU_SECTION_LENGTH.DERIVATION_PATH_LENGTH+a.length*i.APDU_SECTION_LENGTH.DERIVATION_PATH_SEGMENT+i.APDU_SECTION_LENGTH.DATA_SIZE+n.byteLength,r=new d.ByteArrayBuilder(e);r.add8BitUIntToData(a.length),a.forEach(s=>{r.add32BitUIntToData(s)}),r.add16BitUIntToData(n.byteLength),r.addBufferToData(n);const l=r.build();return new g.SendAleoCommandInChunksTask(this.api,{dataLength:n.byteLength,data:l,commandFactory:s=>new I.SignRootIntentCommand(s)}).run()}}0&&(module.exports={SignRootIntentTask});
2
2
  //# sourceMappingURL=SignRootIntentTask.js.map